summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp54
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h12
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp10
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp2
-rw-r--r--Swiften/Parser/UnitTest/XMLParserTest.cpp6
5 files changed, 42 insertions, 42 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());
diff --git a/Swiften/Parser/UnitTest/XMLParserTest.cpp b/Swiften/Parser/UnitTest/XMLParserTest.cpp
index 4785317..6ef1899 100644
--- a/Swiften/Parser/UnitTest/XMLParserTest.cpp
+++ b/Swiften/Parser/UnitTest/XMLParserTest.cpp
@@ -62,7 +62,7 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(testling.parse(
"<query xmlns='jabber:iq:version'>"
- "<name>Swift</name>"
+ "<name>Swift</name>"
"</query>"));
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), client_.events.size());
@@ -191,7 +191,7 @@ class XMLParserTest : public CppUnit::TestFixture {
Event(
Type type,
const String& data,
- const String& ns,
+ const String& ns,
const AttributeMap& attributes)
: type(type), data(data), ns(ns), attributes(attributes) {}
Event(Type type, const String& data, const String& ns = String())
@@ -199,7 +199,7 @@ class XMLParserTest : public CppUnit::TestFixture {
Type type;
String data;
- String ns;
+ String ns;
AttributeMap attributes;
};