diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp index 4003b6c..9c810da 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp @@ -1,18 +1,16 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#pragma clang diagnostic ignored "-Wunused-private-field" - #include <Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h> -#include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> + +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> -#include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h> +#include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLRawTextNode.h> using namespace Swift; @@ -23,18 +21,18 @@ PubSubAffiliationsSerializer::PubSubAffiliationsSerializer(PayloadSerializerColl PubSubAffiliationsSerializer::~PubSubAffiliationsSerializer() { } -std::string PubSubAffiliationsSerializer::serializePayload(boost::shared_ptr<PubSubAffiliations> payload) const { - if (!payload) { - return ""; - } - XMLElement element("affiliations", "http://jabber.org/protocol/pubsub"); - if (payload->getNode()) { - element.setAttribute("node", *payload->getNode()); - } - foreach(boost::shared_ptr<PubSubAffiliation> item, payload->getAffiliations()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubAffiliationSerializer(serializers).serialize(item))); - } - return element.serialize(); +std::string PubSubAffiliationsSerializer::serializePayload(std::shared_ptr<PubSubAffiliations> payload) const { + if (!payload) { + return ""; + } + XMLElement element("affiliations", "http://jabber.org/protocol/pubsub"); + if (payload->getNode()) { + element.setAttribute("node", *payload->getNode()); + } + for (const auto& item : payload->getAffiliations()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubAffiliationSerializer(serializers).serialize(item))); + } + return element.serialize(); } |