diff options
Diffstat (limited to 'Swiften/Parser/SerializingParser.cpp')
-rw-r--r-- | Swiften/Parser/SerializingParser.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/Swiften/Parser/SerializingParser.cpp b/Swiften/Parser/SerializingParser.cpp index 4a7590f..85b0dd4 100644 --- a/Swiften/Parser/SerializingParser.cpp +++ b/Swiften/Parser/SerializingParser.cpp @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Parser/SerializingParser.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <cassert> +#include <memory> #include <Swiften/Serializer/XML/XMLTextNode.h> -#include <Swiften/Base/foreach.h> namespace Swift { @@ -17,34 +17,34 @@ SerializingParser::SerializingParser() { } void SerializingParser::handleStartElement(const std::string& tag, const std::string& ns, const AttributeMap& attributes) { - boost::shared_ptr<XMLElement> element = boost::make_shared<XMLElement>(tag, ns); - // FIXME: Ignoring attribute namespace - foreach (const AttributeMap::Entry& e, attributes.getEntries()) { - element->setAttribute(e.getAttribute().getName(), e.getValue()); - } - - if (elementStack_.empty()) { - rootElement_ = element; - } - else { - (*(elementStack_.end() - 1))->addNode(element); - } - elementStack_.push_back(element); + std::shared_ptr<XMLElement> element = std::make_shared<XMLElement>(tag, ns); + // FIXME: Ignoring attribute namespace + for (const auto& e : attributes.getEntries()) { + element->setAttribute(e.getAttribute().getName(), e.getValue()); + } + + if (elementStack_.empty()) { + rootElement_ = element; + } + else { + (*(elementStack_.end() - 1))->addNode(element); + } + elementStack_.push_back(element); } void SerializingParser::handleEndElement(const std::string&, const std::string&) { - assert(!elementStack_.empty()); - elementStack_.pop_back(); + assert(!elementStack_.empty()); + elementStack_.pop_back(); } void SerializingParser::handleCharacterData(const std::string& data) { - if (!elementStack_.empty()) { - (*(elementStack_.end()-1))->addNode(boost::make_shared<XMLTextNode>(data)); - } + if (!elementStack_.empty()) { + (*(elementStack_.end()-1))->addNode(std::make_shared<XMLTextNode>(data)); + } } std::string SerializingParser::getResult() const { - return (rootElement_ ? rootElement_->serialize() : ""); + return (rootElement_ ? rootElement_->serialize() : ""); } } |