diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp index 483654a..2efe3c8 100644 --- a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp +++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp @@ -1,19 +1,15 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#pragma clang diagnostic ignored "-Wunused-private-field" - #include <Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h> #include <boost/optional.hpp> - -#include <Swiften/Parser/PayloadParserFactoryCollection.h> #include <Swiften/Parser/PayloadParserFactory.h> - +#include <Swiften/Parser/PayloadParserFactoryCollection.h> using namespace Swift; @@ -24,36 +20,36 @@ IsodeIQDelegationParser::~IsodeIQDelegationParser() { } void IsodeIQDelegationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { - - - if (level == 1) { - if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) { - currentPayloadParser.reset(factory->createPayloadParser()); - } - } - - if (level >= 1 && currentPayloadParser) { - currentPayloadParser->handleStartElement(element, ns, attributes); - } - ++level; + + + if (level == 1) { + if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) { + currentPayloadParser.reset(factory->createPayloadParser()); + } + } + + if (level >= 1 && currentPayloadParser) { + currentPayloadParser->handleStartElement(element, ns, attributes); + } + ++level; } void IsodeIQDelegationParser::handleEndElement(const std::string& element, const std::string& ns) { - --level; - if (currentPayloadParser) { - if (level >= 1) { - currentPayloadParser->handleEndElement(element, ns); - } - - if (level == 1) { - getPayloadInternal()->setForward(boost::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload())); - currentPayloadParser.reset(); - } - } + --level; + if (currentPayloadParser) { + if (level >= 1) { + currentPayloadParser->handleEndElement(element, ns); + } + + if (level == 1) { + getPayloadInternal()->setForward(std::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload())); + currentPayloadParser.reset(); + } + } } void IsodeIQDelegationParser::handleCharacterData(const std::string& data) { - if (level > 1 && currentPayloadParser) { - currentPayloadParser->handleCharacterData(data); - } + if (level > 1 && currentPayloadParser) { + currentPayloadParser->handleCharacterData(data); + } } |