diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp | 59 |
2 files changed, 0 insertions, 59 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp deleted file mode 100644 index 7e65575..0000000 --- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "Swiften/Parser/PayloadParsers/SecurityLabelParser.h" -#include "Swiften/Parser/SerializingParser.h" - -namespace Swift { - -SecurityLabelParser::SecurityLabelParser() : level_(TopLevel), labelParser_(0) { -} - -void SecurityLabelParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { - ++level_; - if (level_ == DisplayMarkingOrLabelLevel) { - if (element == "displaymarking") { - currentText_ = ""; - getPayloadInternal()->setBackgroundColor(attributes.getAttribute("bgcolor")); - getPayloadInternal()->setForegroundColor(attributes.getAttribute("fgcolor")); - } - else if (element == "label" || element == "equivalentlabel") { - assert(!labelParser_); - labelParser_ = new SerializingParser(); - } - } - else if (level_ >= SecurityLabelLevel && labelParser_) { - labelParser_->handleStartElement(element, ns, attributes); - } -} - -void SecurityLabelParser::handleEndElement(const String& element, const String& ns) { - if (level_ == DisplayMarkingOrLabelLevel) { - if (element == "displaymarking") { - getPayloadInternal()->setDisplayMarking(currentText_); - } - else if (labelParser_) { - if (element == "label") { - getPayloadInternal()->setLabel(labelParser_->getResult()); - } - else { - getPayloadInternal()->addEquivalentLabel(labelParser_->getResult()); - } - delete labelParser_; - labelParser_ = 0; - } - } - else if (labelParser_ && level_ >= SecurityLabelLevel) { - labelParser_->handleEndElement(element, ns); - } - --level_; - -} - -void SecurityLabelParser::handleCharacterData(const String& data) { - if (labelParser_) { - labelParser_->handleCharacterData(data); - } - else { - currentText_ += data; - } -} - -} |