diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-08-22 09:44:35 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-08-22 09:44:35 (GMT) |
commit | 4814521a30b1edbd34a782cd804a501225294fd8 (patch) | |
tree | b0b8df3ea1b5e5aaf8c964c8c817a8982cce644b /Swiften/Parser/PayloadParsers | |
parent | fe4dbe0430524152d198401eb18934abd4bae082 (diff) | |
download | swift-contrib-4814521a30b1edbd34a782cd804a501225294fd8.zip swift-contrib-4814521a30b1edbd34a782cd804a501225294fd8.tar.bz2 |
Fix expanded tab characters.
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
4 files changed, 39 insertions, 39 deletions
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp index d571f0b..e4da756 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp @@ -5,44 +5,44 @@ namespace Swift { SecurityLabelsCatalogParser::SecurityLabelsCatalogParser() : level_(TopLevel), labelParser_(0) { - labelParserFactory_ = new SecurityLabelParserFactory(); + labelParserFactory_ = new SecurityLabelParserFactory(); } SecurityLabelsCatalogParser::~SecurityLabelsCatalogParser() { - delete labelParserFactory_; + delete labelParserFactory_; } void SecurityLabelsCatalogParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { ++level_; if (level_ == PayloadLevel) { - getPayloadInternal()->setTo(JID(attributes.getAttribute("to"))); - getPayloadInternal()->setName(attributes.getAttribute("name")); - getPayloadInternal()->setDescription(attributes.getAttribute("desc")); - } - else if (level_ == LabelLevel) { - assert(!labelParser_); - if (labelParserFactory_->canParse(element, ns, attributes)) { - labelParser_ = dynamic_cast<SecurityLabelParser*>(labelParserFactory_->createPayloadParser()); - assert(labelParser_); - } - } - - if (labelParser_) { - labelParser_->handleStartElement(element, ns, attributes); - } + getPayloadInternal()->setTo(JID(attributes.getAttribute("to"))); + getPayloadInternal()->setName(attributes.getAttribute("name")); + getPayloadInternal()->setDescription(attributes.getAttribute("desc")); + } + else if (level_ == LabelLevel) { + assert(!labelParser_); + if (labelParserFactory_->canParse(element, ns, attributes)) { + labelParser_ = dynamic_cast<SecurityLabelParser*>(labelParserFactory_->createPayloadParser()); + assert(labelParser_); + } + } + + if (labelParser_) { + labelParser_->handleStartElement(element, ns, attributes); + } } void SecurityLabelsCatalogParser::handleEndElement(const String& element, const String& ns) { - if (labelParser_) { - labelParser_->handleEndElement(element, ns); - } - if (level_ == LabelLevel && labelParser_) { - SecurityLabel* label = dynamic_cast<SecurityLabel*>(labelParser_->getPayload().get()); - assert(label); - getPayloadInternal()->addLabel(SecurityLabel(*label)); - delete labelParser_; - labelParser_ = 0; - } + if (labelParser_) { + labelParser_->handleEndElement(element, ns); + } + if (level_ == LabelLevel && labelParser_) { + SecurityLabel* label = dynamic_cast<SecurityLabel*>(labelParser_->getPayload().get()); + assert(label); + getPayloadInternal()->addLabel(SecurityLabel(*label)); + delete labelParser_; + labelParser_ = 0; + } --level_; } diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h index ec31235..799e43a 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h @@ -5,13 +5,13 @@ #include "Swiften/Parser/GenericPayloadParser.h" namespace Swift { - class SecurityLabelParserFactory; - class SecurityLabelParser; + class SecurityLabelParserFactory; + class SecurityLabelParser; class SecurityLabelsCatalogParser : public GenericPayloadParser<SecurityLabelsCatalog> { public: SecurityLabelsCatalogParser(); - ~SecurityLabelsCatalogParser(); + ~SecurityLabelsCatalogParser(); virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); virtual void handleEndElement(const String& element, const String&); @@ -21,11 +21,11 @@ namespace Swift { enum Level { TopLevel = 0, PayloadLevel = 1, - LabelLevel = 2 + LabelLevel = 2 }; int level_; - SecurityLabelParserFactory* labelParserFactory_; - SecurityLabelParser* labelParser_; + SecurityLabelParserFactory* labelParserFactory_; + SecurityLabelParser* labelParser_; }; } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp index 5da3fbd..325309f 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp @@ -21,17 +21,17 @@ class SecurityLabelParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse( "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">" - "<displaymarking fgcolor=\"black\" bgcolor=\"red\">SECRET</displaymarking>" - "<label>" + "<displaymarking fgcolor=\"black\" bgcolor=\"red\">SECRET</displaymarking>" + "<label>" "<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>" "</label>" - "<equivalentlabel>" + "<equivalentlabel>" "<icismlabel xmlns=\"http://example.gov/IC-ISM/0\" classification=\"S\" ownerProducer=\"USA\" disseminationControls=\"FOUO\"/>" "</equivalentlabel>" - "<equivalentlabel>" + "<equivalentlabel>" "<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MRUCAgD9DA9BcXVhIChvYnNvbGV0ZSk=</esssecuritylabel>" "</equivalentlabel>" - "</securitylabel>")); + "</securitylabel>")); SecurityLabel* payload = dynamic_cast<SecurityLabel*>(testling.getPayload().get()); CPPUNIT_ASSERT_EQUAL(String("SECRET"), payload->getDisplayMarking()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp index 0021c0d..2f3f47a 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp @@ -29,7 +29,7 @@ class SecurityLabelsCatalogParserTest : public CppUnit::TestFixture "<displaymarking bgcolor=\"navy\" fgcolor=\"black\">CONFIDENTIAL</displaymarking>" "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel></label>" "</securitylabel>" - "</catalog>")); + "</catalog>")); SecurityLabelsCatalog* payload = dynamic_cast<SecurityLabelsCatalog*>(testling.getPayload().get()); CPPUNIT_ASSERT_EQUAL(String("Default"), payload->getName()); |