diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp index 5e8c337..6e01881 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.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/PubSubSubscriptionsSerializer.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/PubSubSubscriptionSerializer.h> +#include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLRawTextNode.h> using namespace Swift; @@ -23,18 +21,18 @@ PubSubSubscriptionsSerializer::PubSubSubscriptionsSerializer(PayloadSerializerCo PubSubSubscriptionsSerializer::~PubSubSubscriptionsSerializer() { } -std::string PubSubSubscriptionsSerializer::serializePayload(boost::shared_ptr<PubSubSubscriptions> payload) const { - if (!payload) { - return ""; - } - XMLElement element("subscriptions", "http://jabber.org/protocol/pubsub"); - if (payload->getNode()) { - element.setAttribute("node", *payload->getNode()); - } - foreach(boost::shared_ptr<PubSubSubscription> item, payload->getSubscriptions()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubSubscriptionSerializer(serializers).serialize(item))); - } - return element.serialize(); +std::string PubSubSubscriptionsSerializer::serializePayload(std::shared_ptr<PubSubSubscriptions> payload) const { + if (!payload) { + return ""; + } + XMLElement element("subscriptions", "http://jabber.org/protocol/pubsub"); + if (payload->getNode()) { + element.setAttribute("node", *payload->getNode()); + } + for (const auto& item : payload->getSubscriptions()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubSubscriptionSerializer(serializers).serialize(item))); + } + return element.serialize(); } |