diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 17:23:49 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-04 08:28:23 (GMT) |
commit | 741c45b74d5f634622eb5f757c49323274fb8937 (patch) | |
tree | b9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften | |
parent | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff) | |
download | swift-741c45b74d5f634622eb5f757c49323274fb8937.zip swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2 |
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed'
replacement calls to all source files:
's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g'
's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g'
's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g'
's/boost::make_shared/std::make_shared/g'
's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g'
's/boost::shared_ptr/std::shared_ptr/g'
's/boost::weak_ptr/std::weak_ptr/g'
's/boost::enable_shared_from_this/std::enable_shared_from_this/g'
The remaining issues have been fixed manually.
Test-Information:
Code builds on OS X 10.11.4 and unit tests pass.
Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swiften')
974 files changed, 4882 insertions, 4894 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp index 1cdf467..22c478d 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp @@ -6,8 +6,9 @@ #include <Swiften/AdHoc/OutgoingAdHocCommandSession.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Algorithm.h> #include <Swiften/Queries/GenericRequest.h> @@ -21,7 +22,7 @@ OutgoingAdHocCommandSession::~OutgoingAdHocCommandSession() { connection_.disconnect(); } -void OutgoingAdHocCommandSession::handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error) { +void OutgoingAdHocCommandSession::handleResponse(std::shared_ptr<Command> payload, ErrorPayload::ref error) { if (error) { onError(error); } else { @@ -61,7 +62,7 @@ bool OutgoingAdHocCommandSession::getIsMultiStage() const { } void OutgoingAdHocCommandSession::start() { - boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, boost::make_shared<Command>(commandNode_), iqRouter_); + std::shared_ptr<GenericRequest<Command> > commandRequest = std::make_shared< GenericRequest<Command> >(IQ::Set, to_, std::make_shared<Command>(commandNode_), iqRouter_); connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2)); commandRequest->send(); } @@ -85,9 +86,9 @@ void OutgoingAdHocCommandSession::goNext(Form::ref form) { } void OutgoingAdHocCommandSession::submitForm(Form::ref form, Command::Action action) { - boost::shared_ptr<Command> command(boost::make_shared<Command>(commandNode_, sessionID_, action)); + std::shared_ptr<Command> command(std::make_shared<Command>(commandNode_, sessionID_, action)); command->setForm(form); - boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_); + std::shared_ptr<GenericRequest<Command> > commandRequest = std::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_); connection_.disconnect(); connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2)); commandRequest->send(); diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h index fdb6e35..48135c1 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h @@ -7,10 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/Command.h> @@ -84,7 +83,7 @@ namespace Swift { ActionState getActionState(Command::Action action) const; private: - void handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error); + void handleResponse(std::shared_ptr<Command> payload, ErrorPayload::ref error); void submitForm(Form::ref, Command::Action action); private: diff --git a/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp b/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp index 79769a8..241f375 100644 --- a/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp +++ b/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp @@ -38,14 +38,14 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { public: void setUp() { ownerJID = JID("owner@domain.com/theowner"); - stanzaChannel = boost::make_shared<DummyStanzaChannel>(); - iqRouter = boost::make_shared<IQRouter>(stanzaChannel.get()); - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); - vcardStorage = boost::make_shared<VCardMemoryStorage>(crypto.get()); - vcardManager = boost::make_shared<VCardManager>(ownerJID, iqRouter.get(), vcardStorage.get()); - avatarStorage = boost::make_shared<AvatarMemoryStorage>(); - mucRegistry = boost::make_shared<DummyMUCRegistry>(); - avatarManager = boost::make_shared<AvatarManagerImpl>(vcardManager.get(), stanzaChannel.get(), avatarStorage.get(), crypto.get(), mucRegistry.get()); + stanzaChannel = std::make_shared<DummyStanzaChannel>(); + iqRouter = std::make_shared<IQRouter>(stanzaChannel.get()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + vcardStorage = std::make_shared<VCardMemoryStorage>(crypto.get()); + vcardManager = std::make_shared<VCardManager>(ownerJID, iqRouter.get(), vcardStorage.get()); + avatarStorage = std::make_shared<AvatarMemoryStorage>(); + mucRegistry = std::make_shared<DummyMUCRegistry>(); + avatarManager = std::make_shared<AvatarManagerImpl>(vcardManager.get(), stanzaChannel.get(), avatarStorage.get(), crypto.get(), mucRegistry.get()); } void testGetSetAvatar() { @@ -57,9 +57,9 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* notify the 'owner' JID that our avatar has changed */ ByteArray fullAvatar = createByteArray("abcdefg"); - boost::shared_ptr<VCardUpdate> vcardUpdate = boost::make_shared<VCardUpdate>(); + std::shared_ptr<VCardUpdate> vcardUpdate = std::make_shared<VCardUpdate>(); vcardUpdate->setPhotoHash(Hexify::hexify(crypto->getSHA1Hash(fullAvatar))); - boost::shared_ptr<Presence> presence = boost::make_shared<Presence>(); + std::shared_ptr<Presence> presence = std::make_shared<Presence>(); presence->setTo(ownerJID); presence->setFrom(personJID); presence->setType(Presence::Available); @@ -69,13 +69,13 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* reply to the avatar request with our new avatar */ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - boost::shared_ptr<IQ> request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); + std::shared_ptr<IQ> request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); stanzaChannel->sentStanzas.pop_back(); CPPUNIT_ASSERT(!!request); - boost::shared_ptr<VCard> vcard = request->getPayload<VCard>(); + std::shared_ptr<VCard> vcard = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!vcard); - boost::shared_ptr<IQ> reply = boost::make_shared<IQ>(IQ::Result); + std::shared_ptr<IQ> reply = std::make_shared<IQ>(IQ::Result); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -90,8 +90,8 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* send new presence to notify of blank avatar */ - vcardUpdate = boost::make_shared<VCardUpdate>(); - presence = boost::make_shared<Presence>(); + vcardUpdate = std::make_shared<VCardUpdate>(); + presence = std::make_shared<Presence>(); presence->setTo(ownerJID); presence->setFrom(personJID); presence->setType(Presence::Available); @@ -101,14 +101,14 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* reply to the avatar request with our EMPTY avatar */ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); + request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); stanzaChannel->sentStanzas.pop_back(); CPPUNIT_ASSERT(!!request); vcard = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!vcard); ByteArray blankAvatar = createByteArray(""); - reply = boost::make_shared<IQ>(IQ::Result); + reply = std::make_shared<IQ>(IQ::Result); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -130,14 +130,14 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { private: JID ownerJID; - boost::shared_ptr<DummyStanzaChannel> stanzaChannel; - boost::shared_ptr<IQRouter> iqRouter; - boost::shared_ptr<CryptoProvider> crypto; - boost::shared_ptr<VCardMemoryStorage> vcardStorage; - boost::shared_ptr<VCardManager> vcardManager; - boost::shared_ptr<AvatarMemoryStorage> avatarStorage; - boost::shared_ptr<DummyMUCRegistry> mucRegistry; - boost::shared_ptr<AvatarManagerImpl> avatarManager; + std::shared_ptr<DummyStanzaChannel> stanzaChannel; + std::shared_ptr<IQRouter> iqRouter; + std::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<VCardMemoryStorage> vcardStorage; + std::shared_ptr<VCardManager> vcardManager; + std::shared_ptr<AvatarMemoryStorage> avatarStorage; + std::shared_ptr<DummyMUCRegistry> mucRegistry; + std::shared_ptr<AvatarManagerImpl> avatarManager; }; diff --git a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp index fb4cd8f..288a5af 100644 --- a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp +++ b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp @@ -62,14 +62,14 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testGetAvatarWithNoAvatarProviderReturnsEmpty() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); boost::optional<std::string> hash = testling->getAvatarHash(user1); CPPUNIT_ASSERT(!hash); } void testGetAvatarWithSingleAvatarProvider() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->avatars[user1] = avatarHash1; testling->addProvider(avatarProvider1); @@ -79,7 +79,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testGetAvatarWithMultipleAvatarProviderReturnsFirstAvatar() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider2->avatars[user1] = avatarHash2; testling->addProvider(avatarProvider1); @@ -91,7 +91,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testGetAvatarWithMultipleAvatarProviderAndFailingFirstProviderReturnsSecondAvatar() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider2->avatars[user1] = avatarHash2; testling->addProvider(avatarProvider1); testling->addProvider(avatarProvider2); @@ -102,7 +102,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -112,7 +112,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateWithoutChangeDoesNotTriggerChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); testling->addProvider(avatarProvider2); avatarProvider1->avatars[user1] = avatarHash1; @@ -126,7 +126,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderSecondUpdateTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -140,7 +140,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { void testProviderUpdateWithAvatarDisappearingTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -153,7 +153,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateAfterAvatarDisappearedTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -169,7 +169,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { void testProviderUpdateAfterGetDoesNotTriggerChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; @@ -180,7 +180,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testRemoveProviderDisconnectsUpdates() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); testling->addProvider(avatarProvider2); testling->removeProvider(avatarProvider1); @@ -192,7 +192,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateBareJIDAfterGetFullJID() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->useBare = true; testling->addProvider(avatarProvider1); @@ -210,7 +210,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { JID ownJID = JID("user0@own.com/res"); JID user1 = JID("user1@bar.com/bla"); - boost::shared_ptr<CryptoProvider> crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + std::shared_ptr<CryptoProvider> crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); DummyStanzaChannel* stanzaChannel = new DummyStanzaChannel(); stanzaChannel->setAvailable(true); IQRouter* iqRouter = new IQRouter(stanzaChannel); @@ -219,16 +219,16 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { VCardMemoryStorage* vcardStorage = new VCardMemoryStorage(crypto.get()); VCardManager* vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage); - boost::shared_ptr<VCardUpdateAvatarManager> updateManager(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardUpdateAvatarManager> updateManager(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); updateManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); - boost::shared_ptr<VCardAvatarManager> manager(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardAvatarManager> manager(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); manager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); - boost::shared_ptr<OfflineAvatarManager> offlineManager(new OfflineAvatarManager(avatarStorage)); + std::shared_ptr<OfflineAvatarManager> offlineManager(new OfflineAvatarManager(avatarStorage)); offlineManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->useBare = true; testling->addProvider(updateManager.get()); testling->addProvider(manager.get()); @@ -257,7 +257,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { vcardManager->requestVCard(user1.toBare()); CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - IQ::ref request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); + IQ::ref request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); VCard::ref payload = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!payload); stanzaChannel->sentStanzas.pop_back(); @@ -267,7 +267,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { VCard::ref vcard2(new VCard()); vcard2->setPhoto(avatar2); - IQ::ref reply = boost::make_shared<IQ>(); + IQ::ref reply = std::make_shared<IQ>(); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -295,13 +295,13 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { vcardManager->requestVCard(user1.toBare()); CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); + request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); payload = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!payload); stanzaChannel->sentStanzas.pop_back(); VCard::ref vcard3(new VCard()); - reply = boost::make_shared<IQ>(); + reply = std::make_shared<IQ>(); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -331,8 +331,8 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<CombinedAvatarProvider> createProvider() { - boost::shared_ptr<CombinedAvatarProvider> result(new CombinedAvatarProvider()); + std::shared_ptr<CombinedAvatarProvider> createProvider() { + std::shared_ptr<CombinedAvatarProvider> result(new CombinedAvatarProvider()); result->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); return result; } diff --git a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp index 5a28995..2ca9c1a 100644 --- a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp @@ -38,7 +38,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); ownJID = JID("foo@fum.com/bum"); stanzaChannel = new DummyStanzaChannel(); stanzaChannel->setAvailable(true); @@ -63,7 +63,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashKnownAvatar() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); avatarStorage->addAvatar(avatar1Hash, avatar1); @@ -74,7 +74,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashEmptyAvatar() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); storeEmptyVCard(user1.toBare()); boost::optional<std::string> result = testling->getAvatarHash(user1); @@ -84,7 +84,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); boost::optional<std::string> result = testling->getAvatarHash(user1); @@ -96,7 +96,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashUnknownAvatarUnknownVCard() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); boost::optional<std::string> result = testling->getAvatarHash(user1); @@ -105,7 +105,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashKnownAvatarUnknownVCard() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); avatarStorage->setAvatarForJID(user1, avatar1Hash); @@ -117,7 +117,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { void testVCardUpdateTriggersUpdate() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); vcardManager->requestVCard(user1); sendVCardResult(); @@ -125,8 +125,8 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<VCardAvatarManager> createManager() { - boost::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardAvatarManager> createManager() { + std::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); result->onAvatarChanged.connect(boost::bind(&VCardAvatarManagerTest::handleAvatarChanged, this, _1)); return result; } @@ -170,7 +170,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { std::vector<JID> changes; JID user1; JID user2; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(VCardAvatarManagerTest); diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index 5f6c691..bfa13cd 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -39,7 +39,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); ownJID = JID("foo@fum.com/bum"); stanzaChannel = new DummyStanzaChannel(); stanzaChannel->setAvailable(true); @@ -65,7 +65,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_NewHashNewVCardRequestsVCard() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel->sentStanzas.size())); @@ -73,7 +73,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); @@ -87,7 +87,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_KnownHash() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -100,7 +100,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -117,7 +117,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testVCardWithEmptyPhoto() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); vcardManager->requestVCard(JID("foo@bar.com")); stanzaChannel->onIQReceived(createVCardResult(ByteArray())); @@ -128,7 +128,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testStanzaChannelReset_ClearsHash() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -145,7 +145,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -163,16 +163,16 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<VCardUpdateAvatarManager> createManager() { - boost::shared_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardUpdateAvatarManager> createManager() { + std::shared_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); result->onAvatarChanged.connect(boost::bind(&VCardUpdateAvatarManagerTest::handleAvatarChanged, this, _1)); return result; } - boost::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) { + std::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); - presence->addPayload(boost::make_shared<VCardUpdate>(hash)); + presence->addPayload(std::make_shared<VCardUpdate>(hash)); return presence; } @@ -206,7 +206,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { std::vector<JID> changes; JID user1; JID user2; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(VCardUpdateAvatarManagerTest); diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.cpp b/Swiften/Avatars/VCardUpdateAvatarManager.cpp index e40eee3..3e8d87b 100644 --- a/Swiften/Avatars/VCardUpdateAvatarManager.cpp +++ b/Swiften/Avatars/VCardUpdateAvatarManager.cpp @@ -26,8 +26,8 @@ VCardUpdateAvatarManager::VCardUpdateAvatarManager(VCardManager* vcardManager, S vcardManager_->onVCardChanged.connect(boost::bind(&VCardUpdateAvatarManager::handleVCardChanged, this, _1, _2)); } -void VCardUpdateAvatarManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) { - boost::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>(); +void VCardUpdateAvatarManager::handlePresenceReceived(std::shared_ptr<Presence> presence) { + std::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>(); if (!update || presence->getPayload<ErrorPayload>()) { return; } diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h index d66da3a..c58d491 100644 --- a/Swiften/Avatars/VCardUpdateAvatarManager.h +++ b/Swiften/Avatars/VCardUpdateAvatarManager.h @@ -7,8 +7,7 @@ #pragma once #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Avatars/AvatarProvider.h> #include <Swiften/Base/API.h> @@ -31,7 +30,7 @@ namespace Swift { boost::optional<std::string> getAvatarHash(const JID&) const; private: - void handlePresenceReceived(boost::shared_ptr<Presence>); + void handlePresenceReceived(std::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); void handleVCardChanged(const JID& from, VCard::ref); void setAvatarHash(const JID& from, const std::string& hash); diff --git a/Swiften/Base/Debug.cpp b/Swiften/Base/Debug.cpp index 2d306d5..b59de35 100644 --- a/Swiften/Base/Debug.cpp +++ b/Swiften/Base/Debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,8 +7,7 @@ #include <Swiften/Base/Debug.h> #include <iostream> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Client/ClientError.h> #include <Swiften/Serializer/PayloadSerializer.h> @@ -119,16 +118,16 @@ std::ostream& operator<<(std::ostream& os, const Swift::ClientError& error) { std::ostream& operator<<(std::ostream& os, Swift::Element* ele) { using namespace Swift; - boost::shared_ptr<Element> element = boost::shared_ptr<Element>(ele); + std::shared_ptr<Element> element = std::shared_ptr<Element>(ele); - boost::shared_ptr<Payload> payload = boost::dynamic_pointer_cast<Payload>(element); + std::shared_ptr<Payload> payload = std::dynamic_pointer_cast<Payload>(element); if (payload) { FullPayloadSerializerCollection payloadSerializerCollection; PayloadSerializer *serializer = payloadSerializerCollection.getPayloadSerializer(payload); os << "Payload(" << serializer->serialize(payload) << ")"; return os; } - boost::shared_ptr<ToplevelElement> topLevelElement = boost::dynamic_pointer_cast<ToplevelElement>(element); + std::shared_ptr<ToplevelElement> topLevelElement = std::dynamic_pointer_cast<ToplevelElement>(element); if (topLevelElement) { FullPayloadSerializerCollection payloadSerializerCollection; XMPPSerializer xmppSerializer(&payloadSerializerCollection, ClientStreamType, false); diff --git a/Swiften/Base/SafeByteArray.h b/Swiften/Base/SafeByteArray.h index f824194..342c185 100644 --- a/Swiften/Base/SafeByteArray.h +++ b/Swiften/Base/SafeByteArray.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/Base/SafeAllocator.h> @@ -27,8 +26,8 @@ namespace Swift { return SafeByteArray(s.begin(), s.end()); } - inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const std::string& s) { - return boost::make_shared<SafeByteArray>(s.begin(), s.end()); + inline std::shared_ptr<SafeByteArray> createSafeByteArrayRef(const std::string& s) { + return std::make_shared<SafeByteArray>(s.begin(), s.end()); } inline SafeByteArray createSafeByteArray(char c) { @@ -39,16 +38,16 @@ namespace Swift { return SafeByteArray(c, c + n); } - inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const char* c, size_t n) { - return boost::make_shared<SafeByteArray>(c, c + n); + inline std::shared_ptr<SafeByteArray> createSafeByteArrayRef(const char* c, size_t n) { + return std::make_shared<SafeByteArray>(c, c + n); } inline SafeByteArray createSafeByteArray(const unsigned char* c, size_t n) { return SafeByteArray(c, c + n); } - inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const unsigned char* c, size_t n) { - return boost::make_shared<SafeByteArray>(c, c + n); + inline std::shared_ptr<SafeByteArray> createSafeByteArrayRef(const unsigned char* c, size_t n) { + return std::make_shared<SafeByteArray>(c, c + n); } /* WARNING! This breaks the safety of the data in the safe byte array. diff --git a/Swiften/Chat/ChatStateNotifier.cpp b/Swiften/Chat/ChatStateNotifier.cpp index c623ce1..cbb9b0b 100644 --- a/Swiften/Chat/ChatStateNotifier.cpp +++ b/Swiften/Chat/ChatStateNotifier.cpp @@ -6,8 +6,9 @@ #include <Swiften/Chat/ChatStateNotifier.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Client/StanzaChannel.h> #include <Swiften/Disco/EntityCapsProvider.h> @@ -69,15 +70,15 @@ bool ChatStateNotifier::contactShouldReceiveStates() { } void ChatStateNotifier::changeState(ChatState::ChatStateType state) { - boost::shared_ptr<Message> message(boost::make_shared<Message>()); + std::shared_ptr<Message> message(std::make_shared<Message>()); message->setTo(contact_); - message->addPayload(boost::make_shared<ChatState>(state)); + message->addPayload(std::make_shared<ChatState>(state)); stanzaChannel_->sendMessage(message); } void ChatStateNotifier::addChatStateRequest(Message::ref message) { if (contactShouldReceiveStates()) { - message->addPayload(boost::make_shared<ChatState>(ChatState::Active)); + message->addPayload(std::make_shared<ChatState>(ChatState::Active)); } } diff --git a/Swiften/Chat/ChatStateNotifier.h b/Swiften/Chat/ChatStateNotifier.h index a53fad8..a8cc86a 100644 --- a/Swiften/Chat/ChatStateNotifier.h +++ b/Swiften/Chat/ChatStateNotifier.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> diff --git a/Swiften/Chat/ChatStateTracker.cpp b/Swiften/Chat/ChatStateTracker.cpp index 5141872..25ecd1c 100644 --- a/Swiften/Chat/ChatStateTracker.cpp +++ b/Swiften/Chat/ChatStateTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -11,17 +11,17 @@ ChatStateTracker::ChatStateTracker() { currentState_ = ChatState::Gone; } -void ChatStateTracker::handleMessageReceived(boost::shared_ptr<Message> message) { +void ChatStateTracker::handleMessageReceived(std::shared_ptr<Message> message) { if (message->getType() == Message::Error) { return; } - boost::shared_ptr<ChatState> statePayload = message->getPayload<ChatState>(); + std::shared_ptr<ChatState> statePayload = message->getPayload<ChatState>(); if (statePayload) { changeState(statePayload->getChatState());; } } -void ChatStateTracker::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { +void ChatStateTracker::handlePresenceChange(std::shared_ptr<Presence> newPresence) { if (newPresence->getType() == Presence::Unavailable) { onChatStateChange(ChatState::Gone); } diff --git a/Swiften/Chat/ChatStateTracker.h b/Swiften/Chat/ChatStateTracker.h index f31da0b..5bbc7ec 100644 --- a/Swiften/Chat/ChatStateTracker.h +++ b/Swiften/Chat/ChatStateTracker.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -18,8 +18,8 @@ namespace Swift { class SWIFTEN_API ChatStateTracker { public: ChatStateTracker(); - void handleMessageReceived(boost::shared_ptr<Message> message); - void handlePresenceChange(boost::shared_ptr<Presence> newPresence); + void handleMessageReceived(std::shared_ptr<Message> message); + void handlePresenceChange(std::shared_ptr<Presence> newPresence); boost::signal<void (ChatState::ChatStateType)> onChatStateChange; private: void changeState(ChatState::ChatStateType state); diff --git a/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp b/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp index af43ced..278068a 100644 --- a/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp +++ b/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp @@ -70,21 +70,21 @@ public: void testContactShouldReceiveStates_CapsOnly() { setContactHas85Caps(); - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); notifier_->addChatStateRequest(message); CPPUNIT_ASSERT(message->getPayload<ChatState>()); CPPUNIT_ASSERT_EQUAL(ChatState::Active, message->getPayload<ChatState>()->getChatState()); } void testContactShouldReceiveStates_CapsNorActive() { - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); notifier_->addChatStateRequest(message); CPPUNIT_ASSERT(!message->getPayload<ChatState>()); } void testContactShouldReceiveStates_ActiveOverrideOn() { notifier_->receivedMessageFromContact(true); - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); notifier_->addChatStateRequest(message); CPPUNIT_ASSERT(message->getPayload<ChatState>()); CPPUNIT_ASSERT_EQUAL(ChatState::Active, message->getPayload<ChatState>()->getChatState()); @@ -97,7 +97,7 @@ public: * thought this should check for false, but I later found it was OPTIONAL * (MAY) behaviour only for if you didn't receive caps. */ - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); notifier_->addChatStateRequest(message); CPPUNIT_ASSERT(message->getPayload<ChatState>()); CPPUNIT_ASSERT_EQUAL(ChatState::Active, message->getPayload<ChatState>()->getChatState()); @@ -142,7 +142,7 @@ public: int getComposingCount() const { int result = 0; - foreach(boost::shared_ptr<Stanza> stanza, stanzaChannel->sentStanzas) { + foreach(std::shared_ptr<Stanza> stanza, stanzaChannel->sentStanzas) { if (stanza->getPayload<ChatState>() && stanza->getPayload<ChatState>()->getChatState() == ChatState::Composing) { result++; } @@ -152,7 +152,7 @@ public: int getActiveCount() const { int result = 0; - foreach(boost::shared_ptr<Stanza> stanza, stanzaChannel->sentStanzas) { + foreach(std::shared_ptr<Stanza> stanza, stanzaChannel->sentStanzas) { if (stanza->getPayload<ChatState>() && stanza->getPayload<ChatState>()->getChatState() == ChatState::Active) { result++; } diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h index 7763745..9c51065 100644 --- a/Swiften/Client/Client.h +++ b/Swiften/Client/Client.h @@ -93,12 +93,12 @@ namespace Swift { /** * Returns the last received presence for the given (full) JID. */ - boost::shared_ptr<Presence> getLastPresence(const JID& jid) const; + std::shared_ptr<Presence> getLastPresence(const JID& jid) const; /** * Returns the presence with the highest priority received for the given JID. */ - boost::shared_ptr<Presence> getHighestPriorityPresence(const JID& bareJID) const; + std::shared_ptr<Presence> getHighestPriorityPresence(const JID& bareJID) const; PresenceOracle* getPresenceOracle() const { return presenceOracle; @@ -169,7 +169,7 @@ namespace Swift { /** * This signal is emitted when a JID changes presence. */ - boost::signal<void (boost::shared_ptr<Presence>)> onPresenceChange; + boost::signal<void (std::shared_ptr<Presence>)> onPresenceChange; private: Storages* getStorages() const; diff --git a/Swiften/Client/ClientBlockListManager.cpp b/Swiften/Client/ClientBlockListManager.cpp index 84a5639..bfdec30 100644 --- a/Swiften/Client/ClientBlockListManager.cpp +++ b/Swiften/Client/ClientBlockListManager.cpp @@ -7,9 +7,9 @@ #include <Swiften/Client/ClientBlockListManager.h> #include <cassert> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Client/BlockListImpl.h> @@ -18,15 +18,15 @@ using namespace Swift; namespace { class BlockResponder : public SetResponder<BlockPayload> { public: - BlockResponder(boost::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<BlockPayload>(iqRouter), blockList(blockList) { + BlockResponder(std::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<BlockPayload>(iqRouter), blockList(blockList) { } - virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<BlockPayload> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<BlockPayload> payload) { if (getIQRouter()->isAccountJID(from)) { if (payload) { blockList->addItems(payload->getItems()); } - sendResponse(from, id, boost::shared_ptr<BlockPayload>()); + sendResponse(from, id, std::shared_ptr<BlockPayload>()); } else { sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel); @@ -35,15 +35,15 @@ namespace { } private: - boost::shared_ptr<BlockListImpl> blockList; + std::shared_ptr<BlockListImpl> blockList; }; class UnblockResponder : public SetResponder<UnblockPayload> { public: - UnblockResponder(boost::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<UnblockPayload>(iqRouter), blockList(blockList) { + UnblockResponder(std::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<UnblockPayload>(iqRouter), blockList(blockList) { } - virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<UnblockPayload> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<UnblockPayload> payload) { if (getIQRouter()->isAccountJID(from)) { if (payload) { if (payload->getItems().empty()) { @@ -53,7 +53,7 @@ namespace { blockList->removeItems(payload->getItems()); } } - sendResponse(from, id, boost::shared_ptr<UnblockPayload>()); + sendResponse(from, id, std::shared_ptr<UnblockPayload>()); } else { sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel); @@ -62,7 +62,7 @@ namespace { } private: - boost::shared_ptr<BlockListImpl> blockList; + std::shared_ptr<BlockListImpl> blockList; }; } @@ -77,20 +77,20 @@ ClientBlockListManager::~ClientBlockListManager() { } } -boost::shared_ptr<BlockList> ClientBlockListManager::getBlockList() { +std::shared_ptr<BlockList> ClientBlockListManager::getBlockList() { if (!blockList) { - blockList = boost::make_shared<BlockListImpl>(); + blockList = std::make_shared<BlockListImpl>(); blockList->setState(BlockList::Init); } return blockList; } -boost::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() { +std::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() { if (!blockList) { - blockList = boost::make_shared<BlockListImpl>(); + blockList = std::make_shared<BlockListImpl>(); } blockList->setState(BlockList::Requesting); - boost::shared_ptr<GenericRequest<BlockListPayload> > getRequest = boost::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), boost::make_shared<BlockListPayload>(), iqRouter); + std::shared_ptr<GenericRequest<BlockListPayload> > getRequest = std::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), std::make_shared<BlockListPayload>(), iqRouter); getRequest->onResponse.connect(boost::bind(&ClientBlockListManager::handleBlockListReceived, this, _1, _2)); getRequest->send(); return blockList; @@ -101,8 +101,8 @@ GenericRequest<BlockPayload>::ref ClientBlockListManager::createBlockJIDRequest( } GenericRequest<BlockPayload>::ref ClientBlockListManager::createBlockJIDsRequest(const std::vector<JID>& jids) { - boost::shared_ptr<BlockPayload> payload = boost::make_shared<BlockPayload>(jids); - return boost::make_shared< GenericRequest<BlockPayload> >(IQ::Set, JID(), payload, iqRouter); + std::shared_ptr<BlockPayload> payload = std::make_shared<BlockPayload>(jids); + return std::make_shared< GenericRequest<BlockPayload> >(IQ::Set, JID(), payload, iqRouter); } GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDRequest(const JID& jid) { @@ -110,8 +110,8 @@ GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDRequ } GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDsRequest(const std::vector<JID>& jids) { - boost::shared_ptr<UnblockPayload> payload = boost::make_shared<UnblockPayload>(jids); - return boost::make_shared< GenericRequest<UnblockPayload> >(IQ::Set, JID(), payload, iqRouter); + std::shared_ptr<UnblockPayload> payload = std::make_shared<UnblockPayload>(jids); + return std::make_shared< GenericRequest<UnblockPayload> >(IQ::Set, JID(), payload, iqRouter); } GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockAllRequest() { @@ -119,7 +119,7 @@ GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockAllRequ } -void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockListPayload> payload, ErrorPayload::ref error) { +void ClientBlockListManager::handleBlockListReceived(std::shared_ptr<BlockListPayload> payload, ErrorPayload::ref error) { if (error || !payload) { blockList->setState(BlockList::Error); } @@ -127,11 +127,11 @@ void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockList blockList->setItems(payload->getItems()); blockList->setState(BlockList::Available); if (!blockResponder) { - blockResponder = boost::make_shared<BlockResponder>(blockList, iqRouter); + blockResponder = std::make_shared<BlockResponder>(blockList, iqRouter); blockResponder->start(); } if (!unblockResponder) { - unblockResponder = boost::make_shared<UnblockResponder>(blockList, iqRouter); + unblockResponder = std::make_shared<UnblockResponder>(blockList, iqRouter); unblockResponder->start(); } } diff --git a/Swiften/Client/ClientBlockListManager.h b/Swiften/Client/ClientBlockListManager.h index 63ff1cd..44e3ee1 100644 --- a/Swiften/Client/ClientBlockListManager.h +++ b/Swiften/Client/ClientBlockListManager.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -30,12 +30,12 @@ namespace Swift { /** * Returns the blocklist. */ - boost::shared_ptr<BlockList> getBlockList(); + std::shared_ptr<BlockList> getBlockList(); /** * Get the blocklist from the server. */ - boost::shared_ptr<BlockList> requestBlockList(); + std::shared_ptr<BlockList> requestBlockList(); GenericRequest<BlockPayload>::ref createBlockJIDRequest(const JID& jid); GenericRequest<BlockPayload>::ref createBlockJIDsRequest(const std::vector<JID>& jids); @@ -45,13 +45,13 @@ namespace Swift { GenericRequest<UnblockPayload>::ref createUnblockAllRequest(); private: - void handleBlockListReceived(boost::shared_ptr<BlockListPayload> payload, ErrorPayload::ref); + void handleBlockListReceived(std::shared_ptr<BlockListPayload> payload, ErrorPayload::ref); private: IQRouter* iqRouter; - boost::shared_ptr<SetResponder<BlockPayload> > blockResponder; - boost::shared_ptr<SetResponder<UnblockPayload> > unblockResponder; - boost::shared_ptr<BlockListImpl> blockList; + std::shared_ptr<SetResponder<BlockPayload> > blockResponder; + std::shared_ptr<SetResponder<UnblockPayload> > unblockResponder; + std::shared_ptr<BlockListImpl> blockList; }; } diff --git a/Swiften/Client/ClientError.h b/Swiften/Client/ClientError.h index 5ae1086..3453611 100644 --- a/Swiften/Client/ClientError.h +++ b/Swiften/Client/ClientError.h @@ -1,12 +1,13 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> + #include <boost/system/system_error.hpp> namespace Swift { @@ -54,12 +55,12 @@ namespace Swift { Type getType() const { return type_; } - void setErrorCode(boost::shared_ptr<boost::system::error_code> errorCode) { errorCode_ = errorCode; } + void setErrorCode(std::shared_ptr<boost::system::error_code> errorCode) { errorCode_ = errorCode; } - boost::shared_ptr<boost::system::error_code> getErrorCode() const { return errorCode_; } + std::shared_ptr<boost::system::error_code> getErrorCode() const { return errorCode_; } private: Type type_; - boost::shared_ptr<boost::system::error_code> errorCode_; + std::shared_ptr<boost::system::error_code> errorCode_; }; } diff --git a/Swiften/Client/ClientOptions.h b/Swiften/Client/ClientOptions.h index c902388..3a93197 100644 --- a/Swiften/Client/ClientOptions.h +++ b/Swiften/Client/ClientOptions.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeString.h> @@ -152,7 +152,7 @@ namespace Swift { * This can be initialized with a custom HTTPTrafficFilter, which allows HTTP CONNECT * proxy initialization to be customized. */ - boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter; + std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter; /** * Options passed to the TLS stack diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index 1b67c96..c301881 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -10,7 +10,7 @@ #include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid_io.hpp> #include <boost/uuid/uuid_generators.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/Platform.h> #include <Swiften/Base/Log.h> @@ -57,7 +57,7 @@ namespace Swift { ClientSession::ClientSession( const JID& jid, - boost::shared_ptr<SessionStream> stream, + std::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) : localJID(jid), @@ -104,7 +104,7 @@ void ClientSession::sendStreamHeader() { stream->writeHeader(header); } -void ClientSession::sendStanza(boost::shared_ptr<Stanza> stanza) { +void ClientSession::sendStanza(std::shared_ptr<Stanza> stanza) { stream->writeElement(stanza); if (stanzaAckRequester_) { stanzaAckRequester_->handleStanzaSent(stanza); @@ -116,17 +116,17 @@ void ClientSession::handleStreamStart(const ProtocolHeader&) { state = Negotiating; } -void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { - if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) { +void ClientSession::handleElement(std::shared_ptr<ToplevelElement> element) { + if (std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element)) { if (stanzaAckResponder_) { stanzaAckResponder_->handleStanzaReceived(); } if (getState() == Initialized) { onStanzaReceived(stanza); } - else if (boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(element)) { + else if (std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(element)) { if (state == BindingResource) { - boost::shared_ptr<ResourceBind> resourceBind(iq->getPayload<ResourceBind>()); + std::shared_ptr<ResourceBind> resourceBind(iq->getPayload<ResourceBind>()); if (iq->getType() == IQ::Error && iq->getID() == "session-bind") { finishSession(Error::ResourceBindError); } @@ -162,12 +162,12 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { } } } - else if (boost::dynamic_pointer_cast<StanzaAckRequest>(element)) { + else if (std::dynamic_pointer_cast<StanzaAckRequest>(element)) { if (stanzaAckResponder_) { stanzaAckResponder_->handleAckRequestReceived(); } } - else if (boost::shared_ptr<StanzaAck> ack = boost::dynamic_pointer_cast<StanzaAck>(element)) { + else if (std::shared_ptr<StanzaAck> ack = std::dynamic_pointer_cast<StanzaAck>(element)) { if (stanzaAckRequester_) { if (ack->isValid()) { stanzaAckRequester_->handleAckReceived(ack->getHandledStanzasCount()); @@ -180,11 +180,11 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { SWIFT_LOG(warning) << "Ignoring ack"; } } - else if (StreamError::ref streamError = boost::dynamic_pointer_cast<StreamError>(element)) { + else if (StreamError::ref streamError = std::dynamic_pointer_cast<StreamError>(element)) { finishSession(Error::StreamError); } else if (getState() == Initialized) { - boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element); + std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element); if (stanza) { if (stanzaAckResponder_) { stanzaAckResponder_->handleStanzaReceived(); @@ -197,14 +197,14 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { if (streamFeatures->hasStartTLS() && stream->supportsTLSEncryption() && useTLS != NeverUseTLS) { state = WaitingForEncrypt; - stream->writeElement(boost::make_shared<StartTLSRequest>()); + stream->writeElement(std::make_shared<StartTLSRequest>()); } else if (useTLS == RequireTLS && !stream->isTLSEncrypted()) { finishSession(Error::NoSupportedAuthMechanismsError); } else if (useStreamCompression && stream->supportsZLibCompression() && streamFeatures->hasCompressionMethod("zlib")) { state = Compressing; - stream->writeElement(boost::make_shared<CompressRequest>("zlib")); + stream->writeElement(std::make_shared<CompressRequest>("zlib")); } else if (streamFeatures->hasAuthenticationMechanisms()) { #ifdef SWIFTEN_PLATFORM_WIN32 @@ -217,13 +217,13 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { } else { WindowsGSSAPIClientAuthenticator* gssapiAuthenticator = new WindowsGSSAPIClientAuthenticator(*authenticationHostname, localJID.getDomain(), authenticationPort); - boost::shared_ptr<Error> error = boost::make_shared<Error>(Error::AuthenticationFailedError); + std::shared_ptr<Error> error = std::make_shared<Error>(Error::AuthenticationFailedError); authenticator = gssapiAuthenticator; if (!gssapiAuthenticator->isError()) { state = Authenticating; - stream->writeElement(boost::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse())); + stream->writeElement(std::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse())); } else { error->errorCode = gssapiAuthenticator->getErrorCode(); @@ -237,7 +237,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { if (streamFeatures->hasAuthenticationMechanism("EXTERNAL")) { authenticator = new EXTERNALClientAuthenticator(); state = Authenticating; - stream->writeElement(boost::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray(""))); + stream->writeElement(std::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray(""))); } else { finishSession(Error::TLSClientCertificateError); @@ -246,7 +246,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { else if (streamFeatures->hasAuthenticationMechanism("EXTERNAL")) { authenticator = new EXTERNALClientAuthenticator(); state = Authenticating; - stream->writeElement(boost::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray(""))); + stream->writeElement(std::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray(""))); } else if (streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1") || streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1-PLUS")) { std::ostringstream s; @@ -298,26 +298,26 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { } } } - else if (boost::dynamic_pointer_cast<Compressed>(element)) { + else if (std::dynamic_pointer_cast<Compressed>(element)) { CHECK_STATE_OR_RETURN(Compressing); state = WaitingForStreamStart; stream->addZLibCompression(); stream->resetXMPPParser(); sendStreamHeader(); } - else if (boost::dynamic_pointer_cast<CompressFailure>(element)) { + else if (std::dynamic_pointer_cast<CompressFailure>(element)) { finishSession(Error::CompressionFailedError); } - else if (boost::dynamic_pointer_cast<StreamManagementEnabled>(element)) { - stanzaAckRequester_ = boost::make_shared<StanzaAckRequester>(); + else if (std::dynamic_pointer_cast<StreamManagementEnabled>(element)) { + stanzaAckRequester_ = std::make_shared<StanzaAckRequester>(); stanzaAckRequester_->onRequestAck.connect(boost::bind(&ClientSession::requestAck, shared_from_this())); stanzaAckRequester_->onStanzaAcked.connect(boost::bind(&ClientSession::handleStanzaAcked, shared_from_this(), _1)); - stanzaAckResponder_ = boost::make_shared<StanzaAckResponder>(); + stanzaAckResponder_ = std::make_shared<StanzaAckResponder>(); stanzaAckResponder_->onAck.connect(boost::bind(&ClientSession::ack, shared_from_this(), _1)); needAcking = false; continueSessionInitialization(); } - else if (boost::dynamic_pointer_cast<StreamManagementFailed>(element)) { + else if (std::dynamic_pointer_cast<StreamManagementFailed>(element)) { needAcking = false; continueSessionInitialization(); } @@ -325,11 +325,11 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { CHECK_STATE_OR_RETURN(Authenticating); assert(authenticator); if (authenticator->setChallenge(challenge->getValue())) { - stream->writeElement(boost::make_shared<AuthResponse>(authenticator->getResponse())); + stream->writeElement(std::make_shared<AuthResponse>(authenticator->getResponse())); } #ifdef SWIFTEN_PLATFORM_WIN32 else if (WindowsGSSAPIClientAuthenticator* gssapiAuthenticator = dynamic_cast<WindowsGSSAPIClientAuthenticator*>(authenticator)) { - boost::shared_ptr<Error> error = boost::make_shared<Error>(Error::AuthenticationFailedError); + std::shared_ptr<Error> error = std::make_shared<Error>(Error::AuthenticationFailedError); error->errorCode = gssapiAuthenticator->getErrorCode(); finishSession(error); @@ -374,7 +374,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { void ClientSession::continueSessionInitialization() { if (needResourceBind) { state = BindingResource; - boost::shared_ptr<ResourceBind> resourceBind(boost::make_shared<ResourceBind>()); + std::shared_ptr<ResourceBind> resourceBind(std::make_shared<ResourceBind>()); if (!localJID.getResource().empty()) { resourceBind->setResource(localJID.getResource()); } @@ -382,11 +382,11 @@ void ClientSession::continueSessionInitialization() { } else if (needAcking) { state = EnablingSessionManagement; - stream->writeElement(boost::make_shared<EnableStreamManagement>()); + stream->writeElement(std::make_shared<EnableStreamManagement>()); } else if (needSessionStart) { state = StartingSession; - sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", boost::make_shared<StartSession>())); + sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", std::make_shared<StartSession>())); } else { state = Initialized; @@ -407,14 +407,14 @@ void ClientSession::sendCredentials(const SafeByteArray& password) { assert(authenticator); state = Authenticating; authenticator->setCredentials(localJID.getNode(), password); - stream->writeElement(boost::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse())); + stream->writeElement(std::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse())); } void ClientSession::handleTLSEncrypted() { CHECK_STATE_OR_RETURN(Encrypting); std::vector<Certificate::ref> certificateChain = stream->getPeerCertificateChain(); - boost::shared_ptr<CertificateVerificationError> verificationError = stream->getPeerCertificateVerificationError(); + std::shared_ptr<CertificateVerificationError> verificationError = stream->getPeerCertificateVerificationError(); if (verificationError) { checkTrustOrFinish(certificateChain, verificationError); } @@ -424,12 +424,12 @@ void ClientSession::handleTLSEncrypted() { continueAfterTLSEncrypted(); } else { - checkTrustOrFinish(certificateChain, boost::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidServerIdentity)); + checkTrustOrFinish(certificateChain, std::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidServerIdentity)); } } } -void ClientSession::checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, boost::shared_ptr<CertificateVerificationError> error) { +void ClientSession::checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, std::shared_ptr<CertificateVerificationError> error) { if (certificateTrustChecker && certificateTrustChecker->isCertificateTrusted(certificateChain)) { continueAfterTLSEncrypted(); } @@ -444,7 +444,7 @@ void ClientSession::continueAfterTLSEncrypted() { sendStreamHeader(); } -void ClientSession::handleStreamClosed(boost::shared_ptr<Swift::Error> streamError) { +void ClientSession::handleStreamClosed(std::shared_ptr<Swift::Error> streamError) { State previousState = state; state = Finished; @@ -472,14 +472,14 @@ void ClientSession::handleStreamClosed(boost::shared_ptr<Swift::Error> streamErr } void ClientSession::finish() { - finishSession(boost::shared_ptr<Error>()); + finishSession(std::shared_ptr<Error>()); } void ClientSession::finishSession(Error::Type error) { - finishSession(boost::make_shared<Swift::ClientSession::Error>(error)); + finishSession(std::make_shared<Swift::ClientSession::Error>(error)); } -void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) { +void ClientSession::finishSession(std::shared_ptr<Swift::Error> error) { state = Finishing; if (!error_) { error_ = error; @@ -500,15 +500,15 @@ void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) { } void ClientSession::requestAck() { - stream->writeElement(boost::make_shared<StanzaAckRequest>()); + stream->writeElement(std::make_shared<StanzaAckRequest>()); } -void ClientSession::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { +void ClientSession::handleStanzaAcked(std::shared_ptr<Stanza> stanza) { onStanzaAcked(stanza); } void ClientSession::ack(unsigned int handledStanzasCount) { - stream->writeElement(boost::make_shared<StanzaAck>(handledStanzasCount)); + stream->writeElement(std::make_shared<StanzaAck>(handledStanzasCount)); } } diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index b1b6755..7309218 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/boost_bsignals.h> @@ -26,7 +24,7 @@ namespace Swift { class IDNConverter; class CryptoProvider; - class SWIFTEN_API ClientSession : public boost::enable_shared_from_this<ClientSession> { + class SWIFTEN_API ClientSession : public std::enable_shared_from_this<ClientSession> { public: enum State { Initial, @@ -58,7 +56,7 @@ namespace Swift { TLSError, StreamError } type; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; Error(Type type) : type(type) {} }; @@ -70,8 +68,8 @@ namespace Swift { ~ClientSession(); - static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) { - return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto)); + static std::shared_ptr<ClientSession> create(const JID& jid, std::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) { + return std::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto)); } State getState() const { @@ -121,7 +119,7 @@ namespace Swift { } void sendCredentials(const SafeByteArray& password); - void sendStanza(boost::shared_ptr<Stanza>); + void sendStanza(std::shared_ptr<Stanza>); void setCertificateTrustChecker(CertificateTrustChecker* checker) { certificateTrustChecker = checker; @@ -142,19 +140,19 @@ namespace Swift { public: boost::signal<void ()> onNeedCredentials; boost::signal<void ()> onInitialized; - boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished; - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived; - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked; + boost::signal<void (std::shared_ptr<Swift::Error>)> onFinished; + boost::signal<void (std::shared_ptr<Stanza>)> onStanzaReceived; + boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked; private: ClientSession( const JID& jid, - boost::shared_ptr<SessionStream>, + std::shared_ptr<SessionStream>, IDNConverter* idnConverter, CryptoProvider* crypto); void finishSession(Error::Type error); - void finishSession(boost::shared_ptr<Swift::Error> error); + void finishSession(std::shared_ptr<Swift::Error> error); JID getRemoteJID() const { return JID("", localJID.getDomain()); @@ -162,9 +160,9 @@ namespace Swift { void sendStreamHeader(); - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); - void handleStreamClosed(boost::shared_ptr<Swift::Error>); + void handleStreamClosed(std::shared_ptr<Swift::Error>); void handleTLSEncrypted(); @@ -172,15 +170,15 @@ namespace Swift { void continueSessionInitialization(); void requestAck(); - void handleStanzaAcked(boost::shared_ptr<Stanza> stanza); + void handleStanzaAcked(std::shared_ptr<Stanza> stanza); void ack(unsigned int handledStanzasCount); void continueAfterTLSEncrypted(); - void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, boost::shared_ptr<CertificateVerificationError> error); + void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, std::shared_ptr<CertificateVerificationError> error); private: JID localJID; State state; - boost::shared_ptr<SessionStream> stream; + std::shared_ptr<SessionStream> stream; IDNConverter* idnConverter; CryptoProvider* crypto; bool allowPLAINOverNonTLS; @@ -192,9 +190,9 @@ namespace Swift { bool needAcking; bool rosterVersioningSupported; ClientAuthenticator* authenticator; - boost::shared_ptr<StanzaAckRequester> stanzaAckRequester_; - boost::shared_ptr<StanzaAckResponder> stanzaAckResponder_; - boost::shared_ptr<Swift::Error> error_; + std::shared_ptr<StanzaAckRequester> stanzaAckRequester_; + std::shared_ptr<StanzaAckResponder> stanzaAckResponder_; + std::shared_ptr<Swift::Error> error_; CertificateTrustChecker* certificateTrustChecker; bool singleSignOn; int authenticationPort; diff --git a/Swiften/Client/ClientSessionStanzaChannel.cpp b/Swiften/Client/ClientSessionStanzaChannel.cpp index 1340b7c..f1cba5d 100644 --- a/Swiften/Client/ClientSessionStanzaChannel.cpp +++ b/Swiften/Client/ClientSessionStanzaChannel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ ClientSessionStanzaChannel::~ClientSessionStanzaChannel() { } } -void ClientSessionStanzaChannel::setSession(boost::shared_ptr<ClientSession> session) { +void ClientSessionStanzaChannel::setSession(std::shared_ptr<ClientSession> session) { assert(!this->session); this->session = session; session->onInitialized.connect(boost::bind(&ClientSessionStanzaChannel::handleSessionInitialized, this)); @@ -31,15 +31,15 @@ void ClientSessionStanzaChannel::setSession(boost::shared_ptr<ClientSession> ses session->onStanzaAcked.connect(boost::bind(&ClientSessionStanzaChannel::handleStanzaAcked, this, _1)); } -void ClientSessionStanzaChannel::sendIQ(boost::shared_ptr<IQ> iq) { +void ClientSessionStanzaChannel::sendIQ(std::shared_ptr<IQ> iq) { send(iq); } -void ClientSessionStanzaChannel::sendMessage(boost::shared_ptr<Message> message) { +void ClientSessionStanzaChannel::sendMessage(std::shared_ptr<Message> message) { send(message); } -void ClientSessionStanzaChannel::sendPresence(boost::shared_ptr<Presence> presence) { +void ClientSessionStanzaChannel::sendPresence(std::shared_ptr<Presence> presence) { send(presence); } @@ -47,7 +47,7 @@ std::string ClientSessionStanzaChannel::getNewIQID() { return idGenerator.generateID(); } -void ClientSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { +void ClientSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) { if (!isAvailable()) { std::cerr << "Warning: Client: Trying to send a stanza while disconnected." << std::endl; return; @@ -55,7 +55,7 @@ void ClientSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { session->sendStanza(stanza); } -void ClientSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Error>) { +void ClientSessionStanzaChannel::handleSessionFinished(std::shared_ptr<Error>) { session->onFinished.disconnect(boost::bind(&ClientSessionStanzaChannel::handleSessionFinished, this, _1)); session->onStanzaReceived.disconnect(boost::bind(&ClientSessionStanzaChannel::handleStanza, this, _1)); session->onStanzaAcked.disconnect(boost::bind(&ClientSessionStanzaChannel::handleStanzaAcked, this, _1)); @@ -65,20 +65,20 @@ void ClientSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Error>) onAvailableChanged(false); } -void ClientSessionStanzaChannel::handleStanza(boost::shared_ptr<Stanza> stanza) { - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(stanza); +void ClientSessionStanzaChannel::handleStanza(std::shared_ptr<Stanza> stanza) { + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(stanza); if (message) { onMessageReceived(message); return; } - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(stanza); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(stanza); if (presence) { onPresenceReceived(presence); return; } - boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(stanza); + std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(stanza); if (iq) { onIQReceived(iq); return; @@ -100,7 +100,7 @@ std::vector<Certificate::ref> ClientSessionStanzaChannel::getPeerCertificateChai return std::vector<Certificate::ref>(); } -void ClientSessionStanzaChannel::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { +void ClientSessionStanzaChannel::handleStanzaAcked(std::shared_ptr<Stanza> stanza) { onStanzaAcked(stanza); } diff --git a/Swiften/Client/ClientSessionStanzaChannel.h b/Swiften/Client/ClientSessionStanzaChannel.h index d3b302b..0527a5c 100644 --- a/Swiften/Client/ClientSessionStanzaChannel.h +++ b/Swiften/Client/ClientSessionStanzaChannel.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/IDGenerator.h> @@ -24,11 +24,11 @@ namespace Swift { public: virtual ~ClientSessionStanzaChannel(); - void setSession(boost::shared_ptr<ClientSession> session); + void setSession(std::shared_ptr<ClientSession> session); - void sendIQ(boost::shared_ptr<IQ> iq); - void sendMessage(boost::shared_ptr<Message> message); - void sendPresence(boost::shared_ptr<Presence> presence); + void sendIQ(std::shared_ptr<IQ> iq); + void sendMessage(std::shared_ptr<Message> message); + void sendPresence(std::shared_ptr<Presence> presence); bool getStreamManagementEnabled() const; virtual std::vector<Certificate::ref> getPeerCertificateChain() const; @@ -38,15 +38,15 @@ namespace Swift { private: std::string getNewIQID(); - void send(boost::shared_ptr<Stanza> stanza); - void handleSessionFinished(boost::shared_ptr<Error> error); - void handleStanza(boost::shared_ptr<Stanza> stanza); - void handleStanzaAcked(boost::shared_ptr<Stanza> stanza); + void send(std::shared_ptr<Stanza> stanza); + void handleSessionFinished(std::shared_ptr<Error> error); + void handleStanza(std::shared_ptr<Stanza> stanza); + void handleStanzaAcked(std::shared_ptr<Stanza> stanza); void handleSessionInitialized(); private: IDGenerator idGenerator; - boost::shared_ptr<ClientSession> session; + std::shared_ptr<ClientSession> session; }; } diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index 44fadc6..c2f8fd7 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -6,9 +6,10 @@ #include <Swiften/Client/CoreClient.h> +#include <memory> + #include <boost/bind.hpp> #include <boost/optional.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Algorithm.h> #include <Swiften/Base/IDGenerator.h> @@ -115,7 +116,7 @@ void CoreClient::connect(const ClientOptions& o) { } assert(!connector_); if (options.boshURL.isEmpty()) { - connector_ = boost::make_shared<ChainedConnector>(host, port, serviceLookupPrefix, networkFactories->getDomainNameResolver(), connectionFactories, networkFactories->getTimerFactory()); + connector_ = std::make_shared<ChainedConnector>(host, port, serviceLookupPrefix, networkFactories->getDomainNameResolver(), connectionFactories, networkFactories->getTimerFactory()); connector_->onConnectFinished.connect(boost::bind(&CoreClient::handleConnectorFinished, this, _1, _2)); connector_->setTimeoutMilliseconds(2*60*1000); connector_->start(); @@ -124,7 +125,7 @@ void CoreClient::connect(const ClientOptions& o) { /* Autodiscovery of which proxy works is largely ok with a TCP session, because this is a one-off. With BOSH * it would be quite painful given that potentially every stanza could be sent on a new connection. */ - boost::shared_ptr<BOSHSessionStream> boshSessionStream_ = boost::shared_ptr<BOSHSessionStream>(new BOSHSessionStream( + std::shared_ptr<BOSHSessionStream> boshSessionStream_ = std::shared_ptr<BOSHSessionStream>(new BOSHSessionStream( options.boshURL, getPayloadParserFactories(), getPayloadSerializers(), @@ -181,7 +182,7 @@ void CoreClient::bindSessionToStream() { /** * Only called for TCP sessions. BOSH is handled inside the BOSHSessionStream. */ -void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) { +void CoreClient::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) { resetConnector(); if (!connection) { if (options.forgetPassword) { @@ -189,7 +190,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio } boost::optional<ClientError> clientError; if (!disconnectRequested_) { - clientError = boost::dynamic_pointer_cast<DomainNameResolveError>(error) ? boost::optional<ClientError>(ClientError::DomainNameResolveError) : boost::optional<ClientError>(ClientError::ConnectionError); + clientError = std::dynamic_pointer_cast<DomainNameResolveError>(error) ? boost::optional<ClientError>(ClientError::DomainNameResolveError) : boost::optional<ClientError>(ClientError::ConnectionError); } onDisconnected(clientError); } @@ -205,7 +206,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio connection_ = connection; - sessionStream_ = boost::make_shared<BasicSessionStream>(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), networkFactories->getTLSContextFactory(), networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), options.tlsOptions); + sessionStream_ = std::make_shared<BasicSessionStream>(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), networkFactories->getTLSContextFactory(), networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), options.tlsOptions); if (certificate_) { sessionStream_->setTLSCertificate(certificate_); } @@ -232,7 +233,7 @@ void CoreClient::setCertificate(CertificateWithKey::ref certificate) { certificate_ = certificate; } -void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { +void CoreClient::handleSessionFinished(std::shared_ptr<Error> error) { if (options.forgetPassword) { purgePassword(); } @@ -241,7 +242,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { boost::optional<ClientError> actualError; if (error) { ClientError clientError; - if (boost::shared_ptr<ClientSession::Error> actualError = boost::dynamic_pointer_cast<ClientSession::Error>(error)) { + if (std::shared_ptr<ClientSession::Error> actualError = std::dynamic_pointer_cast<ClientSession::Error>(error)) { switch(actualError->type) { case ClientSession::Error::AuthenticationFailedError: clientError = ClientError(ClientError::AuthenticationFailedError); @@ -276,7 +277,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { } clientError.setErrorCode(actualError->errorCode); } - else if (boost::shared_ptr<TLSError> actualError = boost::dynamic_pointer_cast<TLSError>(error)) { + else if (std::shared_ptr<TLSError> actualError = std::dynamic_pointer_cast<TLSError>(error)) { switch(actualError->getType()) { case TLSError::CertificateCardRemoved: clientError = ClientError(ClientError::CertificateCardRemoved); @@ -286,7 +287,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { break; } } - else if (boost::shared_ptr<SessionStream::SessionStreamError> actualError = boost::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) { + else if (std::shared_ptr<SessionStream::SessionStreamError> actualError = std::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) { switch(actualError->type) { case SessionStream::SessionStreamError::ParseError: clientError = ClientError(ClientError::XMLError); @@ -305,7 +306,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) { break; } } - else if (boost::shared_ptr<CertificateVerificationError> verificationError = boost::dynamic_pointer_cast<CertificateVerificationError>(error)) { + else if (std::shared_ptr<CertificateVerificationError> verificationError = std::dynamic_pointer_cast<CertificateVerificationError>(error)) { switch(verificationError->getType()) { case CertificateVerificationError::UnknownError: clientError = ClientError(ClientError::UnknownCertificateError); @@ -377,11 +378,11 @@ void CoreClient::handleStanzaChannelAvailableChanged(bool available) { } } -void CoreClient::sendMessage(boost::shared_ptr<Message> message) { +void CoreClient::sendMessage(std::shared_ptr<Message> message) { stanzaChannel_->sendMessage(message); } -void CoreClient::sendPresence(boost::shared_ptr<Presence> presence) { +void CoreClient::sendPresence(std::shared_ptr<Presence> presence) { stanzaChannel_->sendPresence(presence); } @@ -458,7 +459,7 @@ void CoreClient::resetSession() { if (connection_) { connection_->disconnect(); } - else if (boost::dynamic_pointer_cast<BOSHSessionStream>(sessionStream_)) { + else if (std::dynamic_pointer_cast<BOSHSessionStream>(sessionStream_)) { sessionStream_->close(); } sessionStream_.reset(); diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 3efc38f..a1e4681 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Base/boost_bsignals.h> @@ -78,12 +77,12 @@ namespace Swift { /** * Sends a message. */ - void sendMessage(boost::shared_ptr<Message>); + void sendMessage(std::shared_ptr<Message>); /** * Sends a presence stanza. */ - void sendPresence(boost::shared_ptr<Presence>); + void sendPresence(std::shared_ptr<Presence>); /** * Sends raw, unchecked data. @@ -177,12 +176,12 @@ namespace Swift { /** * Emitted when a message is received. */ - boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived; + boost::signal<void (std::shared_ptr<Message>)> onMessageReceived; /** * Emitted when a presence stanza is received. */ - boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived; + boost::signal<void (std::shared_ptr<Presence>) > onPresenceReceived; /** * Emitted when the server acknowledges receipt of a @@ -190,10 +189,10 @@ namespace Swift { * * \see getStreamManagementEnabled() */ - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked; + boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked; protected: - boost::shared_ptr<ClientSession> getSession() const { + std::shared_ptr<ClientSession> getSession() const { return session_; } @@ -207,15 +206,15 @@ namespace Swift { virtual void handleConnected() {} private: - void handleConnectorFinished(boost::shared_ptr<Connection>, boost::shared_ptr<Error> error); + void handleConnectorFinished(std::shared_ptr<Connection>, std::shared_ptr<Error> error); void handleStanzaChannelAvailableChanged(bool available); - void handleSessionFinished(boost::shared_ptr<Error>); + void handleSessionFinished(std::shared_ptr<Error>); void handleNeedCredentials(); void handleDataRead(const SafeByteArray&); void handleDataWritten(const SafeByteArray&); - void handlePresenceReceived(boost::shared_ptr<Presence>); - void handleMessageReceived(boost::shared_ptr<Message>); - void handleStanzaAcked(boost::shared_ptr<Stanza>); + void handlePresenceReceived(std::shared_ptr<Presence>); + void handleMessageReceived(std::shared_ptr<Message>); + void handleStanzaAcked(std::shared_ptr<Stanza>); void purgePassword(); void bindSessionToStream(); @@ -230,11 +229,11 @@ namespace Swift { ClientSessionStanzaChannel* stanzaChannel_; IQRouter* iqRouter_; ClientOptions options; - boost::shared_ptr<ChainedConnector> connector_; + std::shared_ptr<ChainedConnector> connector_; std::vector<ConnectionFactory*> proxyConnectionFactories; - boost::shared_ptr<Connection> connection_; - boost::shared_ptr<SessionStream> sessionStream_; - boost::shared_ptr<ClientSession> session_; + std::shared_ptr<Connection> connection_; + std::shared_ptr<SessionStream> sessionStream_; + std::shared_ptr<ClientSession> session_; CertificateWithKey::ref certificate_; bool disconnectRequested_; CertificateTrustChecker* certificateTrustChecker; diff --git a/Swiften/Client/DummyStanzaChannel.h b/Swiften/Client/DummyStanzaChannel.h index 0e52f62..48b611c 100644 --- a/Swiften/Client/DummyStanzaChannel.h +++ b/Swiften/Client/DummyStanzaChannel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,7 +15,7 @@ namespace Swift { public: DummyStanzaChannel() : available_(true) {} - virtual void sendStanza(boost::shared_ptr<Stanza> stanza) { + virtual void sendStanza(std::shared_ptr<Stanza> stanza) { sentStanzas.push_back(stanza); } @@ -24,15 +24,15 @@ namespace Swift { onAvailableChanged(available); } - virtual void sendIQ(boost::shared_ptr<IQ> iq) { + virtual void sendIQ(std::shared_ptr<IQ> iq) { sentStanzas.push_back(iq); } - virtual void sendMessage(boost::shared_ptr<Message> message) { + virtual void sendMessage(std::shared_ptr<Message> message) { sentStanzas.push_back(message); } - virtual void sendPresence(boost::shared_ptr<Presence> presence) { + virtual void sendPresence(std::shared_ptr<Presence> presence) { sentStanzas.push_back(presence); } @@ -52,7 +52,7 @@ namespace Swift { if (index >= sentStanzas.size()) { return false; } - boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]); + std::shared_ptr<IQ> iqStanza = std::dynamic_pointer_cast<IQ>(sentStanzas[index]); return iqStanza && iqStanza->getType() == type && iqStanza->getTo() == jid && iqStanza->getPayload<T>(); } @@ -60,7 +60,7 @@ namespace Swift { if (index >= sentStanzas.size()) { return false; } - boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]); + std::shared_ptr<IQ> iqStanza = std::dynamic_pointer_cast<IQ>(sentStanzas[index]); return iqStanza && iqStanza->getType() == IQ::Result && iqStanza->getID() == id; } @@ -68,22 +68,22 @@ namespace Swift { if (index >= sentStanzas.size()) { return false; } - boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]); + std::shared_ptr<IQ> iqStanza = std::dynamic_pointer_cast<IQ>(sentStanzas[index]); return iqStanza && iqStanza->getType() == IQ::Error && iqStanza->getID() == id; } - template<typename T> boost::shared_ptr<T> getStanzaAtIndex(size_t index) { + template<typename T> std::shared_ptr<T> getStanzaAtIndex(size_t index) { if (sentStanzas.size() <= index) { - return boost::shared_ptr<T>(); + return std::shared_ptr<T>(); } - return boost::dynamic_pointer_cast<T>(sentStanzas[index]); + return std::dynamic_pointer_cast<T>(sentStanzas[index]); } std::vector<Certificate::ref> getPeerCertificateChain() const { return std::vector<Certificate::ref>(); } - std::vector<boost::shared_ptr<Stanza> > sentStanzas; + std::vector<std::shared_ptr<Stanza> > sentStanzas; bool available_; }; } diff --git a/Swiften/Client/NickResolver.cpp b/Swiften/Client/NickResolver.cpp index c424447..394d490 100644 --- a/Swiften/Client/NickResolver.cpp +++ b/Swiften/Client/NickResolver.cpp @@ -6,8 +6,9 @@ #include <Swiften/Client/NickResolver.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/MUC/MUCRegistry.h> #include <Swiften/Roster/XMPPRoster.h> diff --git a/Swiften/Client/NickResolver.h b/Swiften/Client/NickResolver.h index b187796..0e46411 100644 --- a/Swiften/Client/NickResolver.h +++ b/Swiften/Client/NickResolver.h @@ -7,10 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/VCard.h> diff --git a/Swiften/Client/StanzaChannel.h b/Swiften/Client/StanzaChannel.h index ec36634..933d39d 100644 --- a/Swiften/Client/StanzaChannel.h +++ b/Swiften/Client/StanzaChannel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -18,15 +18,15 @@ namespace Swift { class SWIFTEN_API StanzaChannel : public IQChannel { public: - virtual void sendMessage(boost::shared_ptr<Message>) = 0; - virtual void sendPresence(boost::shared_ptr<Presence>) = 0; + virtual void sendMessage(std::shared_ptr<Message>) = 0; + virtual void sendPresence(std::shared_ptr<Presence>) = 0; virtual bool isAvailable() const = 0; virtual bool getStreamManagementEnabled() const = 0; virtual std::vector<Certificate::ref> getPeerCertificateChain() const = 0; boost::signal<void (bool /* isAvailable */)> onAvailableChanged; - boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived; - boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived; - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked; + boost::signal<void (std::shared_ptr<Message>)> onMessageReceived; + boost::signal<void (std::shared_ptr<Presence>) > onPresenceReceived; + boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked; }; } diff --git a/Swiften/Client/UnitTest/BlockListImplTest.cpp b/Swiften/Client/UnitTest/BlockListImplTest.cpp index 0502f46..b2e45e2 100644 --- a/Swiften/Client/UnitTest/BlockListImplTest.cpp +++ b/Swiften/Client/UnitTest/BlockListImplTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -60,7 +60,7 @@ class BlockListImplTest : public CppUnit::TestFixture { } void setUp() { - blockList_ = boost::make_shared<BlockListImpl>(); + blockList_ = std::make_shared<BlockListImpl>(); addedJIDs_.clear(); removedJIDs_.clear(); blockList_->addItem(JID("a@example.com")); @@ -83,7 +83,7 @@ class BlockListImplTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<BlockListImpl> blockList_; + std::shared_ptr<BlockListImpl> blockList_; std::vector<JID> addedJIDs_; std::vector<JID> removedJIDs_; }; diff --git a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp index 2f33984..aaf99e0 100644 --- a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp +++ b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp @@ -61,7 +61,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { blockRequest->send(); IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2); CPPUNIT_ASSERT(request.get() != nullptr); - boost::shared_ptr<BlockPayload> blockPayload = request->getPayload<BlockPayload>(); + std::shared_ptr<BlockPayload> blockPayload = request->getPayload<BlockPayload>(); CPPUNIT_ASSERT(blockPayload.get() != nullptr); CPPUNIT_ASSERT_EQUAL(JID("romeo@montague.net"), blockPayload->getItems().at(0)); @@ -72,7 +72,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), clientBlockListManager_->getBlockList()->getItems().size()); // send block push - boost::shared_ptr<BlockPayload> pushPayload = boost::make_shared<BlockPayload>(); + std::shared_ptr<BlockPayload> pushPayload = std::make_shared<BlockPayload>(); pushPayload->addItem(JID("romeo@montague.net")); IQ::ref blockPush = IQ::createRequest(IQ::Set, ownJID_, "push1", pushPayload); stanzaChannel_->sendIQ(blockPush); @@ -95,7 +95,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { unblockRequest->send(); IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2); CPPUNIT_ASSERT(request.get() != nullptr); - boost::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>(); + std::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>(); CPPUNIT_ASSERT(unblockPayload.get() != nullptr); CPPUNIT_ASSERT_EQUAL(JID("romeo@montague.net"), unblockPayload->getItems().at(0)); @@ -106,7 +106,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), clientBlockListManager_->getBlockList()->getItems().size()); // send block push - boost::shared_ptr<UnblockPayload> pushPayload = boost::make_shared<UnblockPayload>(); + std::shared_ptr<UnblockPayload> pushPayload = std::make_shared<UnblockPayload>(); pushPayload->addItem(JID("romeo@montague.net")); IQ::ref unblockPush = IQ::createRequest(IQ::Set, ownJID_, "push1", pushPayload); stanzaChannel_->sendIQ(unblockPush); @@ -130,7 +130,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { unblockRequest->send(); IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2); CPPUNIT_ASSERT(request.get() != nullptr); - boost::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>(); + std::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>(); CPPUNIT_ASSERT(unblockPayload.get() != nullptr); CPPUNIT_ASSERT_EQUAL(true, unblockPayload->getItems().empty()); @@ -141,7 +141,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), clientBlockListManager_->getBlockList()->getItems().size()); // send block push - boost::shared_ptr<UnblockPayload> pushPayload = boost::make_shared<UnblockPayload>(); + std::shared_ptr<UnblockPayload> pushPayload = std::make_shared<UnblockPayload>(); IQ::ref unblockPush = IQ::createRequest(IQ::Set, ownJID_, "push1", pushPayload); stanzaChannel_->sendIQ(unblockPush); stanzaChannel_->onIQReceived(unblockPush); @@ -157,20 +157,20 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture { private: void helperInitialBlockListFetch(const std::vector<JID>& blockedJids) { - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList(); CPPUNIT_ASSERT(blockList); // check for IQ request IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(0); CPPUNIT_ASSERT(request.get() != nullptr); - boost::shared_ptr<BlockListPayload> requestPayload = request->getPayload<BlockListPayload>(); + std::shared_ptr<BlockListPayload> requestPayload = request->getPayload<BlockListPayload>(); CPPUNIT_ASSERT(requestPayload.get() != nullptr); CPPUNIT_ASSERT_EQUAL(BlockList::Requesting, blockList->getState()); CPPUNIT_ASSERT_EQUAL(BlockList::Requesting, clientBlockListManager_->getBlockList()->getState()); // build IQ response - boost::shared_ptr<BlockListPayload> responsePayload = boost::make_shared<BlockListPayload>(); + std::shared_ptr<BlockListPayload> responsePayload = std::make_shared<BlockListPayload>(); foreach(const JID& jid, blockedJids) { responsePayload->addItem(jid); } diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp index 335b537..bd93f4b 100644 --- a/Swiften/Client/UnitTest/ClientSessionTest.cpp +++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp @@ -5,10 +5,10 @@ */ #include <deque> +#include <memory> #include <boost/bind.hpp> #include <boost/optional.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -75,9 +75,9 @@ class ClientSessionTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); - idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); - server = boost::make_shared<MockSessionStream>(); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + idnConverter = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + server = std::make_shared<MockSessionStream>(); sessionFinishedReceived = false; needCredentials = false; blindCertificateTrustChecker = new BlindCertificateTrustChecker(); @@ -88,7 +88,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStart_Error() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->breakConnection(); @@ -98,7 +98,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStart_StreamError() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->sendStreamStart(); server->sendStreamError(); @@ -109,7 +109,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStartTLS() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->setCertificateTrustChecker(blindCertificateTrustChecker); session->start(); server->receiveStreamStart(); @@ -127,7 +127,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStartTLS_ServerError() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -142,7 +142,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStartTLS_ConnectError() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -157,7 +157,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStartTLS_InvalidIdentity() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -171,11 +171,11 @@ class ClientSessionTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(ClientSession::Finished, session->getState()); CPPUNIT_ASSERT(sessionFinishedReceived); CPPUNIT_ASSERT(sessionFinishedError); - CPPUNIT_ASSERT_EQUAL(CertificateVerificationError::InvalidServerIdentity, boost::dynamic_pointer_cast<CertificateVerificationError>(sessionFinishedError)->getType()); + CPPUNIT_ASSERT_EQUAL(CertificateVerificationError::InvalidServerIdentity, std::dynamic_pointer_cast<CertificateVerificationError>(sessionFinishedError)->getType()); } void testStart_StreamFeaturesWithoutResourceBindingFails() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -187,7 +187,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testAuthenticate() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -203,7 +203,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testAuthenticate_Unauthorized() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -220,7 +220,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testAuthenticate_PLAINOverNonTLS() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->setAllowPLAINOverNonTLS(false); session->start(); server->receiveStreamStart(); @@ -233,7 +233,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testAuthenticate_RequireTLS() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->setUseTLS(ClientSession::RequireTLS); session->setAllowPLAINOverNonTLS(true); session->start(); @@ -247,7 +247,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testAuthenticate_NoValidAuthMechanisms() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -259,7 +259,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testAuthenticate_EXTERNAL() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -272,7 +272,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testUnexpectedChallenge() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -287,7 +287,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStreamManagement() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -311,7 +311,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testStreamManagement_Failed() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -334,7 +334,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } void testFinishAcksStanzas() { - boost::shared_ptr<ClientSession> session(createSession()); + std::shared_ptr<ClientSession> session(createSession()); initializeSession(session); server->sendMessage(); server->sendMessage(); @@ -346,15 +346,15 @@ class ClientSessionTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<ClientSession> createSession() { - boost::shared_ptr<ClientSession> session = ClientSession::create(JID("me@foo.com"), server, idnConverter.get(), crypto.get()); + std::shared_ptr<ClientSession> createSession() { + std::shared_ptr<ClientSession> session = ClientSession::create(JID("me@foo.com"), server, idnConverter.get(), crypto.get()); session->onFinished.connect(boost::bind(&ClientSessionTest::handleSessionFinished, this, _1)); session->onNeedCredentials.connect(boost::bind(&ClientSessionTest::handleSessionNeedCredentials, this)); session->setAllowPLAINOverNonTLS(true); return session; } - void initializeSession(boost::shared_ptr<ClientSession> session) { + void initializeSession(std::shared_ptr<ClientSession> session) { session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -371,7 +371,7 @@ class ClientSessionTest : public CppUnit::TestFixture { server->sendStreamManagementEnabled(); } - void handleSessionFinished(boost::shared_ptr<Error> error) { + void handleSessionFinished(std::shared_ptr<Error> error) { sessionFinishedReceived = true; sessionFinishedError = error; } @@ -383,11 +383,11 @@ class ClientSessionTest : public CppUnit::TestFixture { class MockSessionStream : public SessionStream { public: struct Event { - Event(boost::shared_ptr<ToplevelElement> element) : element(element), footer(false) {} + Event(std::shared_ptr<ToplevelElement> element) : element(element), footer(false) {} Event(const ProtocolHeader& header) : header(header), footer(false) {} Event() : footer(true) {} - boost::shared_ptr<ToplevelElement> element; + std::shared_ptr<ToplevelElement> element; boost::optional<ProtocolHeader> header; bool footer; }; @@ -396,7 +396,7 @@ class ClientSessionTest : public CppUnit::TestFixture { } virtual void close() { - onClosed(boost::shared_ptr<Error>()); + onClosed(std::shared_ptr<Error>()); } virtual bool isOpen() { @@ -411,7 +411,7 @@ class ClientSessionTest : public CppUnit::TestFixture { receivedEvents.push_back(Event()); } - virtual void writeElement(boost::shared_ptr<ToplevelElement> element) { + virtual void writeElement(std::shared_ptr<ToplevelElement> element) { receivedEvents.push_back(Event(element)); } @@ -442,8 +442,8 @@ class ClientSessionTest : public CppUnit::TestFixture { return std::vector<Certificate::ref>(); } - virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const { - return boost::shared_ptr<CertificateVerificationError>(); + virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const { + return std::shared_ptr<CertificateVerificationError>(); } virtual bool supportsZLibCompression() { @@ -463,11 +463,11 @@ class ClientSessionTest : public CppUnit::TestFixture { } void breakConnection() { - onClosed(boost::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError)); + onClosed(std::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError)); } void breakTLS() { - onClosed(boost::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::TLSError)); + onClosed(std::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::TLSError)); } @@ -478,29 +478,29 @@ class ClientSessionTest : public CppUnit::TestFixture { } void sendStreamFeaturesWithStartTLS() { - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->setHasStartTLS(); onElementReceived(streamFeatures); } void sendChallenge() { - onElementReceived(boost::make_shared<AuthChallenge>()); + onElementReceived(std::make_shared<AuthChallenge>()); } void sendStreamError() { - onElementReceived(boost::make_shared<StreamError>()); + onElementReceived(std::make_shared<StreamError>()); } void sendTLSProceed() { - onElementReceived(boost::make_shared<TLSProceed>()); + onElementReceived(std::make_shared<TLSProceed>()); } void sendTLSFailure() { - onElementReceived(boost::make_shared<StartTLSFailure>()); + onElementReceived(std::make_shared<StartTLSFailure>()); } void sendStreamFeaturesWithMultipleAuthentication() { - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->addAuthenticationMechanism("PLAIN"); streamFeatures->addAuthenticationMechanism("DIGEST-MD5"); streamFeatures->addAuthenticationMechanism("SCRAM-SHA1"); @@ -508,59 +508,59 @@ class ClientSessionTest : public CppUnit::TestFixture { } void sendStreamFeaturesWithPLAINAuthentication() { - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->addAuthenticationMechanism("PLAIN"); onElementReceived(streamFeatures); } void sendStreamFeaturesWithEXTERNALAuthentication() { - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->addAuthenticationMechanism("EXTERNAL"); onElementReceived(streamFeatures); } void sendStreamFeaturesWithUnknownAuthentication() { - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->addAuthenticationMechanism("UNKNOWN"); onElementReceived(streamFeatures); } void sendStreamFeaturesWithBindAndStreamManagement() { - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->setHasResourceBind(); streamFeatures->setHasStreamManagement(); onElementReceived(streamFeatures); } void sendEmptyStreamFeatures() { - onElementReceived(boost::make_shared<StreamFeatures>()); + onElementReceived(std::make_shared<StreamFeatures>()); } void sendAuthSuccess() { - onElementReceived(boost::make_shared<AuthSuccess>()); + onElementReceived(std::make_shared<AuthSuccess>()); } void sendAuthFailure() { - onElementReceived(boost::make_shared<AuthFailure>()); + onElementReceived(std::make_shared<AuthFailure>()); } void sendStreamManagementEnabled() { - onElementReceived(boost::make_shared<StreamManagementEnabled>()); + onElementReceived(std::make_shared<StreamManagementEnabled>()); } void sendStreamManagementFailed() { - onElementReceived(boost::make_shared<StreamManagementFailed>()); + onElementReceived(std::make_shared<StreamManagementFailed>()); } void sendBindResult() { - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); + std::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); resourceBind->setJID(JID("foo@bar.com/bla")); - boost::shared_ptr<IQ> iq = IQ::createResult(JID("foo@bar.com"), bindID, resourceBind); + std::shared_ptr<IQ> iq = IQ::createResult(JID("foo@bar.com"), bindID, resourceBind); onElementReceived(iq); } void sendMessage() { - boost::shared_ptr<Message> message = boost::make_shared<Message>(); + std::shared_ptr<Message> message = std::make_shared<Message>(); message->setTo(JID("foo@bar.com/bla")); onElementReceived(message); } @@ -573,13 +573,13 @@ class ClientSessionTest : public CppUnit::TestFixture { void receiveStartTLS() { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<StartTLSRequest>(event.element)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<StartTLSRequest>(event.element)); } void receiveAuthRequest(const std::string& mech) { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - boost::shared_ptr<AuthRequest> request(boost::dynamic_pointer_cast<AuthRequest>(event.element)); + std::shared_ptr<AuthRequest> request(std::dynamic_pointer_cast<AuthRequest>(event.element)); CPPUNIT_ASSERT(request); CPPUNIT_ASSERT_EQUAL(mech, request->getMechanism()); } @@ -587,13 +587,13 @@ class ClientSessionTest : public CppUnit::TestFixture { void receiveStreamManagementEnable() { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<EnableStreamManagement>(event.element)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<EnableStreamManagement>(event.element)); } void receiveBind() { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(event.element); + std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(event.element); CPPUNIT_ASSERT(iq); CPPUNIT_ASSERT(iq->getPayload<ResourceBind>()); bindID = iq->getID(); @@ -602,7 +602,7 @@ class ClientSessionTest : public CppUnit::TestFixture { void receiveAck(unsigned int n) { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - boost::shared_ptr<StanzaAck> ack = boost::dynamic_pointer_cast<StanzaAck>(event.element); + std::shared_ptr<StanzaAck> ack = std::dynamic_pointer_cast<StanzaAck>(event.element); CPPUNIT_ASSERT(ack); CPPUNIT_ASSERT_EQUAL(n, ack->getHandledStanzasCount()); } @@ -624,20 +624,20 @@ class ClientSessionTest : public CppUnit::TestFixture { std::deque<Event> receivedEvents; }; - boost::shared_ptr<IDNConverter> idnConverter; - boost::shared_ptr<MockSessionStream> server; + std::shared_ptr<IDNConverter> idnConverter; + std::shared_ptr<MockSessionStream> server; bool sessionFinishedReceived; bool needCredentials; - boost::shared_ptr<Error> sessionFinishedError; + std::shared_ptr<Error> sessionFinishedError; BlindCertificateTrustChecker* blindCertificateTrustChecker; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); #if 0 void testAuthenticate() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); session->onNeedCredentials.connect(boost::bind(&ClientSessionTest::setNeedCredentials, this)); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); @@ -658,7 +658,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testAuthenticate_Unauthorized() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithAuthentication(); @@ -675,7 +675,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testAuthenticate_NoValidAuthMechanisms() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithUnsupportedAuthentication(); @@ -687,7 +687,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testResourceBind() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithResourceBind(); @@ -703,7 +703,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testResourceBind_ChangeResource() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithResourceBind(); @@ -717,7 +717,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testResourceBind_EmptyResource() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com")); + std::shared_ptr<MockSession> session(createSession("me@foo.com")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithResourceBind(); @@ -731,7 +731,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testResourceBind_Error() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com")); + std::shared_ptr<MockSession> session(createSession("me@foo.com")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithResourceBind(); @@ -745,7 +745,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testSessionStart() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); session->onSessionStarted.connect(boost::bind(&ClientSessionTest::setSessionStarted, this)); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); @@ -761,7 +761,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testSessionStart_Error() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeaturesWithSession(); @@ -775,7 +775,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testSessionStart_AfterResourceBind() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); session->onSessionStarted.connect(boost::bind(&ClientSessionTest::setSessionStarted, this)); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); @@ -792,7 +792,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testWhitespacePing() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeatures(); @@ -802,7 +802,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); } void testReceiveElementAfterSessionStarted() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); getMockServer()->sendStreamFeatures(); @@ -810,11 +810,11 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); processEvents(); getMockServer()->expectMessage(); - session->sendElement(boost::make_shared<Message>())); + session->sendElement(std::make_shared<Message>())); } void testSendElement() { - boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); + std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar")); session->onElementReceived.connect(boost::bind(&ClientSessionTest::addReceivedElement, this, _1)); getMockServer()->expectStreamStart(); getMockServer()->sendStreamStart(); @@ -824,6 +824,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest); processEvents(); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(receivedElements_.size())); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<Message>(receivedElements_[0])); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<Message>(receivedElements_[0])); } #endif diff --git a/Swiften/Client/UnitTest/NickResolverTest.cpp b/Swiften/Client/UnitTest/NickResolverTest.cpp index 855b15a..2846173 100644 --- a/Swiften/Client/UnitTest/NickResolverTest.cpp +++ b/Swiften/Client/UnitTest/NickResolverTest.cpp @@ -36,7 +36,7 @@ class NickResolverTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); ownJID_ = JID("kev@wonderland.lit"); xmppRoster_ = new XMPPRosterImpl(); stanzaChannel_ = new DummyStanzaChannel(); @@ -147,7 +147,7 @@ class NickResolverTest : public CppUnit::TestFixture { MUCRegistry* registry_; NickResolver* resolver_; JID ownJID_; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(NickResolverTest); diff --git a/Swiften/Component/ComponentConnector.cpp b/Swiften/Component/ComponentConnector.cpp index 410c19e..632eb84 100644 --- a/Swiften/Component/ComponentConnector.cpp +++ b/Swiften/Component/ComponentConnector.cpp @@ -39,14 +39,14 @@ void ComponentConnector::start() { } void ComponentConnector::stop() { - finish(boost::shared_ptr<Connection>()); + finish(std::shared_ptr<Connection>()); } void ComponentConnector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) { addressQuery.reset(); if (error || addresses.empty()) { - finish(boost::shared_ptr<Connection>()); + finish(std::shared_ptr<Connection>()); } else { addressQueryResults = std::deque<HostAddress>(addresses.begin(), addresses.end()); @@ -76,7 +76,7 @@ void ComponentConnector::handleConnectionConnectFinished(bool error) { tryNextAddress(); } else { - finish(boost::shared_ptr<Connection>()); + finish(std::shared_ptr<Connection>()); } } else { @@ -84,7 +84,7 @@ void ComponentConnector::handleConnectionConnectFinished(bool error) { } } -void ComponentConnector::finish(boost::shared_ptr<Connection> connection) { +void ComponentConnector::finish(std::shared_ptr<Connection> connection) { if (timer) { timer->stop(); timer->onTick.disconnect(boost::bind(&ComponentConnector::handleTimeout, shared_from_this())); @@ -102,7 +102,7 @@ void ComponentConnector::finish(boost::shared_ptr<Connection> connection) { } void ComponentConnector::handleTimeout() { - finish(boost::shared_ptr<Connection>()); + finish(std::shared_ptr<Connection>()); } } diff --git a/Swiften/Component/ComponentConnector.h b/Swiften/Component/ComponentConnector.h index 68cb0d7..831851a 100644 --- a/Swiften/Component/ComponentConnector.h +++ b/Swiften/Component/ComponentConnector.h @@ -7,10 +7,9 @@ #pragma once #include <deque> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Network/Connection.h> @@ -24,9 +23,9 @@ namespace Swift { class ConnectionFactory; class TimerFactory; - class SWIFTEN_API ComponentConnector : public boost::bsignals::trackable, public boost::enable_shared_from_this<ComponentConnector> { + class SWIFTEN_API ComponentConnector : public boost::bsignals::trackable, public std::enable_shared_from_this<ComponentConnector> { public: - typedef boost::shared_ptr<ComponentConnector> ref; + typedef std::shared_ptr<ComponentConnector> ref; static ComponentConnector::ref create(const std::string& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) { return ref(new ComponentConnector(hostname, port, resolver, connectionFactory, timerFactory)); @@ -37,7 +36,7 @@ namespace Swift { void start(); void stop(); - boost::signal<void (boost::shared_ptr<Connection>)> onConnectFinished; + boost::signal<void (std::shared_ptr<Connection>)> onConnectFinished; private: ComponentConnector(const std::string& hostname, int port, DomainNameResolver*, ConnectionFactory*, TimerFactory*); @@ -47,7 +46,7 @@ namespace Swift { void tryConnect(const HostAddressPort& target); void handleConnectionConnectFinished(bool error); - void finish(boost::shared_ptr<Connection>); + void finish(std::shared_ptr<Connection>); void handleTimeout(); @@ -58,9 +57,9 @@ namespace Swift { ConnectionFactory* connectionFactory; TimerFactory* timerFactory; int timeoutMilliseconds; - boost::shared_ptr<Timer> timer; - boost::shared_ptr<DomainNameAddressQuery> addressQuery; + std::shared_ptr<Timer> timer; + std::shared_ptr<DomainNameAddressQuery> addressQuery; std::deque<HostAddress> addressQueryResults; - boost::shared_ptr<Connection> currentConnection; + std::shared_ptr<Connection> currentConnection; }; } diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp index 46c88db..0805ac1 100644 --- a/Swiften/Component/ComponentSession.cpp +++ b/Swiften/Component/ComponentSession.cpp @@ -6,8 +6,9 @@ #include <Swiften/Component/ComponentSession.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Component/ComponentHandshakeGenerator.h> #include <Swiften/Elements/ComponentHandshake.h> @@ -17,7 +18,7 @@ namespace Swift { -ComponentSession::ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream, CryptoProvider* crypto) : jid(jid), secret(secret), stream(stream), crypto(crypto), state(Initial) { +ComponentSession::ComponentSession(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream> stream, CryptoProvider* crypto) : jid(jid), secret(secret), stream(stream), crypto(crypto), state(Initial) { } ComponentSession::~ComponentSession() { @@ -39,7 +40,7 @@ void ComponentSession::sendStreamHeader() { stream->writeHeader(header); } -void ComponentSession::sendStanza(boost::shared_ptr<Stanza> stanza) { +void ComponentSession::sendStanza(std::shared_ptr<Stanza> stanza) { stream->writeElement(stanza); } @@ -49,8 +50,8 @@ void ComponentSession::handleStreamStart(const ProtocolHeader& header) { stream->writeElement(ComponentHandshake::ref(new ComponentHandshake(ComponentHandshakeGenerator::getHandshake(header.getID(), secret, crypto)))); } -void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element) { - if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) { +void ComponentSession::handleElement(std::shared_ptr<ToplevelElement> element) { + if (std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element)) { if (getState() == Initialized) { onStanzaReceived(stanza); } @@ -58,7 +59,7 @@ void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element) finishSession(Error::UnexpectedElementError); } } - else if (boost::dynamic_pointer_cast<ComponentHandshake>(element)) { + else if (std::dynamic_pointer_cast<ComponentHandshake>(element)) { if (!checkState(Authenticating)) { return; } @@ -67,7 +68,7 @@ void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element) onInitialized(); } else if (getState() == Authenticating) { - if (boost::dynamic_pointer_cast<StreamFeatures>(element)) { + if (std::dynamic_pointer_cast<StreamFeatures>(element)) { // M-Link sends stream features, so swallow that. } else { @@ -88,7 +89,7 @@ bool ComponentSession::checkState(State state) { return true; } -void ComponentSession::handleStreamClosed(boost::shared_ptr<Swift::Error> streamError) { +void ComponentSession::handleStreamClosed(std::shared_ptr<Swift::Error> streamError) { State oldState = state; state = Finished; stream->setWhitespacePingEnabled(false); @@ -104,14 +105,14 @@ void ComponentSession::handleStreamClosed(boost::shared_ptr<Swift::Error> stream } void ComponentSession::finish() { - finishSession(boost::shared_ptr<Error>()); + finishSession(std::shared_ptr<Error>()); } void ComponentSession::finishSession(Error::Type error) { - finishSession(boost::make_shared<Swift::ComponentSession::Error>(error)); + finishSession(std::make_shared<Swift::ComponentSession::Error>(error)); } -void ComponentSession::finishSession(boost::shared_ptr<Swift::Error> finishError) { +void ComponentSession::finishSession(std::shared_ptr<Swift::Error> finishError) { state = Finishing; error = finishError; assert(stream->isOpen()); diff --git a/Swiften/Component/ComponentSession.h b/Swiften/Component/ComponentSession.h index 608bb79..97f5378 100644 --- a/Swiften/Component/ComponentSession.h +++ b/Swiften/Component/ComponentSession.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/boost_bsignals.h> @@ -23,7 +21,7 @@ namespace Swift { class ComponentAuthenticator; class CryptoProvider; - class SWIFTEN_API ComponentSession : public boost::enable_shared_from_this<ComponentSession> { + class SWIFTEN_API ComponentSession : public std::enable_shared_from_this<ComponentSession> { public: enum State { Initial, @@ -44,8 +42,8 @@ namespace Swift { ~ComponentSession(); - static boost::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream, CryptoProvider* crypto) { - return boost::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream, crypto)); + static std::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream> stream, CryptoProvider* crypto) { + return std::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream, crypto)); } State getState() const { @@ -55,33 +53,33 @@ namespace Swift { void start(); void finish(); - void sendStanza(boost::shared_ptr<Stanza>); + void sendStanza(std::shared_ptr<Stanza>); public: boost::signal<void ()> onInitialized; - boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished; - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived; + boost::signal<void (std::shared_ptr<Swift::Error>)> onFinished; + boost::signal<void (std::shared_ptr<Stanza>)> onStanzaReceived; private: - ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream>, CryptoProvider*); + ComponentSession(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream>, CryptoProvider*); void finishSession(Error::Type error); - void finishSession(boost::shared_ptr<Swift::Error> error); + void finishSession(std::shared_ptr<Swift::Error> error); void sendStreamHeader(); - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); - void handleStreamClosed(boost::shared_ptr<Swift::Error>); + void handleStreamClosed(std::shared_ptr<Swift::Error>); bool checkState(State); private: JID jid; std::string secret; - boost::shared_ptr<SessionStream> stream; + std::shared_ptr<SessionStream> stream; CryptoProvider* crypto; - boost::shared_ptr<Swift::Error> error; + std::shared_ptr<Swift::Error> error; State state; }; } diff --git a/Swiften/Component/ComponentSessionStanzaChannel.cpp b/Swiften/Component/ComponentSessionStanzaChannel.cpp index ffb1f13..282d9f1 100644 --- a/Swiften/Component/ComponentSessionStanzaChannel.cpp +++ b/Swiften/Component/ComponentSessionStanzaChannel.cpp @@ -12,7 +12,7 @@ namespace Swift { -void ComponentSessionStanzaChannel::setSession(boost::shared_ptr<ComponentSession> session) { +void ComponentSessionStanzaChannel::setSession(std::shared_ptr<ComponentSession> session) { assert(!this->session); this->session = session; session->onInitialized.connect(boost::bind(&ComponentSessionStanzaChannel::handleSessionInitialized, this)); @@ -20,15 +20,15 @@ void ComponentSessionStanzaChannel::setSession(boost::shared_ptr<ComponentSessio session->onStanzaReceived.connect(boost::bind(&ComponentSessionStanzaChannel::handleStanza, this, _1)); } -void ComponentSessionStanzaChannel::sendIQ(boost::shared_ptr<IQ> iq) { +void ComponentSessionStanzaChannel::sendIQ(std::shared_ptr<IQ> iq) { send(iq); } -void ComponentSessionStanzaChannel::sendMessage(boost::shared_ptr<Message> message) { +void ComponentSessionStanzaChannel::sendMessage(std::shared_ptr<Message> message) { send(message); } -void ComponentSessionStanzaChannel::sendPresence(boost::shared_ptr<Presence> presence) { +void ComponentSessionStanzaChannel::sendPresence(std::shared_ptr<Presence> presence) { send(presence); } @@ -36,7 +36,7 @@ std::string ComponentSessionStanzaChannel::getNewIQID() { return idGenerator.generateID(); } -void ComponentSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { +void ComponentSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) { if (!isAvailable()) { std::cerr << "Warning: Component: Trying to send a stanza while disconnected." << std::endl; return; @@ -44,7 +44,7 @@ void ComponentSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { session->sendStanza(stanza); } -void ComponentSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Error>) { +void ComponentSessionStanzaChannel::handleSessionFinished(std::shared_ptr<Error>) { session->onFinished.disconnect(boost::bind(&ComponentSessionStanzaChannel::handleSessionFinished, this, _1)); session->onStanzaReceived.disconnect(boost::bind(&ComponentSessionStanzaChannel::handleStanza, this, _1)); session->onInitialized.disconnect(boost::bind(&ComponentSessionStanzaChannel::handleSessionInitialized, this)); @@ -53,20 +53,20 @@ void ComponentSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Erro onAvailableChanged(false); } -void ComponentSessionStanzaChannel::handleStanza(boost::shared_ptr<Stanza> stanza) { - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(stanza); +void ComponentSessionStanzaChannel::handleStanza(std::shared_ptr<Stanza> stanza) { + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(stanza); if (message) { onMessageReceived(message); return; } - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(stanza); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(stanza); if (presence) { onPresenceReceived(presence); return; } - boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(stanza); + std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(stanza); if (iq) { onIQReceived(iq); return; diff --git a/Swiften/Component/ComponentSessionStanzaChannel.h b/Swiften/Component/ComponentSessionStanzaChannel.h index 31931ea..ad38edc 100644 --- a/Swiften/Component/ComponentSessionStanzaChannel.h +++ b/Swiften/Component/ComponentSessionStanzaChannel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/IDGenerator.h> @@ -22,11 +22,11 @@ namespace Swift { */ class SWIFTEN_API ComponentSessionStanzaChannel : public StanzaChannel { public: - void setSession(boost::shared_ptr<ComponentSession> session); + void setSession(std::shared_ptr<ComponentSession> session); - void sendIQ(boost::shared_ptr<IQ> iq); - void sendMessage(boost::shared_ptr<Message> message); - void sendPresence(boost::shared_ptr<Presence> presence); + void sendIQ(std::shared_ptr<IQ> iq); + void sendMessage(std::shared_ptr<Message> message); + void sendPresence(std::shared_ptr<Presence> presence); bool getStreamManagementEnabled() const { return false; @@ -43,14 +43,14 @@ namespace Swift { private: std::string getNewIQID(); - void send(boost::shared_ptr<Stanza> stanza); - void handleSessionFinished(boost::shared_ptr<Error> error); - void handleStanza(boost::shared_ptr<Stanza> stanza); + void send(std::shared_ptr<Stanza> stanza); + void handleSessionFinished(std::shared_ptr<Error> error); + void handleStanza(std::shared_ptr<Stanza> stanza); void handleSessionInitialized(); private: IDGenerator idGenerator; - boost::shared_ptr<ComponentSession> session; + std::shared_ptr<ComponentSession> session; }; } diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp index ac4f14e..dfa0896 100644 --- a/Swiften/Component/CoreComponent.cpp +++ b/Swiften/Component/CoreComponent.cpp @@ -52,7 +52,7 @@ void CoreComponent::connect(const std::string& host, int port) { connector_->start(); } -void CoreComponent::handleConnectorFinished(boost::shared_ptr<Connection> connection) { +void CoreComponent::handleConnectorFinished(std::shared_ptr<Connection> connection) { connector_->onConnectFinished.disconnect(boost::bind(&CoreComponent::handleConnectorFinished, this, _1)); connector_.reset(); if (!connection) { @@ -65,7 +65,7 @@ void CoreComponent::handleConnectorFinished(boost::shared_ptr<Connection> connec connection_ = connection; assert(!sessionStream_); - sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), nullptr, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions())); + sessionStream_ = std::make_shared<BasicSessionStream>(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), nullptr, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions()); sessionStream_->onDataRead.connect(boost::bind(&CoreComponent::handleDataRead, this, _1)); sessionStream_->onDataWritten.connect(boost::bind(&CoreComponent::handleDataWritten, this, _1)); @@ -93,7 +93,7 @@ void CoreComponent::disconnect() { disconnectRequested_ = false; } -void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) { +void CoreComponent::handleSessionFinished(std::shared_ptr<Error> error) { session_->onFinished.disconnect(boost::bind(&CoreComponent::handleSessionFinished, this, _1)); session_.reset(); @@ -106,7 +106,7 @@ void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) { if (error) { ComponentError componentError; - if (boost::shared_ptr<ComponentSession::Error> actualError = boost::dynamic_pointer_cast<ComponentSession::Error>(error)) { + if (std::shared_ptr<ComponentSession::Error> actualError = std::dynamic_pointer_cast<ComponentSession::Error>(error)) { switch(actualError->type) { case ComponentSession::Error::AuthenticationFailedError: componentError = ComponentError(ComponentError::AuthenticationFailedError); @@ -116,7 +116,7 @@ void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) { break; } } - else if (boost::shared_ptr<SessionStream::SessionStreamError> actualError = boost::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) { + else if (std::shared_ptr<SessionStream::SessionStreamError> actualError = std::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) { switch(actualError->type) { case SessionStream::SessionStreamError::ParseError: componentError = ComponentError(ComponentError::XMLError); @@ -155,11 +155,11 @@ void CoreComponent::handleStanzaChannelAvailableChanged(bool available) { } } -void CoreComponent::sendMessage(boost::shared_ptr<Message> message) { +void CoreComponent::sendMessage(std::shared_ptr<Message> message) { stanzaChannel_->sendMessage(message); } -void CoreComponent::sendPresence(boost::shared_ptr<Presence> presence) { +void CoreComponent::sendPresence(std::shared_ptr<Presence> presence) { stanzaChannel_->sendPresence(presence); } diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h index ff88173..3368671 100644 --- a/Swiften/Component/CoreComponent.h +++ b/Swiften/Component/CoreComponent.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/SafeByteArray.h> @@ -50,8 +49,8 @@ namespace Swift { void connect(const std::string& host, int port); void disconnect(); - void sendMessage(boost::shared_ptr<Message>); - void sendPresence(boost::shared_ptr<Presence>); + void sendMessage(std::shared_ptr<Message>); + void sendPresence(std::shared_ptr<Presence>); void sendData(const std::string& data); IQRouter* getIQRouter() const { @@ -79,13 +78,13 @@ namespace Swift { boost::signal<void (const SafeByteArray&)> onDataRead; boost::signal<void (const SafeByteArray&)> onDataWritten; - boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived; - boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived; + boost::signal<void (std::shared_ptr<Message>)> onMessageReceived; + boost::signal<void (std::shared_ptr<Presence>) > onPresenceReceived; private: - void handleConnectorFinished(boost::shared_ptr<Connection>); + void handleConnectorFinished(std::shared_ptr<Connection>); void handleStanzaChannelAvailableChanged(bool available); - void handleSessionFinished(boost::shared_ptr<Error>); + void handleSessionFinished(std::shared_ptr<Error>); void handleDataRead(const SafeByteArray&); void handleDataWritten(const SafeByteArray&); @@ -96,9 +95,9 @@ namespace Swift { ComponentSessionStanzaChannel* stanzaChannel_; IQRouter* iqRouter_; ComponentConnector::ref connector_; - boost::shared_ptr<Connection> connection_; - boost::shared_ptr<BasicSessionStream> sessionStream_; - boost::shared_ptr<ComponentSession> session_; + std::shared_ptr<Connection> connection_; + std::shared_ptr<BasicSessionStream> sessionStream_; + std::shared_ptr<ComponentSession> session_; bool disconnectRequested_; }; } diff --git a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp index 04a6a9e..3515a0a 100644 --- a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp +++ b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -152,8 +152,8 @@ class ComponentConnectorTest : public CppUnit::TestFixture { return connector; } - void handleConnectorFinished(boost::shared_ptr<Connection> connection) { - boost::shared_ptr<MockConnection> c(boost::dynamic_pointer_cast<MockConnection>(connection)); + void handleConnectorFinished(std::shared_ptr<Connection> connection) { + std::shared_ptr<MockConnection> c(std::dynamic_pointer_cast<MockConnection>(connection)); if (connection) { assert(c); } @@ -188,8 +188,8 @@ class ComponentConnectorTest : public CppUnit::TestFixture { MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop), isResponsive(true) { } - boost::shared_ptr<Connection> createConnection() { - return boost::shared_ptr<Connection>(new MockConnection(failingPorts, isResponsive, eventLoop)); + std::shared_ptr<Connection> createConnection() { + return std::make_shared<MockConnection>(failingPorts, isResponsive, eventLoop); } EventLoop* eventLoop; @@ -204,7 +204,7 @@ class ComponentConnectorTest : public CppUnit::TestFixture { StaticDomainNameResolver* resolver; MockConnectionFactory* connectionFactory; DummyTimerFactory* timerFactory; - std::vector< boost::shared_ptr<MockConnection> > connections; + std::vector< std::shared_ptr<MockConnection> > connections; }; CPPUNIT_TEST_SUITE_REGISTRATION(ComponentConnectorTest); diff --git a/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp b/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp index 82f43f6..ce8eaa4 100644 --- a/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp +++ b/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ class ComponentHandshakeGeneratorTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); } void testGetHandshake() { @@ -35,7 +35,7 @@ class ComponentHandshakeGeneratorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(ComponentHandshakeGeneratorTest); diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index 1726794..63c89dc 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -30,13 +30,13 @@ class ComponentSessionTest : public CppUnit::TestFixture { public: void setUp() { - server = boost::make_shared<MockSessionStream>(); + server = std::make_shared<MockSessionStream>(); sessionFinishedReceived = false; - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); } void testStart() { - boost::shared_ptr<ComponentSession> session(createSession()); + std::shared_ptr<ComponentSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -51,7 +51,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { } void testStart_Error() { - boost::shared_ptr<ComponentSession> session(createSession()); + std::shared_ptr<ComponentSession> session(createSession()); session->start(); server->breakConnection(); @@ -61,7 +61,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { } void testStart_Unauthorized() { - boost::shared_ptr<ComponentSession> session(createSession()); + std::shared_ptr<ComponentSession> session(createSession()); session->start(); server->receiveStreamStart(); server->sendStreamStart(); @@ -74,13 +74,13 @@ class ComponentSessionTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<ComponentSession> createSession() { - boost::shared_ptr<ComponentSession> session = ComponentSession::create(JID("service.foo.com"), "servicesecret", server, crypto.get()); + std::shared_ptr<ComponentSession> createSession() { + std::shared_ptr<ComponentSession> session = ComponentSession::create(JID("service.foo.com"), "servicesecret", server, crypto.get()); session->onFinished.connect(boost::bind(&ComponentSessionTest::handleSessionFinished, this, _1)); return session; } - void handleSessionFinished(boost::shared_ptr<Error> error) { + void handleSessionFinished(std::shared_ptr<Error> error) { sessionFinishedReceived = true; sessionFinishedError = error; } @@ -88,11 +88,11 @@ class ComponentSessionTest : public CppUnit::TestFixture { class MockSessionStream : public SessionStream { public: struct Event { - Event(boost::shared_ptr<ToplevelElement> element) : element(element), footer(false) {} + Event(std::shared_ptr<ToplevelElement> element) : element(element), footer(false) {} Event(const ProtocolHeader& header) : header(header), footer(false) {} Event() : footer(true) {} - boost::shared_ptr<ToplevelElement> element; + std::shared_ptr<ToplevelElement> element; boost::optional<ProtocolHeader> header; bool footer; }; @@ -101,7 +101,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { } virtual void close() { - onClosed(boost::shared_ptr<Error>()); + onClosed(std::shared_ptr<Error>()); } virtual bool isOpen() { @@ -116,7 +116,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { receivedEvents.push_back(Event()); } - virtual void writeElement(boost::shared_ptr<ToplevelElement> element) { + virtual void writeElement(std::shared_ptr<ToplevelElement> element) { receivedEvents.push_back(Event(element)); } @@ -147,8 +147,8 @@ class ComponentSessionTest : public CppUnit::TestFixture { return std::vector<Certificate::ref>(); } - virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const { - return boost::shared_ptr<CertificateVerificationError>(); + virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const { + return std::shared_ptr<CertificateVerificationError>(); } virtual bool supportsZLibCompression() { @@ -168,7 +168,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { } void breakConnection() { - onClosed(boost::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError)); + onClosed(std::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError)); } void sendStreamStart() { @@ -194,7 +194,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { void receiveHandshake() { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - ComponentHandshake::ref handshake(boost::dynamic_pointer_cast<ComponentHandshake>(event.element)); + ComponentHandshake::ref handshake(std::dynamic_pointer_cast<ComponentHandshake>(event.element)); CPPUNIT_ASSERT(handshake); CPPUNIT_ASSERT_EQUAL(std::string("4c4f8a41141722c8bbfbdd92d827f7b2fc0a542b"), handshake->getData()); } @@ -213,10 +213,10 @@ class ComponentSessionTest : public CppUnit::TestFixture { std::deque<Event> receivedEvents; }; - boost::shared_ptr<MockSessionStream> server; + std::shared_ptr<MockSessionStream> server; bool sessionFinishedReceived; - boost::shared_ptr<Error> sessionFinishedError; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<Error> sessionFinishedError; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(ComponentSessionTest); diff --git a/Swiften/Compress/ZLibCodecompressor.cpp b/Swiften/Compress/ZLibCodecompressor.cpp index fd6d3b0..a9929a8 100644 --- a/Swiften/Compress/ZLibCodecompressor.cpp +++ b/Swiften/Compress/ZLibCodecompressor.cpp @@ -22,7 +22,7 @@ namespace Swift { static const size_t CHUNK_SIZE = 1024; // If you change this, also change the unittest -ZLibCodecompressor::ZLibCodecompressor() : p(boost::make_shared<Private>()) { +ZLibCodecompressor::ZLibCodecompressor() : p(std::make_shared<Private>()) { memset(&p->stream, 0, sizeof(z_stream)); p->stream.zalloc = Z_NULL; p->stream.zfree = Z_NULL; diff --git a/Swiften/Compress/ZLibCodecompressor.h b/Swiften/Compress/ZLibCodecompressor.h index 253c34a..641b7a3 100644 --- a/Swiften/Compress/ZLibCodecompressor.h +++ b/Swiften/Compress/ZLibCodecompressor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,6 +20,6 @@ namespace Swift { protected: struct Private; - boost::shared_ptr<Private> p; + std::shared_ptr<Private> p; }; } diff --git a/Swiften/Crypto/CryptoProvider.cpp b/Swiften/Crypto/CryptoProvider.cpp index 04b0b16..9c7c637 100644 --- a/Swiften/Crypto/CryptoProvider.cpp +++ b/Swiften/Crypto/CryptoProvider.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Crypto/CryptoProvider.h> -#include <boost/shared_ptr.hpp> +#include <memory> using namespace Swift; diff --git a/Swiften/Crypto/CryptoProvider.h b/Swiften/Crypto/CryptoProvider.h index a86468c..3eaeeb3 100644 --- a/Swiften/Crypto/CryptoProvider.h +++ b/Swiften/Crypto/CryptoProvider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,11 +26,11 @@ namespace Swift { // Convenience template<typename T> ByteArray getSHA1Hash(const T& data) { - return boost::shared_ptr<Hash>(createSHA1())->update(data).getHash(); + return std::shared_ptr<Hash>(createSHA1())->update(data).getHash(); } template<typename T> ByteArray getMD5Hash(const T& data) { - return boost::shared_ptr<Hash>(createMD5())->update(data).getHash(); + return std::shared_ptr<Hash>(createMD5())->update(data).getHash(); } }; } diff --git a/Swiften/Crypto/UnitTest/CryptoProviderTest.cpp b/Swiften/Crypto/UnitTest/CryptoProviderTest.cpp index d37e776..72eb81d 100644 --- a/Swiften/Crypto/UnitTest/CryptoProviderTest.cpp +++ b/Swiften/Crypto/UnitTest/CryptoProviderTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -58,14 +58,14 @@ class CryptoProviderTest : public CppUnit::TestFixture { //////////////////////////////////////////////////////////// void testGetSHA1Hash() { - boost::shared_ptr<Hash> sha = boost::shared_ptr<Hash>(provider->createSHA1()); + std::shared_ptr<Hash> sha = std::shared_ptr<Hash>(provider->createSHA1()); sha->update(createByteArray("client/pc//Exodus 0.9.1<http://jabber.org/protocol/caps<http://jabber.org/protocol/disco#info<http://jabber.org/protocol/disco#items<http://jabber.org/protocol/muc<")); CPPUNIT_ASSERT_EQUAL(createByteArray("\x42\x06\xb2\x3c\xa6\xb0\xa6\x43\xd2\x0d\x89\xb0\x4f\xf5\x8c\xf7\x8b\x80\x96\xed"), sha->getHash()); } void testGetSHA1Hash_TwoUpdates() { - boost::shared_ptr<Hash> sha = boost::shared_ptr<Hash>(provider->createSHA1()); + std::shared_ptr<Hash> sha = std::shared_ptr<Hash>(provider->createSHA1()); sha->update(createByteArray("client/pc//Exodus 0.9.1<http://jabber.org/protocol/caps<")); sha->update(createByteArray("http://jabber.org/protocol/disco#info<http://jabber.org/protocol/disco#items<http://jabber.org/protocol/muc<")); @@ -73,7 +73,7 @@ class CryptoProviderTest : public CppUnit::TestFixture { } void testGetSHA1Hash_NoData() { - boost::shared_ptr<Hash> sha = boost::shared_ptr<Hash>(provider->createSHA1()); + std::shared_ptr<Hash> sha = std::shared_ptr<Hash>(provider->createSHA1()); sha->update(std::vector<unsigned char>()); CPPUNIT_ASSERT_EQUAL(createByteArray("\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09"), sha->getHash()); @@ -117,7 +117,7 @@ class CryptoProviderTest : public CppUnit::TestFixture { } void testMD5Incremental() { - boost::shared_ptr<Hash> testling = boost::shared_ptr<Hash>(provider->createMD5()); + std::shared_ptr<Hash> testling = std::shared_ptr<Hash>(provider->createMD5()); testling->update(createByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); testling->update(createByteArray("abcdefghijklmnopqrstuvwxyz0123456789")); diff --git a/Swiften/Crypto/WindowsCryptoProvider.cpp b/Swiften/Crypto/WindowsCryptoProvider.cpp index e0410c6..61ac03e 100644 --- a/Swiften/Crypto/WindowsCryptoProvider.cpp +++ b/Swiften/Crypto/WindowsCryptoProvider.cpp @@ -17,7 +17,7 @@ #include <security.h> #include <Wincrypt.h> #include <cassert> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Crypto/Hash.h> #include <Swiften/Base/ByteArray.h> @@ -191,7 +191,7 @@ namespace { } WindowsCryptoProvider::WindowsCryptoProvider() { - p = boost::make_shared<Private>(); + p = std::make_shared<Private>(); if (!CryptAcquireContext(&p->context, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { assert(false); } diff --git a/Swiften/Crypto/WindowsCryptoProvider.h b/Swiften/Crypto/WindowsCryptoProvider.h index 4c998d2..ddf7ffa 100644 --- a/Swiften/Crypto/WindowsCryptoProvider.h +++ b/Swiften/Crypto/WindowsCryptoProvider.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/Override.h> #include <Swiften/Crypto/CryptoProvider.h> @@ -26,6 +27,6 @@ namespace Swift { private: struct Private; - boost::shared_ptr<Private> p; + std::shared_ptr<Private> p; }; } diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp index 139ee6c..337bad6 100644 --- a/Swiften/Disco/CapsManager.cpp +++ b/Swiften/Disco/CapsManager.cpp @@ -23,8 +23,8 @@ CapsManager::CapsManager(CapsStorage* capsStorage, StanzaChannel* stanzaChannel, stanzaChannel->onAvailableChanged.connect(boost::bind(&CapsManager::handleStanzaChannelAvailableChanged, this, _1)); } -void CapsManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) { - boost::shared_ptr<CapsInfo> capsInfo = presence->getPayload<CapsInfo>(); +void CapsManager::handlePresenceReceived(std::shared_ptr<Presence> presence) { + std::shared_ptr<CapsInfo> capsInfo = presence->getPayload<CapsInfo>(); if (!capsInfo || capsInfo->getHash() != "sha-1" || presence->getPayload<ErrorPayload>()) { return; } diff --git a/Swiften/Disco/CapsManager.h b/Swiften/Disco/CapsManager.h index c96db13..e5d80aa 100644 --- a/Swiften/Disco/CapsManager.h +++ b/Swiften/Disco/CapsManager.h @@ -36,7 +36,7 @@ namespace Swift { } private: - void handlePresenceReceived(boost::shared_ptr<Presence>); + void handlePresenceReceived(std::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); void handleDiscoInfoReceived(const JID&, const std::string& hash, DiscoInfo::ref, ErrorPayload::ref); void requestDiscoInfo(const JID& jid, const std::string& node, const std::string& hash); diff --git a/Swiften/Disco/CapsMemoryStorage.h b/Swiften/Disco/CapsMemoryStorage.h index 39559ec..15a1fd3 100644 --- a/Swiften/Disco/CapsMemoryStorage.h +++ b/Swiften/Disco/CapsMemoryStorage.h @@ -7,10 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Disco/CapsStorage.h> diff --git a/Swiften/Disco/CapsStorage.h b/Swiften/Disco/CapsStorage.h index 5459ecf..ebfd3f3 100644 --- a/Swiften/Disco/CapsStorage.h +++ b/Swiften/Disco/CapsStorage.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/DiscoInfo.h> diff --git a/Swiften/Disco/DiscoInfoResponder.cpp b/Swiften/Disco/DiscoInfoResponder.cpp index cf18f43..c94d299 100644 --- a/Swiften/Disco/DiscoInfoResponder.cpp +++ b/Swiften/Disco/DiscoInfoResponder.cpp @@ -6,7 +6,7 @@ #include <Swiften/Disco/DiscoInfoResponder.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Queries/IQRouter.h> @@ -31,14 +31,14 @@ void DiscoInfoResponder::setDiscoInfo(const std::string& node, const DiscoInfo& nodeInfo_[node] = newInfo; } -bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<DiscoInfo> info) { +bool DiscoInfoResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<DiscoInfo> info) { if (info->getNode().empty()) { - sendResponse(from, id, boost::make_shared<DiscoInfo>(info_)); + sendResponse(from, id, std::make_shared<DiscoInfo>(info_)); } else { std::map<std::string,DiscoInfo>::const_iterator i = nodeInfo_.find(info->getNode()); if (i != nodeInfo_.end()) { - sendResponse(from, id, boost::make_shared<DiscoInfo>((*i).second)); + sendResponse(from, id, std::make_shared<DiscoInfo>((*i).second)); } else { sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); diff --git a/Swiften/Disco/DiscoInfoResponder.h b/Swiften/Disco/DiscoInfoResponder.h index 0781173..9995695 100644 --- a/Swiften/Disco/DiscoInfoResponder.h +++ b/Swiften/Disco/DiscoInfoResponder.h @@ -24,7 +24,7 @@ namespace Swift { void setDiscoInfo(const std::string& node, const DiscoInfo& info); private: - virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> payload); + virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<DiscoInfo> payload); private: DiscoInfo info_; diff --git a/Swiften/Disco/DiscoServiceWalker.cpp b/Swiften/Disco/DiscoServiceWalker.cpp index 19170ce..761e6ab 100644 --- a/Swiften/Disco/DiscoServiceWalker.cpp +++ b/Swiften/Disco/DiscoServiceWalker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -49,7 +49,7 @@ void DiscoServiceWalker::walkNode(const JID& jid) { discoInfoRequest->send(); } -void DiscoServiceWalker::handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, GetDiscoInfoRequest::ref request) { +void DiscoServiceWalker::handleDiscoInfoResponse(std::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, GetDiscoInfoRequest::ref request) { /* If we got canceled, don't do anything */ if (!active_) { return; @@ -85,7 +85,7 @@ void DiscoServiceWalker::handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> in } } -void DiscoServiceWalker::handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, GetDiscoItemsRequest::ref request) { +void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error, GetDiscoItemsRequest::ref request) { /* If we got canceled, don't do anything */ if (!active_) { return; diff --git a/Swiften/Disco/DiscoServiceWalker.h b/Swiften/Disco/DiscoServiceWalker.h index bd8102b..43bd910 100644 --- a/Swiften/Disco/DiscoServiceWalker.h +++ b/Swiften/Disco/DiscoServiceWalker.h @@ -6,12 +6,11 @@ #pragma once +#include <memory> #include <set> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Disco/GetDiscoInfoRequest.h> @@ -48,7 +47,7 @@ namespace Swift { } /** Emitted for each service found. */ - boost::signal<void(const JID&, boost::shared_ptr<DiscoInfo>)> onServiceFound; + boost::signal<void(const JID&, std::shared_ptr<DiscoInfo>)> onServiceFound; /** Emitted when walking is aborted. */ boost::signal<void()> onWalkAborted; @@ -59,8 +58,8 @@ namespace Swift { private: void walkNode(const JID& jid); void markNodeCompleted(const JID& jid); - void handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, GetDiscoInfoRequest::ref request); - void handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, GetDiscoItemsRequest::ref request); + void handleDiscoInfoResponse(std::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, GetDiscoInfoRequest::ref request); + void handleDiscoItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error, GetDiscoItemsRequest::ref request); void handleDiscoError(const JID& jid, ErrorPayload::ref error); private: diff --git a/Swiften/Disco/EntityCapsManager.cpp b/Swiften/Disco/EntityCapsManager.cpp index d30af54..64d90be 100644 --- a/Swiften/Disco/EntityCapsManager.cpp +++ b/Swiften/Disco/EntityCapsManager.cpp @@ -19,10 +19,10 @@ EntityCapsManager::EntityCapsManager(CapsProvider* capsProvider, StanzaChannel* capsProvider->onCapsAvailable.connect(boost::bind(&EntityCapsManager::handleCapsAvailable, this, _1)); } -void EntityCapsManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) { +void EntityCapsManager::handlePresenceReceived(std::shared_ptr<Presence> presence) { JID from = presence->getFrom(); if (presence->isAvailable()) { - boost::shared_ptr<CapsInfo> capsInfo = presence->getPayload<CapsInfo>(); + std::shared_ptr<CapsInfo> capsInfo = presence->getPayload<CapsInfo>(); if (!capsInfo || capsInfo->getHash() != "sha-1" || presence->getPayload<ErrorPayload>()) { return; } diff --git a/Swiften/Disco/EntityCapsManager.h b/Swiften/Disco/EntityCapsManager.h index 2a5d2d7..00b685b 100644 --- a/Swiften/Disco/EntityCapsManager.h +++ b/Swiften/Disco/EntityCapsManager.h @@ -35,7 +35,7 @@ namespace Swift { DiscoInfo::ref getCaps(const JID&) const; private: - void handlePresenceReceived(boost::shared_ptr<Presence>); + void handlePresenceReceived(std::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); void handleCapsAvailable(const std::string&); diff --git a/Swiften/Disco/FeatureOracle.cpp b/Swiften/Disco/FeatureOracle.cpp index 1267cb0..8328984 100644 --- a/Swiften/Disco/FeatureOracle.cpp +++ b/Swiften/Disco/FeatureOracle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -70,7 +70,7 @@ DiscoInfo::ref FeatureOracle::getDiscoResultForJID(const JID& jid) { } } } - discoInfo = boost::make_shared<DiscoInfo>(); + discoInfo = std::make_shared<DiscoInfo>(); foreach(const std::string& commonFeature, commonFeatures) { discoInfo->addFeature(commonFeature); diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h index ccbd3e2..1d86c14 100644 --- a/Swiften/Disco/GetDiscoInfoRequest.h +++ b/Swiften/Disco/GetDiscoInfoRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/DiscoInfo.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API GetDiscoInfoRequest : public GenericRequest<DiscoInfo> { public: - typedef boost::shared_ptr<GetDiscoInfoRequest> ref; + typedef std::shared_ptr<GetDiscoInfoRequest> ref; static ref create(const JID& jid, IQRouter* router) { return ref(new GetDiscoInfoRequest(jid, router)); @@ -27,11 +27,11 @@ namespace Swift { private: GetDiscoInfoRequest(const JID& jid, IQRouter* router) : - GenericRequest<DiscoInfo>(IQ::Get, jid, boost::make_shared<DiscoInfo>(), router) { + GenericRequest<DiscoInfo>(IQ::Get, jid, std::make_shared<DiscoInfo>(), router) { } GetDiscoInfoRequest(const JID& jid, const std::string& node, IQRouter* router) : - GenericRequest<DiscoInfo>(IQ::Get, jid, boost::make_shared<DiscoInfo>(), router) { + GenericRequest<DiscoInfo>(IQ::Get, jid, std::make_shared<DiscoInfo>(), router) { getPayloadGeneric()->setNode(node); } }; diff --git a/Swiften/Disco/GetDiscoItemsRequest.h b/Swiften/Disco/GetDiscoItemsRequest.h index 7f1adc6..5b1ccf2 100644 --- a/Swiften/Disco/GetDiscoItemsRequest.h +++ b/Swiften/Disco/GetDiscoItemsRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/DiscoItems.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API GetDiscoItemsRequest : public GenericRequest<DiscoItems> { public: - typedef boost::shared_ptr<GetDiscoItemsRequest> ref; + typedef std::shared_ptr<GetDiscoItemsRequest> ref; static ref create(const JID& jid, IQRouter* router) { return ref(new GetDiscoItemsRequest(jid, router)); @@ -27,11 +27,11 @@ namespace Swift { private: GetDiscoItemsRequest(const JID& jid, IQRouter* router) : - GenericRequest<DiscoItems>(IQ::Get, jid, boost::make_shared<DiscoItems>(), router) { + GenericRequest<DiscoItems>(IQ::Get, jid, std::make_shared<DiscoItems>(), router) { } GetDiscoItemsRequest(const JID& jid, const std::string& node, IQRouter* router) : - GenericRequest<DiscoItems>(IQ::Get, jid, boost::make_shared<DiscoItems>(), router) { + GenericRequest<DiscoItems>(IQ::Get, jid, std::make_shared<DiscoItems>(), router) { getPayloadGeneric()->setNode(node); } }; diff --git a/Swiften/Disco/JIDDiscoInfoResponder.cpp b/Swiften/Disco/JIDDiscoInfoResponder.cpp index 7bec992..8802bce 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.cpp +++ b/Swiften/Disco/JIDDiscoInfoResponder.cpp @@ -6,7 +6,7 @@ #include <Swiften/Disco/JIDDiscoInfoResponder.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Queries/IQRouter.h> @@ -32,16 +32,16 @@ void JIDDiscoInfoResponder::setDiscoInfo(const JID& jid, const std::string& node i->second.nodeDiscoInfo[node] = newInfo; } -bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> discoInfo) { +bool JIDDiscoInfoResponder::handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<DiscoInfo> discoInfo) { JIDDiscoInfoMap::const_iterator i = info.find(to); if (i != info.end()) { if (discoInfo->getNode().empty()) { - sendResponse(from, to, id, boost::make_shared<DiscoInfo>(i->second.discoInfo)); + sendResponse(from, to, id, std::make_shared<DiscoInfo>(i->second.discoInfo)); } else { std::map<std::string,DiscoInfo>::const_iterator j = i->second.nodeDiscoInfo.find(discoInfo->getNode()); if (j != i->second.nodeDiscoInfo.end()) { - sendResponse(from, to, id, boost::make_shared<DiscoInfo>(j->second)); + sendResponse(from, to, id, std::make_shared<DiscoInfo>(j->second)); } else { sendError(from, to, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); diff --git a/Swiften/Disco/JIDDiscoInfoResponder.h b/Swiften/Disco/JIDDiscoInfoResponder.h index e2fbb5b7..1eb6228 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.h +++ b/Swiften/Disco/JIDDiscoInfoResponder.h @@ -25,7 +25,7 @@ namespace Swift { void setDiscoInfo(const JID& jid, const std::string& node, const DiscoInfo& info); private: - virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<DiscoInfo> payload); + virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<DiscoInfo> payload); private: struct JIDDiscoInfo { diff --git a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp index 58c9531..8d27ec5 100644 --- a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp +++ b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp @@ -22,7 +22,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); } void testGenerate_XEP0115SimpleExample() { @@ -51,24 +51,24 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { discoInfo.addFeature("http://jabber.org/protocol/muc"); Form::ref extension(new Form(Form::ResultType)); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "urn:xmpp:dataforms:softwareinfo"); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "urn:xmpp:dataforms:softwareinfo"); field->setName("FORM_TYPE"); extension->addField(field); - field = boost::make_shared<FormField>(FormField::ListMultiType); + field = std::make_shared<FormField>(FormField::ListMultiType); field->addValue("ipv6"); field->addValue("ipv4"); field->setName("ip_version"); extension->addField(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "Psi"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Psi"); field->setName("software"); extension->addField(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "0.11"); + field = std::make_shared<FormField>(FormField::TextSingleType, "0.11"); field->setName("software_version"); extension->addField(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "Mac"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Mac"); field->setName("os"); extension->addField(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "10.5.1"); + field = std::make_shared<FormField>(FormField::TextSingleType, "10.5.1"); field->setName("os_version"); extension->addField(field); discoInfo.addExtension(extension); @@ -80,7 +80,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(CapsInfoGeneratorTest); diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp index fe7ee7e..ca727c2 100644 --- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp @@ -45,21 +45,21 @@ class CapsManagerTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); storage = new CapsMemoryStorage(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::make_shared<DiscoInfo>(); + discoInfo1 = std::make_shared<DiscoInfo>(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); - capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); + capsInfo1 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::make_shared<DiscoInfo>(); + discoInfo2 = std::make_shared<DiscoInfo>(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get())); + capsInfo2 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", ""); + legacyCapsInfo = std::make_shared<CapsInfo>("http://swift.im", "ver1", ""); } void tearDown() { @@ -69,17 +69,17 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveNewHashRequestsDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(0, user1, IQ::Get)); - boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[0]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(discoInfo); CPPUNIT_ASSERT_EQUAL("http://node1.im#" + capsInfo1->getVersion(), discoInfo->getNode()); } void testReceiveSameHashDoesNotRequestDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->sentStanzas.clear(); sendPresenceWithCaps(user1, capsInfo1); @@ -88,14 +88,14 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveLegacyCapsDoesNotRequestDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, legacyCapsInfo); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size())); } void testReceiveSameHashAfterSuccesfulDiscoDoesNotRequestDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo1); @@ -106,7 +106,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromSameUserAfterFailedDiscoDoesNotRequestDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getID())); @@ -117,7 +117,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromSameUserAfterIncorrectVerificationDoesNotRequestDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo2); @@ -128,7 +128,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromDifferentUserAfterFailedDiscoRequestsDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); @@ -138,7 +138,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromDifferentUserAfterIncorrectVerificationRequestsDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo2); @@ -148,7 +148,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveDifferentHashFromSameUserAfterFailedDiscoDoesNotRequestDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getID())); @@ -159,50 +159,50 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSuccesfulDiscoStoresCaps() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo1); - boost::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion())); + std::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion())); CPPUNIT_ASSERT(discoInfo); CPPUNIT_ASSERT(discoInfo->hasFeature("http://swift.im/feature1")); } void testReceiveIncorrectVerificationDiscoDoesNotStoreCaps() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo2); - boost::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion())); + std::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion())); CPPUNIT_ASSERT(!discoInfo); } void testReceiveFailingDiscoFallsBack() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(1, user2, IQ::Get)); - boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(discoInfo); CPPUNIT_ASSERT_EQUAL("http://node2.im#" + capsInfo1alt->getVersion(), discoInfo->getNode()); } void testReceiveNoDiscoFallsBack() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); - stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), boost::shared_ptr<DiscoInfo>())); + stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), std::shared_ptr<DiscoInfo>())); CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(1, user2, IQ::Get)); - boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(discoInfo); CPPUNIT_ASSERT_EQUAL("http://node2.im#" + capsInfo1alt->getVersion(), discoInfo->getNode()); } void testReceiveFailingFallbackDiscoFallsBack() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); sendPresenceWithCaps(user3, capsInfo1); @@ -213,7 +213,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromFailingUserAfterReconnectRequestsDisco() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); stanzaChannel->setAvailable(false); @@ -226,7 +226,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReconnectResetsFallback() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); stanzaChannel->setAvailable(false); @@ -239,7 +239,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReconnectResetsRequests() { - boost::shared_ptr<CapsManager> testling = createManager(); + std::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->sentStanzas.clear(); stanzaChannel->setAvailable(false); @@ -250,8 +250,8 @@ class CapsManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<CapsManager> createManager() { - boost::shared_ptr<CapsManager> manager(new CapsManager(storage, stanzaChannel, iqRouter, crypto.get())); + std::shared_ptr<CapsManager> createManager() { + std::shared_ptr<CapsManager> manager(new CapsManager(storage, stanzaChannel, iqRouter, crypto.get())); manager->setWarnOnInvalidHash(false); //manager->onCapsChanged.connect(boost::bind(&CapsManagerTest::handleCapsChanged, this, _1)); return manager; @@ -261,14 +261,14 @@ class CapsManagerTest : public CppUnit::TestFixture { changes.push_back(jid); } - void sendPresenceWithCaps(const JID& jid, boost::shared_ptr<CapsInfo> caps) { - boost::shared_ptr<Presence> presence(new Presence()); + void sendPresenceWithCaps(const JID& jid, std::shared_ptr<CapsInfo> caps) { + std::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); presence->addPayload(caps); stanzaChannel->onPresenceReceived(presence); } - void sendDiscoInfoResult(boost::shared_ptr<DiscoInfo> discoInfo) { + void sendDiscoInfoResult(std::shared_ptr<DiscoInfo> discoInfo) { stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), discoInfo)); } @@ -278,15 +278,15 @@ class CapsManagerTest : public CppUnit::TestFixture { CapsStorage* storage; std::vector<JID> changes; JID user1; - boost::shared_ptr<DiscoInfo> discoInfo1; - boost::shared_ptr<CapsInfo> capsInfo1; - boost::shared_ptr<CapsInfo> capsInfo1alt; + std::shared_ptr<DiscoInfo> discoInfo1; + std::shared_ptr<CapsInfo> capsInfo1; + std::shared_ptr<CapsInfo> capsInfo1alt; JID user2; - boost::shared_ptr<DiscoInfo> discoInfo2; - boost::shared_ptr<CapsInfo> capsInfo2; - boost::shared_ptr<CapsInfo> legacyCapsInfo; + std::shared_ptr<DiscoInfo> discoInfo2; + std::shared_ptr<CapsInfo> capsInfo2; + std::shared_ptr<CapsInfo> legacyCapsInfo; JID user3; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(CapsManagerTest); diff --git a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp index 907029e..45dc959 100644 --- a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp @@ -40,11 +40,11 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { discoInfo.addFeature("foo"); testling.setDiscoInfo(discoInfo); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("foo")); @@ -62,12 +62,12 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { discoInfoBar.addFeature("bar"); testling.setDiscoInfo("bar-node", discoInfoBar); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); query->setNode("bar-node"); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("bar")); @@ -77,13 +77,13 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { void testHandleRequest_GetInvalidNodeInfo() { DiscoInfoResponder testling(router_); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); query->setNode("bar-node"); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query)); testling.start(); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); + std::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); CPPUNIT_ASSERT(payload); testling.stop(); diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp index 4062753..d775f6c 100644 --- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp @@ -34,22 +34,22 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); stanzaChannel = new DummyStanzaChannel(); capsProvider = new DummyCapsProvider(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::make_shared<DiscoInfo>(); + discoInfo1 = std::make_shared<DiscoInfo>(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); - capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); + capsInfo1 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::make_shared<DiscoInfo>(); + discoInfo2 = std::make_shared<DiscoInfo>(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get())); + capsInfo2 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", ""); + legacyCapsInfo = std::make_shared<CapsInfo>("http://swift.im", "ver1", ""); } void tearDown() { @@ -58,7 +58,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveKnownHash() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); @@ -68,7 +68,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveKnownHashTwiceDoesNotTriggerChange() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); changes.clear(); @@ -79,14 +79,14 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveUnknownHashDoesNotTriggerChange() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size())); } void testHashAvailable() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; @@ -98,7 +98,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveUnknownHashAfterKnownHashTriggersChangeAndClearsCaps() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); changes.clear(); @@ -110,7 +110,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveUnavailablePresenceAfterKnownHashTriggersChangeAndClearsCaps() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); changes.clear(); @@ -122,7 +122,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReconnectTriggersChangeAndClearsCaps() { - boost::shared_ptr<EntityCapsManager> testling = createManager(); + std::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; capsProvider->caps[capsInfo2->getVersion()] = discoInfo2; sendPresenceWithCaps(user1, capsInfo1); @@ -139,8 +139,8 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<EntityCapsManager> createManager() { - boost::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel)); + std::shared_ptr<EntityCapsManager> createManager() { + std::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel)); manager->onCapsChanged.connect(boost::bind(&EntityCapsManagerTest::handleCapsChanged, this, _1)); return manager; } @@ -149,15 +149,15 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { changes.push_back(jid); } - void sendPresenceWithCaps(const JID& jid, boost::shared_ptr<CapsInfo> caps) { - boost::shared_ptr<Presence> presence(new Presence()); + void sendPresenceWithCaps(const JID& jid, std::shared_ptr<CapsInfo> caps) { + std::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); presence->addPayload(caps); stanzaChannel->onPresenceReceived(presence); } void sendUnavailablePresence(const JID& jid) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); presence->setType(Presence::Unavailable); stanzaChannel->onPresenceReceived(presence); @@ -180,16 +180,16 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { DummyStanzaChannel* stanzaChannel; DummyCapsProvider* capsProvider; JID user1; - boost::shared_ptr<DiscoInfo> discoInfo1; - boost::shared_ptr<CapsInfo> capsInfo1; - boost::shared_ptr<CapsInfo> capsInfo1alt; + std::shared_ptr<DiscoInfo> discoInfo1; + std::shared_ptr<CapsInfo> capsInfo1; + std::shared_ptr<CapsInfo> capsInfo1alt; JID user2; - boost::shared_ptr<DiscoInfo> discoInfo2; - boost::shared_ptr<CapsInfo> capsInfo2; - boost::shared_ptr<CapsInfo> legacyCapsInfo; + std::shared_ptr<DiscoInfo> discoInfo2; + std::shared_ptr<CapsInfo> capsInfo2; + std::shared_ptr<CapsInfo> legacyCapsInfo; JID user3; std::vector<JID> changes; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(EntityCapsManagerTest); diff --git a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp index 3c1a057..9369a04 100644 --- a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp @@ -41,11 +41,11 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture { discoInfo.addFeature("foo"); testling.setDiscoInfo(JID("foo@bar.com/baz"), discoInfo); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/baz"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("foo")); @@ -63,12 +63,12 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture { discoInfoBar.addFeature("bar"); testling.setDiscoInfo(JID("foo@bar.com/baz"), "bar-node", discoInfoBar); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); query->setNode("bar-node"); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/baz"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); + std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode()); CPPUNIT_ASSERT(payload->hasFeature("bar")); @@ -83,12 +83,12 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture { testling.setDiscoInfo(JID("foo@bar.com/baz"), discoInfo); testling.start(); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); query->setNode("bar-node"); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/baz"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); + std::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); CPPUNIT_ASSERT(payload); testling.stop(); @@ -101,11 +101,11 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture { testling.setDiscoInfo(JID("foo@bar.com/baz"), discoInfo); testling.start(); - boost::shared_ptr<DiscoInfo> query(new DiscoInfo()); + std::shared_ptr<DiscoInfo> query(new DiscoInfo()); channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/fum"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); + std::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); CPPUNIT_ASSERT(payload); testling.stop(); diff --git a/Swiften/Elements/AuthFailure.h b/Swiften/Elements/AuthFailure.h index 8f6702c..9546b0d 100644 --- a/Swiften/Elements/AuthFailure.h +++ b/Swiften/Elements/AuthFailure.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API AuthFailure : public ToplevelElement { public: - typedef boost::shared_ptr<AuthFailure> ref; + typedef std::shared_ptr<AuthFailure> ref; AuthFailure() {} }; diff --git a/Swiften/Elements/Bytestreams.h b/Swiften/Elements/Bytestreams.h index dc6ec78..ca30922 100644 --- a/Swiften/Elements/Bytestreams.h +++ b/Swiften/Elements/Bytestreams.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API Bytestreams : public Payload { public: - typedef boost::shared_ptr<Bytestreams> ref; + typedef std::shared_ptr<Bytestreams> ref; struct StreamHost { StreamHost(const std::string& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {} diff --git a/Swiften/Elements/CapsInfo.h b/Swiften/Elements/CapsInfo.h index 875ede4..d1e5103 100644 --- a/Swiften/Elements/CapsInfo.h +++ b/Swiften/Elements/CapsInfo.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { class SWIFTEN_API CapsInfo : public Payload { public: - typedef boost::shared_ptr<CapsInfo> ref; + typedef std::shared_ptr<CapsInfo> ref; CapsInfo(const std::string& node = "", const std::string& version = "", const std::string& hash = "sha-1") : node_(node), version_(version), hash_(hash) {} diff --git a/Swiften/Elements/CarbonsDisable.h b/Swiften/Elements/CarbonsDisable.h index f6c9a38..9526061 100644 --- a/Swiften/Elements/CarbonsDisable.h +++ b/Swiften/Elements/CarbonsDisable.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API CarbonsDisable : public Payload { public: - typedef boost::shared_ptr<CarbonsDisable> ref; + typedef std::shared_ptr<CarbonsDisable> ref; public: virtual ~CarbonsDisable(); diff --git a/Swiften/Elements/CarbonsEnable.h b/Swiften/Elements/CarbonsEnable.h index 1cb64ad..bcb27a2 100644 --- a/Swiften/Elements/CarbonsEnable.h +++ b/Swiften/Elements/CarbonsEnable.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API CarbonsEnable : public Payload { public: - typedef boost::shared_ptr<CarbonsEnable> ref; + typedef std::shared_ptr<CarbonsEnable> ref; public: virtual ~CarbonsEnable(); diff --git a/Swiften/Elements/CarbonsPrivate.h b/Swiften/Elements/CarbonsPrivate.h index fdd3944..5cc25ff 100644 --- a/Swiften/Elements/CarbonsPrivate.h +++ b/Swiften/Elements/CarbonsPrivate.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API CarbonsPrivate : public Payload { public: - typedef boost::shared_ptr<CarbonsPrivate> ref; + typedef std::shared_ptr<CarbonsPrivate> ref; public: virtual ~CarbonsPrivate(); diff --git a/Swiften/Elements/CarbonsReceived.cpp b/Swiften/Elements/CarbonsReceived.cpp index 1c0a72b..7c233a3 100644 --- a/Swiften/Elements/CarbonsReceived.cpp +++ b/Swiften/Elements/CarbonsReceived.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -11,11 +11,11 @@ namespace Swift { } - void CarbonsReceived::setForwarded(boost::shared_ptr<Forwarded> forwarded) { + void CarbonsReceived::setForwarded(std::shared_ptr<Forwarded> forwarded) { forwarded_ = forwarded; } - boost::shared_ptr<Forwarded> CarbonsReceived::getForwarded() const { + std::shared_ptr<Forwarded> CarbonsReceived::getForwarded() const { return forwarded_; } } diff --git a/Swiften/Elements/CarbonsReceived.h b/Swiften/Elements/CarbonsReceived.h index 82ccff9..c33b600 100644 --- a/Swiften/Elements/CarbonsReceived.h +++ b/Swiften/Elements/CarbonsReceived.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Forwarded.h> @@ -15,14 +15,14 @@ namespace Swift { class SWIFTEN_API CarbonsReceived : public Payload { public: - typedef boost::shared_ptr<CarbonsReceived> ref; + typedef std::shared_ptr<CarbonsReceived> ref; public: virtual ~CarbonsReceived(); - void setForwarded(boost::shared_ptr<Forwarded> forwarded); - boost::shared_ptr<Forwarded> getForwarded() const; + void setForwarded(std::shared_ptr<Forwarded> forwarded); + std::shared_ptr<Forwarded> getForwarded() const; private: - boost::shared_ptr<Forwarded> forwarded_; + std::shared_ptr<Forwarded> forwarded_; }; } diff --git a/Swiften/Elements/CarbonsSent.cpp b/Swiften/Elements/CarbonsSent.cpp index c2380c6..a026871 100644 --- a/Swiften/Elements/CarbonsSent.cpp +++ b/Swiften/Elements/CarbonsSent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -11,11 +11,11 @@ namespace Swift { } - void CarbonsSent::setForwarded(boost::shared_ptr<Forwarded> forwarded) { + void CarbonsSent::setForwarded(std::shared_ptr<Forwarded> forwarded) { forwarded_ = forwarded; } - boost::shared_ptr<Forwarded> CarbonsSent::getForwarded() const { + std::shared_ptr<Forwarded> CarbonsSent::getForwarded() const { return forwarded_; } } diff --git a/Swiften/Elements/CarbonsSent.h b/Swiften/Elements/CarbonsSent.h index d025a0d..89739de 100644 --- a/Swiften/Elements/CarbonsSent.h +++ b/Swiften/Elements/CarbonsSent.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Forwarded.h> @@ -15,14 +15,14 @@ namespace Swift { class SWIFTEN_API CarbonsSent : public Payload { public: - typedef boost::shared_ptr<CarbonsSent> ref; + typedef std::shared_ptr<CarbonsSent> ref; public: virtual ~CarbonsSent(); - void setForwarded(boost::shared_ptr<Forwarded> forwarded); - boost::shared_ptr<Forwarded> getForwarded() const; + void setForwarded(std::shared_ptr<Forwarded> forwarded); + std::shared_ptr<Forwarded> getForwarded() const; private: - boost::shared_ptr<Forwarded> forwarded_; + std::shared_ptr<Forwarded> forwarded_; }; } diff --git a/Swiften/Elements/ChatState.h b/Swiften/Elements/ChatState.h index c1ae68e..4288398 100644 --- a/Swiften/Elements/ChatState.h +++ b/Swiften/Elements/ChatState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API ChatState : public Payload { public: - typedef boost::shared_ptr<ChatState> ref; + typedef std::shared_ptr<ChatState> ref; public: enum ChatStateType {Active, Composing, Paused, Inactive, Gone}; diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h index fff3d6b..33aadd5 100644 --- a/Swiften/Elements/Command.h +++ b/Swiften/Elements/Command.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Form.h> #include <Swiften/Elements/Payload.h> @@ -20,7 +19,7 @@ namespace Swift { */ class SWIFTEN_API Command : public Payload { public: - typedef boost::shared_ptr<Command> ref; + typedef std::shared_ptr<Command> ref; enum Status {Executing, Completed, Canceled, NoStatus}; enum Action {Cancel, Execute, Complete, Prev, Next, NoAction}; diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index e8afc18..4d6d059 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { class SWIFTEN_API ComponentHandshake : public ToplevelElement { public: - typedef boost::shared_ptr<ComponentHandshake> ref; + typedef std::shared_ptr<ComponentHandshake> ref; ComponentHandshake(const std::string& data = "") : data(data) { } diff --git a/Swiften/Elements/ContainerPayload.h b/Swiften/Elements/ContainerPayload.h index 7435f34..3da04b7 100644 --- a/Swiften/Elements/ContainerPayload.h +++ b/Swiften/Elements/ContainerPayload.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -19,17 +18,17 @@ namespace Swift { class SWIFTEN_API ContainerPayload : public Payload { public: ContainerPayload() {} - ContainerPayload(boost::shared_ptr<T> payload) : payload(payload) {} + ContainerPayload(std::shared_ptr<T> payload) : payload(payload) {} - void setPayload(boost::shared_ptr<T> payload) { + void setPayload(std::shared_ptr<T> payload) { this->payload = payload; } - boost::shared_ptr<T> getPayload() const { + std::shared_ptr<T> getPayload() const { return payload; } private: - boost::shared_ptr<T> payload; + std::shared_ptr<T> payload; }; } diff --git a/Swiften/Elements/DeliveryReceipt.h b/Swiften/Elements/DeliveryReceipt.h index a4936a5..238485d 100644 --- a/Swiften/Elements/DeliveryReceipt.h +++ b/Swiften/Elements/DeliveryReceipt.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API DeliveryReceipt : public Payload { public: - typedef boost::shared_ptr<DeliveryReceipt> ref; + typedef std::shared_ptr<DeliveryReceipt> ref; public: DeliveryReceipt() {} diff --git a/Swiften/Elements/DeliveryReceiptRequest.h b/Swiften/Elements/DeliveryReceiptRequest.h index 58086df..9a7d478 100644 --- a/Swiften/Elements/DeliveryReceiptRequest.h +++ b/Swiften/Elements/DeliveryReceiptRequest.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API DeliveryReceiptRequest : public Payload { public: - typedef boost::shared_ptr<DeliveryReceiptRequest> ref; + typedef std::shared_ptr<DeliveryReceiptRequest> ref; public: DeliveryReceiptRequest() {} diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h index d6ca6b8..6ce3fbb 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -19,7 +19,7 @@ namespace Swift { */ class SWIFTEN_API DiscoInfo : public Payload { public: - typedef boost::shared_ptr<DiscoInfo> ref; + typedef std::shared_ptr<DiscoInfo> ref; static const std::string ChatStatesFeature; static const std::string SecurityLabelsFeature; diff --git a/Swiften/Elements/ErrorPayload.h b/Swiften/Elements/ErrorPayload.h index 800ff22..0269e4d 100644 --- a/Swiften/Elements/ErrorPayload.h +++ b/Swiften/Elements/ErrorPayload.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { class SWIFTEN_API ErrorPayload : public Payload { public: - typedef boost::shared_ptr<ErrorPayload> ref; + typedef std::shared_ptr<ErrorPayload> ref; enum Type { Cancel, Continue, Modify, Auth, Wait }; @@ -71,11 +70,11 @@ namespace Swift { return text_; } - void setPayload(boost::shared_ptr<Payload> payload) { + void setPayload(std::shared_ptr<Payload> payload) { payload_ = payload; } - boost::shared_ptr<Payload> getPayload() const { + std::shared_ptr<Payload> getPayload() const { return payload_; } @@ -83,6 +82,6 @@ namespace Swift { Type type_; Condition condition_; std::string text_; - boost::shared_ptr<Payload> payload_; + std::shared_ptr<Payload> payload_; }; } diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index ebdb161..85ba9c7 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -24,7 +24,7 @@ namespace Swift { */ class SWIFTEN_API Form : public Payload { public: - typedef boost::shared_ptr<Form> ref; + typedef std::shared_ptr<Form> ref; typedef std::vector<FormField::ref> FormItem; enum Type { FormType, SubmitType, CancelType, ResultType }; @@ -32,21 +32,21 @@ namespace Swift { public: Form(Type type = FormType) : type_(type) {} - void addPage(boost::shared_ptr<FormPage> page) { + void addPage(std::shared_ptr<FormPage> page) { assert(page); pages_.push_back(page); } - const std::vector<boost::shared_ptr<FormPage> >& getPages() const { + const std::vector<std::shared_ptr<FormPage> >& getPages() const { return pages_; } - void addField(boost::shared_ptr<FormField> field) { + void addField(std::shared_ptr<FormField> field) { assert(field); fields_.push_back(field); } - const std::vector<boost::shared_ptr<FormField> >& getFields() const { + const std::vector<std::shared_ptr<FormField> >& getFields() const { return fields_; } @@ -54,21 +54,21 @@ namespace Swift { fields_.clear(); } - void addTextElement(boost::shared_ptr<FormText> text) { + void addTextElement(std::shared_ptr<FormText> text) { assert(text); textElements_.push_back(text); } - const std::vector<boost::shared_ptr<FormText> >& getTextElements() const { + const std::vector<std::shared_ptr<FormText> >& getTextElements() const { return textElements_; } - void addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef) { + void addReportedRef(std::shared_ptr<FormReportedRef> reportedRef) { assert(reportedRef); reportedRefs_.push_back(reportedRef); } - const std::vector<boost::shared_ptr<FormReportedRef> >& getReportedRefs() const { + const std::vector<std::shared_ptr<FormReportedRef> >& getReportedRefs() const { return reportedRefs_; } @@ -109,13 +109,13 @@ namespace Swift { void clearReportedFields() { reportedFields_.clear(); } private: - std::vector<boost::shared_ptr<FormReportedRef> >reportedRefs_; - std::vector<boost::shared_ptr<FormText> > textElements_; - std::vector<boost::shared_ptr<FormPage> > pages_; - std::vector<boost::shared_ptr<FormField> > fields_; - std::vector<boost::shared_ptr<FormField> > reportedFields_; + std::vector<std::shared_ptr<FormReportedRef> >reportedRefs_; + std::vector<std::shared_ptr<FormText> > textElements_; + std::vector<std::shared_ptr<FormPage> > pages_; + std::vector<std::shared_ptr<FormField> > fields_; + std::vector<std::shared_ptr<FormField> > reportedFields_; std::vector<FormItem> items_; - boost::shared_ptr<FormReportedRef> reportedRef_; + std::shared_ptr<FormReportedRef> reportedRef_; std::string title_; std::string instructions_; Type type_; diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h index e62dec4..2d71ac7 100644 --- a/Swiften/Elements/FormField.h +++ b/Swiften/Elements/FormField.h @@ -6,18 +6,17 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> namespace Swift { class SWIFTEN_API FormField { public: - typedef boost::shared_ptr<FormField> ref; + typedef std::shared_ptr<FormField> ref; enum Type { UnknownType, diff --git a/Swiften/Elements/FormPage.cpp b/Swiften/Elements/FormPage.cpp index a4e1616..0afa112 100644 --- a/Swiften/Elements/FormPage.cpp +++ b/Swiften/Elements/FormPage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,35 +21,35 @@ const std::string& FormPage::getLabel() const { return label_; } -void FormPage::addChildSection(boost::shared_ptr<FormSection> section) { +void FormPage::addChildSection(std::shared_ptr<FormSection> section) { childSections_.push_back(section); } -const std::vector<boost::shared_ptr<FormSection> >& FormPage::getChildSections() const { +const std::vector<std::shared_ptr<FormSection> >& FormPage::getChildSections() const { return childSections_; } -void FormPage::addTextElement(boost::shared_ptr<FormText> textElement) { +void FormPage::addTextElement(std::shared_ptr<FormText> textElement) { textElements_.push_back(textElement); } -const std::vector<boost::shared_ptr<FormText> >& FormPage::getTextElements() const { +const std::vector<std::shared_ptr<FormText> >& FormPage::getTextElements() const { return textElements_; } -void FormPage::addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef) { +void FormPage::addReportedRef(std::shared_ptr<FormReportedRef> reportedRef) { reportedRefs_.push_back(reportedRef); } -const std::vector<boost::shared_ptr<FormReportedRef> >& FormPage::getReportedRefs() const { +const std::vector<std::shared_ptr<FormReportedRef> >& FormPage::getReportedRefs() const { return reportedRefs_; } -void FormPage::addField(boost::shared_ptr<FormField> field) { +void FormPage::addField(std::shared_ptr<FormField> field) { fields_.push_back(field); } -const std::vector<boost::shared_ptr<FormField> >& FormPage::getFields() const { +const std::vector<std::shared_ptr<FormField> >& FormPage::getFields() const { return fields_; } diff --git a/Swiften/Elements/FormPage.h b/Swiften/Elements/FormPage.h index f7a4a9a..8412d9e 100644 --- a/Swiften/Elements/FormPage.h +++ b/Swiften/Elements/FormPage.h @@ -5,11 +5,10 @@ */ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/FormField.h> #include <Swiften/Elements/FormReportedRef.h> @@ -20,28 +19,28 @@ namespace Swift { class SWIFTEN_API FormPage { public: - typedef boost::shared_ptr<FormPage> page; + typedef std::shared_ptr<FormPage> page; FormPage (); ~FormPage(); void setLabel(const std::string& label); const std::string& getLabel() const; - void addChildSection(boost::shared_ptr<FormSection> section); - const std::vector<boost::shared_ptr<FormSection> >& getChildSections() const; - void addTextElement(boost::shared_ptr<FormText> textElement); - const std::vector<boost::shared_ptr<FormText> >& getTextElements() const; - void addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef); - const std::vector<boost::shared_ptr<FormReportedRef> >& getReportedRefs() const; - void addField(boost::shared_ptr<FormField> field); - const std::vector<boost::shared_ptr<FormField> >& getFields() const; + void addChildSection(std::shared_ptr<FormSection> section); + const std::vector<std::shared_ptr<FormSection> >& getChildSections() const; + void addTextElement(std::shared_ptr<FormText> textElement); + const std::vector<std::shared_ptr<FormText> >& getTextElements() const; + void addReportedRef(std::shared_ptr<FormReportedRef> reportedRef); + const std::vector<std::shared_ptr<FormReportedRef> >& getReportedRefs() const; + void addField(std::shared_ptr<FormField> field); + const std::vector<std::shared_ptr<FormField> >& getFields() const; void addFieldRef(std::string ref); const std::vector<std::string> getFieldRefs() const; private: std::string label_; - std::vector<boost::shared_ptr<FormText> > textElements_; - std::vector<boost::shared_ptr<FormSection> > childSections_; - std::vector<boost::shared_ptr<FormReportedRef> > reportedRefs_; - std::vector<boost::shared_ptr<FormField> > fields_; + std::vector<std::shared_ptr<FormText> > textElements_; + std::vector<std::shared_ptr<FormSection> > childSections_; + std::vector<std::shared_ptr<FormReportedRef> > reportedRefs_; + std::vector<std::shared_ptr<FormField> > fields_; std::vector<std::string> fieldRefs_; }; } diff --git a/Swiften/Elements/FormReportedRef.h b/Swiften/Elements/FormReportedRef.h index a972f10..d6dc718 100644 --- a/Swiften/Elements/FormReportedRef.h +++ b/Swiften/Elements/FormReportedRef.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> @@ -14,6 +14,6 @@ namespace Swift { class SWIFTEN_API FormReportedRef { public: - typedef boost::shared_ptr<FormReportedRef> ref; + typedef std::shared_ptr<FormReportedRef> ref; }; } diff --git a/Swiften/Elements/FormSection.cpp b/Swiften/Elements/FormSection.cpp index 2fe1954..9ca3b4d 100644 --- a/Swiften/Elements/FormSection.cpp +++ b/Swiften/Elements/FormSection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,35 +21,35 @@ const std::string& FormSection::getLabel() const { return label_; } -void FormSection::addTextElement(boost::shared_ptr<FormText> textElement) { +void FormSection::addTextElement(std::shared_ptr<FormText> textElement) { textElements_.push_back(textElement); } -const std::vector<boost::shared_ptr<FormText> >& FormSection::getTextElements() const { +const std::vector<std::shared_ptr<FormText> >& FormSection::getTextElements() const { return textElements_; } -void FormSection::addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef) { +void FormSection::addReportedRef(std::shared_ptr<FormReportedRef> reportedRef) { reportedRefs_.push_back(reportedRef); } -const std::vector<boost::shared_ptr<FormReportedRef> >& FormSection::getReportedRefs() const { +const std::vector<std::shared_ptr<FormReportedRef> >& FormSection::getReportedRefs() const { return reportedRefs_; } -void FormSection::addChildSection(boost::shared_ptr<FormSection> childSection) { +void FormSection::addChildSection(std::shared_ptr<FormSection> childSection) { childSections_.push_back(childSection); } -const std::vector<boost::shared_ptr<FormSection> >& FormSection::getChildSections() const { +const std::vector<std::shared_ptr<FormSection> >& FormSection::getChildSections() const { return childSections_; } -void FormSection::addField(boost::shared_ptr<FormField> field) { +void FormSection::addField(std::shared_ptr<FormField> field) { fields_.push_back(field); } -const std::vector<boost::shared_ptr<FormField> >& FormSection::getFields() const { +const std::vector<std::shared_ptr<FormField> >& FormSection::getFields() const { return fields_; } diff --git a/Swiften/Elements/FormSection.h b/Swiften/Elements/FormSection.h index 69638c4..b1d60bc 100644 --- a/Swiften/Elements/FormSection.h +++ b/Swiften/Elements/FormSection.h @@ -5,11 +5,10 @@ */ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/FormField.h> #include <Swiften/Elements/FormReportedRef.h> @@ -19,28 +18,28 @@ namespace Swift { class SWIFTEN_API FormSection { public: - typedef boost::shared_ptr<FormSection> section; + typedef std::shared_ptr<FormSection> section; FormSection(); ~FormSection(); void setLabel(const std::string& label); const std::string& getLabel() const; - void addTextElement(boost::shared_ptr<FormText> textElement); - const std::vector<boost::shared_ptr<FormText> >& getTextElements() const; - void addReportedRef(boost::shared_ptr<FormReportedRef> reportedRef); - const std::vector<boost::shared_ptr<FormReportedRef> >& getReportedRefs() const; - void addChildSection(boost::shared_ptr<FormSection> childSection); - const std::vector<boost::shared_ptr<FormSection> >& getChildSections() const; - void addField(boost::shared_ptr<FormField> field); - const std::vector<boost::shared_ptr<FormField> >& getFields() const; + void addTextElement(std::shared_ptr<FormText> textElement); + const std::vector<std::shared_ptr<FormText> >& getTextElements() const; + void addReportedRef(std::shared_ptr<FormReportedRef> reportedRef); + const std::vector<std::shared_ptr<FormReportedRef> >& getReportedRefs() const; + void addChildSection(std::shared_ptr<FormSection> childSection); + const std::vector<std::shared_ptr<FormSection> >& getChildSections() const; + void addField(std::shared_ptr<FormField> field); + const std::vector<std::shared_ptr<FormField> >& getFields() const; void addFieldRef(std::string ref); const std::vector<std::string> getFieldRefs() const; private: std::string label_; - std::vector<boost::shared_ptr<FormText> > textElements_; - std::vector<boost::shared_ptr<FormReportedRef> > reportedRefs_; - std::vector<boost::shared_ptr<FormSection> > childSections_; - std::vector<boost::shared_ptr<FormField> > fields_; + std::vector<std::shared_ptr<FormText> > textElements_; + std::vector<std::shared_ptr<FormReportedRef> > reportedRefs_; + std::vector<std::shared_ptr<FormSection> > childSections_; + std::vector<std::shared_ptr<FormField> > fields_; std::vector<std::string> fieldRefs_; }; } diff --git a/Swiften/Elements/FormText.h b/Swiften/Elements/FormText.h index 1d95a3a..a0c8d56 100644 --- a/Swiften/Elements/FormText.h +++ b/Swiften/Elements/FormText.h @@ -5,10 +5,9 @@ */ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> namespace Swift { @@ -16,7 +15,7 @@ namespace Swift { class SWIFTEN_API FormText{ public: - typedef boost::shared_ptr<FormText> text; + typedef std::shared_ptr<FormText> text; FormText(); virtual ~FormText(); void setTextString(const std::string& text); diff --git a/Swiften/Elements/Forwarded.h b/Swiften/Elements/Forwarded.h index 8401fe1..1a31b89 100644 --- a/Swiften/Elements/Forwarded.h +++ b/Swiften/Elements/Forwarded.h @@ -20,14 +20,14 @@ namespace Swift { public: virtual ~Forwarded(); - void setDelay(boost::shared_ptr<Delay> delay) { delay_ = delay; } - const boost::shared_ptr<Delay>& getDelay() const { return delay_; } + void setDelay(std::shared_ptr<Delay> delay) { delay_ = delay; } + const std::shared_ptr<Delay>& getDelay() const { return delay_; } - void setStanza(boost::shared_ptr<Stanza> stanza) { stanza_ = stanza; } - const boost::shared_ptr<Stanza>& getStanza() const { return stanza_; } + void setStanza(std::shared_ptr<Stanza> stanza) { stanza_ = stanza; } + const std::shared_ptr<Stanza>& getStanza() const { return stanza_; } private: - boost::shared_ptr<Delay> delay_; - boost::shared_ptr<Stanza> stanza_; + std::shared_ptr<Delay> delay_; + std::shared_ptr<Stanza> stanza_; }; } diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h index 97a46bb..bd0b661 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -6,19 +6,17 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { class SWIFTEN_API IBB : public Payload { public: - typedef boost::shared_ptr<IBB> ref; + typedef std::shared_ptr<IBB> ref; enum Action { Open, @@ -34,20 +32,20 @@ namespace Swift { } static IBB::ref createIBBOpen(const std::string& streamID, int blockSize) { - IBB::ref result = boost::make_shared<IBB>(Open, streamID); + IBB::ref result = std::make_shared<IBB>(Open, streamID); result->setBlockSize(blockSize); return result; } static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const std::vector<unsigned char>& data) { - IBB::ref result = boost::make_shared<IBB>(Data, streamID); + IBB::ref result = std::make_shared<IBB>(Data, streamID); result->setSequenceNumber(sequenceNumber); result->setData(data); return result; } static IBB::ref createIBBClose(const std::string& streamID) { - return boost::make_shared<IBB>(Close, streamID); + return std::make_shared<IBB>(Close, streamID); } void setAction(Action action) { diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp index cd1498e..31a654f 100644 --- a/Swiften/Elements/IQ.cpp +++ b/Swiften/Elements/IQ.cpp @@ -1,18 +1,18 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Elements/IQ.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { -boost::shared_ptr<IQ> IQ::createRequest( - Type type, const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(type); +std::shared_ptr<IQ> IQ::createRequest( + Type type, const JID& to, const std::string& id, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(type); if (to.isValid()) { iq->setTo(to); } @@ -23,8 +23,8 @@ boost::shared_ptr<IQ> IQ::createRequest( return iq; } -boost::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(Result); +std::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(Result); iq->setTo(to); iq->setID(id); if (payload) { @@ -33,8 +33,8 @@ boost::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, boo return iq; } -boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std::string& id, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(Result); +std::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std::string& id, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(Result); iq->setTo(to); iq->setFrom(from); iq->setID(id); @@ -44,22 +44,22 @@ boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std return iq; } -boost::shared_ptr<IQ> IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error); +std::shared_ptr<IQ> IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(IQ::Error); iq->setTo(to); iq->setID(id); - boost::shared_ptr<ErrorPayload> errorPayload = boost::make_shared<Swift::ErrorPayload>(condition, type); + std::shared_ptr<ErrorPayload> errorPayload = std::make_shared<Swift::ErrorPayload>(condition, type); errorPayload->setPayload(payload); iq->addPayload(errorPayload); return iq; } -boost::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, boost::shared_ptr<Payload> payload) { - boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error); +std::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, std::shared_ptr<Payload> payload) { + std::shared_ptr<IQ> iq = std::make_shared<IQ>(IQ::Error); iq->setTo(to); iq->setFrom(from); iq->setID(id); - boost::shared_ptr<ErrorPayload> errorPayload = boost::make_shared<Swift::ErrorPayload>(condition, type); + std::shared_ptr<ErrorPayload> errorPayload = std::make_shared<Swift::ErrorPayload>(condition, type); errorPayload->setPayload(payload); iq->addPayload(errorPayload); return iq; diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h index 275c00e..00ed848 100644 --- a/Swiften/Elements/IQ.h +++ b/Swiften/Elements/IQ.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ErrorPayload.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API IQ : public Stanza { public: - typedef boost::shared_ptr<IQ> ref; + typedef std::shared_ptr<IQ> ref; enum Type { Get, Set, Result, Error }; @@ -24,33 +24,33 @@ namespace Swift { Type getType() const { return type_; } void setType(Type type) { type_ = type; } - static boost::shared_ptr<IQ> createRequest( + static std::shared_ptr<IQ> createRequest( Type type, const JID& to, const std::string& id, - boost::shared_ptr<Payload> payload); - static boost::shared_ptr<IQ> createResult( + std::shared_ptr<Payload> payload); + static std::shared_ptr<IQ> createResult( const JID& to, const std::string& id, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - static boost::shared_ptr<IQ> createResult( + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + static std::shared_ptr<IQ> createResult( const JID& to, const JID& from, const std::string& id, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - static boost::shared_ptr<IQ> createError( + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + static std::shared_ptr<IQ> createError( const JID& to, const std::string& id, ErrorPayload::Condition condition = ErrorPayload::BadRequest, ErrorPayload::Type type = ErrorPayload::Cancel, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); - static boost::shared_ptr<IQ> createError( + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); + static std::shared_ptr<IQ> createError( const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition = ErrorPayload::BadRequest, ErrorPayload::Type type = ErrorPayload::Cancel, - boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); + std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()); private: Type type_; diff --git a/Swiften/Elements/Idle.h b/Swiften/Elements/Idle.h index 07ecc74..9f721aa 100644 --- a/Swiften/Elements/Idle.h +++ b/Swiften/Elements/Idle.h @@ -12,8 +12,9 @@ #pragma once +#include <memory> + #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -22,7 +23,7 @@ namespace Swift { class SWIFTEN_API Idle : public Payload { public: - typedef boost::shared_ptr<Idle> ref; + typedef std::shared_ptr<Idle> ref; public: Idle() {} diff --git a/Swiften/Elements/InBandRegistrationPayload.h b/Swiften/Elements/InBandRegistrationPayload.h index a282df8..4fad248 100644 --- a/Swiften/Elements/InBandRegistrationPayload.h +++ b/Swiften/Elements/InBandRegistrationPayload.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Form.h> @@ -18,7 +18,7 @@ namespace Swift { class SWIFTEN_API InBandRegistrationPayload : public Payload { public: - typedef boost::shared_ptr<InBandRegistrationPayload> ref; + typedef std::shared_ptr<InBandRegistrationPayload> ref; InBandRegistrationPayload() : registered(false), remove(false) {} diff --git a/Swiften/Elements/IsodeIQDelegation.h b/Swiften/Elements/IsodeIQDelegation.h index 12fd9bd..39655ce 100644 --- a/Swiften/Elements/IsodeIQDelegation.h +++ b/Swiften/Elements/IsodeIQDelegation.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,16 +21,16 @@ namespace Swift { virtual ~IsodeIQDelegation(); - boost::shared_ptr<Forwarded> getForward() const { + std::shared_ptr<Forwarded> getForward() const { return forward; } - void setForward(boost::shared_ptr<Forwarded> value) { + void setForward(std::shared_ptr<Forwarded> value) { this->forward = value ; } private: - boost::shared_ptr<Forwarded> forward; + std::shared_ptr<Forwarded> forward; }; } diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h index 46751fd..286e08b 100644 --- a/Swiften/Elements/JingleContentPayload.h +++ b/Swiften/Elements/JingleContentPayload.h @@ -20,7 +20,7 @@ namespace Swift { class SWIFTEN_API JingleContentPayload : public Payload { public: - typedef boost::shared_ptr<JingleContentPayload> ref; + typedef std::shared_ptr<JingleContentPayload> ref; enum Creator { UnknownCreator, @@ -62,34 +62,34 @@ namespace Swift { descriptions.push_back(description); } - const std::vector<boost::shared_ptr<JingleTransportPayload> >& getTransports() const { + const std::vector<std::shared_ptr<JingleTransportPayload> >& getTransports() const { return transports; } - void addTransport(boost::shared_ptr<JingleTransportPayload> transport) { + void addTransport(std::shared_ptr<JingleTransportPayload> transport) { transports.push_back(transport); } template<typename T> - boost::shared_ptr<T> getDescription() const { + std::shared_ptr<T> getDescription() const { for (size_t i = 0; i < descriptions.size(); ++i) { - boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(descriptions[i])); + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(descriptions[i])); if (result) { return result; } } - return boost::shared_ptr<T>(); + return std::shared_ptr<T>(); } template<typename T> - boost::shared_ptr<T> getTransport() const { + std::shared_ptr<T> getTransport() const { for (size_t i = 0; i < transports.size(); ++i) { - boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(transports[i])); + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(transports[i])); if (result) { return result; } } - return boost::shared_ptr<T>(); + return std::shared_ptr<T>(); } private: @@ -97,6 +97,6 @@ namespace Swift { std::string name; //Senders senders; std::vector<JingleDescription::ref> descriptions; - std::vector<boost::shared_ptr<JingleTransportPayload> > transports; + std::vector<std::shared_ptr<JingleTransportPayload> > transports; }; } diff --git a/Swiften/Elements/JingleDescription.h b/Swiften/Elements/JingleDescription.h index b52291e..ee3dcae 100644 --- a/Swiften/Elements/JingleDescription.h +++ b/Swiften/Elements/JingleDescription.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -14,6 +14,6 @@ namespace Swift { class SWIFTEN_API JingleDescription : public Payload { public: - typedef boost::shared_ptr<JingleDescription> ref; + typedef std::shared_ptr<JingleDescription> ref; }; } diff --git a/Swiften/Elements/JingleFileTransferDescription.h b/Swiften/Elements/JingleFileTransferDescription.h index 4389bb2..2418f3b 100644 --- a/Swiften/Elements/JingleFileTransferDescription.h +++ b/Swiften/Elements/JingleFileTransferDescription.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleDescription.h> #include <Swiften/Elements/JingleFileTransferFileInfo.h> @@ -17,7 +16,7 @@ namespace Swift { class SWIFTEN_API JingleFileTransferDescription : public JingleDescription { public: - typedef boost::shared_ptr<JingleFileTransferDescription> ref; + typedef std::shared_ptr<JingleFileTransferDescription> ref; void setFileInfo(const JingleFileTransferFileInfo& fileInfo) { fileInfo_ = fileInfo; diff --git a/Swiften/Elements/JingleFileTransferFileInfo.h b/Swiften/Elements/JingleFileTransferFileInfo.h index cc592c4..9fd8756 100644 --- a/Swiften/Elements/JingleFileTransferFileInfo.h +++ b/Swiften/Elements/JingleFileTransferFileInfo.h @@ -7,12 +7,12 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> #include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/HashElement.h> @@ -24,7 +24,7 @@ namespace Swift { * @brief This class represents the file info used in XEP-0234. */ class SWIFTEN_API JingleFileTransferFileInfo : public Payload { - typedef boost::shared_ptr<JingleFileTransferFileInfo> ref; + typedef std::shared_ptr<JingleFileTransferFileInfo> ref; public: JingleFileTransferFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0, const boost::posix_time::ptime &date = boost::posix_time::ptime()) : diff --git a/Swiften/Elements/JingleFileTransferHash.h b/Swiften/Elements/JingleFileTransferHash.h index 42fc23c..4669e1c 100644 --- a/Swiften/Elements/JingleFileTransferHash.h +++ b/Swiften/Elements/JingleFileTransferHash.h @@ -13,10 +13,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleDescription.h> #include <Swiften/Elements/JingleFileTransferFileInfo.h> @@ -25,7 +24,7 @@ namespace Swift { class SWIFTEN_API JingleFileTransferHash : public Payload { public: - typedef boost::shared_ptr<JingleFileTransferHash> ref; + typedef std::shared_ptr<JingleFileTransferHash> ref; void setFileInfo(const JingleFileTransferFileInfo& fileInfo) { fileInfo_ = fileInfo; diff --git a/Swiften/Elements/JingleIBBTransportPayload.h b/Swiften/Elements/JingleIBBTransportPayload.h index 6626f51..8f0a369 100644 --- a/Swiften/Elements/JingleIBBTransportPayload.h +++ b/Swiften/Elements/JingleIBBTransportPayload.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleTransportPayload.h> @@ -17,7 +17,7 @@ namespace Swift { class SWIFTEN_API JingleIBBTransportPayload : public JingleTransportPayload { public: - typedef boost::shared_ptr<JingleIBBTransportPayload> ref; + typedef std::shared_ptr<JingleIBBTransportPayload> ref; enum StanzaType { IQStanza, diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index a862c41..d1dfb44 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/JingleContentPayload.h> @@ -20,7 +20,7 @@ namespace Swift { class SWIFTEN_API JinglePayload : public Payload { public: - typedef boost::shared_ptr<JinglePayload> ref; + typedef std::shared_ptr<JinglePayload> ref; struct Reason : public Payload { enum Type { UnknownType, @@ -109,7 +109,7 @@ namespace Swift { this->payloads.push_back(content); } - void addPayload(boost::shared_ptr<Payload> payload) { + void addPayload(std::shared_ptr<Payload> payload) { this->payloads.push_back(payload); } @@ -117,15 +117,15 @@ namespace Swift { return getPayloads<JingleContentPayload>(); } - const std::vector<boost::shared_ptr<Payload> > getPayloads() const { + const std::vector<std::shared_ptr<Payload> > getPayloads() const { return payloads; } template<typename T> - const std::vector<boost::shared_ptr<T> > getPayloads() const { - std::vector<boost::shared_ptr<T> > matched_payloads; - for (std::vector<boost::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { - boost::shared_ptr<T> result = boost::dynamic_pointer_cast<T>(*i); + const std::vector<std::shared_ptr<T> > getPayloads() const { + std::vector<std::shared_ptr<T> > matched_payloads; + for (std::vector<std::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { + std::shared_ptr<T> result = std::dynamic_pointer_cast<T>(*i); if (result) { matched_payloads.push_back(result); } @@ -136,10 +136,10 @@ namespace Swift { } template<typename T> - const boost::shared_ptr<T> getPayload() const { - boost::shared_ptr<T> result; - for (std::vector<boost::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { - result = boost::dynamic_pointer_cast<T>(*i); + const std::shared_ptr<T> getPayload() const { + std::shared_ptr<T> result; + for (std::vector<std::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { + result = std::dynamic_pointer_cast<T>(*i); if (result) { return result; } @@ -161,7 +161,7 @@ namespace Swift { JID initiator; JID responder; std::string sessionID; - std::vector<boost::shared_ptr<Payload> > payloads; + std::vector<std::shared_ptr<Payload> > payloads; boost::optional<Reason> reason; }; } diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h index bb542f0..5e16243 100644 --- a/Swiften/Elements/JingleS5BTransportPayload.h +++ b/Swiften/Elements/JingleS5BTransportPayload.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Bytestreams.h> #include <Swiften/Elements/JingleTransportPayload.h> @@ -106,7 +105,7 @@ namespace Swift { return proxyError; } public: - typedef boost::shared_ptr<JingleS5BTransportPayload> ref; + typedef std::shared_ptr<JingleS5BTransportPayload> ref; private: Mode mode; diff --git a/Swiften/Elements/JingleTransportPayload.h b/Swiften/Elements/JingleTransportPayload.h index 12a08cd..d777213 100644 --- a/Swiften/Elements/JingleTransportPayload.h +++ b/Swiften/Elements/JingleTransportPayload.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -23,7 +23,7 @@ namespace Swift { } public: - typedef boost::shared_ptr<JingleTransportPayload> ref; + typedef std::shared_ptr<JingleTransportPayload> ref; private: std::string sessionID; diff --git a/Swiften/Elements/MAMFin.h b/Swiften/Elements/MAMFin.h index dd1f7bf..e5e719b 100644 --- a/Swiften/Elements/MAMFin.h +++ b/Swiften/Elements/MAMFin.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -37,11 +37,11 @@ namespace Swift { return isStable_; } - void setResultSet(boost::shared_ptr<ResultSet> resultSet) { + void setResultSet(std::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } - boost::shared_ptr<ResultSet> getResultSet() const { + std::shared_ptr<ResultSet> getResultSet() const { return resultSet_; } @@ -57,7 +57,7 @@ namespace Swift { private: bool isComplete_; bool isStable_; - boost::shared_ptr<ResultSet> resultSet_; + std::shared_ptr<ResultSet> resultSet_; boost::optional<std::string> queryID_; }; } diff --git a/Swiften/Elements/MAMQuery.h b/Swiften/Elements/MAMQuery.h index 253fa0c..764c238 100644 --- a/Swiften/Elements/MAMQuery.h +++ b/Swiften/Elements/MAMQuery.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Form.h> @@ -27,16 +27,16 @@ namespace Swift { void setNode(const boost::optional<std::string>& node) { node_ = node; } const boost::optional<std::string>& getNode() const { return node_; } - void setForm(boost::shared_ptr<Form> form) { form_ = form; } - const boost::shared_ptr<Form>& getForm() const { return form_; } + void setForm(std::shared_ptr<Form> form) { form_ = form; } + const std::shared_ptr<Form>& getForm() const { return form_; } - void setResultSet(boost::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } - const boost::shared_ptr<ResultSet>& getResultSet() const { return resultSet_; } + void setResultSet(std::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } + const std::shared_ptr<ResultSet>& getResultSet() const { return resultSet_; } private: boost::optional<std::string> queryID_; boost::optional<std::string> node_; - boost::shared_ptr<Form> form_; - boost::shared_ptr<ResultSet> resultSet_; + std::shared_ptr<Form> form_; + std::shared_ptr<ResultSet> resultSet_; }; } diff --git a/Swiften/Elements/MUCAdminPayload.h b/Swiften/Elements/MUCAdminPayload.h index c9b01d9..3f78cc8 100644 --- a/Swiften/Elements/MUCAdminPayload.h +++ b/Swiften/Elements/MUCAdminPayload.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/MUCItem.h> @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API MUCAdminPayload : public Payload { public: - typedef boost::shared_ptr<MUCAdminPayload> ref; + typedef std::shared_ptr<MUCAdminPayload> ref; MUCAdminPayload() { diff --git a/Swiften/Elements/MUCDestroyPayload.h b/Swiften/Elements/MUCDestroyPayload.h index 80eb83e..ad1bda2 100644 --- a/Swiften/Elements/MUCDestroyPayload.h +++ b/Swiften/Elements/MUCDestroyPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API MUCDestroyPayload : public Payload { public: - typedef boost::shared_ptr<MUCDestroyPayload> ref; + typedef std::shared_ptr<MUCDestroyPayload> ref; MUCDestroyPayload() { } diff --git a/Swiften/Elements/MUCInvitationPayload.h b/Swiften/Elements/MUCInvitationPayload.h index 508a8ec..545e60f 100644 --- a/Swiften/Elements/MUCInvitationPayload.h +++ b/Swiften/Elements/MUCInvitationPayload.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API MUCInvitationPayload : public Payload { public: - typedef boost::shared_ptr<MUCInvitationPayload> ref; + typedef std::shared_ptr<MUCInvitationPayload> ref; MUCInvitationPayload() : continuation_(false), impromptu_(false) { } diff --git a/Swiften/Elements/MUCOwnerPayload.h b/Swiften/Elements/MUCOwnerPayload.h index f75f677..5f3c633 100644 --- a/Swiften/Elements/MUCOwnerPayload.h +++ b/Swiften/Elements/MUCOwnerPayload.h @@ -15,24 +15,24 @@ namespace Swift { class SWIFTEN_API MUCOwnerPayload : public Payload { public: - typedef boost::shared_ptr<MUCOwnerPayload> ref; + typedef std::shared_ptr<MUCOwnerPayload> ref; MUCOwnerPayload() { } - boost::shared_ptr<Payload> getPayload() const { + std::shared_ptr<Payload> getPayload() const { return payload; } - void setPayload(boost::shared_ptr<Payload> p) { + void setPayload(std::shared_ptr<Payload> p) { payload = p; } Form::ref getForm() { - return boost::dynamic_pointer_cast<Form>(payload); + return std::dynamic_pointer_cast<Form>(payload); } private: - boost::shared_ptr<Payload> payload; + std::shared_ptr<Payload> payload; }; } diff --git a/Swiften/Elements/MUCPayload.h b/Swiften/Elements/MUCPayload.h index 8588ca2..6e199e5 100644 --- a/Swiften/Elements/MUCPayload.h +++ b/Swiften/Elements/MUCPayload.h @@ -18,7 +18,7 @@ namespace Swift { class SWIFTEN_API MUCPayload : public Payload { public: - typedef boost::shared_ptr<MUCPayload> ref; + typedef std::shared_ptr<MUCPayload> ref; MUCPayload() { maxChars_ = -1; diff --git a/Swiften/Elements/MUCUserPayload.h b/Swiften/Elements/MUCUserPayload.h index e83c2d0..dd57376 100644 --- a/Swiften/Elements/MUCUserPayload.h +++ b/Swiften/Elements/MUCUserPayload.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/MUCItem.h> @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API MUCUserPayload : public Payload { public: - typedef boost::shared_ptr<MUCUserPayload> ref; + typedef std::shared_ptr<MUCUserPayload> ref; struct StatusCode { StatusCode() : code(0) {} @@ -61,11 +61,11 @@ namespace Swift { const std::vector<StatusCode>& getStatusCodes() const {return statusCodes_;} - boost::shared_ptr<Payload> getPayload() const { + std::shared_ptr<Payload> getPayload() const { return payload_; } - void setPayload(boost::shared_ptr<Payload> p) { + void setPayload(std::shared_ptr<Payload> p) { payload_ = p; } @@ -90,7 +90,7 @@ namespace Swift { private: std::vector<MUCItem> items_; std::vector<StatusCode> statusCodes_; - boost::shared_ptr<Payload> payload_; + std::shared_ptr<Payload> payload_; boost::optional<std::string> password_; boost::optional<Invite> invite_; }; diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index c55e04b..f276ef7 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Body.h> @@ -22,14 +21,14 @@ namespace Swift { class SWIFTEN_API Message : public Stanza { public: - typedef boost::shared_ptr<Message> ref; + typedef std::shared_ptr<Message> ref; enum Type { Normal, Chat, Error, Groupchat, Headline }; Message() : type_(Chat) { } std::string getSubject() const { - boost::shared_ptr<Subject> subject(getPayload<Subject>()); + std::shared_ptr<Subject> subject(getPayload<Subject>()); if (subject) { return subject->getText(); } @@ -37,7 +36,7 @@ namespace Swift { } void setSubject(const std::string& subject) { - updatePayload(boost::make_shared<Subject>(subject)); + updatePayload(std::make_shared<Subject>(subject)); } // Explicitly convert to bool. In C++11, it would be cleaner to @@ -47,7 +46,7 @@ namespace Swift { } boost::optional<std::string> getBody() const { - boost::shared_ptr<Body> body(getPayload<Body>()); + std::shared_ptr<Body> body(getPayload<Body>()); boost::optional<std::string> bodyData; if (body) { bodyData = body->getText(); @@ -61,15 +60,15 @@ namespace Swift { void setBody(const boost::optional<std::string>& body) { if (body) { - updatePayload(boost::make_shared<Body>(body.get())); + updatePayload(std::make_shared<Body>(body.get())); } else { - removePayloadOfSameType(boost::make_shared<Body>()); + removePayloadOfSameType(std::make_shared<Body>()); } } bool isError() { - boost::shared_ptr<Swift::ErrorPayload> error(getPayload<Swift::ErrorPayload>()); + std::shared_ptr<Swift::ErrorPayload> error(getPayload<Swift::ErrorPayload>()); return getType() == Message::Error || error; } diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h index e31afa9..9923f0b 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Element.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API Payload : public Element { public: - typedef boost::shared_ptr<Payload> ref; + typedef std::shared_ptr<Payload> ref; public: Payload() {} SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Payload) diff --git a/Swiften/Elements/Presence.cpp b/Swiften/Elements/Presence.cpp index 344efc1..f75f3be 100644 --- a/Swiften/Elements/Presence.cpp +++ b/Swiften/Elements/Presence.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,16 +22,16 @@ Presence::~Presence() { } int Presence::getPriority() const { - boost::shared_ptr<Priority> priority(getPayload<Priority>()); + std::shared_ptr<Priority> priority(getPayload<Priority>()); return (priority ? priority->getPriority() : 0); } void Presence::setPriority(int priority) { - updatePayload(boost::make_shared<Priority>(priority)); + updatePayload(std::make_shared<Priority>(priority)); } std::string Presence::getStatus() const { - boost::shared_ptr<Status> status(getPayload<Status>()); + std::shared_ptr<Status> status(getPayload<Status>()); if (status) { return status->getText(); } @@ -39,7 +39,7 @@ std::string Presence::getStatus() const { } void Presence::setStatus(const std::string& status) { - updatePayload(boost::make_shared<Status>(status)); + updatePayload(std::make_shared<Status>(status)); } } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 0b6ee5f..e658606 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Stanza.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API Presence : public Stanza { public: - typedef boost::shared_ptr<Presence> ref; + typedef std::shared_ptr<Presence> ref; enum Type { Available, Error, Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed }; @@ -25,22 +25,22 @@ namespace Swift { virtual ~Presence(); static ref create() { - return boost::make_shared<Presence>(); + return std::make_shared<Presence>(); } static ref create(const std::string& status) { - return boost::make_shared<Presence>(status); + return std::make_shared<Presence>(status); } static ref create(Presence::ref presence) { - return boost::make_shared<Presence>(*presence); + return std::make_shared<Presence>(*presence); } Type getType() const { return type_; } void setType(Type type) { type_ = type; } StatusShow::Type getShow() const { - boost::shared_ptr<StatusShow> show(getPayload<StatusShow>()); + std::shared_ptr<StatusShow> show(getPayload<StatusShow>()); if (show) { return show->getType(); } @@ -48,7 +48,7 @@ namespace Swift { } void setShow(const StatusShow::Type &show) { - updatePayload(boost::make_shared<StatusShow>(show)); + updatePayload(std::make_shared<StatusShow>(show)); } std::string getStatus() const; @@ -57,8 +57,8 @@ namespace Swift { int getPriority() const; void setPriority(int priority); - boost::shared_ptr<Presence> clone() const { - return boost::make_shared<Presence>(*this); + std::shared_ptr<Presence> clone() const { + return std::make_shared<Presence>(*this); } bool isAvailable() const { diff --git a/Swiften/Elements/PrivateStorage.h b/Swiften/Elements/PrivateStorage.h index e1f97d5..dfae34c 100644 --- a/Swiften/Elements/PrivateStorage.h +++ b/Swiften/Elements/PrivateStorage.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -14,18 +14,18 @@ namespace Swift { class SWIFTEN_API PrivateStorage : public Payload { public: - PrivateStorage(boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()) : payload(payload) { + PrivateStorage(std::shared_ptr<Payload> payload = std::shared_ptr<Payload>()) : payload(payload) { } - boost::shared_ptr<Payload> getPayload() const { + std::shared_ptr<Payload> getPayload() const { return payload; } - void setPayload(boost::shared_ptr<Payload> p) { + void setPayload(std::shared_ptr<Payload> p) { payload = p; } private: - boost::shared_ptr<Payload> payload; + std::shared_ptr<Payload> payload; }; } diff --git a/Swiften/Elements/PubSubAffiliations.h b/Swiften/Elements/PubSubAffiliations.h index 9f66056..c7e22ce 100644 --- a/Swiften/Elements/PubSubAffiliations.h +++ b/Swiften/Elements/PubSubAffiliations.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -34,21 +34,21 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubAffiliation> >& getAffiliations() const { + const std::vector< std::shared_ptr<PubSubAffiliation> >& getAffiliations() const { return affiliations; } - void setAffiliations(const std::vector< boost::shared_ptr<PubSubAffiliation> >& value) { + void setAffiliations(const std::vector< std::shared_ptr<PubSubAffiliation> >& value) { this->affiliations = value ; } - void addAffiliation(boost::shared_ptr<PubSubAffiliation> value) { + void addAffiliation(std::shared_ptr<PubSubAffiliation> value) { this->affiliations.push_back(value); } private: boost::optional< std::string > node; - std::vector< boost::shared_ptr<PubSubAffiliation> > affiliations; + std::vector< std::shared_ptr<PubSubAffiliation> > affiliations; }; } diff --git a/Swiften/Elements/PubSubConfigure.h b/Swiften/Elements/PubSubConfigure.h index e8f3cbc..8442198 100644 --- a/Swiften/Elements/PubSubConfigure.h +++ b/Swiften/Elements/PubSubConfigure.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,16 +21,16 @@ namespace Swift { virtual ~PubSubConfigure(); - boost::shared_ptr<Form> getData() const { + std::shared_ptr<Form> getData() const { return data; } - void setData(boost::shared_ptr<Form> value) { + void setData(std::shared_ptr<Form> value) { this->data = value ; } private: - boost::shared_ptr<Form> data; + std::shared_ptr<Form> data; }; } diff --git a/Swiften/Elements/PubSubCreate.h b/Swiften/Elements/PubSubCreate.h index b2226c4..5ece36e 100644 --- a/Swiften/Elements/PubSubCreate.h +++ b/Swiften/Elements/PubSubCreate.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -32,17 +31,17 @@ namespace Swift { this->node = value ; } - boost::shared_ptr<PubSubConfigure> getConfigure() const { + std::shared_ptr<PubSubConfigure> getConfigure() const { return configure; } - void setConfigure(boost::shared_ptr<PubSubConfigure> value) { + void setConfigure(std::shared_ptr<PubSubConfigure> value) { this->configure = value ; } private: std::string node; - boost::shared_ptr<PubSubConfigure> configure; + std::shared_ptr<PubSubConfigure> configure; }; } diff --git a/Swiften/Elements/PubSubEvent.h b/Swiften/Elements/PubSubEvent.h index 85d9bed..8f02258 100644 --- a/Swiften/Elements/PubSubEvent.h +++ b/Swiften/Elements/PubSubEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> diff --git a/Swiften/Elements/PubSubEventCollection.h b/Swiften/Elements/PubSubEventCollection.h index 390fa58..61056e2 100644 --- a/Swiften/Elements/PubSubEventCollection.h +++ b/Swiften/Elements/PubSubEventCollection.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -34,26 +34,26 @@ namespace Swift { this->node = value ; } - boost::shared_ptr<PubSubEventDisassociate> getDisassociate() const { + std::shared_ptr<PubSubEventDisassociate> getDisassociate() const { return disassociate; } - void setDisassociate(boost::shared_ptr<PubSubEventDisassociate> value) { + void setDisassociate(std::shared_ptr<PubSubEventDisassociate> value) { this->disassociate = value ; } - boost::shared_ptr<PubSubEventAssociate> getAssociate() const { + std::shared_ptr<PubSubEventAssociate> getAssociate() const { return associate; } - void setAssociate(boost::shared_ptr<PubSubEventAssociate> value) { + void setAssociate(std::shared_ptr<PubSubEventAssociate> value) { this->associate = value ; } private: boost::optional< std::string > node; - boost::shared_ptr<PubSubEventDisassociate> disassociate; - boost::shared_ptr<PubSubEventAssociate> associate; + std::shared_ptr<PubSubEventDisassociate> disassociate; + std::shared_ptr<PubSubEventAssociate> associate; }; } diff --git a/Swiften/Elements/PubSubEventConfiguration.h b/Swiften/Elements/PubSubEventConfiguration.h index 14639ab..6c5305d 100644 --- a/Swiften/Elements/PubSubEventConfiguration.h +++ b/Swiften/Elements/PubSubEventConfiguration.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Form.h> @@ -32,17 +31,17 @@ namespace Swift { this->node = value ; } - boost::shared_ptr<Form> getData() const { + std::shared_ptr<Form> getData() const { return data; } - void setData(boost::shared_ptr<Form> value) { + void setData(std::shared_ptr<Form> value) { this->data = value ; } private: std::string node; - boost::shared_ptr<Form> data; + std::shared_ptr<Form> data; }; } diff --git a/Swiften/Elements/PubSubEventDelete.h b/Swiften/Elements/PubSubEventDelete.h index a778276..787dce0 100644 --- a/Swiften/Elements/PubSubEventDelete.h +++ b/Swiften/Elements/PubSubEventDelete.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -32,17 +31,17 @@ namespace Swift { this->node = value ; } - boost::shared_ptr<PubSubEventRedirect> getRedirects() const { + std::shared_ptr<PubSubEventRedirect> getRedirects() const { return redirects; } - void setRedirects(boost::shared_ptr<PubSubEventRedirect> value) { + void setRedirects(std::shared_ptr<PubSubEventRedirect> value) { this->redirects = value ; } private: std::string node; - boost::shared_ptr<PubSubEventRedirect> redirects; + std::shared_ptr<PubSubEventRedirect> redirects; }; } diff --git a/Swiften/Elements/PubSubEventItem.h b/Swiften/Elements/PubSubEventItem.h index bbadab9..50e8757 100644 --- a/Swiften/Elements/PubSubEventItem.h +++ b/Swiften/Elements/PubSubEventItem.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -40,15 +40,15 @@ namespace Swift { this->publisher = value ; } - const std::vector< boost::shared_ptr<Payload> >& getData() const { + const std::vector< std::shared_ptr<Payload> >& getData() const { return data; } - void setData(const std::vector< boost::shared_ptr<Payload> >& value) { + void setData(const std::vector< std::shared_ptr<Payload> >& value) { this->data = value ; } - void addData(boost::shared_ptr<Payload> value) { + void addData(std::shared_ptr<Payload> value) { this->data.push_back(value); } @@ -64,7 +64,7 @@ namespace Swift { private: boost::optional< std::string > node; boost::optional< std::string > publisher; - std::vector< boost::shared_ptr<Payload> > data; + std::vector< std::shared_ptr<Payload> > data; boost::optional< std::string > id; }; } diff --git a/Swiften/Elements/PubSubEventItems.h b/Swiften/Elements/PubSubEventItems.h index 9d1e09b..48fd340 100644 --- a/Swiften/Elements/PubSubEventItems.h +++ b/Swiften/Elements/PubSubEventItems.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -34,34 +33,34 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubEventItem> >& getItems() const { + const std::vector< std::shared_ptr<PubSubEventItem> >& getItems() const { return items; } - void setItems(const std::vector< boost::shared_ptr<PubSubEventItem> >& value) { + void setItems(const std::vector< std::shared_ptr<PubSubEventItem> >& value) { this->items = value ; } - void addItem(boost::shared_ptr<PubSubEventItem> value) { + void addItem(std::shared_ptr<PubSubEventItem> value) { this->items.push_back(value); } - const std::vector< boost::shared_ptr<PubSubEventRetract> >& getRetracts() const { + const std::vector< std::shared_ptr<PubSubEventRetract> >& getRetracts() const { return retracts; } - void setRetracts(const std::vector< boost::shared_ptr<PubSubEventRetract> >& value) { + void setRetracts(const std::vector< std::shared_ptr<PubSubEventRetract> >& value) { this->retracts = value ; } - void addRetract(boost::shared_ptr<PubSubEventRetract> value) { + void addRetract(std::shared_ptr<PubSubEventRetract> value) { this->retracts.push_back(value); } private: std::string node; - std::vector< boost::shared_ptr<PubSubEventItem> > items; - std::vector< boost::shared_ptr<PubSubEventRetract> > retracts; + std::vector< std::shared_ptr<PubSubEventItem> > items; + std::vector< std::shared_ptr<PubSubEventRetract> > retracts; }; } diff --git a/Swiften/Elements/PubSubItem.h b/Swiften/Elements/PubSubItem.h index 5a16edc..d424ae4 100644 --- a/Swiften/Elements/PubSubItem.h +++ b/Swiften/Elements/PubSubItem.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -23,15 +22,15 @@ namespace Swift { virtual ~PubSubItem(); - const std::vector< boost::shared_ptr<Payload> >& getData() const { + const std::vector< std::shared_ptr<Payload> >& getData() const { return data; } - void setData(const std::vector< boost::shared_ptr<Payload> >& value) { + void setData(const std::vector< std::shared_ptr<Payload> >& value) { this->data = value ; } - void addData(boost::shared_ptr<Payload> value) { + void addData(std::shared_ptr<Payload> value) { this->data.push_back(value); } @@ -45,7 +44,7 @@ namespace Swift { private: - std::vector< boost::shared_ptr<Payload> > data; + std::vector< std::shared_ptr<Payload> > data; std::string id; }; } diff --git a/Swiften/Elements/PubSubItems.h b/Swiften/Elements/PubSubItems.h index b7d8fcc..9903075 100644 --- a/Swiften/Elements/PubSubItems.h +++ b/Swiften/Elements/PubSubItems.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -34,15 +34,15 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { + const std::vector< std::shared_ptr<PubSubItem> >& getItems() const { return items; } - void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { + void setItems(const std::vector< std::shared_ptr<PubSubItem> >& value) { this->items = value ; } - void addItem(boost::shared_ptr<PubSubItem> value) { + void addItem(std::shared_ptr<PubSubItem> value) { this->items.push_back(value); } @@ -65,7 +65,7 @@ namespace Swift { private: std::string node; - std::vector< boost::shared_ptr<PubSubItem> > items; + std::vector< std::shared_ptr<PubSubItem> > items; boost::optional< unsigned int > maximumItems; boost::optional< std::string > subscriptionID; }; diff --git a/Swiften/Elements/PubSubOptions.h b/Swiften/Elements/PubSubOptions.h index fffc175..2b312a7 100644 --- a/Swiften/Elements/PubSubOptions.h +++ b/Swiften/Elements/PubSubOptions.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -42,11 +42,11 @@ namespace Swift { this->jid = value ; } - boost::shared_ptr<Form> getData() const { + std::shared_ptr<Form> getData() const { return data; } - void setData(boost::shared_ptr<Form> value) { + void setData(std::shared_ptr<Form> value) { this->data = value ; } @@ -62,7 +62,7 @@ namespace Swift { private: std::string node; JID jid; - boost::shared_ptr<Form> data; + std::shared_ptr<Form> data; boost::optional< std::string > subscriptionID; }; } diff --git a/Swiften/Elements/PubSubOwnerAffiliations.h b/Swiften/Elements/PubSubOwnerAffiliations.h index 5005b01..f1085bb 100644 --- a/Swiften/Elements/PubSubOwnerAffiliations.h +++ b/Swiften/Elements/PubSubOwnerAffiliations.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -33,21 +32,21 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubOwnerAffiliation> >& getAffiliations() const { + const std::vector< std::shared_ptr<PubSubOwnerAffiliation> >& getAffiliations() const { return affiliations; } - void setAffiliations(const std::vector< boost::shared_ptr<PubSubOwnerAffiliation> >& value) { + void setAffiliations(const std::vector< std::shared_ptr<PubSubOwnerAffiliation> >& value) { this->affiliations = value ; } - void addAffiliation(boost::shared_ptr<PubSubOwnerAffiliation> value) { + void addAffiliation(std::shared_ptr<PubSubOwnerAffiliation> value) { this->affiliations.push_back(value); } private: std::string node; - std::vector< boost::shared_ptr<PubSubOwnerAffiliation> > affiliations; + std::vector< std::shared_ptr<PubSubOwnerAffiliation> > affiliations; }; } diff --git a/Swiften/Elements/PubSubOwnerConfigure.h b/Swiften/Elements/PubSubOwnerConfigure.h index 086095c..7dcf792 100644 --- a/Swiften/Elements/PubSubOwnerConfigure.h +++ b/Swiften/Elements/PubSubOwnerConfigure.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -33,17 +33,17 @@ namespace Swift { this->node = value ; } - boost::shared_ptr<Form> getData() const { + std::shared_ptr<Form> getData() const { return data; } - void setData(boost::shared_ptr<Form> value) { + void setData(std::shared_ptr<Form> value) { this->data = value ; } private: boost::optional< std::string > node; - boost::shared_ptr<Form> data; + std::shared_ptr<Form> data; }; } diff --git a/Swiften/Elements/PubSubOwnerDefault.h b/Swiften/Elements/PubSubOwnerDefault.h index a0b82f7..322f47a 100644 --- a/Swiften/Elements/PubSubOwnerDefault.h +++ b/Swiften/Elements/PubSubOwnerDefault.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -22,16 +22,16 @@ namespace Swift { virtual ~PubSubOwnerDefault(); - boost::shared_ptr<Form> getData() const { + std::shared_ptr<Form> getData() const { return data; } - void setData(boost::shared_ptr<Form> value) { + void setData(std::shared_ptr<Form> value) { this->data = value ; } private: - boost::shared_ptr<Form> data; + std::shared_ptr<Form> data; }; } diff --git a/Swiften/Elements/PubSubOwnerDelete.h b/Swiften/Elements/PubSubOwnerDelete.h index 7f908a1..7cc5d79 100644 --- a/Swiften/Elements/PubSubOwnerDelete.h +++ b/Swiften/Elements/PubSubOwnerDelete.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -32,17 +31,17 @@ namespace Swift { this->node = value ; } - boost::shared_ptr<PubSubOwnerRedirect> getRedirect() const { + std::shared_ptr<PubSubOwnerRedirect> getRedirect() const { return redirect; } - void setRedirect(boost::shared_ptr<PubSubOwnerRedirect> value) { + void setRedirect(std::shared_ptr<PubSubOwnerRedirect> value) { this->redirect = value ; } private: std::string node; - boost::shared_ptr<PubSubOwnerRedirect> redirect; + std::shared_ptr<PubSubOwnerRedirect> redirect; }; } diff --git a/Swiften/Elements/PubSubOwnerSubscriptions.h b/Swiften/Elements/PubSubOwnerSubscriptions.h index 44c31b8..ec5aa17 100644 --- a/Swiften/Elements/PubSubOwnerSubscriptions.h +++ b/Swiften/Elements/PubSubOwnerSubscriptions.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -33,21 +32,21 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubOwnerSubscription> >& getSubscriptions() const { + const std::vector< std::shared_ptr<PubSubOwnerSubscription> >& getSubscriptions() const { return subscriptions; } - void setSubscriptions(const std::vector< boost::shared_ptr<PubSubOwnerSubscription> >& value) { + void setSubscriptions(const std::vector< std::shared_ptr<PubSubOwnerSubscription> >& value) { this->subscriptions = value ; } - void addSubscription(boost::shared_ptr<PubSubOwnerSubscription> value) { + void addSubscription(std::shared_ptr<PubSubOwnerSubscription> value) { this->subscriptions.push_back(value); } private: std::string node; - std::vector< boost::shared_ptr<PubSubOwnerSubscription> > subscriptions; + std::vector< std::shared_ptr<PubSubOwnerSubscription> > subscriptions; }; } diff --git a/Swiften/Elements/PubSubPublish.h b/Swiften/Elements/PubSubPublish.h index a6fca8d..dff099b 100644 --- a/Swiften/Elements/PubSubPublish.h +++ b/Swiften/Elements/PubSubPublish.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -33,21 +32,21 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { + const std::vector< std::shared_ptr<PubSubItem> >& getItems() const { return items; } - void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { + void setItems(const std::vector< std::shared_ptr<PubSubItem> >& value) { this->items = value ; } - void addItem(boost::shared_ptr<PubSubItem> value) { + void addItem(std::shared_ptr<PubSubItem> value) { this->items.push_back(value); } private: std::string node; - std::vector< boost::shared_ptr<PubSubItem> > items; + std::vector< std::shared_ptr<PubSubItem> > items; }; } diff --git a/Swiften/Elements/PubSubRetract.h b/Swiften/Elements/PubSubRetract.h index 60ceb28..0d30c31 100644 --- a/Swiften/Elements/PubSubRetract.h +++ b/Swiften/Elements/PubSubRetract.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/Payload.h> @@ -33,15 +32,15 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { + const std::vector< std::shared_ptr<PubSubItem> >& getItems() const { return items; } - void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { + void setItems(const std::vector< std::shared_ptr<PubSubItem> >& value) { this->items = value ; } - void addItem(boost::shared_ptr<PubSubItem> value) { + void addItem(std::shared_ptr<PubSubItem> value) { this->items.push_back(value); } @@ -56,7 +55,7 @@ namespace Swift { private: std::string node; - std::vector< boost::shared_ptr<PubSubItem> > items; + std::vector< std::shared_ptr<PubSubItem> > items; bool notify; }; } diff --git a/Swiften/Elements/PubSubSubscribe.h b/Swiften/Elements/PubSubSubscribe.h index 8c57a21..a4c0b68 100644 --- a/Swiften/Elements/PubSubSubscribe.h +++ b/Swiften/Elements/PubSubSubscribe.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -42,11 +42,11 @@ namespace Swift { this->jid = value ; } - boost::shared_ptr<PubSubOptions> getOptions() const { + std::shared_ptr<PubSubOptions> getOptions() const { return options; } - void setOptions(boost::shared_ptr<PubSubOptions> value) { + void setOptions(std::shared_ptr<PubSubOptions> value) { this->options = value ; } @@ -54,6 +54,6 @@ namespace Swift { private: boost::optional< std::string > node; JID jid; - boost::shared_ptr<PubSubOptions> options; + std::shared_ptr<PubSubOptions> options; }; } diff --git a/Swiften/Elements/PubSubSubscription.h b/Swiften/Elements/PubSubSubscription.h index 5bb1194..e2b527f 100644 --- a/Swiften/Elements/PubSubSubscription.h +++ b/Swiften/Elements/PubSubSubscription.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -56,11 +56,11 @@ namespace Swift { this->jid = value ; } - boost::shared_ptr<PubSubSubscribeOptions> getOptions() const { + std::shared_ptr<PubSubSubscribeOptions> getOptions() const { return options; } - void setOptions(boost::shared_ptr<PubSubSubscribeOptions> value) { + void setOptions(std::shared_ptr<PubSubSubscribeOptions> value) { this->options = value ; } @@ -77,7 +77,7 @@ namespace Swift { boost::optional< std::string > node; boost::optional< std::string > subscriptionID; JID jid; - boost::shared_ptr<PubSubSubscribeOptions> options; + std::shared_ptr<PubSubSubscribeOptions> options; SubscriptionType subscription; }; } diff --git a/Swiften/Elements/PubSubSubscriptions.h b/Swiften/Elements/PubSubSubscriptions.h index 63fc402..441e6c1 100644 --- a/Swiften/Elements/PubSubSubscriptions.h +++ b/Swiften/Elements/PubSubSubscriptions.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -34,21 +34,21 @@ namespace Swift { this->node = value ; } - const std::vector< boost::shared_ptr<PubSubSubscription> >& getSubscriptions() const { + const std::vector< std::shared_ptr<PubSubSubscription> >& getSubscriptions() const { return subscriptions; } - void setSubscriptions(const std::vector< boost::shared_ptr<PubSubSubscription> >& value) { + void setSubscriptions(const std::vector< std::shared_ptr<PubSubSubscription> >& value) { this->subscriptions = value ; } - void addSubscription(boost::shared_ptr<PubSubSubscription> value) { + void addSubscription(std::shared_ptr<PubSubSubscription> value) { this->subscriptions.push_back(value); } private: boost::optional< std::string > node; - std::vector< boost::shared_ptr<PubSubSubscription> > subscriptions; + std::vector< std::shared_ptr<PubSubSubscription> > subscriptions; }; } diff --git a/Swiften/Elements/Replace.h b/Swiften/Elements/Replace.h index b64777f..d51981d 100644 --- a/Swiften/Elements/Replace.h +++ b/Swiften/Elements/Replace.h @@ -12,17 +12,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { class SWIFTEN_API Replace : public Payload { public: - typedef boost::shared_ptr<Replace> ref; + typedef std::shared_ptr<Replace> ref; Replace(const std::string& id = std::string()) : replaceID_(id) {} const std::string& getID() const { return replaceID_; diff --git a/Swiften/Elements/ResultSet.h b/Swiften/Elements/ResultSet.h index 44995d1..c8e59d4 100644 --- a/Swiften/Elements/ResultSet.h +++ b/Swiften/Elements/ResultSet.h @@ -6,6 +6,8 @@ #pragma once +#include <string> + #include <boost/optional.hpp> #include <Swiften/Base/API.h> diff --git a/Swiften/Elements/RosterItemExchangePayload.h b/Swiften/Elements/RosterItemExchangePayload.h index 5090aff..fc61f3d 100644 --- a/Swiften/Elements/RosterItemExchangePayload.h +++ b/Swiften/Elements/RosterItemExchangePayload.h @@ -12,11 +12,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> @@ -24,7 +23,7 @@ namespace Swift { class SWIFTEN_API RosterItemExchangePayload : public Payload { public: - typedef boost::shared_ptr<RosterItemExchangePayload> ref; + typedef std::shared_ptr<RosterItemExchangePayload> ref; class SWIFTEN_API Item { public: diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h index 35e81cd..5fc6bd1 100644 --- a/Swiften/Elements/RosterPayload.h +++ b/Swiften/Elements/RosterPayload.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -18,7 +18,7 @@ namespace Swift { class SWIFTEN_API RosterPayload : public Payload { public: - typedef boost::shared_ptr<RosterPayload> ref; + typedef std::shared_ptr<RosterPayload> ref; typedef std::vector<RosterItemPayload> RosterItemPayloads; public: diff --git a/Swiften/Elements/S5BProxyRequest.h b/Swiften/Elements/S5BProxyRequest.h index cbc7d5b..e3f5206 100644 --- a/Swiften/Elements/S5BProxyRequest.h +++ b/Swiften/Elements/S5BProxyRequest.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,7 +25,7 @@ namespace Swift { class SWIFTEN_API S5BProxyRequest : public Payload { public: - typedef boost::shared_ptr<S5BProxyRequest> ref; + typedef std::shared_ptr<S5BProxyRequest> ref; public: struct StreamHost { diff --git a/Swiften/Elements/SearchPayload.h b/Swiften/Elements/SearchPayload.h index 6784291..0fcb2b1 100644 --- a/Swiften/Elements/SearchPayload.h +++ b/Swiften/Elements/SearchPayload.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Form.h> @@ -21,7 +21,7 @@ namespace Swift { */ class SWIFTEN_API SearchPayload : public Payload { public: - typedef boost::shared_ptr<SearchPayload> ref; + typedef std::shared_ptr<SearchPayload> ref; struct Item { std::string first; diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h index 8e6db64..ba4d294 100644 --- a/Swiften/Elements/SecurityLabelsCatalog.h +++ b/Swiften/Elements/SecurityLabelsCatalog.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/SecurityLabel.h> @@ -19,15 +18,15 @@ namespace Swift { class SWIFTEN_API SecurityLabelsCatalog : public Payload { public: - typedef boost::shared_ptr<SecurityLabelsCatalog> ref; + typedef std::shared_ptr<SecurityLabelsCatalog> ref; class Item { public: Item() : default_(false) {} - boost::shared_ptr<SecurityLabel> getLabel() const { + std::shared_ptr<SecurityLabel> getLabel() const { return label_; } - void setLabel(boost::shared_ptr<SecurityLabel> label) { + void setLabel(std::shared_ptr<SecurityLabel> label) { label_ = label; } @@ -43,7 +42,7 @@ namespace Swift { default_ = isDefault; } private: - boost::shared_ptr<SecurityLabel> label_; + std::shared_ptr<SecurityLabel> label_; std::string selector_; bool default_; }; diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h index 57318b9..2bf582e 100644 --- a/Swiften/Elements/SoftwareVersion.h +++ b/Swiften/Elements/SoftwareVersion.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { class SWIFTEN_API SoftwareVersion : public Payload { public: - typedef boost::shared_ptr<SoftwareVersion> ref; + typedef std::shared_ptr<SoftwareVersion> ref; SoftwareVersion( const std::string& name = "", diff --git a/Swiften/Elements/Stanza.cpp b/Swiften/Elements/Stanza.cpp index 617be4e..5d1229c 100644 --- a/Swiften/Elements/Stanza.cpp +++ b/Swiften/Elements/Stanza.cpp @@ -22,8 +22,8 @@ Stanza::~Stanza() { payloads_.clear(); } -void Stanza::updatePayload(boost::shared_ptr<Payload> payload) { - foreach (boost::shared_ptr<Payload>& i, payloads_) { +void Stanza::updatePayload(std::shared_ptr<Payload> payload) { + foreach (std::shared_ptr<Payload>& i, payloads_) { if (typeid(*i.get()) == typeid(*payload.get())) { i = payload; return; @@ -32,32 +32,32 @@ void Stanza::updatePayload(boost::shared_ptr<Payload> payload) { addPayload(payload); } -static bool sameType(boost::shared_ptr<Payload> a, boost::shared_ptr<Payload> b) { +static bool sameType(std::shared_ptr<Payload> a, std::shared_ptr<Payload> b) { return typeid(*a.get()) == typeid(*b.get()); } -void Stanza::removePayloadOfSameType(boost::shared_ptr<Payload> payload) { +void Stanza::removePayloadOfSameType(std::shared_ptr<Payload> payload) { payloads_.erase(std::remove_if(payloads_.begin(), payloads_.end(), boost::bind<bool>(&sameType, payload, _1)), payloads_.end()); } -boost::shared_ptr<Payload> Stanza::getPayloadOfSameType(boost::shared_ptr<Payload> payload) const { - foreach (const boost::shared_ptr<Payload>& i, payloads_) { +std::shared_ptr<Payload> Stanza::getPayloadOfSameType(std::shared_ptr<Payload> payload) const { + foreach (const std::shared_ptr<Payload>& i, payloads_) { if (typeid(*i.get()) == typeid(*payload.get())) { return i; } } - return boost::shared_ptr<Payload>(); + return std::shared_ptr<Payload>(); } boost::optional<boost::posix_time::ptime> Stanza::getTimestamp() const { - boost::shared_ptr<Delay> delay = getPayload<Delay>(); + std::shared_ptr<Delay> delay = getPayload<Delay>(); return delay ? delay->getStamp() : boost::optional<boost::posix_time::ptime>(); } boost::optional<boost::posix_time::ptime> Stanza::getTimestampFrom(const JID& jid) const { - std::vector< boost::shared_ptr<Delay> > delays = getPayloads<Delay>(); + std::vector< std::shared_ptr<Delay> > delays = getPayloads<Delay>(); for (size_t i = 0; i < delays.size(); ++i) { if (delays[i]->getFrom() == jid) { return delays[i]->getStamp(); diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index 765aca8..2df64a1 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -6,12 +6,12 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/date_time/posix_time/ptime.hpp> #include <boost/optional/optional_fwd.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> @@ -22,7 +22,7 @@ namespace Swift { class SWIFTEN_API Stanza : public ToplevelElement { public: - typedef boost::shared_ptr<Stanza> ref; + typedef std::shared_ptr<Stanza> ref; protected: Stanza(); @@ -32,21 +32,21 @@ namespace Swift { SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Stanza) template<typename T> - boost::shared_ptr<T> getPayload() const { + std::shared_ptr<T> getPayload() const { for (size_t i = 0; i < payloads_.size(); ++i) { - boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(payloads_[i])); + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payloads_[i])); if (result) { return result; } } - return boost::shared_ptr<T>(); + return std::shared_ptr<T>(); } template<typename T> - std::vector< boost::shared_ptr<T> > getPayloads() const { - std::vector< boost::shared_ptr<T> > results; + std::vector< std::shared_ptr<T> > getPayloads() const { + std::vector< std::shared_ptr<T> > results; for (size_t i = 0; i < payloads_.size(); ++i) { - boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(payloads_[i])); + std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payloads_[i])); if (result) { results.push_back(result); } @@ -55,11 +55,11 @@ namespace Swift { } - const std::vector< boost::shared_ptr<Payload> >& getPayloads() const { + const std::vector< std::shared_ptr<Payload> >& getPayloads() const { return payloads_; } - void addPayload(boost::shared_ptr<Payload> payload) { + void addPayload(std::shared_ptr<Payload> payload) { payloads_.push_back(payload); } @@ -68,10 +68,10 @@ namespace Swift { payloads_.insert(payloads_.end(), begin, end); } - void updatePayload(boost::shared_ptr<Payload> payload); + void updatePayload(std::shared_ptr<Payload> payload); - void removePayloadOfSameType(boost::shared_ptr<Payload>); - boost::shared_ptr<Payload> getPayloadOfSameType(boost::shared_ptr<Payload>) const; + void removePayloadOfSameType(std::shared_ptr<Payload>); + std::shared_ptr<Payload> getPayloadOfSameType(std::shared_ptr<Payload>) const; const JID& getFrom() const { return from_; } void setFrom(const JID& from) { from_ = from; } @@ -91,6 +91,6 @@ namespace Swift { std::string id_; JID from_; JID to_; - std::vector< boost::shared_ptr<Payload> > payloads_; + std::vector< std::shared_ptr<Payload> > payloads_; }; } diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h index 45680c0..68f0a2f 100644 --- a/Swiften/Elements/StanzaAck.h +++ b/Swiften/Elements/StanzaAck.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API StanzaAck : public ToplevelElement { public: - typedef boost::shared_ptr<StanzaAck> ref; + typedef std::shared_ptr<StanzaAck> ref; StanzaAck() : valid(false), handledStanzasCount(0) {} StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {} diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index ce57134..aa294fd 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> namespace Swift { class SWIFTEN_API StreamError : public ToplevelElement { public: - typedef boost::shared_ptr<StreamError> ref; + typedef std::shared_ptr<StreamError> ref; enum Type { BadFormat, diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h index 1d07a16..5832a24 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> @@ -18,7 +18,7 @@ namespace Swift { class SWIFTEN_API StreamFeatures : public ToplevelElement { public: - typedef boost::shared_ptr<StreamFeatures> ref; + typedef std::shared_ptr<StreamFeatures> ref; StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false), hasRosterVersioning_(false) {} diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h index cd37974..2bb9a0e 100644 --- a/Swiften/Elements/StreamInitiation.h +++ b/Swiften/Elements/StreamInitiation.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API StreamInitiation : public Payload { public: - typedef boost::shared_ptr<StreamInitiation> ref; + typedef std::shared_ptr<StreamInitiation> ref; StreamInitiation() : isFileTransfer(true) {} diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h index 11bd4c5..f2dc5b9 100644 --- a/Swiften/Elements/StreamInitiationFileInfo.h +++ b/Swiften/Elements/StreamInitiationFileInfo.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -18,7 +18,7 @@ namespace Swift { class SWIFTEN_API StreamInitiationFileInfo : public Payload { public: - typedef boost::shared_ptr<StreamInitiationFileInfo> ref; + typedef std::shared_ptr<StreamInitiationFileInfo> ref; public: StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long size = 0, diff --git a/Swiften/Elements/UnitTest/FormTest.cpp b/Swiften/Elements/UnitTest/FormTest.cpp index 9255fa8..c728bde 100644 --- a/Swiften/Elements/UnitTest/FormTest.cpp +++ b/Swiften/Elements/UnitTest/FormTest.cpp @@ -4,8 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -25,13 +24,13 @@ class FormTest : public CppUnit::TestFixture { void testGetFormType() { Form form; - form.addField(boost::make_shared<FormField>(FormField::FixedType, "Foo")); + form.addField(std::make_shared<FormField>(FormField::FixedType, "Foo")); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); field->setName("FORM_TYPE"); form.addField(field); - form.addField(boost::make_shared<FormField>(FormField::FixedType, "Bar")); + form.addField(std::make_shared<FormField>(FormField::FixedType, "Bar")); CPPUNIT_ASSERT_EQUAL(std::string("jabber:bot"), form.getFormType()); } @@ -39,7 +38,7 @@ class FormTest : public CppUnit::TestFixture { void testGetFormType_InvalidFormType() { Form form; - FormField::ref field = boost::make_shared<FormField>(FormField::FixedType, "jabber:bot"); + FormField::ref field = std::make_shared<FormField>(FormField::FixedType, "jabber:bot"); field->setName("FORM_TYPE"); form.addField(field); @@ -49,7 +48,7 @@ class FormTest : public CppUnit::TestFixture { void testGetFormType_NoFormType() { Form form; - form.addField(boost::make_shared<FormField>(FormField::FixedType, "Foo")); + form.addField(std::make_shared<FormField>(FormField::FixedType, "Foo")); CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); } diff --git a/Swiften/Elements/UnitTest/IQTest.cpp b/Swiften/Elements/UnitTest/IQTest.cpp index a88e2d6..ed98c75 100644 --- a/Swiften/Elements/UnitTest/IQTest.cpp +++ b/Swiften/Elements/UnitTest/IQTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/shared_ptr.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -26,8 +26,8 @@ class IQTest : public CppUnit::TestFixture IQTest() {} void testCreateResult() { - boost::shared_ptr<Payload> payload(new SoftwareVersion("myclient")); - boost::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid", payload)); + std::shared_ptr<Payload> payload(new SoftwareVersion("myclient")); + std::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid", payload)); CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); @@ -36,7 +36,7 @@ class IQTest : public CppUnit::TestFixture } void testCreateResult_WithoutPayload() { - boost::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid")); + std::shared_ptr<IQ> iq(IQ::createResult(JID("foo@bar/fum"), "myid")); CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); @@ -44,11 +44,11 @@ class IQTest : public CppUnit::TestFixture } void testCreateError() { - boost::shared_ptr<IQ> iq(IQ::createError(JID("foo@bar/fum"), "myid", ErrorPayload::BadRequest, ErrorPayload::Modify)); + std::shared_ptr<IQ> iq(IQ::createError(JID("foo@bar/fum"), "myid", ErrorPayload::BadRequest, ErrorPayload::Modify)); CPPUNIT_ASSERT_EQUAL(JID("foo@bar/fum"), iq->getTo()); CPPUNIT_ASSERT_EQUAL(std::string("myid"), iq->getID()); - boost::shared_ptr<ErrorPayload> error(iq->getPayload<ErrorPayload>()); + std::shared_ptr<ErrorPayload> error(iq->getPayload<ErrorPayload>()); CPPUNIT_ASSERT(error); CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, error->getCondition()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, error->getType()); diff --git a/Swiften/Elements/UnitTest/StanzaTest.cpp b/Swiften/Elements/UnitTest/StanzaTest.cpp index 13c038c..6a45bd8 100644 --- a/Swiften/Elements/UnitTest/StanzaTest.cpp +++ b/Swiften/Elements/UnitTest/StanzaTest.cpp @@ -4,8 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -70,8 +71,8 @@ class StanzaTest : public CppUnit::TestFixture void testConstructor_Copy() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>()); Message copy(m); CPPUNIT_ASSERT(copy.getPayload<MyPayload1>()); @@ -82,7 +83,7 @@ class StanzaTest : public CppUnit::TestFixture bool payloadAlive = true; { Message m; - m.addPayload(boost::make_shared<DestroyingPayload>(&payloadAlive)); + m.addPayload(std::make_shared<DestroyingPayload>(&payloadAlive)); } CPPUNIT_ASSERT(!payloadAlive); @@ -91,7 +92,7 @@ class StanzaTest : public CppUnit::TestFixture void testDestructor_Copy() { bool payloadAlive = true; Message* m1 = new Message(); - m1->addPayload(boost::make_shared<DestroyingPayload>(&payloadAlive)); + m1->addPayload(std::make_shared<DestroyingPayload>(&payloadAlive)); Message* m2 = new Message(*m1); delete m1; @@ -103,30 +104,30 @@ class StanzaTest : public CppUnit::TestFixture void testGetPayload() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>()); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>()); + m.addPayload(std::make_shared<MyPayload3>()); - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); CPPUNIT_ASSERT(p); } void testGetPayload_NoSuchPayload() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload3>()); - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); CPPUNIT_ASSERT(!p); } void testGetPayloads() { Message m; - boost::shared_ptr<MyPayload2> payload1(new MyPayload2()); - boost::shared_ptr<MyPayload2> payload2(new MyPayload2()); - m.addPayload(boost::make_shared<MyPayload1>()); + std::shared_ptr<MyPayload2> payload1(new MyPayload2()); + std::shared_ptr<MyPayload2> payload2(new MyPayload2()); + m.addPayload(std::make_shared<MyPayload1>()); m.addPayload(payload1); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload3>()); m.addPayload(payload2); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m.getPayloads<MyPayload2>().size()); @@ -137,51 +138,51 @@ class StanzaTest : public CppUnit::TestFixture void testUpdatePayload_ExistingPayload() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>("foo")); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>("foo")); + m.addPayload(std::make_shared<MyPayload3>()); - m.updatePayload(boost::make_shared<MyPayload2>("bar")); + m.updatePayload(std::make_shared<MyPayload2>("bar")); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); } void testUpdatePayload_NewPayload() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload3>()); - m.updatePayload(boost::make_shared<MyPayload2>("bar")); + m.updatePayload(std::make_shared<MyPayload2>("bar")); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), m.getPayloads().size()); - boost::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); + std::shared_ptr<MyPayload2> p(m.getPayload<MyPayload2>()); CPPUNIT_ASSERT_EQUAL(std::string("bar"), p->text_); } void testGetPayloadOfSameType() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload2>("foo")); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload2>("foo")); + m.addPayload(std::make_shared<MyPayload3>()); - boost::shared_ptr<MyPayload2> payload(boost::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(boost::make_shared<MyPayload2>("bar")))); + std::shared_ptr<MyPayload2> payload(std::dynamic_pointer_cast<MyPayload2>(m.getPayloadOfSameType(std::make_shared<MyPayload2>("bar")))); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string("foo"), payload->text_); } void testGetPayloadOfSameType_NoSuchPayload() { Message m; - m.addPayload(boost::make_shared<MyPayload1>()); - m.addPayload(boost::make_shared<MyPayload3>()); + m.addPayload(std::make_shared<MyPayload1>()); + m.addPayload(std::make_shared<MyPayload3>()); - CPPUNIT_ASSERT(!m.getPayloadOfSameType(boost::make_shared<MyPayload2>("bar"))); + CPPUNIT_ASSERT(!m.getPayloadOfSameType(std::make_shared<MyPayload2>("bar"))); } void testGetTimestamp() { Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1))); boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); @@ -191,7 +192,7 @@ class StanzaTest : public CppUnit::TestFixture void testGetTimestamp_TimestampWithFrom() { Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo@bar.com"))); boost::optional<boost::posix_time::ptime> timestamp = m.getTimestamp(); @@ -206,10 +207,10 @@ class StanzaTest : public CppUnit::TestFixture void testGetTimestampFrom() { Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(0))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(2), JID("foo2@bar.com"))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(0))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(2), JID("foo2@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); boost::optional<boost::posix_time::ptime> timestamp = m.getTimestampFrom(JID("foo2@bar.com")); @@ -219,8 +220,8 @@ class StanzaTest : public CppUnit::TestFixture void testGetTimestampFrom_Fallsback() { Message m; - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); - m.addPayload(boost::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(1), JID("foo1@bar.com"))); + m.addPayload(std::make_shared<Delay>(boost::posix_time::from_time_t(3), JID("foo3@bar.com"))); boost::optional<boost::posix_time::ptime> timestamp = m.getTimestampFrom(JID("foo2@bar.com")); diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h index 94cd029..5a43c3c 100644 --- a/Swiften/Elements/VCard.h +++ b/Swiften/Elements/VCard.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/ptime.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API VCard : public Payload { public: - typedef boost::shared_ptr<VCard> ref; + typedef std::shared_ptr<VCard> ref; struct EMailAddress { EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) { diff --git a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h index afecd0c..ae0fe17 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API WhiteboardDeleteOperation : public WhiteboardOperation { public: - typedef boost::shared_ptr<WhiteboardDeleteOperation> ref; + typedef std::shared_ptr<WhiteboardDeleteOperation> ref; public: std::string getElementID() const { return elementID_; diff --git a/Swiften/Elements/Whiteboard/WhiteboardElement.h b/Swiften/Elements/Whiteboard/WhiteboardElement.h index a4d1207..6f6ff4f 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardElement.h @@ -12,14 +12,15 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> #include <Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h> namespace Swift { class WhiteboardElement { public: - typedef boost::shared_ptr<WhiteboardElement> ref; + typedef std::shared_ptr<WhiteboardElement> ref; public: virtual ~WhiteboardElement() {} diff --git a/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h index 15b50e4..7d80bf7 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API WhiteboardEllipseElement : public WhiteboardElement { public: - typedef boost::shared_ptr<WhiteboardEllipseElement> ref; + typedef std::shared_ptr<WhiteboardEllipseElement> ref; public: WhiteboardEllipseElement(int cx, int cy, int rx, int ry) { cx_ = cx; diff --git a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h index 7522b7b..b8b7e54 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h @@ -23,7 +23,7 @@ namespace Swift { class SWIFTEN_API WhiteboardFreehandPathElement : public WhiteboardElement { typedef std::pair<int, int> Point; public: - typedef boost::shared_ptr<WhiteboardFreehandPathElement> ref; + typedef std::shared_ptr<WhiteboardFreehandPathElement> ref; public: WhiteboardFreehandPathElement() { } diff --git a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h index 855e502..256c17e 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API WhiteboardInsertOperation : public WhiteboardOperation { public: - typedef boost::shared_ptr<WhiteboardInsertOperation> ref; + typedef std::shared_ptr<WhiteboardInsertOperation> ref; public: WhiteboardElement::ref getElement() const { return element_; diff --git a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h index 7fb8a77..9c64977 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h @@ -20,7 +20,7 @@ namespace Swift { class SWIFTEN_API WhiteboardLineElement : public WhiteboardElement { public: - typedef boost::shared_ptr<WhiteboardLineElement> ref; + typedef std::shared_ptr<WhiteboardLineElement> ref; public: WhiteboardLineElement(int x1, int y1, int x2, int y2) : penWidth_(1) { x1_ = x1; diff --git a/Swiften/Elements/Whiteboard/WhiteboardOperation.h b/Swiften/Elements/Whiteboard/WhiteboardOperation.h index b657bd9..7d48e4d 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardOperation.h @@ -21,7 +21,7 @@ namespace Swift { class WhiteboardOperation { public: - typedef boost::shared_ptr<WhiteboardOperation> ref; + typedef std::shared_ptr<WhiteboardOperation> ref; public: WhiteboardOperation() {} SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(WhiteboardOperation) diff --git a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h index bd0b674..b8591cf 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ namespace Swift { class SWIFTEN_API WhiteboardPolygonElement : public WhiteboardElement { typedef std::pair<int, int> Point; public: - typedef boost::shared_ptr<WhiteboardPolygonElement> ref; + typedef std::shared_ptr<WhiteboardPolygonElement> ref; public: WhiteboardPolygonElement() { } diff --git a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h index c681e97..4dcdc8a 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API WhiteboardRectElement : public WhiteboardElement { public: - typedef boost::shared_ptr<WhiteboardRectElement> ref; + typedef std::shared_ptr<WhiteboardRectElement> ref; public: WhiteboardRectElement(int x, int y, int width, int height) : penWidth_(1) { x_ = x; diff --git a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h index df00bea..41f31f6 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h +++ b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API WhiteboardTextElement : public WhiteboardElement { public: - typedef boost::shared_ptr<WhiteboardTextElement> ref; + typedef std::shared_ptr<WhiteboardTextElement> ref; public: WhiteboardTextElement(int x, int y) { x_ = x; diff --git a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h index 5147999..b6dfd4f 100644 --- a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h +++ b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h @@ -19,7 +19,7 @@ namespace Swift { class SWIFTEN_API WhiteboardUpdateOperation : public WhiteboardOperation { public: - typedef boost::shared_ptr<WhiteboardUpdateOperation> ref; + typedef std::shared_ptr<WhiteboardUpdateOperation> ref; public: WhiteboardElement::ref getElement() const { return element_; diff --git a/Swiften/Elements/WhiteboardPayload.h b/Swiften/Elements/WhiteboardPayload.h index 42e1375..41c0acd 100644 --- a/Swiften/Elements/WhiteboardPayload.h +++ b/Swiften/Elements/WhiteboardPayload.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ namespace Swift { class SWIFTEN_API WhiteboardPayload : public Payload { public: - typedef boost::shared_ptr<WhiteboardPayload> ref; + typedef std::shared_ptr<WhiteboardPayload> ref; public: enum Type {UnknownType, Data, SessionRequest, SessionAccept, SessionTerminate}; diff --git a/Swiften/Entity/GenericPayloadPersister.h b/Swiften/Entity/GenericPayloadPersister.h index 19afc61..7cef857 100644 --- a/Swiften/Entity/GenericPayloadPersister.h +++ b/Swiften/Entity/GenericPayloadPersister.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,8 +18,8 @@ namespace Swift { } public: - boost::shared_ptr<PAYLOAD> loadPayloadGeneric(const boost::filesystem::path& path) { - return boost::dynamic_pointer_cast<PAYLOAD>(loadPayload(path)); + std::shared_ptr<PAYLOAD> loadPayloadGeneric(const boost::filesystem::path& path) { + return std::dynamic_pointer_cast<PAYLOAD>(loadPayload(path)); } protected: diff --git a/Swiften/Entity/PayloadPersister.cpp b/Swiften/Entity/PayloadPersister.cpp index 7147615..4b3fb52 100644 --- a/Swiften/Entity/PayloadPersister.cpp +++ b/Swiften/Entity/PayloadPersister.cpp @@ -25,7 +25,7 @@ PayloadPersister::PayloadPersister() { PayloadPersister::~PayloadPersister() { } -void PayloadPersister::savePayload(boost::shared_ptr<Payload> payload, const boost::filesystem::path& path) { +void PayloadPersister::savePayload(std::shared_ptr<Payload> payload, const boost::filesystem::path& path) { try { if (!boost::filesystem::exists(path.parent_path())) { boost::filesystem::create_directories(path.parent_path()); @@ -39,12 +39,12 @@ void PayloadPersister::savePayload(boost::shared_ptr<Payload> payload, const boo } } -boost::shared_ptr<Payload> PayloadPersister::loadPayload(const boost::filesystem::path& path) { +std::shared_ptr<Payload> PayloadPersister::loadPayload(const boost::filesystem::path& path) { try { if (boost::filesystem::exists(path)) { ByteArray data; readByteArrayFromFile(data, path); - boost::shared_ptr<PayloadParser> parser(createParser()); + std::shared_ptr<PayloadParser> parser(createParser()); PayloadParserTester tester(parser.get()); tester.parse(byteArrayToString(data)); return parser->getPayload(); @@ -53,5 +53,5 @@ boost::shared_ptr<Payload> PayloadPersister::loadPayload(const boost::filesystem catch (const boost::filesystem::filesystem_error& e) { std::cerr << "ERROR: " << e.what() << std::endl; } - return boost::shared_ptr<Payload>(); + return std::shared_ptr<Payload>(); } diff --git a/Swiften/Entity/PayloadPersister.h b/Swiften/Entity/PayloadPersister.h index 9102f4b..c747a41 100644 --- a/Swiften/Entity/PayloadPersister.h +++ b/Swiften/Entity/PayloadPersister.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/filesystem/path.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> @@ -21,8 +22,8 @@ namespace Swift { PayloadPersister(); virtual ~PayloadPersister(); - void savePayload(boost::shared_ptr<Payload>, const boost::filesystem::path&); - boost::shared_ptr<Payload> loadPayload(const boost::filesystem::path&); + void savePayload(std::shared_ptr<Payload>, const boost::filesystem::path&); + std::shared_ptr<Payload> loadPayload(const boost::filesystem::path&); protected: diff --git a/Swiften/EventLoop/BoostASIOEventLoop.cpp b/Swiften/EventLoop/BoostASIOEventLoop.cpp index a9d1440..bab8b54 100644 --- a/Swiften/EventLoop/BoostASIOEventLoop.cpp +++ b/Swiften/EventLoop/BoostASIOEventLoop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -10,7 +10,7 @@ namespace Swift { -BoostASIOEventLoop::BoostASIOEventLoop(boost::shared_ptr<boost::asio::io_service> ioService) : ioService_(ioService) { +BoostASIOEventLoop::BoostASIOEventLoop(std::shared_ptr<boost::asio::io_service> ioService) : ioService_(ioService) { } diff --git a/Swiften/EventLoop/BoostASIOEventLoop.h b/Swiften/EventLoop/BoostASIOEventLoop.h index c39aaf5..41304c4 100644 --- a/Swiften/EventLoop/BoostASIOEventLoop.h +++ b/Swiften/EventLoop/BoostASIOEventLoop.h @@ -1,13 +1,14 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/asio/io_service.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include <Swiften/Base/API.h> @@ -17,7 +18,7 @@ namespace Swift { class SWIFTEN_API BoostASIOEventLoop : public EventLoop { public: - BoostASIOEventLoop(boost::shared_ptr<boost::asio::io_service> ioService); + BoostASIOEventLoop(std::shared_ptr<boost::asio::io_service> ioService); virtual ~BoostASIOEventLoop(); protected: @@ -26,7 +27,7 @@ namespace Swift { virtual void eventPosted(); private: - boost::shared_ptr<boost::asio::io_service> ioService_; + std::shared_ptr<boost::asio::io_service> ioService_; bool isEventInASIOEventLoop_; boost::recursive_mutex isEventInASIOEventLoopMutex_; diff --git a/Swiften/EventLoop/Event.h b/Swiften/EventLoop/Event.h index eecd896..e92bb33 100644 --- a/Swiften/EventLoop/Event.h +++ b/Swiften/EventLoop/Event.h @@ -6,15 +6,16 @@ #pragma once +#include <memory> + #include <boost/function.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/EventLoop/EventOwner.h> namespace Swift { class Event { public: - Event(boost::shared_ptr<EventOwner> owner, const boost::function<void()>& callback) : id(~0U), owner(owner), callback(callback) { + Event(std::shared_ptr<EventOwner> owner, const boost::function<void()>& callback) : id(~0U), owner(owner), callback(callback) { } bool operator==(const Event& o) const { @@ -22,7 +23,7 @@ namespace Swift { } unsigned int id; - boost::shared_ptr<EventOwner> owner; + std::shared_ptr<EventOwner> owner; boost::function<void()> callback; }; } diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp index 2434277..730ee0a 100644 --- a/Swiften/EventLoop/EventLoop.cpp +++ b/Swiften/EventLoop/EventLoop.cpp @@ -74,7 +74,7 @@ void EventLoop::handleNextEvents() { } } -void EventLoop::postEvent(boost::function<void ()> callback, boost::shared_ptr<EventOwner> owner) { +void EventLoop::postEvent(boost::function<void ()> callback, std::shared_ptr<EventOwner> owner) { Event event(owner, callback); bool callEventPosted = false; { @@ -91,7 +91,7 @@ void EventLoop::postEvent(boost::function<void ()> callback, boost::shared_ptr<E } } -void EventLoop::removeEventsFromOwner(boost::shared_ptr<EventOwner> owner) { +void EventLoop::removeEventsFromOwner(std::shared_ptr<EventOwner> owner) { boost::recursive_mutex::scoped_lock removeLock(removeEventsMutex_); boost::recursive_mutex::scoped_lock lock(eventsMutex_); events_.remove_if(lambda::bind(&Event::owner, lambda::_1) == owner); diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h index 84a3e9d..c7f7760 100644 --- a/Swiften/EventLoop/EventLoop.h +++ b/Swiften/EventLoop/EventLoop.h @@ -33,13 +33,13 @@ namespace Swift { * An optional \ref EventOwner can be passed, allowing later removal of events that have not yet been * executed using the \ref removeEventsFromOwner method. */ - void postEvent(boost::function<void ()> event, boost::shared_ptr<EventOwner> owner = boost::shared_ptr<EventOwner>()); + void postEvent(boost::function<void ()> event, std::shared_ptr<EventOwner> owner = std::shared_ptr<EventOwner>()); /** * The \ref removeEventsFromOwner method removes all events from the specified \ref owner from the * event queue. */ - void removeEventsFromOwner(boost::shared_ptr<EventOwner> owner); + void removeEventsFromOwner(std::shared_ptr<EventOwner> owner); protected: /** diff --git a/Swiften/EventLoop/UnitTest/EventLoopTest.cpp b/Swiften/EventLoop/UnitTest/EventLoopTest.cpp index 1028b7e..55715d0 100644 --- a/Swiften/EventLoop/UnitTest/EventLoopTest.cpp +++ b/Swiften/EventLoop/UnitTest/EventLoopTest.cpp @@ -44,8 +44,8 @@ class EventLoopTest : public CppUnit::TestFixture { void testRemove() { SimpleEventLoop testling; - boost::shared_ptr<MyEventOwner> eventOwner1(new MyEventOwner()); - boost::shared_ptr<MyEventOwner> eventOwner2(new MyEventOwner()); + std::shared_ptr<MyEventOwner> eventOwner1(new MyEventOwner()); + std::shared_ptr<MyEventOwner> eventOwner2(new MyEventOwner()); testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 1), eventOwner1); testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 2), eventOwner2); @@ -62,7 +62,7 @@ class EventLoopTest : public CppUnit::TestFixture { void testHandleEvent_Recursive() { DummyEventLoop testling; - boost::shared_ptr<MyEventOwner> eventOwner(new MyEventOwner()); + std::shared_ptr<MyEventOwner> eventOwner(new MyEventOwner()); testling.postEvent(boost::bind(&EventLoopTest::runEventLoop, this, &testling, eventOwner), eventOwner); testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 0), eventOwner); @@ -78,7 +78,7 @@ class EventLoopTest : public CppUnit::TestFixture { void logEvent(int i) { events_.push_back(i); } - void runEventLoop(DummyEventLoop* loop, boost::shared_ptr<MyEventOwner> eventOwner) { + void runEventLoop(DummyEventLoop* loop, std::shared_ptr<MyEventOwner> eventOwner) { loop->processEvents(); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(events_.size())); loop->postEvent(boost::bind(&EventLoopTest::logEvent, this, 1), eventOwner); diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp index 44a5796..c539691 100644 --- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp +++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp @@ -30,7 +30,7 @@ static JID recipient; static int exitCode = CANNOT_CONNECT; static boost::bsignals::connection errorConnection; -static void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*info*/, ErrorPayload::ref error) { +static void handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo> /*info*/, ErrorPayload::ref error) { if (!error) { errorConnection.disconnect(); client->disconnect(); diff --git a/Swiften/Examples/LinkLocalTool/main.cpp b/Swiften/Examples/LinkLocalTool/main.cpp index 37804fb..a853f0e 100644 --- a/Swiften/Examples/LinkLocalTool/main.cpp +++ b/Swiften/Examples/LinkLocalTool/main.cpp @@ -24,11 +24,11 @@ int main(int argc, char* argv[]) { SimpleEventLoop eventLoop; PlatformDNSSDQuerierFactory factory(&eventLoop); - boost::shared_ptr<DNSSDQuerier> querier = factory.createQuerier(); + std::shared_ptr<DNSSDQuerier> querier = factory.createQuerier(); querier->start(); if (std::string(argv[1]) == "browse") { - boost::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); + std::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); browseQuery->startBrowsing(); eventLoop.run(); browseQuery->stopBrowsing(); @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) { std::cerr << "Invalid parameters" << std::endl; return -1; } - boost::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(DNSSDServiceID(argv[2], argv[3], argv[4])); + std::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(DNSSDServiceID(argv[2], argv[3], argv[4])); resolveQuery->start(); eventLoop.run(); std::cerr << "Done running" << std::endl; diff --git a/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp b/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp index 1aaebac..c3983f1 100644 --- a/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp +++ b/Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp @@ -5,9 +5,9 @@ */ #include <iostream> +#include <memory> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Client/Client.h> @@ -27,7 +27,7 @@ using namespace std; static SimpleEventLoop eventLoop; static BoostNetworkFactories networkFactories(&eventLoop); -static boost::shared_ptr<Client> client; +static std::shared_ptr<Client> client; static MUC::ref muc; static JID mucJID; static JID roomJID; @@ -39,7 +39,7 @@ static void joinMUC() { muc->joinAs("SwiftExample"); } -static void handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error) { +static void handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error) { if (error) { cout << "Error fetching list of rooms." << endl; return; @@ -73,7 +73,7 @@ static void handleDisconnected(const boost::optional<ClientError>&) { cout << "Disconnected." << endl; } -static void handleIncomingMessage(boost::shared_ptr<Message> message) { +static void handleIncomingMessage(std::shared_ptr<Message> message) { if (message->getFrom().toBare() == roomJID) { cout << "[ " << roomJID << " ] " << message->getFrom().getResource() << ": " << message->getBody().get_value_or("") << endl; } @@ -91,7 +91,7 @@ int main(int argc, char* argv[]) { } else { mucJID = JID(argv[3]); - client = boost::make_shared<Client>(JID(argv[1]), string(argv[2]), &networkFactories); + client = std::make_shared<Client>(JID(argv[1]), string(argv[2]), &networkFactories); client->setAlwaysTrustCertificates(); // Enable the following line for detailed XML logging diff --git a/Swiften/Examples/NetworkTool/main.cpp b/Swiften/Examples/NetworkTool/main.cpp index 0cedfa7..c50ab67 100644 --- a/Swiften/Examples/NetworkTool/main.cpp +++ b/Swiften/Examples/NetworkTool/main.cpp @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { PlatformNATTraversalWorker natTraverser(&eventLoop); if (std::string(argv[1]) == "get-public-ip") { - boost::shared_ptr<NATTraversalGetPublicIPRequest> query = natTraverser.createGetPublicIPRequest(); + std::shared_ptr<NATTraversalGetPublicIPRequest> query = natTraverser.createGetPublicIPRequest(); query->onResult.connect(boost::bind(&handleGetPublicIPRequestResponse, _1)); query->start(); eventLoop.run(); @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) { if (argc < 4) { std::cerr << "Invalid parameters" << std::endl; } - boost::shared_ptr<NATTraversalForwardPortRequest> query = natTraverser.createForwardPortRequest(boost::lexical_cast<int>(argv[2]), boost::lexical_cast<int>(argv[3])); + std::shared_ptr<NATTraversalForwardPortRequest> query = natTraverser.createForwardPortRequest(boost::lexical_cast<int>(argv[2]), boost::lexical_cast<int>(argv[3])); query->onResult.connect(boost::bind(&handleGetForwardPortRequestResponse, _1)); query->start(); eventLoop.run(); @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) { if (argc < 4) { std::cerr << "Invalid parameters" << std::endl; } - boost::shared_ptr<NATTraversalRemovePortForwardingRequest> query = natTraverser.createRemovePortForwardingRequest(boost::lexical_cast<int>(argv[2]), boost::lexical_cast<int>(argv[3])); + std::shared_ptr<NATTraversalRemovePortForwardingRequest> query = natTraverser.createRemovePortForwardingRequest(boost::lexical_cast<int>(argv[2]), boost::lexical_cast<int>(argv[3])); query->onResult.connect(boost::bind(&handleRemovePortForwardingRequestResponse, _1)); query->start(); eventLoop.run(); diff --git a/Swiften/Examples/ParserTester/ParserTester.cpp b/Swiften/Examples/ParserTester/ParserTester.cpp index af79ece..71b0611 100644 --- a/Swiften/Examples/ParserTester/ParserTester.cpp +++ b/Swiften/Examples/ParserTester/ParserTester.cpp @@ -22,7 +22,7 @@ class MyXMPPParserClient : public XMPPParserClient { virtual void handleStreamStart(const ProtocolHeader&) { std::cout << "-> Stream start" << std::endl; } - virtual void handleElement(boost::shared_ptr<ToplevelElement> element) { + virtual void handleElement(std::shared_ptr<ToplevelElement> element) { std::cout << "-> Element " << typeid(*element.get()).name() << std::endl; } virtual void handleStreamEnd() { diff --git a/Swiften/Examples/SendFile/ReceiveFile.cpp b/Swiften/Examples/SendFile/ReceiveFile.cpp index c6e75e8..0b61987 100644 --- a/Swiften/Examples/SendFile/ReceiveFile.cpp +++ b/Swiften/Examples/SendFile/ReceiveFile.cpp @@ -5,10 +5,10 @@ */ #include <iostream> +#include <memory> #include <boost/bind.hpp> #include <boost/filesystem.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -82,7 +82,7 @@ class FileReceiver { void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) { SWIFT_LOG(debug) << "foo" << std::endl; incomingFileTransfers.push_back(transfer); - boost::shared_ptr<FileWriteBytestream> out = boost::make_shared<FileWriteBytestream>("out"); + std::shared_ptr<FileWriteBytestream> out = std::make_shared<FileWriteBytestream>("out"); transfer->onFinished.connect(boost::bind(&FileReceiver::handleFileTransferFinished, this, _1, out)); transfer->accept(out); } @@ -94,7 +94,7 @@ class FileReceiver { void handleFileTransferFinished( const boost::optional<FileTransferError>& error, - boost::shared_ptr<FileWriteBytestream> out) { + std::shared_ptr<FileWriteBytestream> out) { std::cout << "File transfer finished" << std::endl; out->close(); if (error) { diff --git a/Swiften/Examples/SendFile/SendFile.cpp b/Swiften/Examples/SendFile/SendFile.cpp index 1b70747..0e1fb23 100644 --- a/Swiften/Examples/SendFile/SendFile.cpp +++ b/Swiften/Examples/SendFile/SendFile.cpp @@ -67,7 +67,7 @@ class FileSender { void handleCapsChanged(JID jid) { if (jid.toBare() == recipient) { // create ReadBytestream from file - boost::shared_ptr<FileReadBytestream> fileStream = boost::make_shared<FileReadBytestream>(file); + std::shared_ptr<FileReadBytestream> fileStream = std::make_shared<FileReadBytestream>(file); outgoingFileTransfer = client->getFileTransferManager()->createOutgoingFileTransfer(recipient, file, "Some File!", fileStream); diff --git a/Swiften/Examples/SendMessage/SendMessage.cpp b/Swiften/Examples/SendMessage/SendMessage.cpp index 9a954f2..2458e65 100644 --- a/Swiften/Examples/SendMessage/SendMessage.cpp +++ b/Swiften/Examples/SendMessage/SendMessage.cpp @@ -30,7 +30,7 @@ static boost::bsignals::connection errorConnection; static void handleConnected() { - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); message->setBody(messageBody); message->setTo(recipient); client->sendMessage(message); diff --git a/Swiften/FileTransfer/ByteArrayReadBytestream.cpp b/Swiften/FileTransfer/ByteArrayReadBytestream.cpp index c1fadee..cd9fa4a 100644 --- a/Swiften/FileTransfer/ByteArrayReadBytestream.cpp +++ b/Swiften/FileTransfer/ByteArrayReadBytestream.cpp @@ -6,19 +6,20 @@ #include <Swiften/FileTransfer/ByteArrayReadBytestream.h> +#include <memory> + #include <boost/numeric/conversion/cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Algorithm.h> using namespace Swift; -boost::shared_ptr<ByteArray> ByteArrayReadBytestream::read(size_t size) { +std::shared_ptr<ByteArray> ByteArrayReadBytestream::read(size_t size) { size_t readSize = size; if (position + readSize > data.size()) { readSize = data.size() - position; } - boost::shared_ptr<ByteArray> result = boost::make_shared<ByteArray>( + std::shared_ptr<ByteArray> result = std::make_shared<ByteArray>( data.begin() + boost::numeric_cast<long long>(position), data.begin() + boost::numeric_cast<long long>(position) + boost::numeric_cast<long long>(readSize)); diff --git a/Swiften/FileTransfer/ByteArrayReadBytestream.h b/Swiften/FileTransfer/ByteArrayReadBytestream.h index a711acb..d90e5cc 100644 --- a/Swiften/FileTransfer/ByteArrayReadBytestream.h +++ b/Swiften/FileTransfer/ByteArrayReadBytestream.h @@ -18,7 +18,7 @@ namespace Swift { ByteArrayReadBytestream(const std::vector<unsigned char>& data) : data(data), position(0), dataComplete(true) { } - virtual boost::shared_ptr<ByteArray> read(size_t size); + virtual std::shared_ptr<ByteArray> read(size_t size); virtual bool isFinished() const { return position >= data.size() && dataComplete; diff --git a/Swiften/FileTransfer/BytestreamsRequest.h b/Swiften/FileTransfer/BytestreamsRequest.h index 7fa3660..d278e79 100644 --- a/Swiften/FileTransfer/BytestreamsRequest.h +++ b/Swiften/FileTransfer/BytestreamsRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Bytestreams.h> @@ -15,21 +15,21 @@ namespace Swift { class SWIFTEN_API BytestreamsRequest : public GenericRequest<Bytestreams> { public: - typedef boost::shared_ptr<BytestreamsRequest> ref; + typedef std::shared_ptr<BytestreamsRequest> ref; - static ref create(const JID& jid, boost::shared_ptr<Bytestreams> payload, IQRouter* router) { + static ref create(const JID& jid, std::shared_ptr<Bytestreams> payload, IQRouter* router) { return ref(new BytestreamsRequest(jid, payload, router)); } - static ref create(const JID& from, const JID& to, boost::shared_ptr<Bytestreams> payload, IQRouter* router) { + static ref create(const JID& from, const JID& to, std::shared_ptr<Bytestreams> payload, IQRouter* router) { return ref(new BytestreamsRequest(from, to, payload, router)); } private: - BytestreamsRequest(const JID& jid, boost::shared_ptr<Bytestreams> payload, IQRouter* router) : GenericRequest<Bytestreams>(IQ::Set, jid, payload, router) { + BytestreamsRequest(const JID& jid, std::shared_ptr<Bytestreams> payload, IQRouter* router) : GenericRequest<Bytestreams>(IQ::Set, jid, payload, router) { } - BytestreamsRequest(const JID& from, const JID& to, boost::shared_ptr<Bytestreams> payload, IQRouter* router) : GenericRequest<Bytestreams>(IQ::Set, from, to, payload, router) { + BytestreamsRequest(const JID& from, const JID& to, std::shared_ptr<Bytestreams> payload, IQRouter* router) : GenericRequest<Bytestreams>(IQ::Set, from, to, payload, router) { } }; } diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp index b54f1c1..9428d0b 100644 --- a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp +++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp @@ -1,13 +1,14 @@ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/DefaultFileTransferTransporter.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -107,7 +108,7 @@ void DefaultFileTransferTransporter::handleLocalCandidatesGenerated( void DefaultFileTransferTransporter::handleRemoteCandidateSelectFinished( const boost::optional<JingleS5BTransportPayload::Candidate>& candidate, - boost::shared_ptr<SOCKS5BytestreamClientSession> session) { + std::shared_ptr<SOCKS5BytestreamClientSession> session) { remoteS5BClientSession = session; onRemoteCandidateSelectFinished(s5bSessionID, candidate); } @@ -134,11 +135,11 @@ void DefaultFileTransferTransporter::handleActivateProxySessionResult(const std: void DefaultFileTransferTransporter::startActivatingProxy(const JID& proxyServiceJID) { // activate proxy SWIFT_LOG(debug) << "Start activating proxy " << proxyServiceJID.toString() << " with sid = " << s5bSessionID << "." << std::endl; - S5BProxyRequest::ref proxyRequest = boost::make_shared<S5BProxyRequest>(); + S5BProxyRequest::ref proxyRequest = std::make_shared<S5BProxyRequest>(); proxyRequest->setSID(s5bSessionID); proxyRequest->setActivate(role == Initiator ? responder : initiator); - boost::shared_ptr<GenericRequest<S5BProxyRequest> > request = boost::make_shared<GenericRequest<S5BProxyRequest> >(IQ::Set, proxyServiceJID, proxyRequest, router); + std::shared_ptr<GenericRequest<S5BProxyRequest> > request = std::make_shared<GenericRequest<S5BProxyRequest> >(IQ::Set, proxyServiceJID, proxyRequest, router); request->onResponse.connect(boost::bind(&DefaultFileTransferTransporter::handleActivateProxySessionResult, this, s5bSessionID, _2)); request->send(); } @@ -148,97 +149,97 @@ void DefaultFileTransferTransporter::stopActivatingProxy() { assert(false); } -boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createIBBSendSession( - const std::string& sessionID, unsigned int blockSize, boost::shared_ptr<ReadBytestream> stream) { +std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createIBBSendSession( + const std::string& sessionID, unsigned int blockSize, std::shared_ptr<ReadBytestream> stream) { if (s5bServerManager->getServer()) { closeLocalSession(); } closeRemoteSession(); - boost::shared_ptr<IBBSendSession> ibbSession = boost::make_shared<IBBSendSession>( + std::shared_ptr<IBBSendSession> ibbSession = std::make_shared<IBBSendSession>( sessionID, initiator, responder, stream, router); ibbSession->setBlockSize(blockSize); - return boost::make_shared<IBBSendTransportSession>(ibbSession); + return std::make_shared<IBBSendTransportSession>(ibbSession); } -boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createIBBReceiveSession( - const std::string& sessionID, unsigned long long size, boost::shared_ptr<WriteBytestream> stream) { +std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createIBBReceiveSession( + const std::string& sessionID, unsigned long long size, std::shared_ptr<WriteBytestream> stream) { if (s5bServerManager->getServer()) { closeLocalSession(); } closeRemoteSession(); - boost::shared_ptr<IBBReceiveSession> ibbSession = boost::make_shared<IBBReceiveSession>( + std::shared_ptr<IBBReceiveSession> ibbSession = std::make_shared<IBBReceiveSession>( sessionID, initiator, responder, size, stream, router); - return boost::make_shared<IBBReceiveTransportSession>(ibbSession); + return std::make_shared<IBBReceiveTransportSession>(ibbSession); } -boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createRemoteCandidateSession( - boost::shared_ptr<ReadBytestream> stream, const JingleS5BTransportPayload::Candidate& /* candidate */) { +std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createRemoteCandidateSession( + std::shared_ptr<ReadBytestream> stream, const JingleS5BTransportPayload::Candidate& /* candidate */) { closeLocalSession(); - return boost::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >( + return std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >( remoteS5BClientSession, stream); } -boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createRemoteCandidateSession( - boost::shared_ptr<WriteBytestream> stream, const JingleS5BTransportPayload::Candidate& /* candidate */) { +std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createRemoteCandidateSession( + std::shared_ptr<WriteBytestream> stream, const JingleS5BTransportPayload::Candidate& /* candidate */) { closeLocalSession(); - return boost::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >( + return std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >( remoteS5BClientSession, stream); } -boost::shared_ptr<SOCKS5BytestreamServerSession> DefaultFileTransferTransporter::getServerSession() { +std::shared_ptr<SOCKS5BytestreamServerSession> DefaultFileTransferTransporter::getServerSession() { s5bRegistry->setHasBytestream(getSOCKS5DstAddr(), false); - std::vector<boost::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = + std::vector<std::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr()); while (serverSessions.size() > 1) { - boost::shared_ptr<SOCKS5BytestreamServerSession> session = serverSessions.back(); + std::shared_ptr<SOCKS5BytestreamServerSession> session = serverSessions.back(); serverSessions.pop_back(); session->stop(); } - return !serverSessions.empty() ? serverSessions.front() : boost::shared_ptr<SOCKS5BytestreamServerSession>(); + return !serverSessions.empty() ? serverSessions.front() : std::shared_ptr<SOCKS5BytestreamServerSession>(); } -boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCandidateSession( - boost::shared_ptr<ReadBytestream> stream, const JingleS5BTransportPayload::Candidate& candidate) { +std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCandidateSession( + std::shared_ptr<ReadBytestream> stream, const JingleS5BTransportPayload::Candidate& candidate) { closeRemoteSession(); - boost::shared_ptr<TransportSession> transportSession; + std::shared_ptr<TransportSession> transportSession; if (candidate.type == JingleS5BTransportPayload::Candidate::ProxyType) { SOCKS5BytestreamClientSession::ref proxySession = s5bProxy->getProxySessionAndCloseOthers(candidate.jid, getLocalCandidateSOCKS5DstAddr()); assert(proxySession); - transportSession = boost::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); + transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); } if (!transportSession) { - boost::shared_ptr<SOCKS5BytestreamServerSession> serverSession = getServerSession(); + std::shared_ptr<SOCKS5BytestreamServerSession> serverSession = getServerSession(); if (serverSession) { - transportSession = boost::make_shared<S5BTransportSession<SOCKS5BytestreamServerSession> >(serverSession, stream); + transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamServerSession> >(serverSession, stream); } } if (!transportSession) { - transportSession = boost::make_shared<FailingTransportSession>(); + transportSession = std::make_shared<FailingTransportSession>(); } return transportSession; } -boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCandidateSession( - boost::shared_ptr<WriteBytestream> stream, const JingleS5BTransportPayload::Candidate& candidate) { +std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCandidateSession( + std::shared_ptr<WriteBytestream> stream, const JingleS5BTransportPayload::Candidate& candidate) { closeRemoteSession(); - boost::shared_ptr<TransportSession> transportSession; + std::shared_ptr<TransportSession> transportSession; if (candidate.type == JingleS5BTransportPayload::Candidate::ProxyType) { SOCKS5BytestreamClientSession::ref proxySession = s5bProxy->getProxySessionAndCloseOthers(candidate.jid, getLocalCandidateSOCKS5DstAddr()); assert(proxySession); - transportSession = boost::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); + transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); } if (!transportSession) { - boost::shared_ptr<SOCKS5BytestreamServerSession> serverSession = getServerSession(); + std::shared_ptr<SOCKS5BytestreamServerSession> serverSession = getServerSession(); if (serverSession) { - transportSession = boost::make_shared<S5BTransportSession<SOCKS5BytestreamServerSession> >(serverSession, stream); + transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamServerSession> >(serverSession, stream); } } if (!transportSession) { - transportSession = boost::make_shared<FailingTransportSession>(); + transportSession = std::make_shared<FailingTransportSession>(); } return transportSession; } @@ -285,8 +286,8 @@ std::string DefaultFileTransferTransporter::getLocalCandidateSOCKS5DstAddr() con void DefaultFileTransferTransporter::closeLocalSession() { s5bRegistry->setHasBytestream(getSOCKS5DstAddr(), false); if (s5bServerManager->getServer()) { - std::vector<boost::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr()); - foreach(boost::shared_ptr<SOCKS5BytestreamServerSession> session, serverSessions) { + std::vector<std::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr()); + foreach(std::shared_ptr<SOCKS5BytestreamServerSession> session, serverSessions) { session->stop(); } } diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.h b/Swiften/FileTransfer/DefaultFileTransferTransporter.h index 7ec6a12..339232f 100644 --- a/Swiften/FileTransfer/DefaultFileTransferTransporter.h +++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.h @@ -65,28 +65,28 @@ namespace Swift { virtual void startActivatingProxy(const JID& jid) SWIFTEN_OVERRIDE; virtual void stopActivatingProxy() SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createIBBSendSession( - const std::string& sessionID, unsigned int blockSize, boost::shared_ptr<ReadBytestream>) SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createIBBReceiveSession( - const std::string& sessionID, unsigned long long size, boost::shared_ptr<WriteBytestream>) SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession( - boost::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession( - boost::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession( - boost::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession( - boost::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createIBBSendSession( + const std::string& sessionID, unsigned int blockSize, std::shared_ptr<ReadBytestream>) SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createIBBReceiveSession( + const std::string& sessionID, unsigned long long size, std::shared_ptr<WriteBytestream>) SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession( + std::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession( + std::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession( + std::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession( + std::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) SWIFTEN_OVERRIDE; private: void handleLocalCandidatesGenerated(const std::vector<JingleS5BTransportPayload::Candidate>&); void handleRemoteCandidateSelectFinished( const boost::optional<JingleS5BTransportPayload::Candidate>&, - boost::shared_ptr<SOCKS5BytestreamClientSession>); + std::shared_ptr<SOCKS5BytestreamClientSession>); void handleActivateProxySessionResult(const std::string& sessionID, ErrorPayload::ref error); void closeLocalSession(); void closeRemoteSession(); - boost::shared_ptr<SOCKS5BytestreamServerSession> getServerSession(); + std::shared_ptr<SOCKS5BytestreamServerSession> getServerSession(); std::string getSOCKS5DstAddr() const; std::string getInitiatorCandidateSOCKS5DstAddr() const; @@ -106,7 +106,7 @@ namespace Swift { LocalJingleTransportCandidateGenerator* localCandidateGenerator; RemoteJingleTransportCandidateSelector* remoteCandidateSelector; std::string s5bSessionID; - boost::shared_ptr<SOCKS5BytestreamClientSession> remoteS5BClientSession; + std::shared_ptr<SOCKS5BytestreamClientSession> remoteS5BClientSession; }; } diff --git a/Swiften/FileTransfer/FileReadBytestream.cpp b/Swiften/FileTransfer/FileReadBytestream.cpp index ad9a33b..2ff00dc 100644 --- a/Swiften/FileTransfer/FileReadBytestream.cpp +++ b/Swiften/FileTransfer/FileReadBytestream.cpp @@ -7,10 +7,10 @@ #include <Swiften/FileTransfer/FileReadBytestream.h> #include <cassert> +#include <memory> #include <boost/filesystem/fstream.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/ByteArray.h> @@ -27,11 +27,11 @@ FileReadBytestream::~FileReadBytestream() { } } -boost::shared_ptr<ByteArray> FileReadBytestream::read(size_t size) { +std::shared_ptr<ByteArray> FileReadBytestream::read(size_t size) { if (!stream) { stream = new boost::filesystem::ifstream(file, std::ios_base::in|std::ios_base::binary); } - boost::shared_ptr<ByteArray> result = boost::make_shared<ByteArray>(); + std::shared_ptr<ByteArray> result = std::make_shared<ByteArray>(); result->resize(size); assert(stream->good()); stream->read(reinterpret_cast<char*>(vecptr(*result)), boost::numeric_cast<std::streamsize>(size)); diff --git a/Swiften/FileTransfer/FileReadBytestream.h b/Swiften/FileTransfer/FileReadBytestream.h index 24cfbae..aaf3de3 100644 --- a/Swiften/FileTransfer/FileReadBytestream.h +++ b/Swiften/FileTransfer/FileReadBytestream.h @@ -18,7 +18,7 @@ namespace Swift { FileReadBytestream(const boost::filesystem::path& file); virtual ~FileReadBytestream(); - virtual boost::shared_ptr< std::vector<unsigned char> > read(size_t size); + virtual std::shared_ptr< std::vector<unsigned char> > read(size_t size); virtual bool isFinished() const; private: diff --git a/Swiften/FileTransfer/FileTransfer.h b/Swiften/FileTransfer/FileTransfer.h index b585ab9..e6442b7 100644 --- a/Swiften/FileTransfer/FileTransfer.h +++ b/Swiften/FileTransfer/FileTransfer.h @@ -5,16 +5,17 @@ */ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/cstdint.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -46,7 +47,7 @@ namespace Swift { Type type; std::string message; }; - typedef boost::shared_ptr<FileTransfer> ref; + typedef std::shared_ptr<FileTransfer> ref; public: FileTransfer(); diff --git a/Swiften/FileTransfer/FileTransferManager.h b/Swiften/FileTransfer/FileTransferManager.h index be2902a..60deeaa 100644 --- a/Swiften/FileTransfer/FileTransferManager.h +++ b/Swiften/FileTransfer/FileTransferManager.h @@ -36,7 +36,7 @@ namespace Swift { const JID& to, const boost::filesystem::path& filepath, const std::string& description, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, const FileTransferOptions& = FileTransferOptions()) = 0; virtual OutgoingFileTransfer::ref createOutgoingFileTransfer( const JID& to, @@ -44,7 +44,7 @@ namespace Swift { const std::string& description, const boost::uintmax_t sizeInBytes, const boost::posix_time::ptime& lastModified, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, const FileTransferOptions& = FileTransferOptions()) = 0; static bool isSupportedBy(const DiscoInfo::ref info); diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp index 80993ef..d449179 100644 --- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp +++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp @@ -125,7 +125,7 @@ OutgoingFileTransfer::ref FileTransferManagerImpl::createOutgoingFileTransfer( const JID& to, const boost::filesystem::path& filepath, const std::string& description, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, const FileTransferOptions& config) { #if BOOST_FILESYSTEM_VERSION == 2 // TODO: Delete this when boost 1.44 becomes a minimum requirement, and we no longer need v2 std::string filename = filepath.filename(); @@ -144,7 +144,7 @@ OutgoingFileTransfer::ref FileTransferManagerImpl::createOutgoingFileTransfer( const std::string& description, const boost::uintmax_t sizeInBytes, const boost::posix_time::ptime& lastModified, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, const FileTransferOptions& config) { JingleFileTransferFileInfo fileInfo; fileInfo.setDate(lastModified); diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.h b/Swiften/FileTransfer/FileTransferManagerImpl.h index a939ace..3566e92 100644 --- a/Swiften/FileTransfer/FileTransferManagerImpl.h +++ b/Swiften/FileTransfer/FileTransferManagerImpl.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -71,7 +71,7 @@ namespace Swift { const JID& to, const boost::filesystem::path& filepath, const std::string& description, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, const FileTransferOptions&) SWIFTEN_OVERRIDE; OutgoingFileTransfer::ref createOutgoingFileTransfer( const JID& to, @@ -79,7 +79,7 @@ namespace Swift { const std::string& description, const boost::uintmax_t sizeInBytes, const boost::posix_time::ptime& lastModified, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, const FileTransferOptions&) SWIFTEN_OVERRIDE; void start(); diff --git a/Swiften/FileTransfer/FileTransferTransporter.h b/Swiften/FileTransfer/FileTransferTransporter.h index dc12b0e..a680ca2 100644 --- a/Swiften/FileTransfer/FileTransferTransporter.h +++ b/Swiften/FileTransfer/FileTransferTransporter.h @@ -40,21 +40,21 @@ namespace Swift { virtual void startActivatingProxy(const JID& proxy) = 0; virtual void stopActivatingProxy() = 0; - virtual boost::shared_ptr<TransportSession> createIBBSendSession( - const std::string& sessionID, unsigned int blockSize, boost::shared_ptr<ReadBytestream>) = 0; - virtual boost::shared_ptr<TransportSession> createIBBReceiveSession( - const std::string& sessionID, unsigned long long size, boost::shared_ptr<WriteBytestream>) = 0; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession( - boost::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession( - boost::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession( - boost::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession( - boost::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; + virtual std::shared_ptr<TransportSession> createIBBSendSession( + const std::string& sessionID, unsigned int blockSize, std::shared_ptr<ReadBytestream>) = 0; + virtual std::shared_ptr<TransportSession> createIBBReceiveSession( + const std::string& sessionID, unsigned long long size, std::shared_ptr<WriteBytestream>) = 0; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession( + std::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession( + std::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession( + std::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession( + std::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& candidate) = 0; boost::signal<void (const std::string& /* sessionID */, const std::vector<JingleS5BTransportPayload::Candidate>&, const std::string& /* dstAddr */)> onLocalCandidatesGenerated; boost::signal<void (const std::string& /* sessionID */, const boost::optional<JingleS5BTransportPayload::Candidate>&)> onRemoteCandidateSelectFinished; - boost::signal<void (const std::string& /* sessionID */, boost::shared_ptr<ErrorPayload>)> onProxyActivated; + boost::signal<void (const std::string& /* sessionID */, std::shared_ptr<ErrorPayload>)> onProxyActivated; }; } diff --git a/Swiften/FileTransfer/IBBReceiveSession.cpp b/Swiften/FileTransfer/IBBReceiveSession.cpp index 5a29ccb..24996ed 100644 --- a/Swiften/FileTransfer/IBBReceiveSession.cpp +++ b/Swiften/FileTransfer/IBBReceiveSession.cpp @@ -72,7 +72,7 @@ IBBReceiveSession::IBBReceiveSession( const JID& from, const JID& to, unsigned long long size, - boost::shared_ptr<WriteBytestream> bytestream, + std::shared_ptr<WriteBytestream> bytestream, IQRouter* router) : id(id), from(from), diff --git a/Swiften/FileTransfer/IBBReceiveSession.h b/Swiften/FileTransfer/IBBReceiveSession.h index 3eec96e..c383455 100644 --- a/Swiften/FileTransfer/IBBReceiveSession.h +++ b/Swiften/FileTransfer/IBBReceiveSession.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/optional/optional_fwd.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -26,7 +27,7 @@ namespace Swift { const JID& from, const JID& to, unsigned long long size, - boost::shared_ptr<WriteBytestream> bytestream, + std::shared_ptr<WriteBytestream> bytestream, IQRouter* router); ~IBBReceiveSession(); @@ -55,7 +56,7 @@ namespace Swift { JID from; JID to; unsigned long long size; - boost::shared_ptr<WriteBytestream> bytestream; + std::shared_ptr<WriteBytestream> bytestream; IQRouter* router; IBBResponder* responder; bool active; diff --git a/Swiften/FileTransfer/IBBReceiveTransportSession.cpp b/Swiften/FileTransfer/IBBReceiveTransportSession.cpp index 2e19b75..6e47ac6 100644 --- a/Swiften/FileTransfer/IBBReceiveTransportSession.cpp +++ b/Swiften/FileTransfer/IBBReceiveTransportSession.cpp @@ -10,7 +10,7 @@ namespace Swift { -IBBReceiveTransportSession::IBBReceiveTransportSession(boost::shared_ptr<IBBReceiveSession> session) : session(session) { +IBBReceiveTransportSession::IBBReceiveTransportSession(std::shared_ptr<IBBReceiveSession> session) : session(session) { finishedConnection = session->onFinished.connect(boost::bind(boost::ref(onFinished), _1)); } diff --git a/Swiften/FileTransfer/IBBReceiveTransportSession.h b/Swiften/FileTransfer/IBBReceiveTransportSession.h index f66731b..65488d9 100644 --- a/Swiften/FileTransfer/IBBReceiveTransportSession.h +++ b/Swiften/FileTransfer/IBBReceiveTransportSession.h @@ -15,14 +15,14 @@ namespace Swift { class SWIFTEN_API IBBReceiveTransportSession : public TransportSession { public: - IBBReceiveTransportSession(boost::shared_ptr<IBBReceiveSession> session); + IBBReceiveTransportSession(std::shared_ptr<IBBReceiveSession> session); virtual ~IBBReceiveTransportSession(); virtual void start() SWIFTEN_OVERRIDE; virtual void stop() SWIFTEN_OVERRIDE; private: - boost::shared_ptr<IBBReceiveSession> session; + std::shared_ptr<IBBReceiveSession> session; boost::bsignals::scoped_connection finishedConnection; boost::bsignals::scoped_connection bytesSentConnection; }; diff --git a/Swiften/FileTransfer/IBBRequest.h b/Swiften/FileTransfer/IBBRequest.h index 165dd21..67bd33a 100644 --- a/Swiften/FileTransfer/IBBRequest.h +++ b/Swiften/FileTransfer/IBBRequest.h @@ -13,14 +13,14 @@ namespace Swift { class SWIFTEN_API IBBRequest : public GenericRequest<IBB> { public: - typedef boost::shared_ptr<IBBRequest> ref; + typedef std::shared_ptr<IBBRequest> ref; - static ref create(const JID& from, const JID& to, boost::shared_ptr<IBB> payload, IQRouter* router) { + static ref create(const JID& from, const JID& to, std::shared_ptr<IBB> payload, IQRouter* router) { return ref(new IBBRequest(from, to, payload, router)); } private: - IBBRequest(const JID& from, const JID& to, boost::shared_ptr<IBB> payload, IQRouter* router) : GenericRequest<IBB>(IQ::Set, from, to, payload, router) { + IBBRequest(const JID& from, const JID& to, std::shared_ptr<IBB> payload, IQRouter* router) : GenericRequest<IBB>(IQ::Set, from, to, payload, router) { } }; } diff --git a/Swiften/FileTransfer/IBBSendSession.cpp b/Swiften/FileTransfer/IBBSendSession.cpp index 10a36a9..e51c91c 100644 --- a/Swiften/FileTransfer/IBBSendSession.cpp +++ b/Swiften/FileTransfer/IBBSendSession.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ IBBSendSession::IBBSendSession( const std::string& id, const JID& from, const JID& to, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, IQRouter* router) : id(id), from(from), @@ -75,7 +75,7 @@ void IBBSendSession::handleIBBResponse(IBB::ref, ErrorPayload::ref error) { void IBBSendSession::sendMoreData() { try { - boost::shared_ptr<ByteArray> data = bytestream->read(blockSize); + std::shared_ptr<ByteArray> data = bytestream->read(blockSize); if (!data->empty()) { waitingForData = false; IBBRequest::ref request = IBBRequest::create(from, to, IBB::createIBBData(id, sequenceNumber, *data), router); diff --git a/Swiften/FileTransfer/IBBSendSession.h b/Swiften/FileTransfer/IBBSendSession.h index e62ef79..7988398 100644 --- a/Swiften/FileTransfer/IBBSendSession.h +++ b/Swiften/FileTransfer/IBBSendSession.h @@ -1,13 +1,14 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -27,7 +28,7 @@ namespace Swift { const std::string& id, const JID& from, const JID& to, - boost::shared_ptr<ReadBytestream> bytestream, + std::shared_ptr<ReadBytestream> bytestream, IQRouter* router); ~IBBSendSession(); @@ -59,12 +60,12 @@ namespace Swift { std::string id; JID from; JID to; - boost::shared_ptr<ReadBytestream> bytestream; + std::shared_ptr<ReadBytestream> bytestream; IQRouter* router; unsigned int blockSize; int sequenceNumber; bool active; bool waitingForData; - boost::shared_ptr<IBBRequest> currentRequest; + std::shared_ptr<IBBRequest> currentRequest; }; } diff --git a/Swiften/FileTransfer/IBBSendTransportSession.cpp b/Swiften/FileTransfer/IBBSendTransportSession.cpp index fd2d8e6..81972c9 100644 --- a/Swiften/FileTransfer/IBBSendTransportSession.cpp +++ b/Swiften/FileTransfer/IBBSendTransportSession.cpp @@ -10,7 +10,7 @@ namespace Swift { -IBBSendTransportSession::IBBSendTransportSession(boost::shared_ptr<IBBSendSession> session) : session(session) { +IBBSendTransportSession::IBBSendTransportSession(std::shared_ptr<IBBSendSession> session) : session(session) { finishedConnection = session->onFinished.connect(boost::bind(boost::ref(onFinished), _1)); bytesSentConnection = session->onBytesSent.connect(boost::bind(boost::ref(onBytesSent), _1)); } diff --git a/Swiften/FileTransfer/IBBSendTransportSession.h b/Swiften/FileTransfer/IBBSendTransportSession.h index 812c42e..5b55215 100644 --- a/Swiften/FileTransfer/IBBSendTransportSession.h +++ b/Swiften/FileTransfer/IBBSendTransportSession.h @@ -15,14 +15,14 @@ namespace Swift { class SWIFTEN_API IBBSendTransportSession : public TransportSession { public: - IBBSendTransportSession(boost::shared_ptr<IBBSendSession> session); + IBBSendTransportSession(std::shared_ptr<IBBSendSession> session); virtual ~IBBSendTransportSession(); virtual void start() SWIFTEN_OVERRIDE; virtual void stop() SWIFTEN_OVERRIDE; private: - boost::shared_ptr<IBBSendSession> session; + std::shared_ptr<IBBSendSession> session; boost::bsignals::scoped_connection finishedConnection; boost::bsignals::scoped_connection bytesSentConnection; }; diff --git a/Swiften/FileTransfer/IncomingFileTransfer.h b/Swiften/FileTransfer/IncomingFileTransfer.h index 4cb18e8..2976216 100644 --- a/Swiften/FileTransfer/IncomingFileTransfer.h +++ b/Swiften/FileTransfer/IncomingFileTransfer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -23,12 +23,12 @@ namespace Swift { */ class SWIFTEN_API IncomingFileTransfer : public FileTransfer { public: - typedef boost::shared_ptr<IncomingFileTransfer> ref; + typedef std::shared_ptr<IncomingFileTransfer> ref; virtual ~IncomingFileTransfer(); virtual void accept( - boost::shared_ptr<WriteBytestream>, + std::shared_ptr<WriteBytestream>, const FileTransferOptions& = FileTransferOptions()) = 0; virtual const JID& getSender() const = 0; diff --git a/Swiften/FileTransfer/IncomingFileTransferManager.cpp b/Swiften/FileTransfer/IncomingFileTransferManager.cpp index b0b4d49..1c2b788 100644 --- a/Swiften/FileTransfer/IncomingFileTransferManager.cpp +++ b/Swiften/FileTransfer/IncomingFileTransferManager.cpp @@ -6,7 +6,7 @@ #include <Swiften/FileTransfer/IncomingFileTransferManager.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/Log.h> #include <Swiften/Elements/JingleDescription.h> @@ -43,7 +43,7 @@ bool IncomingFileTransferManager::handleIncomingJingleSession( if (content->getTransport<JingleS5BTransportPayload>() || content->getTransport<JingleIBBTransportPayload>()) { JingleFileTransferDescription::ref description = content->getDescription<JingleFileTransferDescription>(); if (description) { - IncomingJingleFileTransfer::ref transfer = boost::make_shared<IncomingJingleFileTransfer>( + IncomingJingleFileTransfer::ref transfer = std::make_shared<IncomingJingleFileTransfer>( recipient, session, content, transporterFactory, timerFactory, crypto); onIncomingFileTransfer(transfer); } diff --git a/Swiften/FileTransfer/IncomingFileTransferManager.h b/Swiften/FileTransfer/IncomingFileTransferManager.h index 7a34b2a..fa1b3bb 100644 --- a/Swiften/FileTransfer/IncomingFileTransferManager.h +++ b/Swiften/FileTransfer/IncomingFileTransferManager.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp index 526c54c..f73cd38 100644 --- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp +++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp @@ -6,10 +6,10 @@ #include <Swiften/FileTransfer/IncomingJingleFileTransfer.h> +#include <memory> #include <set> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -66,7 +66,7 @@ IncomingJingleFileTransfer::~IncomingJingleFileTransfer() { } void IncomingJingleFileTransfer::accept( - boost::shared_ptr<WriteBytestream> stream, + std::shared_ptr<WriteBytestream> stream, const FileTransferOptions& options) { SWIFT_LOG(debug) << std::endl; if (state != Initial) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } @@ -126,7 +126,7 @@ void IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated( fillCandidateMap(localCandidates, candidates); - JingleS5BTransportPayload::ref transport = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref transport = std::make_shared<JingleS5BTransportPayload>(); transport->setSessionID(s5bSessionID); transport->setMode(JingleS5BTransportPayload::TCPMode); transport->setDstAddr(dstAddr); @@ -233,7 +233,7 @@ void IncomingJingleFileTransfer::handleTransportReplaceReceived( } JingleIBBTransportPayload::ref ibbTransport; - if (options.isInBandAllowed() && (ibbTransport = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) { + if (options.isInBandAllowed() && (ibbTransport = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) { SWIFT_LOG(debug) << "transport replaced with IBB" << std::endl; startTransferring(transporter->createIBBReceiveSession( @@ -379,7 +379,7 @@ void IncomingJingleFileTransfer::startTransferViaLocalCandidate() { } } -void IncomingJingleFileTransfer::startTransferring(boost::shared_ptr<TransportSession> transportSession) { +void IncomingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSession> transportSession) { SWIFT_LOG(debug) << std::endl; this->transportSession = transportSession; @@ -401,11 +401,11 @@ bool IncomingJingleFileTransfer::isTryingCandidates() const { return state == TryingCandidates; } -boost::shared_ptr<TransportSession> IncomingJingleFileTransfer::createLocalCandidateSession() { +std::shared_ptr<TransportSession> IncomingJingleFileTransfer::createLocalCandidateSession() { return transporter->createLocalCandidateSession(stream, theirCandidateChoice.get()); } -boost::shared_ptr<TransportSession> IncomingJingleFileTransfer::createRemoteCandidateSession() { +std::shared_ptr<TransportSession> IncomingJingleFileTransfer::createRemoteCandidateSession() { return transporter->createRemoteCandidateSession(stream, ourCandidateChoice.get()); } diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.h b/Swiften/FileTransfer/IncomingJingleFileTransfer.h index d3cc331..36b76b1 100644 --- a/Swiften/FileTransfer/IncomingJingleFileTransfer.h +++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/cstdint.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> @@ -42,18 +42,18 @@ namespace Swift { */ class SWIFTEN_API IncomingJingleFileTransfer : public IncomingFileTransfer, public JingleFileTransfer { public: - typedef boost::shared_ptr<IncomingJingleFileTransfer> ref; + typedef std::shared_ptr<IncomingJingleFileTransfer> ref; IncomingJingleFileTransfer( const JID& recipient, - boost::shared_ptr<JingleSession>, - boost::shared_ptr<JingleContentPayload> content, + std::shared_ptr<JingleSession>, + std::shared_ptr<JingleContentPayload> content, FileTransferTransporterFactory*, TimerFactory*, CryptoProvider*); virtual ~IncomingJingleFileTransfer(); - virtual void accept(boost::shared_ptr<WriteBytestream>, const FileTransferOptions& = FileTransferOptions()) SWIFTEN_OVERRIDE; + virtual void accept(std::shared_ptr<WriteBytestream>, const FileTransferOptions& = FileTransferOptions()) SWIFTEN_OVERRIDE; virtual void cancel() SWIFTEN_OVERRIDE; private: @@ -71,9 +71,9 @@ namespace Swift { virtual void handleSessionTerminateReceived( boost::optional<JinglePayload::Reason> reason) SWIFTEN_OVERRIDE; - virtual void handleSessionInfoReceived(boost::shared_ptr<JinglePayload>) SWIFTEN_OVERRIDE; + virtual void handleSessionInfoReceived(std::shared_ptr<JinglePayload>) SWIFTEN_OVERRIDE; virtual void handleTransportReplaceReceived( - const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + const JingleContentID&, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; virtual void handleLocalTransportCandidatesGenerated( const std::string& s5bSessionID, @@ -101,24 +101,24 @@ namespace Swift { static FileTransfer::State::Type getExternalState(State state); virtual bool hasPriorityOnCandidateTie() const SWIFTEN_OVERRIDE; virtual void fallback() SWIFTEN_OVERRIDE; - virtual void startTransferring(boost::shared_ptr<TransportSession>) SWIFTEN_OVERRIDE; + virtual void startTransferring(std::shared_ptr<TransportSession>) SWIFTEN_OVERRIDE; virtual bool isWaitingForPeerProxyActivate() const SWIFTEN_OVERRIDE; virtual bool isWaitingForLocalProxyActivate() const SWIFTEN_OVERRIDE; virtual bool isTryingCandidates() const SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession() SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession() SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession() SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession() SWIFTEN_OVERRIDE; virtual void terminate(JinglePayload::Reason::Type reason) SWIFTEN_OVERRIDE; private: - boost::shared_ptr<JingleContentPayload> initialContent; + std::shared_ptr<JingleContentPayload> initialContent; CryptoProvider* crypto; State state; - boost::shared_ptr<JingleFileTransferDescription> description; - boost::shared_ptr<WriteBytestream> stream; + std::shared_ptr<JingleFileTransferDescription> description; + std::shared_ptr<WriteBytestream> stream; boost::uintmax_t receivedBytes; IncrementalBytestreamHashCalculator* hashCalculator; - boost::shared_ptr<Timer> waitOnHashTimer; + std::shared_ptr<Timer> waitOnHashTimer; std::map<std::string, ByteArray> hashes; FileTransferOptions options; diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp index 53977ec..36725de 100644 --- a/Swiften/FileTransfer/JingleFileTransfer.cpp +++ b/Swiften/FileTransfer/JingleFileTransfer.cpp @@ -19,7 +19,7 @@ using namespace Swift; JingleFileTransfer::JingleFileTransfer( - boost::shared_ptr<JingleSession> session, + std::shared_ptr<JingleSession> session, const JID& target, FileTransferTransporterFactory* transporterFactory) : session(session), @@ -87,7 +87,7 @@ void JingleFileTransfer::handleRemoteTransportCandidateSelectFinished( ourCandidateChoice = candidate; ourCandidateSelectFinished = true; - JingleS5BTransportPayload::ref s5bPayload = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref s5bPayload = std::make_shared<JingleS5BTransportPayload>(); s5bPayload->setSessionID(s5bSessionID); if (candidate) { s5bPayload->setCandidateUsed(candidate->cid); @@ -151,14 +151,14 @@ void JingleFileTransfer::handleProxyActivateFinished( if (error) { SWIFT_LOG(debug) << "Error activating proxy" << std::endl; - JingleS5BTransportPayload::ref proxyError = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref proxyError = std::make_shared<JingleS5BTransportPayload>(); proxyError->setSessionID(s5bSessionID); proxyError->setProxyError(true); session->sendTransportInfo(getContentID(), proxyError); fallback(); } else { - JingleS5BTransportPayload::ref proxyActivate = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref proxyActivate = std::make_shared<JingleS5BTransportPayload>(); proxyActivate->setSessionID(s5bSessionID); proxyActivate->setActivated(theirCandidateChoice->cid); session->sendTransportInfo(getContentID(), proxyActivate); @@ -170,7 +170,7 @@ void JingleFileTransfer::handleTransportInfoReceived( const JingleContentID& /* contentID */, JingleTransportPayload::ref transport) { SWIFT_LOG(debug) << std::endl; - if (JingleS5BTransportPayload::ref s5bPayload = boost::dynamic_pointer_cast<JingleS5BTransportPayload>(transport)) { + if (JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transport)) { if (s5bPayload->hasCandidateError() || !s5bPayload->getCandidateUsed().empty()) { SWIFT_LOG(debug) << "Received candidate decision from peer" << std::endl; if (!isTryingCandidates()) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } diff --git a/Swiften/FileTransfer/JingleFileTransfer.h b/Swiften/FileTransfer/JingleFileTransfer.h index 6862ba2..8a80e06 100644 --- a/Swiften/FileTransfer/JingleFileTransfer.h +++ b/Swiften/FileTransfer/JingleFileTransfer.h @@ -1,15 +1,14 @@ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/ErrorPayload.h> @@ -31,7 +30,7 @@ namespace Swift { class SWIFTEN_API JingleFileTransfer : public AbstractJingleSessionListener { public: JingleFileTransfer( - boost::shared_ptr<JingleSession>, + std::shared_ptr<JingleSession>, const JID& target, FileTransferTransporterFactory*); virtual ~JingleFileTransfer(); @@ -49,15 +48,15 @@ namespace Swift { void handleRemoteTransportCandidateSelectFinished( const std::string& s5bSessionID, const boost::optional<JingleS5BTransportPayload::Candidate>&); virtual JingleContentID getContentID() const = 0; - virtual void startTransferring(boost::shared_ptr<TransportSession>) = 0; + virtual void startTransferring(std::shared_ptr<TransportSession>) = 0; virtual void terminate(JinglePayload::Reason::Type reason) = 0; virtual void fallback() = 0; virtual bool hasPriorityOnCandidateTie() const = 0; virtual bool isWaitingForPeerProxyActivate() const = 0; virtual bool isWaitingForLocalProxyActivate() const = 0; virtual bool isTryingCandidates() const = 0; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession() = 0; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession() = 0; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession() = 0; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession() = 0; virtual void startTransferViaLocalCandidate() = 0; virtual void startTransferViaRemoteCandidate() = 0; @@ -75,7 +74,7 @@ namespace Swift { static FileTransfer::State::Type getExternalFinishedState(JinglePayload::Reason::Type); static boost::optional<FileTransferError> getFileTransferError(JinglePayload::Reason::Type); - boost::shared_ptr<JingleSession> session; + std::shared_ptr<JingleSession> session; JID target; FileTransferTransporterFactory* transporterFactory; FileTransferTransporter* transporter; @@ -87,7 +86,7 @@ namespace Swift { boost::optional<JingleS5BTransportPayload::Candidate> theirCandidateChoice; CandidateMap localCandidates; - boost::shared_ptr<TransportSession> transportSession; + std::shared_ptr<TransportSession> transportSession; boost::bsignals::scoped_connection localTransportCandidatesGeneratedConnection; boost::bsignals::scoped_connection remoteTransportCandidateSelectFinishedConnection; diff --git a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp index 3703ba1..2975193 100644 --- a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp +++ b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp @@ -5,18 +5,17 @@ */ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h> +#include <memory> #include <vector> #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> diff --git a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h index 74c6bfb..66b035e 100644 --- a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h +++ b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h @@ -58,9 +58,9 @@ namespace Swift { SOCKS5BytestreamProxiesManager* s5bProxy; JID ownJID; IDGenerator* idGenerator; - boost::shared_ptr<SOCKS5BytestreamServerInitializeRequest> s5bServerInitializeRequest; - boost::shared_ptr<SOCKS5BytestreamServerResourceUser> s5bServerResourceUser_; - boost::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> s5bServerPortForwardingUser_; + std::shared_ptr<SOCKS5BytestreamServerInitializeRequest> s5bServerInitializeRequest; + std::shared_ptr<SOCKS5BytestreamServerResourceUser> s5bServerResourceUser_; + std::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> s5bServerPortForwardingUser_; bool triedServerInit_; bool triedForwarding_; bool triedProxyDiscovery_; diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.h b/Swiften/FileTransfer/OutgoingFileTransfer.h index e83a893..07fc6d2 100644 --- a/Swiften/FileTransfer/OutgoingFileTransfer.h +++ b/Swiften/FileTransfer/OutgoingFileTransfer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/FileTransfer/FileTransfer.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API OutgoingFileTransfer : public FileTransfer { public: - typedef boost::shared_ptr<OutgoingFileTransfer> ref; + typedef std::shared_ptr<OutgoingFileTransfer> ref; public: virtual ~OutgoingFileTransfer(); diff --git a/Swiften/FileTransfer/OutgoingFileTransferManager.cpp b/Swiften/FileTransfer/OutgoingFileTransferManager.cpp index f6d216e..c74aefb 100644 --- a/Swiften/FileTransfer/OutgoingFileTransferManager.cpp +++ b/Swiften/FileTransfer/OutgoingFileTransferManager.cpp @@ -12,7 +12,7 @@ #include <Swiften/FileTransfer/OutgoingFileTransferManager.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/IDGenerator.h> #include <Swiften/FileTransfer/OutgoingJingleFileTransfer.h> @@ -41,16 +41,16 @@ OutgoingFileTransferManager::~OutgoingFileTransferManager() { delete idGenerator; } -boost::shared_ptr<OutgoingFileTransfer> OutgoingFileTransferManager::createOutgoingFileTransfer( +std::shared_ptr<OutgoingFileTransfer> OutgoingFileTransferManager::createOutgoingFileTransfer( const JID& from, const JID& recipient, - boost::shared_ptr<ReadBytestream> readBytestream, + std::shared_ptr<ReadBytestream> readBytestream, const JingleFileTransferFileInfo& fileInfo, const FileTransferOptions& config) { - JingleSessionImpl::ref jingleSession = boost::make_shared<JingleSessionImpl>( + JingleSessionImpl::ref jingleSession = std::make_shared<JingleSessionImpl>( from, recipient, idGenerator->generateID(), iqRouter); jingleSessionManager->registerOutgoingSession(from, jingleSession); - return boost::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer( + return std::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer( recipient, jingleSession, readBytestream, diff --git a/Swiften/FileTransfer/OutgoingFileTransferManager.h b/Swiften/FileTransfer/OutgoingFileTransferManager.h index 3981005..48a6e5a 100644 --- a/Swiften/FileTransfer/OutgoingFileTransferManager.h +++ b/Swiften/FileTransfer/OutgoingFileTransferManager.h @@ -5,14 +5,14 @@ */ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> @@ -39,10 +39,10 @@ namespace Swift { CryptoProvider* crypto); ~OutgoingFileTransferManager(); - boost::shared_ptr<OutgoingFileTransfer> createOutgoingFileTransfer( + std::shared_ptr<OutgoingFileTransfer> createOutgoingFileTransfer( const JID& from, const JID& to, - boost::shared_ptr<ReadBytestream>, + std::shared_ptr<ReadBytestream>, const JingleFileTransferFileInfo&, const FileTransferOptions&); diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp index c7573c2..fcc160a 100644 --- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp +++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp @@ -17,8 +17,9 @@ #include <Swiften/FileTransfer/OutgoingJingleFileTransfer.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <boost/typeof/typeof.hpp> #include <Swiften/Base/IDGenerator.h> @@ -46,7 +47,7 @@ static const int DEFAULT_BLOCK_SIZE = 4096; OutgoingJingleFileTransfer::OutgoingJingleFileTransfer( const JID& toJID, JingleSession::ref session, - boost::shared_ptr<ReadBytestream> stream, + std::shared_ptr<ReadBytestream> stream, FileTransferTransporterFactory* transporterFactory, TimerFactory* timerFactory, IDGenerator* idGenerator, @@ -125,12 +126,12 @@ void OutgoingJingleFileTransfer::handleSessionAcceptReceived( SWIFT_LOG(debug) << std::endl; if (state != WaitingForAccept) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } - if (JingleS5BTransportPayload::ref s5bPayload = boost::dynamic_pointer_cast<JingleS5BTransportPayload>(transportPayload)) { + if (JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transportPayload)) { transporter->addRemoteCandidates(s5bPayload->getCandidates(), s5bPayload->getDstAddr()); setInternalState(TryingCandidates); transporter->startTryingRemoteCandidates(); } - else if (JingleIBBTransportPayload::ref ibbPayload = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(transportPayload)) { + else if (JingleIBBTransportPayload::ref ibbPayload = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transportPayload)) { startTransferring(transporter->createIBBSendSession(ibbPayload->getSessionID(), ibbPayload->getBlockSize().get_value_or(DEFAULT_BLOCK_SIZE), stream)); } else { @@ -165,7 +166,7 @@ void OutgoingJingleFileTransfer::handleTransportAcceptReceived(const JingleConte SWIFT_LOG(debug) << std::endl; if (state != FallbackRequested) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } - if (JingleIBBTransportPayload::ref ibbPayload = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(transport)) { + if (JingleIBBTransportPayload::ref ibbPayload = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport)) { startTransferring(transporter->createIBBSendSession(ibbPayload->getSessionID(), ibbPayload->getBlockSize().get_value_or(DEFAULT_BLOCK_SIZE), stream)); } else { @@ -174,7 +175,7 @@ void OutgoingJingleFileTransfer::handleTransportAcceptReceived(const JingleConte } } -void OutgoingJingleFileTransfer::handleTransportRejectReceived(const JingleContentID &, boost::shared_ptr<JingleTransportPayload>) { +void OutgoingJingleFileTransfer::handleTransportRejectReceived(const JingleContentID &, std::shared_ptr<JingleTransportPayload>) { SWIFT_LOG(debug) << std::endl; terminate(JinglePayload::Reason::UnsupportedTransports); @@ -183,7 +184,7 @@ void OutgoingJingleFileTransfer::handleTransportRejectReceived(const JingleConte void OutgoingJingleFileTransfer::sendSessionInfoHash() { SWIFT_LOG(debug) << std::endl; - JingleFileTransferHash::ref hashElement = boost::make_shared<JingleFileTransferHash>(); + JingleFileTransferHash::ref hashElement = std::make_shared<JingleFileTransferHash>(); hashElement->getFileInfo().addHash(HashElement("sha-1", hashCalculator->getSHA1Hash())); hashElement->getFileInfo().addHash(HashElement("md5", hashCalculator->getMD5Hash())); session->sendInfo(hashElement); @@ -196,7 +197,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated( fillCandidateMap(localCandidates, candidates); - JingleFileTransferDescription::ref description = boost::make_shared<JingleFileTransferDescription>(); + JingleFileTransferDescription::ref description = std::make_shared<JingleFileTransferDescription>(); fileInfo.addHash(HashElement("sha-1", ByteArray())); fileInfo.addHash(HashElement("md5", ByteArray())); description->setFileInfo(fileInfo); @@ -204,13 +205,13 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated( JingleTransportPayload::ref transport; if (candidates.empty()) { SWIFT_LOG(debug) << "no S5B candidates generated. Send IBB transport candidate." << std::endl; - JingleIBBTransportPayload::ref ibbTransport = boost::make_shared<JingleIBBTransportPayload>(); + JingleIBBTransportPayload::ref ibbTransport = std::make_shared<JingleIBBTransportPayload>(); ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE); ibbTransport->setSessionID(idGenerator->generateID()); transport = ibbTransport; } else { - JingleS5BTransportPayload::ref s5bTransport = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref s5bTransport = std::make_shared<JingleS5BTransportPayload>(); s5bTransport->setSessionID(s5bSessionID); s5bTransport->setMode(JingleS5BTransportPayload::TCPMode); s5bTransport->setDstAddr(dstAddr); @@ -227,7 +228,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated( void OutgoingJingleFileTransfer::fallback() { if (options.isInBandAllowed()) { SWIFT_LOG(debug) << "Trying to fallback to IBB transport." << std::endl; - JingleIBBTransportPayload::ref ibbTransport = boost::make_shared<JingleIBBTransportPayload>(); + JingleIBBTransportPayload::ref ibbTransport = std::make_shared<JingleIBBTransportPayload>(); ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE); ibbTransport->setSessionID(idGenerator->generateID()); setInternalState(FallbackRequested); @@ -255,7 +256,7 @@ void OutgoingJingleFileTransfer::handleTransferFinished(boost::optional<FileTran } } -void OutgoingJingleFileTransfer::startTransferring(boost::shared_ptr<TransportSession> transportSession) { +void OutgoingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSession> transportSession) { SWIFT_LOG(debug) << std::endl; this->transportSession = transportSession; @@ -390,11 +391,11 @@ bool OutgoingJingleFileTransfer::isTryingCandidates() const { return state == TryingCandidates; } -boost::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createLocalCandidateSession() { +std::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createLocalCandidateSession() { return transporter->createLocalCandidateSession(stream, theirCandidateChoice.get()); } -boost::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createRemoteCandidateSession() { +std::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createRemoteCandidateSession() { return transporter->createRemoteCandidateSession(stream, ourCandidateChoice.get()); } diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.h b/Swiften/FileTransfer/OutgoingJingleFileTransfer.h index a8dad1e..4f28433 100644 --- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.h +++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.h @@ -5,15 +5,16 @@ */ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/optional/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -38,8 +39,8 @@ namespace Swift { public: OutgoingJingleFileTransfer( const JID& to, - boost::shared_ptr<JingleSession>, - boost::shared_ptr<ReadBytestream>, + std::shared_ptr<JingleSession>, + std::shared_ptr<ReadBytestream>, FileTransferTransporterFactory*, TimerFactory*, IDGenerator*, @@ -66,10 +67,10 @@ namespace Swift { Finished }; - virtual void handleSessionAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleDescription>, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleSessionAcceptReceived(const JingleContentID&, std::shared_ptr<JingleDescription>, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; virtual void handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) SWIFTEN_OVERRIDE; - virtual void handleTransportAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleTransportRejectReceived(const JingleContentID &, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportAcceptReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportRejectReceived(const JingleContentID &, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; virtual void startTransferViaRemoteCandidate() SWIFTEN_OVERRIDE; virtual void startTransferViaLocalCandidate() SWIFTEN_OVERRIDE; void startTransferringIfCandidateAcknowledged(); @@ -86,14 +87,14 @@ namespace Swift { void sendSessionInfoHash(); - virtual void startTransferring(boost::shared_ptr<TransportSession>) SWIFTEN_OVERRIDE; + virtual void startTransferring(std::shared_ptr<TransportSession>) SWIFTEN_OVERRIDE; virtual bool hasPriorityOnCandidateTie() const SWIFTEN_OVERRIDE; virtual bool isWaitingForPeerProxyActivate() const SWIFTEN_OVERRIDE; virtual bool isWaitingForLocalProxyActivate() const SWIFTEN_OVERRIDE; virtual bool isTryingCandidates() const SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession() SWIFTEN_OVERRIDE; - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession() SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createLocalCandidateSession() SWIFTEN_OVERRIDE; + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession() SWIFTEN_OVERRIDE; void handleWaitForRemoteTerminationTimeout(); @@ -105,7 +106,7 @@ namespace Swift { private: IDGenerator* idGenerator; - boost::shared_ptr<ReadBytestream> stream; + std::shared_ptr<ReadBytestream> stream; JingleFileTransferFileInfo fileInfo; FileTransferOptions options; JingleContentID contentID; diff --git a/Swiften/FileTransfer/ReadBytestream.h b/Swiften/FileTransfer/ReadBytestream.h index e967c53..62542bc 100644 --- a/Swiften/FileTransfer/ReadBytestream.h +++ b/Swiften/FileTransfer/ReadBytestream.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -22,7 +21,7 @@ namespace Swift { * Return an empty vector if no more data is available. * Use onDataAvailable signal for signaling there is data available again. */ - virtual boost::shared_ptr< std::vector<unsigned char> > read(size_t size) = 0; + virtual std::shared_ptr< std::vector<unsigned char> > read(size_t size) = 0; virtual bool isFinished() const = 0; diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp index 296723e..c29fd5c 100644 --- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp +++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp @@ -12,8 +12,9 @@ #include <Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/boost_bsignals.h> @@ -58,7 +59,7 @@ void RemoteJingleTransportCandidateSelector::tryNextCandidate() { if (candidates.empty()) { SWIFT_LOG(debug) << "No more candidates" << std::endl; onCandidateSelectFinished( - boost::optional<JingleS5BTransportPayload::Candidate>(), boost::shared_ptr<SOCKS5BytestreamClientSession>()); + boost::optional<JingleS5BTransportPayload::Candidate>(), std::shared_ptr<SOCKS5BytestreamClientSession>()); } else { lastCandidate = candidates.top(); @@ -67,8 +68,8 @@ void RemoteJingleTransportCandidateSelector::tryNextCandidate() { if ((lastCandidate.type == JingleS5BTransportPayload::Candidate::DirectType && options.isDirectAllowed()) || (lastCandidate.type == JingleS5BTransportPayload::Candidate::AssistedType && options.isAssistedAllowed()) || (lastCandidate.type == JingleS5BTransportPayload::Candidate::ProxyType && options.isProxiedAllowed())) { - boost::shared_ptr<Connection> connection = connectionFactory->createConnection(); - s5bSession = boost::make_shared<SOCKS5BytestreamClientSession>( + std::shared_ptr<Connection> connection = connectionFactory->createConnection(); + s5bSession = std::make_shared<SOCKS5BytestreamClientSession>( connection, lastCandidate.hostPort, socks5DstAddr, timerFactory); sessionReadyConnection = s5bSession->onSessionReady.connect( boost::bind(&RemoteJingleTransportCandidateSelector::handleSessionReady, this, _1)); diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h index 5928754..1f24b6a 100644 --- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h +++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h @@ -14,11 +14,10 @@ #include <Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h> +#include <memory> #include <queue> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/Override.h> #include <Swiften/Elements/JingleS5BTransportPayload.h> #include <Swiften/FileTransfer/FileTransferOptions.h> @@ -40,7 +39,7 @@ namespace Swift { virtual void startSelectingCandidate(); virtual void stopSelectingCandidate(); - boost::signal<void (const boost::optional<JingleS5BTransportPayload::Candidate>&, boost::shared_ptr<SOCKS5BytestreamClientSession>)> onCandidateSelectFinished; + boost::signal<void (const boost::optional<JingleS5BTransportPayload::Candidate>&, std::shared_ptr<SOCKS5BytestreamClientSession>)> onCandidateSelectFinished; private: void tryNextCandidate(); @@ -54,7 +53,7 @@ namespace Swift { JingleS5BTransportPayload::Candidate, std::vector<JingleS5BTransportPayload::Candidate>, JingleS5BTransportPayload::CompareCandidate> candidates; - boost::shared_ptr<SOCKS5BytestreamClientSession> s5bSession; + std::shared_ptr<SOCKS5BytestreamClientSession> s5bSession; boost::bsignals::connection sessionReadyConnection; JingleS5BTransportPayload::Candidate lastCandidate; std::string socks5DstAddr; diff --git a/Swiften/FileTransfer/S5BTransportSession.h b/Swiften/FileTransfer/S5BTransportSession.h index 95143bd..683e9c4 100644 --- a/Swiften/FileTransfer/S5BTransportSession.h +++ b/Swiften/FileTransfer/S5BTransportSession.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,16 +20,16 @@ template <typename T> class SWIFTEN_API S5BTransportSession : public TransportSession { public: S5BTransportSession( - boost::shared_ptr<T> session, - boost::shared_ptr<ReadBytestream> readStream) : + std::shared_ptr<T> session, + std::shared_ptr<ReadBytestream> readStream) : session(session), readStream(readStream) { initialize(); } S5BTransportSession( - boost::shared_ptr<T> session, - boost::shared_ptr<WriteBytestream> writeStream) : + std::shared_ptr<T> session, + std::shared_ptr<WriteBytestream> writeStream) : session(session), writeStream(writeStream) { initialize(); @@ -58,9 +58,9 @@ class SWIFTEN_API S5BTransportSession : public TransportSession { } private: - boost::shared_ptr<T> session; - boost::shared_ptr<ReadBytestream> readStream; - boost::shared_ptr<WriteBytestream> writeStream; + std::shared_ptr<T> session; + std::shared_ptr<ReadBytestream> readStream; + std::shared_ptr<WriteBytestream> writeStream; boost::bsignals::scoped_connection finishedConnection; boost::bsignals::scoped_connection bytesSentConnection; diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp index 98a0988..5ddd32b 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp @@ -27,7 +27,7 @@ namespace Swift { SOCKS5BytestreamClientSession::SOCKS5BytestreamClientSession( - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, const HostAddressPort& addressPort, const std::string& destination, TimerFactory* timerFactory) : @@ -161,7 +161,7 @@ void SOCKS5BytestreamClientSession::authenticate() { state = Authenticating; } -void SOCKS5BytestreamClientSession::startReceiving(boost::shared_ptr<WriteBytestream> writeStream) { +void SOCKS5BytestreamClientSession::startReceiving(std::shared_ptr<WriteBytestream> writeStream) { if (state == Ready) { state = Reading; writeBytestream = writeStream; @@ -172,7 +172,7 @@ void SOCKS5BytestreamClientSession::startReceiving(boost::shared_ptr<WriteBytest } } -void SOCKS5BytestreamClientSession::startSending(boost::shared_ptr<ReadBytestream> readStream) { +void SOCKS5BytestreamClientSession::startSending(std::shared_ptr<ReadBytestream> readStream) { if (state == Ready) { state = Writing; readBytestream = readStream; @@ -191,7 +191,7 @@ HostAddressPort SOCKS5BytestreamClientSession::getAddressPort() const { void SOCKS5BytestreamClientSession::sendData() { if (!readBytestream->isFinished()) { try { - boost::shared_ptr<ByteArray> dataToSend = readBytestream->read(boost::numeric_cast<size_t>(chunkSize)); + std::shared_ptr<ByteArray> dataToSend = readBytestream->read(boost::numeric_cast<size_t>(chunkSize)); connection->write(createSafeByteArray(*dataToSend)); onBytesSent(dataToSend->size()); } @@ -241,7 +241,7 @@ void SOCKS5BytestreamClientSession::handleConnectFinished(bool error) { } } -void SOCKS5BytestreamClientSession::handleDataRead(boost::shared_ptr<SafeByteArray> data) { +void SOCKS5BytestreamClientSession::handleDataRead(std::shared_ptr<SafeByteArray> data) { SWIFT_LOG(debug) << "state: " << state << " data.size() = " << data->size() << std::endl; if (state != Reading) { append(unprocessedData, *data); diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h index 5aea7d0..2a73a79 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h @@ -5,15 +5,16 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> @@ -48,11 +49,11 @@ public: }; public: - typedef boost::shared_ptr<SOCKS5BytestreamClientSession> ref; + typedef std::shared_ptr<SOCKS5BytestreamClientSession> ref; public: SOCKS5BytestreamClientSession( - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, const HostAddressPort&, const std::string&, TimerFactory*); @@ -61,8 +62,8 @@ public: void start(); void stop(); - void startReceiving(boost::shared_ptr<WriteBytestream>); - void startSending(boost::shared_ptr<ReadBytestream>); + void startReceiving(std::shared_ptr<WriteBytestream>); + void startSending(std::shared_ptr<ReadBytestream>); HostAddressPort getAddressPort() const; @@ -78,7 +79,7 @@ private: void authenticate(); void handleConnectFinished(bool error); - void handleDataRead(boost::shared_ptr<SafeByteArray>); + void handleDataRead(std::shared_ptr<SafeByteArray>); void handleDisconnected(const boost::optional<Connection::Error>&); void handleWeFailedTimeout(); @@ -87,7 +88,7 @@ private: void closeConnection(); private: - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; HostAddressPort addressPort; std::string destination; // hexify(SHA1(sessionID + requester + target)) @@ -97,8 +98,8 @@ private: ByteArray authenticateAddress; int chunkSize; - boost::shared_ptr<WriteBytestream> writeBytestream; - boost::shared_ptr<ReadBytestream> readBytestream; + std::shared_ptr<WriteBytestream> writeBytestream; + std::shared_ptr<ReadBytestream> readBytestream; Timer::ref weFailedTimeout; diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp index 881a82d..6a738ee 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,8 +13,9 @@ #include <Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -67,13 +68,13 @@ void SOCKS5BytestreamProxiesManager::connectToProxies(const std::string& session if (localS5BProxies_) { foreach(S5BProxyRequest::ref proxy, localS5BProxies_.get()) { - boost::shared_ptr<Connection> conn = connectionFactory_->createConnection(); + std::shared_ptr<Connection> conn = connectionFactory_->createConnection(); HostAddressPort addressPort = HostAddressPort(proxy->getStreamHost().get().host, proxy->getStreamHost().get().port); SWIFT_LOG_ASSERT(addressPort.isValid(), warning) << std::endl; - boost::shared_ptr<SOCKS5BytestreamClientSession> session = boost::make_shared<SOCKS5BytestreamClientSession>(conn, addressPort, sessionID, timerFactory_); + std::shared_ptr<SOCKS5BytestreamClientSession> session = std::make_shared<SOCKS5BytestreamClientSession>(conn, addressPort, sessionID, timerFactory_); JID proxyJid = proxy->getStreamHost().get().jid; - clientSessions.push_back(std::pair<JID, boost::shared_ptr<SOCKS5BytestreamClientSession> >(proxyJid, session)); + clientSessions.push_back(std::pair<JID, std::shared_ptr<SOCKS5BytestreamClientSession> >(proxyJid, session)); session->onSessionReady.connect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxySessionReady, this,sessionID, proxyJid, session, _1)); session->onFinished.connect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxySessionFinished, this, sessionID, proxyJid, session, _1)); session->start(); @@ -83,14 +84,14 @@ void SOCKS5BytestreamProxiesManager::connectToProxies(const std::string& session proxySessions_[sessionID] = clientSessions; } -boost::shared_ptr<SOCKS5BytestreamClientSession> SOCKS5BytestreamProxiesManager::getProxySessionAndCloseOthers(const JID& proxyJID, const std::string& sessionID) { +std::shared_ptr<SOCKS5BytestreamClientSession> SOCKS5BytestreamProxiesManager::getProxySessionAndCloseOthers(const JID& proxyJID, const std::string& sessionID) { // checking parameters if (proxySessions_.find(sessionID) == proxySessions_.end()) { - return boost::shared_ptr<SOCKS5BytestreamClientSession>(); + return std::shared_ptr<SOCKS5BytestreamClientSession>(); } // get active session - boost::shared_ptr<SOCKS5BytestreamClientSession> activeSession; + std::shared_ptr<SOCKS5BytestreamClientSession> activeSession; for (ProxyJIDClientSessionVector::iterator i = proxySessions_[sessionID].begin(); i != proxySessions_[sessionID].end(); i++) { i->second->onSessionReady.disconnect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxySessionReady, this,sessionID, proxyJID, i->second, _1)); i->second->onFinished.disconnect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxySessionFinished, this, sessionID, proxyJID, i->second, _1)); @@ -107,8 +108,8 @@ boost::shared_ptr<SOCKS5BytestreamClientSession> SOCKS5BytestreamProxiesManager: return activeSession; } -boost::shared_ptr<SOCKS5BytestreamClientSession> SOCKS5BytestreamProxiesManager::createSOCKS5BytestreamClientSession(HostAddressPort addressPort, const std::string& destAddr) { - SOCKS5BytestreamClientSession::ref connection = boost::make_shared<SOCKS5BytestreamClientSession>(connectionFactory_->createConnection(), addressPort, destAddr, timerFactory_); +std::shared_ptr<SOCKS5BytestreamClientSession> SOCKS5BytestreamProxiesManager::createSOCKS5BytestreamClientSession(HostAddressPort addressPort, const std::string& destAddr) { + SOCKS5BytestreamClientSession::ref connection = std::make_shared<SOCKS5BytestreamClientSession>(connectionFactory_->createConnection(), addressPort, destAddr, timerFactory_); return connection; } @@ -146,7 +147,7 @@ void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<Ho // generate proxy per returned address foreach (const HostAddress& address, addresses) { S5BProxyRequest::StreamHost streamHost = proxy->getStreamHost().get(); - S5BProxyRequest::ref proxyForAddress = boost::make_shared<S5BProxyRequest>(*proxy); + S5BProxyRequest::ref proxyForAddress = std::make_shared<S5BProxyRequest>(*proxy); streamHost.host = address.toString(); proxyForAddress->setStreamHost(streamHost); addS5BProxy(proxyForAddress); @@ -157,13 +158,13 @@ void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<Ho } void SOCKS5BytestreamProxiesManager::queryForProxies() { - proxyFinder_ = boost::make_shared<SOCKS5BytestreamProxyFinder>(serviceRoot_, iqRouter_); + proxyFinder_ = std::make_shared<SOCKS5BytestreamProxyFinder>(serviceRoot_, iqRouter_); proxyFinder_->onProxiesFound.connect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxiesFound, this, _1)); proxyFinder_->start(); } -void SOCKS5BytestreamProxiesManager::handleProxySessionReady(const std::string& sessionID, const JID& jid, boost::shared_ptr<SOCKS5BytestreamClientSession> session, bool error) { +void SOCKS5BytestreamProxiesManager::handleProxySessionReady(const std::string& sessionID, const JID& jid, std::shared_ptr<SOCKS5BytestreamClientSession> session, bool error) { session->onSessionReady.disconnect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxySessionReady, this, boost::cref(sessionID), boost::cref(jid), session, _1)); if (!error) { // The SOCKS5 bytestream session to the proxy succeeded; stop and remove other sessions. @@ -181,7 +182,7 @@ void SOCKS5BytestreamProxiesManager::handleProxySessionReady(const std::string& } } -void SOCKS5BytestreamProxiesManager::handleProxySessionFinished(const std::string& sessionID, const JID& jid, boost::shared_ptr<SOCKS5BytestreamClientSession> session, boost::optional<FileTransferError> error) { +void SOCKS5BytestreamProxiesManager::handleProxySessionFinished(const std::string& sessionID, const JID& jid, std::shared_ptr<SOCKS5BytestreamClientSession> session, boost::optional<FileTransferError> error) { session->onFinished.disconnect(boost::bind(&SOCKS5BytestreamProxiesManager::handleProxySessionFinished, this, sessionID, jid, session, _1)); if (error.is_initialized()) { // The SOCKS5 bytestream session to the proxy failed; remove it. diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h index b490ffa..0b566f3 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -49,9 +49,9 @@ namespace Swift { const boost::optional<std::vector<S5BProxyRequest::ref> >& getOrDiscoverS5BProxies(); void connectToProxies(const std::string& sessionID); - boost::shared_ptr<SOCKS5BytestreamClientSession> getProxySessionAndCloseOthers(const JID& proxyJID, const std::string& sessionID); + std::shared_ptr<SOCKS5BytestreamClientSession> getProxySessionAndCloseOthers(const JID& proxyJID, const std::string& sessionID); - boost::shared_ptr<SOCKS5BytestreamClientSession> createSOCKS5BytestreamClientSession(HostAddressPort addressPort, const std::string& destAddr); + std::shared_ptr<SOCKS5BytestreamClientSession> createSOCKS5BytestreamClientSession(HostAddressPort addressPort, const std::string& destAddr); public: boost::signal<void ()> onDiscoveredProxiesChanged; @@ -62,8 +62,8 @@ namespace Swift { void queryForProxies(); - void handleProxySessionReady(const std::string& sessionID, const JID& jid, boost::shared_ptr<SOCKS5BytestreamClientSession> session, bool error); - void handleProxySessionFinished(const std::string& sessionID, const JID& jid, boost::shared_ptr<SOCKS5BytestreamClientSession> session, boost::optional<FileTransferError> error); + void handleProxySessionReady(const std::string& sessionID, const JID& jid, std::shared_ptr<SOCKS5BytestreamClientSession> session, bool error); + void handleProxySessionFinished(const std::string& sessionID, const JID& jid, std::shared_ptr<SOCKS5BytestreamClientSession> session, boost::optional<FileTransferError> error); private: ConnectionFactory* connectionFactory_; @@ -72,11 +72,11 @@ namespace Swift { IQRouter* iqRouter_; JID serviceRoot_; - typedef std::vector<std::pair<JID, boost::shared_ptr<SOCKS5BytestreamClientSession> > > ProxyJIDClientSessionVector; + typedef std::vector<std::pair<JID, std::shared_ptr<SOCKS5BytestreamClientSession> > > ProxyJIDClientSessionVector; typedef std::map<std::string, ProxyJIDClientSessionVector> ProxySessionsMap; ProxySessionsMap proxySessions_; - boost::shared_ptr<SOCKS5BytestreamProxyFinder> proxyFinder_; + std::shared_ptr<SOCKS5BytestreamProxyFinder> proxyFinder_; boost::optional<std::vector<S5BProxyRequest::ref> > localS5BProxies_; }; diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp index e6c85cf..9624d4c 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp @@ -5,15 +5,16 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -30,14 +31,14 @@ SOCKS5BytestreamProxyFinder::~SOCKS5BytestreamProxyFinder() { } void SOCKS5BytestreamProxyFinder::start() { - serviceWalker = boost::make_shared<DiscoServiceWalker>(service, iqRouter); + serviceWalker = std::make_shared<DiscoServiceWalker>(service, iqRouter); serviceWalker->onServiceFound.connect(boost::bind(&SOCKS5BytestreamProxyFinder::handleServiceFound, this, _1, _2)); serviceWalker->onWalkComplete.connect(boost::bind(&SOCKS5BytestreamProxyFinder::handleWalkEnded, this)); serviceWalker->beginWalk(); } void SOCKS5BytestreamProxyFinder::stop() { - typedef boost::shared_ptr<GenericRequest<S5BProxyRequest> > S5BProxyRequestGenericRequest; + typedef std::shared_ptr<GenericRequest<S5BProxyRequest> > S5BProxyRequestGenericRequest; foreach (S5BProxyRequestGenericRequest requester, pendingRequests) { requester->onResponse.disconnect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, requester, _1, _2)); } @@ -49,14 +50,14 @@ void SOCKS5BytestreamProxyFinder::stop() { } void SOCKS5BytestreamProxyFinder::sendBytestreamQuery(const JID& jid) { - S5BProxyRequest::ref proxyRequest = boost::make_shared<S5BProxyRequest>(); - boost::shared_ptr<GenericRequest<S5BProxyRequest> > request = boost::make_shared<GenericRequest<S5BProxyRequest> >(IQ::Get, jid, proxyRequest, iqRouter); + S5BProxyRequest::ref proxyRequest = std::make_shared<S5BProxyRequest>(); + std::shared_ptr<GenericRequest<S5BProxyRequest> > request = std::make_shared<GenericRequest<S5BProxyRequest> >(IQ::Get, jid, proxyRequest, iqRouter); request->onResponse.connect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, request, _1, _2)); pendingRequests.insert(request); request->send(); } -void SOCKS5BytestreamProxyFinder::handleServiceFound(const JID& jid, boost::shared_ptr<DiscoInfo> discoInfo) { +void SOCKS5BytestreamProxyFinder::handleServiceFound(const JID& jid, std::shared_ptr<DiscoInfo> discoInfo) { if (discoInfo->hasFeature(DiscoInfo::Bytestream)) { sendBytestreamQuery(jid); } @@ -68,7 +69,7 @@ void SOCKS5BytestreamProxyFinder::handleWalkEnded() { } } -void SOCKS5BytestreamProxyFinder::handleProxyResponse(boost::shared_ptr<GenericRequest<S5BProxyRequest> > requester, boost::shared_ptr<S5BProxyRequest> request, ErrorPayload::ref error) { +void SOCKS5BytestreamProxyFinder::handleProxyResponse(std::shared_ptr<GenericRequest<S5BProxyRequest> > requester, std::shared_ptr<S5BProxyRequest> request, ErrorPayload::ref error) { requester->onResponse.disconnect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, requester, _1, _2)); pendingRequests.erase(requester); if (error) { diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.h b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.h index 1047df0..55e499e 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,7 +13,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Disco/DiscoServiceWalker.h> @@ -36,21 +36,21 @@ class SWIFTEN_API SOCKS5BytestreamProxyFinder { void start(); void stop(); - boost::signal<void(std::vector<boost::shared_ptr<S5BProxyRequest> >)> onProxiesFound; + boost::signal<void(std::vector<std::shared_ptr<S5BProxyRequest> >)> onProxiesFound; private: void sendBytestreamQuery(const JID&); - void handleServiceFound(const JID&, boost::shared_ptr<DiscoInfo>); - void handleProxyResponse(boost::shared_ptr<GenericRequest<S5BProxyRequest> > requester, boost::shared_ptr<S5BProxyRequest>, ErrorPayload::ref); + void handleServiceFound(const JID&, std::shared_ptr<DiscoInfo>); + void handleProxyResponse(std::shared_ptr<GenericRequest<S5BProxyRequest> > requester, std::shared_ptr<S5BProxyRequest>, ErrorPayload::ref); void handleWalkEnded(); private: JID service; IQRouter* iqRouter; - boost::shared_ptr<DiscoServiceWalker> serviceWalker; + std::shared_ptr<DiscoServiceWalker> serviceWalker; std::vector<S5BProxyRequest::ref> proxyHosts; - std::set<boost::shared_ptr<GenericRequest<S5BProxyRequest> > > pendingRequests; + std::set<std::shared_ptr<GenericRequest<S5BProxyRequest> > > pendingRequests; }; } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp index 2f66dff..1591e24 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/Algorithm.h> #include <Swiften/Base/Log.h> diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp index f25227a..b68bd58 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.cpp @@ -18,7 +18,7 @@ namespace Swift { SOCKS5BytestreamServer::SOCKS5BytestreamServer( - boost::shared_ptr<ConnectionServer> connectionServer, + std::shared_ptr<ConnectionServer> connectionServer, SOCKS5BytestreamRegistry* registry) : connectionServer(connectionServer), registry(registry) { @@ -30,16 +30,16 @@ void SOCKS5BytestreamServer::start() { void SOCKS5BytestreamServer::stop() { connectionServer->onNewConnection.disconnect(boost::bind(&SOCKS5BytestreamServer::handleNewConnection, this, _1)); - foreach (boost::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) { + foreach (std::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) { session->onFinished.disconnect(boost::bind(&SOCKS5BytestreamServer::handleSessionFinished, this, session)); session->stop(); } sessions.clear(); } -void SOCKS5BytestreamServer::handleNewConnection(boost::shared_ptr<Connection> connection) { - boost::shared_ptr<SOCKS5BytestreamServerSession> session = - boost::make_shared<SOCKS5BytestreamServerSession>(connection, registry); +void SOCKS5BytestreamServer::handleNewConnection(std::shared_ptr<Connection> connection) { + std::shared_ptr<SOCKS5BytestreamServerSession> session = + std::make_shared<SOCKS5BytestreamServerSession>(connection, registry); session->onFinished.connect(boost::bind(&SOCKS5BytestreamServer::handleSessionFinished, this, session)); sessions.push_back(session); session->start(); @@ -49,10 +49,10 @@ HostAddressPort SOCKS5BytestreamServer::getAddressPort() const { return connectionServer->getAddressPort(); } -std::vector< boost::shared_ptr<SOCKS5BytestreamServerSession> > SOCKS5BytestreamServer::getSessions( +std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > SOCKS5BytestreamServer::getSessions( const std::string& streamID) const { - std::vector< boost::shared_ptr<SOCKS5BytestreamServerSession> > result; - foreach (boost::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) { + std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > result; + foreach (std::shared_ptr<SOCKS5BytestreamServerSession> session, sessions) { if (session->getStreamID() == streamID) { result.push_back(session); } @@ -60,7 +60,7 @@ std::vector< boost::shared_ptr<SOCKS5BytestreamServerSession> > SOCKS5Bytestream return result; } -void SOCKS5BytestreamServer::handleSessionFinished(boost::shared_ptr<SOCKS5BytestreamServerSession> session) { +void SOCKS5BytestreamServer::handleSessionFinished(std::shared_ptr<SOCKS5BytestreamServerSession> session) { sessions.erase(std::remove(sessions.begin(), sessions.end(), session), sessions.end()); session->onFinished.disconnect(boost::bind(&SOCKS5BytestreamServer::handleSessionFinished, this, session)); } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServer.h b/Swiften/FileTransfer/SOCKS5BytestreamServer.h index f9b293e..c8866c4 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServer.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServer.h @@ -7,10 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/FileTransfer/ReadBytestream.h> #include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h> @@ -24,7 +23,7 @@ namespace Swift { class SWIFTEN_API SOCKS5BytestreamServer { public: SOCKS5BytestreamServer( - boost::shared_ptr<ConnectionServer> connectionServer, + std::shared_ptr<ConnectionServer> connectionServer, SOCKS5BytestreamRegistry* registry); HostAddressPort getAddressPort() const; @@ -32,18 +31,18 @@ namespace Swift { void start(); void stop(); - std::vector< boost::shared_ptr<SOCKS5BytestreamServerSession> > getSessions(const std::string& id) const; + std::vector< std::shared_ptr<SOCKS5BytestreamServerSession> > getSessions(const std::string& id) const; private: - void handleNewConnection(boost::shared_ptr<Connection> connection); - void handleSessionFinished(boost::shared_ptr<SOCKS5BytestreamServerSession>); + void handleNewConnection(std::shared_ptr<Connection> connection); + void handleSessionFinished(std::shared_ptr<SOCKS5BytestreamServerSession>); private: friend class SOCKS5BytestreamServerSession; - boost::shared_ptr<ConnectionServer> connectionServer; + std::shared_ptr<ConnectionServer> connectionServer; SOCKS5BytestreamRegistry* registry; - std::vector<boost::shared_ptr<SOCKS5BytestreamServerSession> > sessions; + std::vector<std::shared_ptr<SOCKS5BytestreamServerSession> > sessions; }; } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp index 22a07fd..33a5283 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp @@ -12,8 +12,9 @@ #include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -59,10 +60,10 @@ SOCKS5BytestreamServerManager::~SOCKS5BytestreamServerManager() { } } -boost::shared_ptr<SOCKS5BytestreamServerResourceUser> SOCKS5BytestreamServerManager::aquireResourceUser() { - boost::shared_ptr<SOCKS5BytestreamServerResourceUser> resourceUser; +std::shared_ptr<SOCKS5BytestreamServerResourceUser> SOCKS5BytestreamServerManager::aquireResourceUser() { + std::shared_ptr<SOCKS5BytestreamServerResourceUser> resourceUser; if (s5bServerResourceUser_.expired()) { - resourceUser = boost::make_shared<SOCKS5BytestreamServerResourceUser>(this); + resourceUser = std::make_shared<SOCKS5BytestreamServerResourceUser>(this); s5bServerResourceUser_ = resourceUser; } else { @@ -71,10 +72,10 @@ boost::shared_ptr<SOCKS5BytestreamServerResourceUser> SOCKS5BytestreamServerMana return resourceUser; } -boost::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> SOCKS5BytestreamServerManager::aquirePortForwardingUser() { - boost::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> portForwardingUser; +std::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> SOCKS5BytestreamServerManager::aquirePortForwardingUser() { + std::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> portForwardingUser; if (s5bServerPortForwardingUser_.expired()) { - portForwardingUser = boost::make_shared<SOCKS5BytestreamServerPortForwardingUser>(this); + portForwardingUser = std::make_shared<SOCKS5BytestreamServerPortForwardingUser>(this); s5bServerPortForwardingUser_ = portForwardingUser; } else { diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.h b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.h index ab12dfe..98b5bea 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Network/HostAddressPort.h> @@ -41,8 +39,8 @@ namespace Swift { NATTraverser* natTraverser); ~SOCKS5BytestreamServerManager(); - boost::shared_ptr<SOCKS5BytestreamServerResourceUser> aquireResourceUser(); - boost::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> aquirePortForwardingUser(); + std::shared_ptr<SOCKS5BytestreamServerResourceUser> aquireResourceUser(); + std::shared_ptr<SOCKS5BytestreamServerPortForwardingUser> aquirePortForwardingUser(); void stop(); @@ -78,18 +76,18 @@ namespace Swift { NATTraverser* natTraverser; enum { Start, Initializing, Initialized } state; SOCKS5BytestreamServer* server; - boost::shared_ptr<ConnectionServer> connectionServer; + std::shared_ptr<ConnectionServer> connectionServer; int connectionServerPort; - boost::shared_ptr<NATTraversalGetPublicIPRequest> getPublicIPRequest; - boost::shared_ptr<NATTraversalForwardPortRequest> forwardPortRequest; - boost::shared_ptr<NATTraversalRemovePortForwardingRequest> unforwardPortRequest; + std::shared_ptr<NATTraversalGetPublicIPRequest> getPublicIPRequest; + std::shared_ptr<NATTraversalForwardPortRequest> forwardPortRequest; + std::shared_ptr<NATTraversalRemovePortForwardingRequest> unforwardPortRequest; boost::optional<HostAddress> publicAddress; boost::optional<NATPortMapping> portMapping; bool attemptedPortMapping_; - boost::weak_ptr<SOCKS5BytestreamServerResourceUser> s5bServerResourceUser_; - boost::weak_ptr<SOCKS5BytestreamServerPortForwardingUser> s5bServerPortForwardingUser_; + std::weak_ptr<SOCKS5BytestreamServerResourceUser> s5bServerResourceUser_; + std::weak_ptr<SOCKS5BytestreamServerPortForwardingUser> s5bServerPortForwardingUser_; }; } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp index e2d46f4..bc4e8e4 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp @@ -21,7 +21,7 @@ namespace Swift { SOCKS5BytestreamServerSession::SOCKS5BytestreamServerSession( - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, SOCKS5BytestreamRegistry* bytestreams) : connection(connection), bytestreams(bytestreams), @@ -49,7 +49,7 @@ void SOCKS5BytestreamServerSession::stop() { finish(); } -void SOCKS5BytestreamServerSession::startSending(boost::shared_ptr<ReadBytestream> stream) { +void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream> stream) { if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; } readBytestream = stream; @@ -61,7 +61,7 @@ void SOCKS5BytestreamServerSession::startSending(boost::shared_ptr<ReadBytestrea sendData(); } -void SOCKS5BytestreamServerSession::startReceiving(boost::shared_ptr<WriteBytestream> stream) { +void SOCKS5BytestreamServerSession::startReceiving(std::shared_ptr<WriteBytestream> stream) { if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; } writeBytestream = stream; @@ -75,7 +75,7 @@ HostAddressPort SOCKS5BytestreamServerSession::getAddressPort() const { return connection->getLocalAddress(); } -void SOCKS5BytestreamServerSession::handleDataRead(boost::shared_ptr<SafeByteArray> data) { +void SOCKS5BytestreamServerSession::handleDataRead(std::shared_ptr<SafeByteArray> data) { if (state != ReadingData) { append(unprocessedData, *data); process(); diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h index a90e8c5..d530a06 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -20,7 +20,7 @@ namespace Swift { class SWIFTEN_API SOCKS5BytestreamServerSession { public: - typedef boost::shared_ptr<SOCKS5BytestreamServerSession> ref; + typedef std::shared_ptr<SOCKS5BytestreamServerSession> ref; public: enum State { @@ -33,7 +33,7 @@ namespace Swift { Finished }; - SOCKS5BytestreamServerSession(boost::shared_ptr<Connection> connection, SOCKS5BytestreamRegistry* registry); + SOCKS5BytestreamServerSession(std::shared_ptr<Connection> connection, SOCKS5BytestreamRegistry* registry); ~SOCKS5BytestreamServerSession(); void setChunkSize(int chunkSize) { @@ -43,8 +43,8 @@ namespace Swift { void start(); void stop(); - void startSending(boost::shared_ptr<ReadBytestream>); - void startReceiving(boost::shared_ptr<WriteBytestream>); + void startSending(std::shared_ptr<ReadBytestream>); + void startReceiving(std::shared_ptr<WriteBytestream>); HostAddressPort getAddressPort() const; @@ -58,20 +58,20 @@ namespace Swift { private: void finish(const boost::optional<FileTransferError>& error = boost::optional<FileTransferError>()); void process(); - void handleDataRead(boost::shared_ptr<SafeByteArray>); + void handleDataRead(std::shared_ptr<SafeByteArray>); void handleDisconnected(const boost::optional<Connection::Error>&); void handleDataAvailable(); void sendData(); private: - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; SOCKS5BytestreamRegistry* bytestreams; ByteArray unprocessedData; State state; int chunkSize; std::string streamID; - boost::shared_ptr<ReadBytestream> readBytestream; - boost::shared_ptr<WriteBytestream> writeBytestream; + std::shared_ptr<ReadBytestream> readBytestream; + std::shared_ptr<WriteBytestream> writeBytestream; bool waitingForData; boost::bsignals::connection disconnectedConnection; diff --git a/Swiften/FileTransfer/StreamInitiationRequest.h b/Swiften/FileTransfer/StreamInitiationRequest.h index c03fae6..44e826c 100644 --- a/Swiften/FileTransfer/StreamInitiationRequest.h +++ b/Swiften/FileTransfer/StreamInitiationRequest.h @@ -13,21 +13,21 @@ namespace Swift { class SWIFTEN_API StreamInitiationRequest : public GenericRequest<StreamInitiation> { public: - typedef boost::shared_ptr<StreamInitiationRequest> ref; + typedef std::shared_ptr<StreamInitiationRequest> ref; - static ref create(const JID& jid, boost::shared_ptr<StreamInitiation> payload, IQRouter* router) { + static ref create(const JID& jid, std::shared_ptr<StreamInitiation> payload, IQRouter* router) { return ref(new StreamInitiationRequest(jid, payload, router)); } - static ref create(const JID& from, const JID& to, boost::shared_ptr<StreamInitiation> payload, IQRouter* router) { + static ref create(const JID& from, const JID& to, std::shared_ptr<StreamInitiation> payload, IQRouter* router) { return ref(new StreamInitiationRequest(from, to, payload, router)); } private: - StreamInitiationRequest(const JID& jid, boost::shared_ptr<StreamInitiation> payload, IQRouter* router) : GenericRequest<StreamInitiation>(IQ::Set, jid, payload, router) { + StreamInitiationRequest(const JID& jid, std::shared_ptr<StreamInitiation> payload, IQRouter* router) : GenericRequest<StreamInitiation>(IQ::Set, jid, payload, router) { } - StreamInitiationRequest(const JID& from, const JID& to, boost::shared_ptr<StreamInitiation> payload, IQRouter* router) : GenericRequest<StreamInitiation>(IQ::Set, from, to, payload, router) { + StreamInitiationRequest(const JID& from, const JID& to, std::shared_ptr<StreamInitiation> payload, IQRouter* router) : GenericRequest<StreamInitiation>(IQ::Set, from, to, payload, router) { } }; } diff --git a/Swiften/FileTransfer/UnitTest/DummyFileTransferManager.h b/Swiften/FileTransfer/UnitTest/DummyFileTransferManager.h index 70d25a5..03e2476 100644 --- a/Swiften/FileTransfer/UnitTest/DummyFileTransferManager.h +++ b/Swiften/FileTransfer/UnitTest/DummyFileTransferManager.h @@ -33,7 +33,7 @@ namespace Swift { const JID&, const boost::filesystem::path&, const std::string&, - boost::shared_ptr<ReadBytestream>, + std::shared_ptr<ReadBytestream>, const FileTransferOptions&) SWIFTEN_OVERRIDE { return OutgoingFileTransfer::ref(); } @@ -44,12 +44,12 @@ namespace Swift { const std::string&, const boost::uintmax_t, const boost::posix_time::ptime&, - boost::shared_ptr<ReadBytestream>, + std::shared_ptr<ReadBytestream>, const FileTransferOptions&) SWIFTEN_OVERRIDE { return OutgoingFileTransfer::ref(); } - virtual void addS5BProxy(boost::shared_ptr<S5BProxyRequest>) { + virtual void addS5BProxy(std::shared_ptr<S5BProxyRequest>) { } }; diff --git a/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h b/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h index f3972ab..5db3368 100644 --- a/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h +++ b/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h @@ -84,37 +84,37 @@ public: virtual void stopActivatingProxy() { } - virtual boost::shared_ptr<TransportSession> createIBBSendSession(const std::string& sessionID, unsigned int blockSize, boost::shared_ptr<ReadBytestream> stream) { - boost::shared_ptr<IBBSendSession> ibbSession = boost::make_shared<IBBSendSession>( + virtual std::shared_ptr<TransportSession> createIBBSendSession(const std::string& sessionID, unsigned int blockSize, std::shared_ptr<ReadBytestream> stream) { + std::shared_ptr<IBBSendSession> ibbSession = std::make_shared<IBBSendSession>( sessionID, initiator_, responder_, stream, iqRouter_); ibbSession->setBlockSize(blockSize); - return boost::make_shared<IBBSendTransportSession>(ibbSession); + return std::make_shared<IBBSendTransportSession>(ibbSession); } - virtual boost::shared_ptr<TransportSession> createIBBReceiveSession(const std::string& sessionID, unsigned long long size, boost::shared_ptr<WriteBytestream> stream) { - boost::shared_ptr<IBBReceiveSession> ibbSession = boost::make_shared<IBBReceiveSession>( + virtual std::shared_ptr<TransportSession> createIBBReceiveSession(const std::string& sessionID, unsigned long long size, std::shared_ptr<WriteBytestream> stream) { + std::shared_ptr<IBBReceiveSession> ibbSession = std::make_shared<IBBReceiveSession>( sessionID, initiator_, responder_, size, stream, iqRouter_); - return boost::make_shared<IBBReceiveTransportSession>(ibbSession); + return std::make_shared<IBBReceiveTransportSession>(ibbSession); } - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession( - boost::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { - return boost::shared_ptr<TransportSession>(); + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession( + std::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { + return std::shared_ptr<TransportSession>(); } - virtual boost::shared_ptr<TransportSession> createRemoteCandidateSession( - boost::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { - return boost::shared_ptr<TransportSession>(); + virtual std::shared_ptr<TransportSession> createRemoteCandidateSession( + std::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { + return std::shared_ptr<TransportSession>(); } - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession( - boost::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { - return boost::shared_ptr<TransportSession>(); + virtual std::shared_ptr<TransportSession> createLocalCandidateSession( + std::shared_ptr<ReadBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { + return std::shared_ptr<TransportSession>(); } - virtual boost::shared_ptr<TransportSession> createLocalCandidateSession( - boost::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { - return boost::shared_ptr<TransportSession>(); + virtual std::shared_ptr<TransportSession> createLocalCandidateSession( + std::shared_ptr<WriteBytestream>, const JingleS5BTransportPayload::Candidate& /* candidate */) { + return std::shared_ptr<TransportSession>(); } private: diff --git a/Swiften/FileTransfer/UnitTest/IBBReceiveSessionTest.cpp b/Swiften/FileTransfer/UnitTest/IBBReceiveSessionTest.cpp index d78f4f0..31f46de 100644 --- a/Swiften/FileTransfer/UnitTest/IBBReceiveSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/IBBReceiveSessionTest.cpp @@ -5,10 +5,10 @@ */ +#include <memory> #include <vector> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -38,7 +38,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); finished = false; - bytestream = boost::make_shared<ByteArrayWriteBytestream>(); + bytestream = std::make_shared<ByteArrayWriteBytestream>(); } void tearDown() { @@ -47,7 +47,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testOpen() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -58,7 +58,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testReceiveData() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -72,7 +72,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testReceiveMultipleData() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -87,7 +87,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testReceiveDataForOtherSession() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -99,7 +99,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testReceiveDataOutOfOrder() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -114,7 +114,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testReceiveLastData() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession", 6)); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession", 6)); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -130,7 +130,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testReceiveClose() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -143,7 +143,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { } void testStopWhileActive() { - boost::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); + std::shared_ptr<IBBReceiveSession> testling(createSession("foo@bar.com/baz", "mysession")); testling->start(); stanzaChannel->onIQReceived(createIBBRequest(IBB::createIBBOpen("mysession", 0x10), "foo@bar.com/baz", "id-open")); @@ -181,7 +181,7 @@ class IBBReceiveSessionTest : public CppUnit::TestFixture { IQRouter* iqRouter; bool finished; boost::optional<FileTransferError> error; - boost::shared_ptr<ByteArrayWriteBytestream> bytestream; + std::shared_ptr<ByteArrayWriteBytestream> bytestream; }; CPPUNIT_TEST_SUITE_REGISTRATION(IBBReceiveSessionTest); diff --git a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp index e417c77..f9057f8 100644 --- a/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp @@ -39,7 +39,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { void setUp() { stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); - bytestream = boost::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg")); + bytestream = std::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg")); finished = false; } @@ -49,7 +49,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testStart() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(1234); testling->start(); @@ -63,7 +63,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testStart_ResponseStartsSending() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(3); testling->start(); @@ -79,7 +79,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testResponseContinuesSending() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(3); testling->start(); stanzaChannel->onIQReceived(createIBBResult()); @@ -95,7 +95,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testRespondToAllFinishes() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(3); testling->start(); stanzaChannel->onIQReceived(createIBBResult()); @@ -108,7 +108,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testErrorResponseFinishesWithError() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(3); testling->start(); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); @@ -118,7 +118,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testStopDuringSessionCloses() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(3); testling->start(); testling->stop(); @@ -133,7 +133,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testStopAfterFinishedDoesNotClose() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); testling->setBlockSize(16); testling->start(); stanzaChannel->onIQReceived(createIBBResult()); @@ -146,7 +146,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testDataStreamPauseStopsSendingData() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); bytestream->setDataComplete(false); testling->setBlockSize(3); testling->start(); @@ -162,7 +162,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testDataStreamResumeAfterPauseSendsData() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); bytestream->setDataComplete(false); testling->setBlockSize(3); testling->start(); @@ -177,7 +177,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testDataStreamResumeBeforePauseDoesNotSendData() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); bytestream->setDataComplete(false); testling->setBlockSize(3); testling->start(); @@ -189,7 +189,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { } void testDataStreamResumeAfterResumeDoesNotSendData() { - boost::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); + std::shared_ptr<IBBSendSession> testling = createSession("foo@bar.com/baz"); bytestream->setDataComplete(false); testling->setBlockSize(3); testling->start(); @@ -206,12 +206,12 @@ class IBBSendSessionTest : public CppUnit::TestFixture { private: IQ::ref createIBBResult() { - return IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[stanzaChannel->sentStanzas.size()-1]->getTo(), stanzaChannel->sentStanzas[stanzaChannel->sentStanzas.size()-1]->getID(), boost::shared_ptr<IBB>()); + return IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[stanzaChannel->sentStanzas.size()-1]->getTo(), stanzaChannel->sentStanzas[stanzaChannel->sentStanzas.size()-1]->getID(), std::shared_ptr<IBB>()); } private: - boost::shared_ptr<IBBSendSession> createSession(const std::string& to) { - boost::shared_ptr<IBBSendSession> session(new IBBSendSession("myid", JID(), JID(to), bytestream, iqRouter)); + std::shared_ptr<IBBSendSession> createSession(const std::string& to) { + std::shared_ptr<IBBSendSession> session(new IBBSendSession("myid", JID(), JID(to), bytestream, iqRouter)); session->onFinished.connect(boost::bind(&IBBSendSessionTest::handleFinished, this, _1)); return session; } @@ -226,7 +226,7 @@ class IBBSendSessionTest : public CppUnit::TestFixture { IQRouter* iqRouter; bool finished; boost::optional<FileTransferError> error; - boost::shared_ptr<ByteArrayReadBytestream> bytestream; + std::shared_ptr<ByteArrayReadBytestream> bytestream; }; CPPUNIT_TEST_SUITE_REGISTRATION(IBBSendSessionTest); diff --git a/Swiften/FileTransfer/UnitTest/IncomingJingleFileTransferTest.cpp b/Swiften/FileTransfer/UnitTest/IncomingJingleFileTransferTest.cpp index a76773c..72b933d 100644 --- a/Swiften/FileTransfer/UnitTest/IncomingJingleFileTransferTest.cpp +++ b/Swiften/FileTransfer/UnitTest/IncomingJingleFileTransferTest.cpp @@ -5,14 +5,13 @@ */ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <iostream> - -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -45,7 +44,6 @@ #include <Swiften/Queries/IQRouter.h> using namespace Swift; -using namespace boost; class IncomingJingleFileTransferTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(IncomingJingleFileTransferTest); @@ -54,9 +52,9 @@ class IncomingJingleFileTransferTest : public CppUnit::TestFixture { //CPPUNIT_TEST(test_AcceptFailingS5BFallsBackToIBB); CPPUNIT_TEST_SUITE_END(); public: - shared_ptr<IncomingJingleFileTransfer> createTestling() { + std::shared_ptr<IncomingJingleFileTransfer> createTestling() { JID ourJID("our@jid.org/full"); - return boost::make_shared<IncomingJingleFileTransfer>(ourJID, shared_ptr<JingleSession>(session), jingleContentPayload, ftTransporterFactory, timerFactory, crypto.get()); + return std::make_shared<IncomingJingleFileTransfer>(ourJID, std::shared_ptr<JingleSession>(session), jingleContentPayload, ftTransporterFactory, timerFactory, crypto.get()); } IQ::ref createIBBRequest(IBB::ref ibb, const JID& from, const std::string& id) { @@ -66,13 +64,13 @@ public: } void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); eventLoop = new DummyEventLoop(); resolver = new StaticDomainNameResolver(eventLoop); - session = boost::make_shared<FakeJingleSession>("foo@bar.com/baz", "mysession"); - jingleContentPayload = make_shared<JingleContentPayload>(); - // fakeRJTCSF = make_shared<FakeRemoteJingleTransportCandidateSelectorFactory>(); - // fakeLJTCF = make_shared<FakeLocalJingleTransportCandidateGeneratorFactory>(); + session = std::make_shared<FakeJingleSession>("foo@bar.com/baz", "mysession"); + jingleContentPayload = std::make_shared<JingleContentPayload>(); + // fakeRJTCSF = std::make_shared<FakeRemoteJingleTransportCandidateSelectorFactory>(); + // fakeLJTCF = std::make_shared<FakeLocalJingleTransportCandidateGeneratorFactory>(); stanzaChannel = new DummyStanzaChannel(); connectionFactory = new DummyConnectionFactory(eventLoop); serverConnectionFactory = new DummyConnectionServerFactory(eventLoop); @@ -108,17 +106,17 @@ public: // Tests whether IncomingJingleFileTransfer would accept a IBB only file transfer. void test_AcceptOnyIBBSendsSessionAccept() { //1. create your test incoming file transfer - shared_ptr<JingleFileTransferDescription> desc = make_shared<JingleFileTransferDescription>(); + std::shared_ptr<JingleFileTransferDescription> desc = std::make_shared<JingleFileTransferDescription>(); desc->setFileInfo(JingleFileTransferFileInfo("foo.txt", "", 10)); jingleContentPayload->addDescription(desc); - JingleIBBTransportPayload::ref tpRef = make_shared<JingleIBBTransportPayload>(); + JingleIBBTransportPayload::ref tpRef = std::make_shared<JingleIBBTransportPayload>(); tpRef->setSessionID("mysession"); jingleContentPayload->addTransport(tpRef); - shared_ptr<IncomingJingleFileTransfer> fileTransfer = createTestling(); + std::shared_ptr<IncomingJingleFileTransfer> fileTransfer = createTestling(); //2. do 'accept' on a dummy writebytestream (you'll have to look if there already is one) - shared_ptr<ByteArrayWriteBytestream> byteStream = make_shared<ByteArrayWriteBytestream>(); + std::shared_ptr<ByteArrayWriteBytestream> byteStream = std::make_shared<ByteArrayWriteBytestream>(); fileTransfer->accept(byteStream); // check whether accept has been called @@ -127,17 +125,17 @@ public: void test_OnlyIBBTransferReceiveWorks() { //1. create your test incoming file transfer - shared_ptr<JingleFileTransferDescription> desc = make_shared<JingleFileTransferDescription>(); + std::shared_ptr<JingleFileTransferDescription> desc = std::make_shared<JingleFileTransferDescription>(); desc->setFileInfo(JingleFileTransferFileInfo("file.txt", "", 10)); jingleContentPayload->addDescription(desc); - JingleIBBTransportPayload::ref tpRef = make_shared<JingleIBBTransportPayload>(); + JingleIBBTransportPayload::ref tpRef = std::make_shared<JingleIBBTransportPayload>(); tpRef->setSessionID("mysession"); jingleContentPayload->addTransport(tpRef); - shared_ptr<IncomingJingleFileTransfer> fileTransfer = createTestling(); + std::shared_ptr<IncomingJingleFileTransfer> fileTransfer = createTestling(); //2. do 'accept' on a dummy writebytestream (you'll have to look if there already is one) - shared_ptr<ByteArrayWriteBytestream> byteStream = make_shared<ByteArrayWriteBytestream>(); + std::shared_ptr<ByteArrayWriteBytestream> byteStream = std::make_shared<ByteArrayWriteBytestream>(); fileTransfer->accept(byteStream); // check whether accept has been called @@ -154,10 +152,10 @@ public: // add SOCKS5BytestreamTransportPayload JingleS5BTransportPayload::ref payLoad = addJingleS5BPayload(); - shared_ptr<IncomingJingleFileTransfer> fileTransfer = createTestling(); + std::shared_ptr<IncomingJingleFileTransfer> fileTransfer = createTestling(); //2. do 'accept' on a dummy writebytestream (you'll have to look if there already is one) - shared_ptr<ByteArrayWriteBytestream> byteStream = make_shared<ByteArrayWriteBytestream>(); + std::shared_ptr<ByteArrayWriteBytestream> byteStream = std::make_shared<ByteArrayWriteBytestream>(); fileTransfer->accept(byteStream); // candidates are gathered @@ -168,7 +166,7 @@ public: // check for candidate error FakeJingleSession::InfoTransportCall infoTransportCall = getCall<FakeJingleSession::InfoTransportCall>(1); - JingleS5BTransportPayload::ref s5bPayload = dynamic_pointer_cast<JingleS5BTransportPayload>(infoTransportCall.payload); + JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(infoTransportCall.payload); CPPUNIT_ASSERT(s5bPayload->hasCandidateError()); // indicate transport replace (Romeo) @@ -189,20 +187,20 @@ public: #endif private: void addFileTransferDescription() { - shared_ptr<JingleFileTransferDescription> desc = make_shared<JingleFileTransferDescription>(); + std::shared_ptr<JingleFileTransferDescription> desc = std::make_shared<JingleFileTransferDescription>(); desc->setFileInfo(JingleFileTransferFileInfo("file.txt", "", 10)); jingleContentPayload->addDescription(desc); } - shared_ptr<JingleS5BTransportPayload> addJingleS5BPayload() { - JingleS5BTransportPayload::ref payLoad = make_shared<JingleS5BTransportPayload>(); + std::shared_ptr<JingleS5BTransportPayload> addJingleS5BPayload() { + JingleS5BTransportPayload::ref payLoad = std::make_shared<JingleS5BTransportPayload>(); payLoad->setSessionID("mysession"); jingleContentPayload->addTransport(payLoad); return payLoad; } - shared_ptr<JingleIBBTransportPayload> addJingleIBBPayload() { - JingleIBBTransportPayload::ref payLoad = make_shared<JingleIBBTransportPayload>(); + std::shared_ptr<JingleIBBTransportPayload> addJingleIBBPayload() { + JingleIBBTransportPayload::ref payLoad = std::make_shared<JingleIBBTransportPayload>(); payLoad->setSessionID("mysession"); jingleContentPayload->addTransport(payLoad); return payLoad; @@ -222,9 +220,9 @@ private: private: EventLoop* eventLoop; - boost::shared_ptr<CryptoProvider> crypto; - boost::shared_ptr<FakeJingleSession> session; - shared_ptr<JingleContentPayload> jingleContentPayload; + std::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<FakeJingleSession> session; + std::shared_ptr<JingleContentPayload> jingleContentPayload; // shared_ptr<FakeRemoteJingleTransportCandidateSelectorFactory> fakeRJTCSF; // shared_ptr<FakeLocalJingleTransportCandidateGeneratorFactory> fakeLJTCF; FileTransferTransporterFactory* ftTransporterFactory; diff --git a/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp b/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp index 401463c..3f4d20f 100644 --- a/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp +++ b/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp @@ -11,10 +11,10 @@ */ #include <iostream> +#include <memory> #include <boost/bind.hpp> #include <boost/optional.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -81,16 +81,16 @@ class OutgoingJingleFileTransferTest : public CppUnit::TestFixture { public: - boost::shared_ptr<OutgoingJingleFileTransfer> createTestling(const FileTransferOptions& options = FileTransferOptions().withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false)) { + std::shared_ptr<OutgoingJingleFileTransfer> createTestling(const FileTransferOptions& options = FileTransferOptions().withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false)) { JID to("test@foo.com/bla"); JingleFileTransferFileInfo fileInfo; fileInfo.setDescription("some file"); fileInfo.setName("test.bin"); fileInfo.addHash(HashElement("sha-1", ByteArray())); fileInfo.setSize(1024 * 1024); - return boost::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer( + return std::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer( to, - boost::shared_ptr<JingleSession>(fakeJingleSession), + std::shared_ptr<JingleSession>(fakeJingleSession), stream, ftTransportFactory, timerFactory, @@ -107,9 +107,9 @@ public: } void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); fakeJingleSession = new FakeJingleSession("foo@bar.com/baz", "mysession"); - jingleContentPayload = boost::make_shared<JingleContentPayload>(); + jingleContentPayload = std::make_shared<JingleContentPayload>(); stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); eventLoop = new DummyEventLoop(); @@ -126,7 +126,7 @@ public: data.push_back(34); } - stream = boost::make_shared<ByteArrayReadBytestream>(data); + stream = std::make_shared<ByteArrayReadBytestream>(data); idGen = new IDGenerator(); s5bProxy = new SOCKS5BytestreamProxiesManager(connectionFactory, timerFactory, resolver, iqRouter, "bar.com"); @@ -151,29 +151,29 @@ public: void test_SendSessionInitiateOnStart() { - boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(); + std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(); transfer->start(); FakeJingleSession::InitiateCall call = getCall<FakeJingleSession::InitiateCall>(0); - JingleFileTransferDescription::ref description = boost::dynamic_pointer_cast<JingleFileTransferDescription>(call.description); + JingleFileTransferDescription::ref description = std::dynamic_pointer_cast<JingleFileTransferDescription>(call.description); CPPUNIT_ASSERT(description); CPPUNIT_ASSERT(static_cast<size_t>(1048576) == description->getFileInfo().getSize()); - JingleIBBTransportPayload::ref transport = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(call.payload); + JingleIBBTransportPayload::ref transport = std::dynamic_pointer_cast<JingleIBBTransportPayload>(call.payload); CPPUNIT_ASSERT(transport); } void test_FallbackToIBBAfterFailingS5B() { - boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(FileTransferOptions().withAssistedAllowed(true).withDirectAllowed(true).withProxiedAllowed(true)); + std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(FileTransferOptions().withAssistedAllowed(true).withDirectAllowed(true).withProxiedAllowed(true)); transfer->start(); FakeJingleSession::InitiateCall call = getCall<FakeJingleSession::InitiateCall>(0); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<JingleS5BTransportPayload>(call.payload)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<JingleS5BTransportPayload>(call.payload)); fakeJingleSession->handleSessionAcceptReceived(call.id, call.description, call.payload); // send candidate failure - JingleS5BTransportPayload::ref candidateFailurePayload = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref candidateFailurePayload = std::make_shared<JingleS5BTransportPayload>(); candidateFailurePayload->setCandidateError(true); candidateFailurePayload->setSessionID(call.payload->getSessionID()); fakeJingleSession->handleTransportInfoReceived(call.id, candidateFailurePayload); @@ -193,7 +193,7 @@ public: } void test_ReceiveSessionTerminateAfterSessionInitiate() { - boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(); + std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(); transfer->start(); getCall<FakeJingleSession::InitiateCall>(0); @@ -207,7 +207,7 @@ public: } void test_DeclineEmitsFinishedStateCanceled() { - boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(); + std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(); transfer->start(); getCall<FakeJingleSession::InitiateCall>(0); @@ -227,20 +227,20 @@ public: private: void addFileTransferDescription() { - boost::shared_ptr<JingleFileTransferDescription> desc = boost::make_shared<JingleFileTransferDescription>(); + std::shared_ptr<JingleFileTransferDescription> desc = std::make_shared<JingleFileTransferDescription>(); desc->setFileInfo(JingleFileTransferFileInfo()); jingleContentPayload->addDescription(desc); } - boost::shared_ptr<JingleS5BTransportPayload> addJingleS5BPayload() { - JingleS5BTransportPayload::ref payLoad = boost::make_shared<JingleS5BTransportPayload>(); + std::shared_ptr<JingleS5BTransportPayload> addJingleS5BPayload() { + JingleS5BTransportPayload::ref payLoad = std::make_shared<JingleS5BTransportPayload>(); payLoad->setSessionID("mysession"); jingleContentPayload->addTransport(payLoad); return payLoad; } - boost::shared_ptr<JingleIBBTransportPayload> addJingleIBBPayload() { - JingleIBBTransportPayload::ref payLoad = boost::make_shared<JingleIBBTransportPayload>(); + std::shared_ptr<JingleIBBTransportPayload> addJingleIBBPayload() { + JingleIBBTransportPayload::ref payLoad = std::make_shared<JingleIBBTransportPayload>(); payLoad->setSessionID("mysession"); jingleContentPayload->addTransport(payLoad); return payLoad; @@ -260,9 +260,9 @@ private: private: std::vector<unsigned char> data; - boost::shared_ptr<ByteArrayReadBytestream> stream; + std::shared_ptr<ByteArrayReadBytestream> stream; FakeJingleSession* fakeJingleSession; - boost::shared_ptr<JingleContentPayload> jingleContentPayload; + std::shared_ptr<JingleContentPayload> jingleContentPayload; FileTransferTransporterFactory* ftTransportFactory; SOCKS5BytestreamServerManager* bytestreamServerManager; DummyStanzaChannel* stanzaChannel; @@ -274,7 +274,7 @@ private: DummyTimerFactory* timerFactory; DummyConnectionFactory* connectionFactory; DummyConnectionServerFactory* serverConnectionFactory; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; NetworkEnvironment* networkEnvironment; NATTraverser* natTraverser; DomainNameResolver* resolver; diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp index 9690c09..5408cd4 100644 --- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp @@ -10,11 +10,12 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_int.hpp> #include <boost/random/variate_generator.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QA/Checker/IO.h> @@ -55,14 +56,14 @@ public: SOCKS5BytestreamClientSessionTest() : destinationAddressPort(HostAddressPort(HostAddress("127.0.0.1"), 8888)) {} void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); destination = "092a44d859d19c9eed676b551ee80025903351c2"; randomGen.seed(static_cast<unsigned int>(time(nullptr))); eventLoop = new DummyEventLoop(); timerFactory = new DummyTimerFactory(); - connection = boost::make_shared<MockeryConnection>(failingPorts, true, eventLoop); + connection = std::make_shared<MockeryConnection>(failingPorts, true, eventLoop); //connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1)); - //stream1 = boost::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg"))); + //stream1 = std::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg"))); // connection->onDataRead.connect(boost::bind(&SOCKS5BytestreamClientSessionTest::handleDataRead, this, _1)); } @@ -76,7 +77,7 @@ public: TestHelper helper; connection->onDataSent.connect(boost::bind(&TestHelper::handleConnectionDataWritten, &helper, _1)); - SOCKS5BytestreamClientSession::ref clientSession = boost::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); + SOCKS5BytestreamClientSession::ref clientSession = std::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); clientSession->onSessionReady.connect(boost::bind(&TestHelper::handleSessionReady, &helper, _1)); clientSession->start(); @@ -102,7 +103,7 @@ public: TestHelper helper; connection->onDataSent.connect(boost::bind(&TestHelper::handleConnectionDataWritten, &helper, _1)); - SOCKS5BytestreamClientSession::ref clientSession = boost::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); + SOCKS5BytestreamClientSession::ref clientSession = std::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); clientSession->onSessionReady.connect(boost::bind(&TestHelper::handleSessionReady, &helper, _1)); clientSession->start(); @@ -122,7 +123,7 @@ public: TestHelper helper; connection->onDataSent.connect(boost::bind(&TestHelper::handleConnectionDataWritten, &helper, _1)); - SOCKS5BytestreamClientSession::ref clientSession = boost::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); + SOCKS5BytestreamClientSession::ref clientSession = std::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); clientSession->onSessionReady.connect(boost::bind(&TestHelper::handleSessionReady, &helper, _1)); clientSession->start(); @@ -149,7 +150,7 @@ public: TestHelper helper; connection->onDataSent.connect(boost::bind(&TestHelper::handleConnectionDataWritten, &helper, _1)); - SOCKS5BytestreamClientSession::ref clientSession = boost::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); + SOCKS5BytestreamClientSession::ref clientSession = std::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); clientSession->onSessionReady.connect(boost::bind(&TestHelper::handleSessionReady, &helper, _1)); clientSession->start(); @@ -165,7 +166,7 @@ public: CPPUNIT_ASSERT_EQUAL(true, helper.sessionReadyCalled); CPPUNIT_ASSERT_EQUAL(false, helper.sessionReadyError); - boost::shared_ptr<ByteArrayWriteBytestream> output = boost::make_shared<ByteArrayWriteBytestream>(); + std::shared_ptr<ByteArrayWriteBytestream> output = std::make_shared<ByteArrayWriteBytestream>(); clientSession->startReceiving(output); ByteArray transferData = generateRandomByteArray(1024); @@ -177,7 +178,7 @@ public: TestHelper helper; connection->onDataSent.connect(boost::bind(&TestHelper::handleConnectionDataWritten, &helper, _1)); - SOCKS5BytestreamClientSession::ref clientSession = boost::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); + SOCKS5BytestreamClientSession::ref clientSession = std::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory); clientSession->onSessionReady.connect(boost::bind(&TestHelper::handleSessionReady, &helper, _1)); clientSession->start(); @@ -195,7 +196,7 @@ public: helper.unprocessedInput.clear(); ByteArray transferData = generateRandomByteArray(1024); - boost::shared_ptr<ByteArrayReadBytestream> input = boost::make_shared<ByteArrayReadBytestream>(transferData); + std::shared_ptr<ByteArrayReadBytestream> input = std::make_shared<ByteArrayReadBytestream>(transferData); clientSession->startSending(input); eventLoop->processEvents(); @@ -225,7 +226,7 @@ private: } void serverRespondRequestOK() { - boost::shared_ptr<SafeByteArray> dataToSend = createSafeByteArrayRef("\x05\x00\x00\x03", 4); + std::shared_ptr<SafeByteArray> dataToSend = createSafeByteArrayRef("\x05\x00\x00\x03", 4); append(*dataToSend, createSafeByteArray(static_cast<char>(destination.size()))); append(*dataToSend, createSafeByteArray(destination)); append(*dataToSend, createSafeByteArray("\x00", 1)); @@ -233,12 +234,12 @@ private: } void serverRespondRequestFail() { - boost::shared_ptr<SafeByteArray> correctData = createSafeByteArrayRef("\x05\x00\x00\x03", 4); + std::shared_ptr<SafeByteArray> correctData = createSafeByteArrayRef("\x05\x00\x00\x03", 4); append(*correctData, createSafeByteArray(static_cast<char>(destination.size()))); append(*correctData, createSafeByteArray(destination)); append(*correctData, createSafeByteArray("\x00", 1)); - boost::shared_ptr<SafeByteArray> dataToSend; + std::shared_ptr<SafeByteArray> dataToSend; //ByteArray failingData = Hexify::unhexify("8417947d1d305c72c11520ea7d2c6e787396705e72c312c6ccc3f66613d7cae1b91b7ab48e8b59a17d559c15fb51"); //append(dataToSend, failingData); //SWIFT_LOG(debug) << "hexed: " << Hexify::hexify(failingData) << std::endl; @@ -269,7 +270,7 @@ private: private: - struct MockeryConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<MockeryConnection> { + struct MockeryConnection : public Connection, public EventOwner, public std::enable_shared_from_this<MockeryConnection> { public: MockeryConnection(const std::vector<HostAddressPort>& failingPorts, bool isResponsive, EventLoop* eventLoop) : eventLoop(eventLoop), failingPorts(failingPorts), isResponsive(isResponsive), disconnectCalled(false) {} @@ -309,9 +310,9 @@ private: std::string destination; DummyEventLoop* eventLoop; DummyTimerFactory* timerFactory; - boost::shared_ptr<MockeryConnection> connection; + std::shared_ptr<MockeryConnection> connection; const std::vector<HostAddressPort> failingPorts; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(SOCKS5BytestreamClientSessionTest); diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp index 12690ff..d419b8a 100644 --- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp +++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp @@ -37,9 +37,9 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { receivedDataChunks = 0; eventLoop = new DummyEventLoop(); bytestreams = new SOCKS5BytestreamRegistry(); - connection = boost::make_shared<DummyConnection>(eventLoop); + connection = std::make_shared<DummyConnection>(eventLoop); connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1)); - stream1 = boost::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg")); + stream1 = std::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg")); finished = false; } @@ -50,7 +50,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testAuthenticate() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); receive(createSafeByteArray("\x05\x02\x01\x02")); @@ -59,7 +59,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testAuthenticate_Chunked() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); receive(createSafeByteArray("\x05\x02\x01")); @@ -70,7 +70,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testRequest() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); bytestreams->setHasBytestream("abcdef", true); authenticate(); @@ -81,7 +81,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testRequest_UnknownBytestream() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); authenticate(); @@ -91,7 +91,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testReceiveData() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); bytestreams->setHasBytestream("abcdef", true); authenticate(); @@ -106,7 +106,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testReceiveData_Chunked() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); testling->setChunkSize(3); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); bytestreams->setHasBytestream("abcdef", true); @@ -121,7 +121,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testDataStreamPauseStopsSendingData() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); testling->setChunkSize(3); stream1->setDataComplete(false); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); @@ -140,7 +140,7 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { } void testDataStreamResumeAfterPauseSendsData() { - boost::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); + std::shared_ptr<SOCKS5BytestreamServerSession> testling(createSession()); testling->setChunkSize(3); stream1->setDataComplete(false); StartStopper<SOCKS5BytestreamServerSession> stopper(testling.get()); @@ -202,10 +202,10 @@ class SOCKS5BytestreamServerSessionTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; SOCKS5BytestreamRegistry* bytestreams; - boost::shared_ptr<DummyConnection> connection; + std::shared_ptr<DummyConnection> connection; std::vector<unsigned char> receivedData; int receivedDataChunks; - boost::shared_ptr<ByteArrayReadBytestream> stream1; + std::shared_ptr<ByteArrayReadBytestream> stream1; bool finished; boost::optional<FileTransferError> error; }; diff --git a/Swiften/FileTransfer/WriteBytestream.h b/Swiften/FileTransfer/WriteBytestream.h index ffcfdcc..ccc7880 100644 --- a/Swiften/FileTransfer/WriteBytestream.h +++ b/Swiften/FileTransfer/WriteBytestream.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> namespace Swift { class SWIFTEN_API WriteBytestream { public: - typedef boost::shared_ptr<WriteBytestream> ref; + typedef std::shared_ptr<WriteBytestream> ref; virtual ~WriteBytestream(); diff --git a/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp b/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp index 5968d7e..4d8a111 100644 --- a/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp +++ b/Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp @@ -35,7 +35,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void testAddMessage() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); HistoryMessage testMessage("Test", JID("foo@bar.com"), JID("fum@baz.org"), boost::posix_time::time_from_string("1980-01-21 22:03")); testling->addMessage(testMessage); @@ -45,7 +45,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void testAddMessage_TwoMessages() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); HistoryMessage testMessage1("Test1", JID("foo@bar.com"), JID("fum@baz.org"), boost::posix_time::time_from_string("1980-01-21 22:03")); testling->addMessage(testMessage1); HistoryMessage testMessage2("Test2", JID("fum@baz.org"), JID("foo@bar.com"), boost::posix_time::time_from_string("1975-03-09 22:04")); @@ -58,7 +58,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void testGetIDForJID_SameJID() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); int id1 = testling->getIDForJID(JID("foo@bar.com")); int id2 = testling->getIDForJID(JID("foo@bar.com")); @@ -66,7 +66,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void testGetIDForJID_DifferentJIDs() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); int id1 = testling->getIDForJID(JID("foo@bar.com")); int id2 = testling->getIDForJID(JID("foo@baz.com")); @@ -74,7 +74,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void getJIDFromID() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); int id = testling->addJID(JID("foo@bar.com")); boost::optional<JID> result(testling->getJIDFromID(id)); @@ -83,7 +83,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void getJIDFromID_UnexistingID() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); boost::optional<JID> result(testling->getJIDFromID(1)); @@ -91,7 +91,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void getIDFromJID() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); int id = testling->addJID(JID("foo@bar.com")); boost::optional<int> result(testling->getIDFromJID(JID("foo@bar.com"))); @@ -100,7 +100,7 @@ class SQLiteHistoryManagerTest : public CppUnit::TestFixture { } void getIDFromJID_UnexistingJID() { - boost::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); + std::shared_ptr<SQLiteHistoryManager> testling(createHistoryManager()); boost::optional<int> result(testling->getIDFromJID(JID("foo@bar.com"))); diff --git a/Swiften/IDN/ICUConverter.cpp b/Swiften/IDN/ICUConverter.cpp index b83739c..d6b0827 100644 --- a/Swiften/IDN/ICUConverter.cpp +++ b/Swiften/IDN/ICUConverter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -87,7 +87,7 @@ namespace { std::vector<char, SafeAllocator<char> > getStringPreparedDetail(const StringType& s, IDNConverter::StringPrepProfile profile) { UErrorCode status = U_ZERO_ERROR; - boost::shared_ptr<UStringPrepProfile> icuProfile(usprep_openByType(getICUProfileType(profile), &status), usprep_close); + std::shared_ptr<UStringPrepProfile> icuProfile(usprep_openByType(getICUProfileType(profile), &status), usprep_close); assert(U_SUCCESS(status)); ICUString icuInput = convertToICUString(s); diff --git a/Swiften/IDN/LibIDNConverter.cpp b/Swiften/IDN/LibIDNConverter.cpp index 0823bcc..0c01352 100644 --- a/Swiften/IDN/LibIDNConverter.cpp +++ b/Swiften/IDN/LibIDNConverter.cpp @@ -15,7 +15,7 @@ extern "C" { #include <cstdlib> #include <vector> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/ByteArray.h> #include <Swiften/Base/SafeAllocator.h> diff --git a/Swiften/IDN/UnitTest/IDNConverterTest.cpp b/Swiften/IDN/UnitTest/IDNConverterTest.cpp index e0c97b5..508a28c 100644 --- a/Swiften/IDN/UnitTest/IDNConverterTest.cpp +++ b/Swiften/IDN/UnitTest/IDNConverterTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/shared_ptr.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -25,7 +25,7 @@ class IDNConverterTest : public CppUnit::TestFixture { public: void setUp() { - testling = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + testling = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); } void testStringPrep() { @@ -58,7 +58,7 @@ class IDNConverterTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<IDNConverter> testling; + std::shared_ptr<IDNConverter> testling; }; CPPUNIT_TEST_SUITE_REGISTRATION(IDNConverterTest); diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp index b1805df..c7abe45 100644 --- a/Swiften/JID/JID.cpp +++ b/Swiften/JID/JID.cpp @@ -26,7 +26,7 @@ #include <Swiften/JID/JID.h> #include <Swiften/IDN/IDNConverter.h> #ifndef SWIFTEN_JID_NO_DEFAULT_IDN_CONVERTER -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/IDN/PlatformIDNConverter.h> #endif @@ -51,7 +51,7 @@ namespace { IDNInitializer() : defaultIDNConverter(PlatformIDNConverter::create()) { idnConverter = defaultIDNConverter.get(); } - boost::shared_ptr<IDNConverter> defaultIDNConverter; + std::shared_ptr<IDNConverter> defaultIDNConverter; } initializer; } #endif diff --git a/Swiften/Jingle/AbstractJingleSessionListener.cpp b/Swiften/Jingle/AbstractJingleSessionListener.cpp index 791dcb3..20edf15 100644 --- a/Swiften/Jingle/AbstractJingleSessionListener.cpp +++ b/Swiften/Jingle/AbstractJingleSessionListener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -10,11 +10,11 @@ using namespace Swift; -void AbstractJingleSessionListener::handleSessionAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleDescription>, boost::shared_ptr<JingleTransportPayload>) { +void AbstractJingleSessionListener::handleSessionAcceptReceived(const JingleContentID&, std::shared_ptr<JingleDescription>, std::shared_ptr<JingleTransportPayload>) { SWIFT_LOG(warning) << "Unimplemented" << std::endl; } -void AbstractJingleSessionListener::handleSessionInfoReceived(boost::shared_ptr<JinglePayload>) { +void AbstractJingleSessionListener::handleSessionInfoReceived(std::shared_ptr<JinglePayload>) { SWIFT_LOG(warning) << "Unimplemented" << std::endl; } @@ -22,19 +22,19 @@ void AbstractJingleSessionListener::handleSessionTerminateReceived(boost::option SWIFT_LOG(warning) << "Unimplemented" << std::endl; } -void AbstractJingleSessionListener::handleTransportAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) { +void AbstractJingleSessionListener::handleTransportAcceptReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { SWIFT_LOG(warning) << "Unimplemented" << std::endl; } -void AbstractJingleSessionListener::handleTransportInfoReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) { +void AbstractJingleSessionListener::handleTransportInfoReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { SWIFT_LOG(warning) << "Unimplemented" << std::endl; } -void AbstractJingleSessionListener::handleTransportRejectReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) { +void AbstractJingleSessionListener::handleTransportRejectReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { SWIFT_LOG(warning) << "Unimplemented" << std::endl; } -void AbstractJingleSessionListener::handleTransportReplaceReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) { +void AbstractJingleSessionListener::handleTransportReplaceReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { SWIFT_LOG(warning) << "Unimplemented" << std::endl; } diff --git a/Swiften/Jingle/AbstractJingleSessionListener.h b/Swiften/Jingle/AbstractJingleSessionListener.h index 678f173..590cd14 100644 --- a/Swiften/Jingle/AbstractJingleSessionListener.h +++ b/Swiften/Jingle/AbstractJingleSessionListener.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,13 +13,13 @@ namespace Swift { class SWIFTEN_API AbstractJingleSessionListener : public JingleSessionListener { public: - virtual void handleSessionAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleDescription>, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleSessionInfoReceived(boost::shared_ptr<JinglePayload>) SWIFTEN_OVERRIDE; + virtual void handleSessionAcceptReceived(const JingleContentID&, std::shared_ptr<JingleDescription>, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleSessionInfoReceived(std::shared_ptr<JinglePayload>) SWIFTEN_OVERRIDE; virtual void handleSessionTerminateReceived(boost::optional<JinglePayload::Reason>) SWIFTEN_OVERRIDE; - virtual void handleTransportAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleTransportInfoReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleTransportRejectReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; - virtual void handleTransportReplaceReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportAcceptReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportInfoReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportRejectReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; + virtual void handleTransportReplaceReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) SWIFTEN_OVERRIDE; virtual void handleTransportInfoAcknowledged(const std::string& id) SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Jingle/FakeJingleSession.cpp b/Swiften/Jingle/FakeJingleSession.cpp index ec792ab..6b88477 100644 --- a/Swiften/Jingle/FakeJingleSession.cpp +++ b/Swiften/Jingle/FakeJingleSession.cpp @@ -12,7 +12,7 @@ #include <Swiften/Jingle/FakeJingleSession.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Jingle/JingleSessionListener.h> @@ -33,7 +33,7 @@ void FakeJingleSession::sendTerminate(JinglePayload::Reason::Type reason) { calledCommands.push_back(TerminateCall(reason)); } -void FakeJingleSession::sendInfo(boost::shared_ptr<Payload> payload) { +void FakeJingleSession::sendInfo(std::shared_ptr<Payload> payload) { calledCommands.push_back(InfoCall(payload)); } @@ -74,7 +74,7 @@ void FakeJingleSession::handleSessionTerminateReceived(boost::optional<JinglePay notifyListeners(&JingleSessionListener::handleSessionTerminateReceived, reason); } -void FakeJingleSession::handleSessionAcceptReceived(const JingleContentID& contentID, boost::shared_ptr<JingleDescription> desc, boost::shared_ptr<JingleTransportPayload> payload) { +void FakeJingleSession::handleSessionAcceptReceived(const JingleContentID& contentID, std::shared_ptr<JingleDescription> desc, std::shared_ptr<JingleTransportPayload> payload) { notifyListeners(&JingleSessionListener::handleSessionAcceptReceived, contentID, desc, payload); } diff --git a/Swiften/Jingle/FakeJingleSession.h b/Swiften/Jingle/FakeJingleSession.h index 0107384..d961d1d 100644 --- a/Swiften/Jingle/FakeJingleSession.h +++ b/Swiften/Jingle/FakeJingleSession.h @@ -12,10 +12,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> #include <boost/variant.hpp> #include <Swiften/Base/API.h> @@ -45,8 +45,8 @@ namespace Swift { }; struct InfoCall { - InfoCall(boost::shared_ptr<Payload> info) : payload(info) {} - boost::shared_ptr<Payload> payload; + InfoCall(std::shared_ptr<Payload> info) : payload(info) {} + std::shared_ptr<Payload> payload; }; struct AcceptCall { @@ -83,14 +83,14 @@ namespace Swift { typedef boost::variant<InitiateCall, TerminateCall, AcceptCall, InfoCall, InfoTransportCall, AcceptTransportCall, RejectTransportCall, ReplaceTransportCall> Command; public: - typedef boost::shared_ptr<FakeJingleSession> ref; + typedef std::shared_ptr<FakeJingleSession> ref; FakeJingleSession(const JID& initiator, const std::string& id); virtual ~FakeJingleSession(); virtual void sendInitiate(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref) SWIFTEN_OVERRIDE; virtual void sendTerminate(JinglePayload::Reason::Type reason) SWIFTEN_OVERRIDE; - virtual void sendInfo(boost::shared_ptr<Payload>) SWIFTEN_OVERRIDE; + virtual void sendInfo(std::shared_ptr<Payload>) SWIFTEN_OVERRIDE; virtual void sendAccept(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref = JingleTransportPayload::ref()) SWIFTEN_OVERRIDE; virtual std::string sendTransportInfo(const JingleContentID&, JingleTransportPayload::ref) SWIFTEN_OVERRIDE; virtual void sendTransportAccept(const JingleContentID&, JingleTransportPayload::ref) SWIFTEN_OVERRIDE; @@ -98,13 +98,13 @@ namespace Swift { virtual void sendTransportReplace(const JingleContentID&, JingleTransportPayload::ref) SWIFTEN_OVERRIDE; void handleSessionTerminateReceived(boost::optional<JinglePayload::Reason>); - void handleSessionAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleDescription>, boost::shared_ptr<JingleTransportPayload>); - void handleSessionInfoReceived(boost::shared_ptr<JinglePayload>); + void handleSessionAcceptReceived(const JingleContentID&, std::shared_ptr<JingleDescription>, std::shared_ptr<JingleTransportPayload>); + void handleSessionInfoReceived(std::shared_ptr<JinglePayload>); void handleTransportReplaceReceived(const JingleContentID&, JingleTransportPayload::ref); - void handleTransportAcceptReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>); - void handleTransportInfoReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>); - void handleTransportRejectReceived(const JingleContentID&, boost::shared_ptr<JingleTransportPayload>); + void handleTransportAcceptReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>); + void handleTransportInfoReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>); + void handleTransportRejectReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>); void handleTransportInfoAcknowledged(const std::string& id); public: diff --git a/Swiften/Jingle/JingleResponder.cpp b/Swiften/Jingle/JingleResponder.cpp index d0c2edd..09bb234 100644 --- a/Swiften/Jingle/JingleResponder.cpp +++ b/Swiften/Jingle/JingleResponder.cpp @@ -6,7 +6,7 @@ #include <Swiften/Jingle/JingleResponder.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/Log.h> #include <Swiften/Jingle/JingleSessionImpl.h> @@ -20,16 +20,16 @@ JingleResponder::JingleResponder(JingleSessionManager* sessionManager, IQRouter* JingleResponder::~JingleResponder() { } -bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<JinglePayload> payload) { +bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<JinglePayload> payload) { if (payload->getAction() == JinglePayload::SessionInitiate) { if (sessionManager->getSession(from, payload->getSessionID())) { // TODO: Add tie-break error sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel); } else { - sendResponse(from, id, boost::shared_ptr<JinglePayload>()); + sendResponse(from, id, std::shared_ptr<JinglePayload>()); if (!payload->getInitiator().isBare()) { - JingleSessionImpl::ref session = boost::make_shared<JingleSessionImpl>(payload->getInitiator(), from, payload->getSessionID(), router); + JingleSessionImpl::ref session = std::make_shared<JingleSessionImpl>(payload->getInitiator(), from, payload->getSessionID(), router); sessionManager->handleIncomingSession(from, to, session, payload->getContents()); } else { SWIFT_LOG(debug) << "Unable to create Jingle session due to initiator not being a full JID." << std::endl; @@ -47,7 +47,7 @@ bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std } if (session) { session->handleIncomingAction(payload); - sendResponse(from, id, boost::shared_ptr<JinglePayload>()); + sendResponse(from, id, std::shared_ptr<JinglePayload>()); } else { SWIFT_LOG(warning) << "Didn't find jingle session!"; diff --git a/Swiften/Jingle/JingleResponder.h b/Swiften/Jingle/JingleResponder.h index 1340835..cb9220c 100644 --- a/Swiften/Jingle/JingleResponder.h +++ b/Swiften/Jingle/JingleResponder.h @@ -19,7 +19,7 @@ namespace Swift { JingleResponder(JingleSessionManager* sessionManager, IQRouter* router); virtual ~JingleResponder(); private: - virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<JinglePayload> payload); + virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<JinglePayload> payload); private: JingleSessionManager* sessionManager; diff --git a/Swiften/Jingle/JingleSession.cpp b/Swiften/Jingle/JingleSession.cpp index 8abbd56..778ee1d 100644 --- a/Swiften/Jingle/JingleSession.cpp +++ b/Swiften/Jingle/JingleSession.cpp @@ -7,9 +7,9 @@ #include <Swiften/Jingle/JingleSession.h> #include <algorithm> +#include <memory> #include <boost/function.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> diff --git a/Swiften/Jingle/JingleSession.h b/Swiften/Jingle/JingleSession.h index 7a64c47..993e8de 100644 --- a/Swiften/Jingle/JingleSession.h +++ b/Swiften/Jingle/JingleSession.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Listenable.h> @@ -24,7 +24,7 @@ namespace Swift { class SWIFTEN_API JingleSession : public Listenable<JingleSessionListener> { public: - typedef boost::shared_ptr<JingleSession> ref; + typedef std::shared_ptr<JingleSession> ref; JingleSession(const JID& initiator, const std::string& id); virtual ~JingleSession(); @@ -39,7 +39,7 @@ namespace Swift { virtual void sendInitiate(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref) = 0; virtual void sendTerminate(JinglePayload::Reason::Type reason) = 0; - virtual void sendInfo(boost::shared_ptr<Payload>) = 0; + virtual void sendInfo(std::shared_ptr<Payload>) = 0; virtual void sendAccept(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref = JingleTransportPayload::ref()) = 0; virtual std::string sendTransportInfo(const JingleContentID&, JingleTransportPayload::ref) = 0; virtual void sendTransportAccept(const JingleContentID&, JingleTransportPayload::ref) = 0; diff --git a/Swiften/Jingle/JingleSessionImpl.cpp b/Swiften/Jingle/JingleSessionImpl.cpp index 3063242..06aa039 100644 --- a/Swiften/Jingle/JingleSessionImpl.cpp +++ b/Swiften/Jingle/JingleSessionImpl.cpp @@ -7,9 +7,9 @@ #include <Swiften/Jingle/JingleSessionImpl.h> #include <algorithm> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Elements/JingleContentPayload.h> @@ -81,9 +81,9 @@ void JingleSessionImpl::handleIncomingAction(JinglePayload::ref action) { } void JingleSessionImpl::sendInitiate(const JingleContentID& id, JingleDescription::ref description, JingleTransportPayload::ref transport) { - JinglePayload::ref payload = boost::make_shared<JinglePayload>(JinglePayload::SessionInitiate, getID()); + JinglePayload::ref payload = std::make_shared<JinglePayload>(JinglePayload::SessionInitiate, getID()); payload->setInitiator(getInitiator()); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(id.getCreator()); content->setName(id.getName()); content->addDescription(description); @@ -94,14 +94,14 @@ void JingleSessionImpl::sendInitiate(const JingleContentID& id, JingleDescriptio } void JingleSessionImpl::sendTerminate(JinglePayload::Reason::Type reason) { - JinglePayload::ref payload = boost::make_shared<JinglePayload>(JinglePayload::SessionTerminate, getID()); + JinglePayload::ref payload = std::make_shared<JinglePayload>(JinglePayload::SessionTerminate, getID()); payload->setReason(JinglePayload::Reason(reason)); payload->setInitiator(getInitiator()); sendSetRequest(payload); } -void JingleSessionImpl::sendInfo(boost::shared_ptr<Payload> info) { - JinglePayload::ref payload = boost::make_shared<JinglePayload>(JinglePayload::SessionInfo, getID()); +void JingleSessionImpl::sendInfo(std::shared_ptr<Payload> info) { + JinglePayload::ref payload = std::make_shared<JinglePayload>(JinglePayload::SessionInfo, getID()); payload->addPayload(info); sendSetRequest(payload); @@ -110,7 +110,7 @@ void JingleSessionImpl::sendInfo(boost::shared_ptr<Payload> info) { void JingleSessionImpl::sendAccept(const JingleContentID& id, JingleDescription::ref description, JingleTransportPayload::ref transPayload) { JinglePayload::ref payload = createPayload(); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(id.getCreator()); content->setName(id.getName()); content->addTransport(transPayload); @@ -126,7 +126,7 @@ void JingleSessionImpl::sendAccept(const JingleContentID& id, JingleDescription: void JingleSessionImpl::sendTransportAccept(const JingleContentID& id, JingleTransportPayload::ref transPayload) { JinglePayload::ref payload = createPayload(); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(id.getCreator()); content->setName(id.getName()); content->addTransport(transPayload); @@ -140,7 +140,7 @@ void JingleSessionImpl::sendTransportAccept(const JingleContentID& id, JingleTra std::string JingleSessionImpl::sendTransportInfo(const JingleContentID& id, JingleTransportPayload::ref transPayload) { JinglePayload::ref payload = createPayload(); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(id.getCreator()); content->setName(id.getName()); content->addTransport(transPayload); @@ -153,7 +153,7 @@ std::string JingleSessionImpl::sendTransportInfo(const JingleContentID& id, Jing void JingleSessionImpl::sendTransportReject(const JingleContentID& id, JingleTransportPayload::ref transPayload) { JinglePayload::ref payload = createPayload(); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(id.getCreator()); content->setName(id.getName()); content->addTransport(transPayload); @@ -166,7 +166,7 @@ void JingleSessionImpl::sendTransportReject(const JingleContentID& id, JingleTra void JingleSessionImpl::sendTransportReplace(const JingleContentID& id, JingleTransportPayload::ref transPayload) { JinglePayload::ref payload = createPayload(); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(id.getCreator()); content->setName(id.getName()); content->addTransport(transPayload); @@ -178,7 +178,7 @@ void JingleSessionImpl::sendTransportReplace(const JingleContentID& id, JingleTr std::string JingleSessionImpl::sendSetRequest(JinglePayload::ref payload) { - boost::shared_ptr<GenericRequest<JinglePayload> > request = boost::make_shared<GenericRequest<JinglePayload> >( + std::shared_ptr<GenericRequest<JinglePayload> > request = std::make_shared<GenericRequest<JinglePayload> >( IQ::Set, peerJID, payload, iqRouter); pendingRequests.insert(std::make_pair( request, @@ -188,7 +188,7 @@ std::string JingleSessionImpl::sendSetRequest(JinglePayload::ref payload) { JinglePayload::ref JingleSessionImpl::createPayload() const { - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setSessionID(getID()); payload->setInitiator(getInitiator()); return payload; diff --git a/Swiften/Jingle/JingleSessionImpl.h b/Swiften/Jingle/JingleSessionImpl.h index eec2370..4dd32ed 100644 --- a/Swiften/Jingle/JingleSessionImpl.h +++ b/Swiften/Jingle/JingleSessionImpl.h @@ -7,8 +7,7 @@ #pragma once #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Jingle/JingleSession.h> #include <Swiften/Queries/GenericRequest.h> @@ -20,13 +19,13 @@ namespace Swift { class JingleSessionImpl : public JingleSession { friend class JingleResponder; public: - typedef boost::shared_ptr<JingleSessionImpl> ref; + typedef std::shared_ptr<JingleSessionImpl> ref; JingleSessionImpl(const JID& initiator, const JID&, const std::string& id, IQRouter* router); virtual void sendInitiate(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref); virtual void sendTerminate(JinglePayload::Reason::Type reason); - virtual void sendInfo(boost::shared_ptr<Payload>); + virtual void sendInfo(std::shared_ptr<Payload>); virtual void sendAccept(const JingleContentID&, JingleDescription::ref, JingleTransportPayload::ref); virtual std::string sendTransportInfo(const JingleContentID&, JingleTransportPayload::ref); virtual void sendTransportAccept(const JingleContentID&, JingleTransportPayload::ref); @@ -34,7 +33,7 @@ namespace Swift { virtual void sendTransportReplace(const JingleContentID&, JingleTransportPayload::ref); private: - typedef boost::shared_ptr<GenericRequest<JinglePayload> > RequestRef; + typedef std::shared_ptr<GenericRequest<JinglePayload> > RequestRef; void handleIncomingAction(JinglePayload::ref); diff --git a/Swiften/Jingle/JingleSessionListener.h b/Swiften/Jingle/JingleSessionListener.h index 54101b6..7c015f0 100644 --- a/Swiften/Jingle/JingleSessionListener.h +++ b/Swiften/Jingle/JingleSessionListener.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,20 +20,20 @@ namespace Swift { virtual void handleSessionAcceptReceived( const JingleContentID&, - boost::shared_ptr<JingleDescription>, - boost::shared_ptr<JingleTransportPayload>) = 0; - virtual void handleSessionInfoReceived(boost::shared_ptr<JinglePayload>) = 0; + std::shared_ptr<JingleDescription>, + std::shared_ptr<JingleTransportPayload>) = 0; + virtual void handleSessionInfoReceived(std::shared_ptr<JinglePayload>) = 0; virtual void handleSessionTerminateReceived(boost::optional<JinglePayload::Reason>) = 0; virtual void handleTransportAcceptReceived( const JingleContentID&, - boost::shared_ptr<JingleTransportPayload>) = 0; + std::shared_ptr<JingleTransportPayload>) = 0; virtual void handleTransportInfoReceived( const JingleContentID&, - boost::shared_ptr<JingleTransportPayload>) = 0; + std::shared_ptr<JingleTransportPayload>) = 0; virtual void handleTransportRejectReceived( - const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) = 0; + const JingleContentID&, std::shared_ptr<JingleTransportPayload>) = 0; virtual void handleTransportReplaceReceived( - const JingleContentID&, boost::shared_ptr<JingleTransportPayload>) = 0; + const JingleContentID&, std::shared_ptr<JingleTransportPayload>) = 0; virtual void handleTransportInfoAcknowledged(const std::string& id) = 0; }; diff --git a/Swiften/Jingle/JingleSessionManager.h b/Swiften/Jingle/JingleSessionManager.h index fea6c73..0c0f775 100644 --- a/Swiften/Jingle/JingleSessionManager.h +++ b/Swiften/Jingle/JingleSessionManager.h @@ -7,8 +7,7 @@ #pragma once #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h index 767ee1d..a227613 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h @@ -17,7 +17,7 @@ namespace Swift { class AvahiBrowseQuery : public DNSSDBrowseQuery, public AvahiQuery { public: - AvahiBrowseQuery(boost::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : AvahiQuery(q, eventLoop), browser(NULL) { + AvahiBrowseQuery(std::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : AvahiQuery(q, eventLoop), browser(NULL) { } void startBrowsing(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp index 11f1650..1b79946 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp @@ -21,20 +21,20 @@ AvahiQuerier::AvahiQuerier(EventLoop* eventLoop) : eventLoop(eventLoop), client( AvahiQuerier::~AvahiQuerier() { } -boost::shared_ptr<DNSSDBrowseQuery> AvahiQuerier::createBrowseQuery() { - return boost::shared_ptr<DNSSDBrowseQuery>(new AvahiBrowseQuery(shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDBrowseQuery> AvahiQuerier::createBrowseQuery() { + return std::make_shared<AvahiBrowseQuery>(shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDRegisterQuery> AvahiQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { - return boost::shared_ptr<DNSSDRegisterQuery>(new AvahiRegisterQuery(name, port, info, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDRegisterQuery> AvahiQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { + return std::make_shared<AvahiRegisterQuery>(name, port, info, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveServiceQuery> AvahiQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { - return boost::shared_ptr<DNSSDResolveServiceQuery>(new AvahiResolveServiceQuery(service, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveServiceQuery> AvahiQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { + return std::make_shared<AvahiResolveServiceQuery>(service, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveHostnameQuery> AvahiQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { - return boost::shared_ptr<DNSSDResolveHostnameQuery>(new AvahiResolveHostnameQuery(hostname, interfaceIndex, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveHostnameQuery> AvahiQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { + return std::make_shared<AvahiResolveHostnameQuery>(hostname, interfaceIndex, shared_from_this(), eventLoop); } void AvahiQuerier::start() { diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h index fa9580e..5dce19d 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <avahi-client/client.h> #include <avahi-client/lookup.h> @@ -24,17 +23,17 @@ namespace Swift { class AvahiQuerier : public DNSSDQuerier, - public boost::enable_shared_from_this<AvahiQuerier> { + public std::enable_shared_from_this<AvahiQuerier> { public: AvahiQuerier(EventLoop* eventLoop); ~AvahiQuerier(); - boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); - boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); - boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); - boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); void start(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp index 97a7912..08997f6 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp @@ -10,7 +10,7 @@ namespace Swift { -AvahiQuery::AvahiQuery(boost::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : querier(q), eventLoop(eventLoop) { +AvahiQuery::AvahiQuery(std::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : querier(q), eventLoop(eventLoop) { } AvahiQuery::~AvahiQuery() { diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h index 5752003..1b98bbf 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/EventLoop/EventOwner.h> @@ -17,13 +16,13 @@ namespace Swift { class AvahiQuery : public EventOwner, - public boost::enable_shared_from_this<AvahiQuery> { + public std::enable_shared_from_this<AvahiQuery> { public: - AvahiQuery(boost::shared_ptr<AvahiQuerier>, EventLoop* eventLoop); + AvahiQuery(std::shared_ptr<AvahiQuerier>, EventLoop* eventLoop); virtual ~AvahiQuery(); protected: - boost::shared_ptr<AvahiQuerier> querier; + std::shared_ptr<AvahiQuerier> querier; EventLoop* eventLoop; }; } diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h index 5570559..68281d0 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h @@ -18,7 +18,7 @@ namespace Swift { class AvahiRegisterQuery : public DNSSDRegisterQuery, public AvahiQuery { public: - AvahiRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), name(name), port(port), txtRecord(txtRecord), group(0) { + AvahiRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), name(name), port(port), txtRecord(txtRecord), group(0) { } void registerService(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp index af1a048..6510275 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp @@ -12,7 +12,7 @@ namespace Swift { -AvahiResolveHostnameQuery::AvahiResolveHostnameQuery(const std::string& hostname, int, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { +AvahiResolveHostnameQuery::AvahiResolveHostnameQuery(const std::string& hostname, int, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { std::cout << "Resolving hostname " << hostname << std::endl; } diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h index 9d21bf9..5498285 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h @@ -20,7 +20,7 @@ namespace Swift { class AvahiResolveHostnameQuery : public DNSSDResolveHostnameQuery, public AvahiQuery { public: - AvahiResolveHostnameQuery(const std::string& hostname, int, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop); + AvahiResolveHostnameQuery(const std::string& hostname, int, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop); void run(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h index c95d131..c05c73e 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h @@ -19,7 +19,7 @@ namespace Swift { class AvahiResolveServiceQuery : public DNSSDResolveServiceQuery, public AvahiQuery { public: - AvahiResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), service(service), resolver(NULL) { + AvahiResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), service(service), resolver(NULL) { } void start(); diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h index 988f025..c049ed2 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h @@ -17,7 +17,7 @@ namespace Swift { class BonjourBrowseQuery : public DNSSDBrowseQuery, public BonjourQuery { public: - BonjourBrowseQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : BonjourQuery(q, eventLoop) { + BonjourBrowseQuery(std::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : BonjourQuery(q, eventLoop) { DNSServiceErrorType result = DNSServiceBrowse( &sdRef, 0, 0, "_presence._tcp", nullptr, &BonjourBrowseQuery::handleServiceDiscoveredStatic, this); diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp index fda5032..e6d8b94 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp @@ -33,23 +33,23 @@ BonjourQuerier::~BonjourQuerier() { assert(!thread); } -boost::shared_ptr<DNSSDBrowseQuery> BonjourQuerier::createBrowseQuery() { - return boost::shared_ptr<DNSSDBrowseQuery>(new BonjourBrowseQuery(shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDBrowseQuery> BonjourQuerier::createBrowseQuery() { + return std::make_shared<BonjourBrowseQuery>(shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { - return boost::shared_ptr<DNSSDRegisterQuery>(new BonjourRegisterQuery(name, port, info, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { + return std::make_shared<BonjourRegisterQuery>(name, port, info, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { - return boost::shared_ptr<DNSSDResolveServiceQuery>(new BonjourResolveServiceQuery(service, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { + return std::make_shared<BonjourResolveServiceQuery>(service, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveHostnameQuery> BonjourQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { - return boost::shared_ptr<DNSSDResolveHostnameQuery>(new BonjourResolveHostnameQuery(hostname, interfaceIndex, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveHostnameQuery> BonjourQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { + return std::make_shared<BonjourResolveHostnameQuery>(hostname, interfaceIndex, shared_from_this(), eventLoop); } -void BonjourQuerier::addRunningQuery(boost::shared_ptr<BonjourQuery> query) { +void BonjourQuerier::addRunningQuery(std::shared_ptr<BonjourQuery> query) { { boost::lock_guard<boost::mutex> lock(runningQueriesMutex); runningQueries.push_back(query); @@ -58,7 +58,7 @@ void BonjourQuerier::addRunningQuery(boost::shared_ptr<BonjourQuery> query) { interruptSelect(); } -void BonjourQuerier::removeRunningQuery(boost::shared_ptr<BonjourQuery> query) { +void BonjourQuerier::removeRunningQuery(std::shared_ptr<BonjourQuery> query) { { boost::lock_guard<boost::mutex> lock(runningQueriesMutex); erase(runningQueries, query); @@ -106,7 +106,7 @@ void BonjourQuerier::run() { maxSocket = interruptSelectReadSocket; FD_SET(interruptSelectReadSocket, &fdSet); - foreach(const boost::shared_ptr<BonjourQuery>& query, runningQueries) { + foreach(const std::shared_ptr<BonjourQuery>& query, runningQueries) { int socketID = query->getSocketID(); maxSocket = std::max(maxSocket, socketID); FD_SET(socketID, &fdSet); @@ -124,7 +124,7 @@ void BonjourQuerier::run() { { boost::lock_guard<boost::mutex> lock(runningQueriesMutex); - foreach(boost::shared_ptr<BonjourQuery> query, runningQueries) { + foreach(std::shared_ptr<BonjourQuery> query, runningQueries) { if (FD_ISSET(query->getSocketID(), &fdSet)) { query->processResult(); } diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h index 74140ac..199eeb2 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h @@ -7,9 +7,8 @@ #pragma once #include <list> +#include <memory> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/thread.hpp> @@ -20,17 +19,17 @@ namespace Swift { class BonjourQuerier : public DNSSDQuerier, - public boost::enable_shared_from_this<BonjourQuerier> { + public std::enable_shared_from_this<BonjourQuerier> { public: BonjourQuerier(EventLoop* eventLoop); ~BonjourQuerier(); - boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); - boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); - boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); - boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); void start(); @@ -39,8 +38,8 @@ namespace Swift { private: friend class BonjourQuery; - void addRunningQuery(boost::shared_ptr<BonjourQuery>); - void removeRunningQuery(boost::shared_ptr<BonjourQuery>); + void addRunningQuery(std::shared_ptr<BonjourQuery>); + void removeRunningQuery(std::shared_ptr<BonjourQuery>); void interruptSelect(); void run(); @@ -49,7 +48,7 @@ namespace Swift { bool stopRequested; boost::thread* thread; boost::mutex runningQueriesMutex; - std::list< boost::shared_ptr<BonjourQuery> > runningQueries; + std::list< std::shared_ptr<BonjourQuery> > runningQueries; int interruptSelectReadSocket; int interruptSelectWriteSocket; boost::condition_variable runningQueriesAvailableEvent; diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp index fa4b6fe..5f9a98f 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp @@ -10,7 +10,7 @@ namespace Swift { -BonjourQuery::BonjourQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(nullptr) { +BonjourQuery::BonjourQuery(std::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(nullptr) { } BonjourQuery::~BonjourQuery() { diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h index 2e3eb80..5520158 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h @@ -6,8 +6,8 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> + #include <boost/thread/mutex.hpp> #include <dns_sd.h> @@ -20,9 +20,9 @@ namespace Swift { class BonjourQuery : public EventOwner, - public boost::enable_shared_from_this<BonjourQuery> { + public std::enable_shared_from_this<BonjourQuery> { public: - BonjourQuery(boost::shared_ptr<BonjourQuerier>, EventLoop* eventLoop); + BonjourQuery(std::shared_ptr<BonjourQuerier>, EventLoop* eventLoop); virtual ~BonjourQuery(); void processResult(); @@ -34,7 +34,7 @@ namespace Swift { protected: EventLoop* eventLoop; - boost::shared_ptr<BonjourQuerier> querier; + std::shared_ptr<BonjourQuerier> querier; mutable boost::mutex sdRefMutex; DNSServiceRef sdRef; }; diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h index 67c96bd..776b434 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h @@ -19,7 +19,7 @@ namespace Swift { class BonjourRegisterQuery : public DNSSDRegisterQuery, public BonjourQuery { public: - BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceRegister( &sdRef, 0, 0, name.c_str(), "_presence._tcp", nullptr, nullptr, boost::numeric_cast<unsigned short>(port), boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h index adc5486..dbf3f0e 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h @@ -22,7 +22,7 @@ namespace Swift { class BonjourResolveHostnameQuery : public DNSSDResolveHostnameQuery, public BonjourQuery { public: - BonjourResolveHostnameQuery(const std::string& hostname, int interfaceIndex, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourResolveHostnameQuery(const std::string& hostname, int interfaceIndex, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceGetAddrInfo( &sdRef, 0, boost::numeric_cast<unsigned int>(interfaceIndex), kDNSServiceProtocol_IPv4, hostname.c_str(), diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h index ee20a25..86b6015 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h @@ -17,7 +17,7 @@ namespace Swift { class BonjourResolveServiceQuery : public DNSSDResolveServiceQuery, public BonjourQuery { public: - BonjourResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceResolve( &sdRef, 0, boost::numeric_cast<unsigned int>(service.getNetworkInterfaceID()), service.getName().c_str(), service.getType().c_str(), diff --git a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h index 85051fe..8f3c3ec 100644 --- a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/ByteArray.h> @@ -24,12 +24,12 @@ namespace Swift { virtual void start() = 0; virtual void stop() = 0; - virtual boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery() = 0; - virtual boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + virtual std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery() = 0; + virtual std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info) = 0; - virtual boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + virtual std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&) = 0; - virtual boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + virtual std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex) = 0; }; } diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h index 860de41..15d8128 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h @@ -14,7 +14,7 @@ namespace Swift { class FakeDNSSDBrowseQuery : public DNSSDBrowseQuery, public FakeDNSSDQuery { public: - FakeDNSSDBrowseQuery(boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier) { + FakeDNSSDBrowseQuery(std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier) { } void startBrowsing() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp index 89698a6..63ad3b8 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp @@ -29,42 +29,42 @@ FakeDNSSDQuerier::~FakeDNSSDQuerier() { } } -boost::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() { - return boost::shared_ptr<DNSSDBrowseQuery>(new FakeDNSSDBrowseQuery(shared_from_this())); +std::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() { + return std::make_shared<FakeDNSSDBrowseQuery>(shared_from_this()); } -boost::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { - return boost::shared_ptr<DNSSDRegisterQuery>(new FakeDNSSDRegisterQuery(name, port, info, shared_from_this())); +std::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { + return std::make_shared<FakeDNSSDRegisterQuery>(name, port, info, shared_from_this()); } -boost::shared_ptr<DNSSDResolveServiceQuery> FakeDNSSDQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { - return boost::shared_ptr<DNSSDResolveServiceQuery>(new FakeDNSSDResolveServiceQuery(service, shared_from_this())); +std::shared_ptr<DNSSDResolveServiceQuery> FakeDNSSDQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { + return std::make_shared<FakeDNSSDResolveServiceQuery>(service, shared_from_this()); } -boost::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { - return boost::shared_ptr<DNSSDResolveHostnameQuery>(new FakeDNSSDResolveHostnameQuery(hostname, interfaceIndex, shared_from_this())); +std::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { + return std::make_shared<FakeDNSSDResolveHostnameQuery>(hostname, interfaceIndex, shared_from_this()); } -void FakeDNSSDQuerier::addRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) { +void FakeDNSSDQuerier::addRunningQuery(std::shared_ptr<FakeDNSSDQuery> query) { runningQueries.push_back(query); allQueriesEverRun.push_back(query); - if (boost::shared_ptr<FakeDNSSDBrowseQuery> browseQuery = boost::dynamic_pointer_cast<FakeDNSSDBrowseQuery>(query)) { + if (std::shared_ptr<FakeDNSSDBrowseQuery> browseQuery = std::dynamic_pointer_cast<FakeDNSSDBrowseQuery>(query)) { foreach(const DNSSDServiceID& service, services) { eventLoop->postEvent(boost::bind(boost::ref(browseQuery->onServiceAdded), service), shared_from_this()); } } - else if (boost::shared_ptr<FakeDNSSDResolveServiceQuery> resolveQuery = boost::dynamic_pointer_cast<FakeDNSSDResolveServiceQuery>(query)) { + else if (std::shared_ptr<FakeDNSSDResolveServiceQuery> resolveQuery = std::dynamic_pointer_cast<FakeDNSSDResolveServiceQuery>(query)) { for(ServiceInfoMap::const_iterator i = serviceInfo.begin(); i != serviceInfo.end(); ++i) { if (i->first == resolveQuery->service) { eventLoop->postEvent(boost::bind(boost::ref(resolveQuery->onServiceResolved), i->second), shared_from_this()); } } } - else if (boost::shared_ptr<FakeDNSSDRegisterQuery> registerQuery = boost::dynamic_pointer_cast<FakeDNSSDRegisterQuery>(query)) { + else if (std::shared_ptr<FakeDNSSDRegisterQuery> registerQuery = std::dynamic_pointer_cast<FakeDNSSDRegisterQuery>(query)) { DNSSDServiceID service(registerQuery->name, domain); eventLoop->postEvent(boost::bind(boost::ref(registerQuery->onRegisterFinished), service), shared_from_this()); } - else if (boost::shared_ptr<FakeDNSSDResolveHostnameQuery> resolveHostnameQuery = boost::dynamic_pointer_cast<FakeDNSSDResolveHostnameQuery>(query)) { + else if (std::shared_ptr<FakeDNSSDResolveHostnameQuery> resolveHostnameQuery = std::dynamic_pointer_cast<FakeDNSSDResolveHostnameQuery>(query)) { std::map<std::string,boost::optional<HostAddress> >::const_iterator i = addresses.find(resolveHostnameQuery->hostname); if (i != addresses.end()) { eventLoop->postEvent( @@ -75,13 +75,13 @@ void FakeDNSSDQuerier::addRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) } } -void FakeDNSSDQuerier::removeRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) { +void FakeDNSSDQuerier::removeRunningQuery(std::shared_ptr<FakeDNSSDQuery> query) { erase(runningQueries, query); } void FakeDNSSDQuerier::addService(const DNSSDServiceID& id) { services.insert(id); - foreach(const boost::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { eventLoop->postEvent(boost::bind(boost::ref(query->onServiceAdded), id), shared_from_this()); } } @@ -89,7 +89,7 @@ void FakeDNSSDQuerier::addService(const DNSSDServiceID& id) { void FakeDNSSDQuerier::removeService(const DNSSDServiceID& id) { services.erase(id); serviceInfo.erase(id); - foreach(const boost::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { eventLoop->postEvent(boost::bind(boost::ref(query->onServiceRemoved), id), shared_from_this()); } } @@ -99,7 +99,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol if (!r.second) { r.first->second = info; } - foreach(const boost::shared_ptr<FakeDNSSDResolveServiceQuery>& query, getQueries<FakeDNSSDResolveServiceQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDResolveServiceQuery>& query, getQueries<FakeDNSSDResolveServiceQuery>()) { if (query->service == id) { eventLoop->postEvent(boost::bind(boost::ref(query->onServiceResolved), info), shared_from_this()); } @@ -107,7 +107,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol } bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, const ByteArray& info) { - foreach(const boost::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { if (query->name == name && query->port == port && query->info == info) { return true; } @@ -116,20 +116,20 @@ bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, co } void FakeDNSSDQuerier::setBrowseError() { - foreach(const boost::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { eventLoop->postEvent(boost::ref(query->onError), shared_from_this()); } } void FakeDNSSDQuerier::setRegisterError() { - foreach(const boost::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { eventLoop->postEvent(boost::bind(boost::ref(query->onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this()); } } void FakeDNSSDQuerier::setAddress(const std::string& hostname, boost::optional<HostAddress> address) { addresses[hostname] = address; - foreach(const boost::shared_ptr<FakeDNSSDResolveHostnameQuery>& query, getQueries<FakeDNSSDResolveHostnameQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDResolveHostnameQuery>& query, getQueries<FakeDNSSDResolveHostnameQuery>()) { if (query->hostname == hostname) { eventLoop->postEvent(boost::bind( boost::ref(query->onHostnameResolved), address), shared_from_this()); diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h index 536bf90..85fdc3a 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h @@ -7,12 +7,10 @@ #pragma once #include <list> +#include <memory> #include <set> #include <string> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/EventLoop/EventOwner.h> @@ -28,7 +26,7 @@ namespace Swift { class SWIFTEN_API FakeDNSSDQuerier : public DNSSDQuerier, public EventOwner, - public boost::enable_shared_from_this<FakeDNSSDQuerier> { + public std::enable_shared_from_this<FakeDNSSDQuerier> { public: FakeDNSSDQuerier(const std::string& domain, EventLoop* eventLoop); ~FakeDNSSDQuerier(); @@ -40,16 +38,16 @@ namespace Swift { allQueriesEverRun.clear(); } - boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); - boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); - boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); - boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); - void addRunningQuery(boost::shared_ptr<FakeDNSSDQuery>); - void removeRunningQuery(boost::shared_ptr<FakeDNSSDQuery>); + void addRunningQuery(std::shared_ptr<FakeDNSSDQuery>); + void removeRunningQuery(std::shared_ptr<FakeDNSSDQuery>); void addService(const DNSSDServiceID& id); void removeService(const DNSSDServiceID& id); @@ -62,10 +60,10 @@ namespace Swift { public: template<typename T> - std::vector< boost::shared_ptr<T> > getAllQueriesEverRun() const { - std::vector< boost::shared_ptr<T> > result; + std::vector< std::shared_ptr<T> > getAllQueriesEverRun() const { + std::vector< std::shared_ptr<T> > result; for (QueryList::const_iterator i = allQueriesEverRun.begin(); i != allQueriesEverRun.end(); ++i) { - if (boost::shared_ptr<T> resultQuery = boost::dynamic_pointer_cast<T>(*i)) { + if (std::shared_ptr<T> resultQuery = std::dynamic_pointer_cast<T>(*i)) { result.push_back(resultQuery); } } @@ -74,10 +72,10 @@ namespace Swift { private: template<typename T> - std::vector< boost::shared_ptr<T> > getQueries() const { - std::vector< boost::shared_ptr<T> > result; + std::vector< std::shared_ptr<T> > getQueries() const { + std::vector< std::shared_ptr<T> > result; for (QueryList::const_iterator i = runningQueries.begin(); i != runningQueries.end(); ++i) { - if (boost::shared_ptr<T> resultQuery = boost::dynamic_pointer_cast<T>(*i)) { + if (std::shared_ptr<T> resultQuery = std::dynamic_pointer_cast<T>(*i)) { result.push_back(resultQuery); } } @@ -87,7 +85,7 @@ namespace Swift { private: std::string domain; EventLoop* eventLoop; - typedef std::list< boost::shared_ptr<FakeDNSSDQuery> > QueryList; + typedef std::list< std::shared_ptr<FakeDNSSDQuery> > QueryList; QueryList runningQueries; QueryList allQueriesEverRun; std::set<DNSSDServiceID> services; diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp index 980b757..0e05968 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp @@ -10,7 +10,7 @@ namespace Swift { -FakeDNSSDQuery::FakeDNSSDQuery(boost::shared_ptr<FakeDNSSDQuerier> querier) : querier(querier) { +FakeDNSSDQuery::FakeDNSSDQuery(std::shared_ptr<FakeDNSSDQuerier> querier) : querier(querier) { } FakeDNSSDQuery::~FakeDNSSDQuery() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h index 0d7dedc..5d869d4 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/EventLoop/EventOwner.h> @@ -16,9 +15,9 @@ namespace Swift { class FakeDNSSDQuery : public EventOwner, - public boost::enable_shared_from_this<FakeDNSSDQuery> { + public std::enable_shared_from_this<FakeDNSSDQuery> { public: - FakeDNSSDQuery(boost::shared_ptr<FakeDNSSDQuerier>); + FakeDNSSDQuery(std::shared_ptr<FakeDNSSDQuerier>); virtual ~FakeDNSSDQuery(); protected: @@ -26,6 +25,6 @@ namespace Swift { void finish(); protected: - boost::shared_ptr<FakeDNSSDQuerier> querier; + std::shared_ptr<FakeDNSSDQuerier> querier; }; } diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h index 484b2c2..7478841 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h @@ -17,7 +17,7 @@ namespace Swift { class FakeDNSSDRegisterQuery : public DNSSDRegisterQuery, public FakeDNSSDQuery { public: - FakeDNSSDRegisterQuery(const std::string& name, int port, const ByteArray& info, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) { + FakeDNSSDRegisterQuery(const std::string& name, int port, const ByteArray& info, std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) { } void registerService() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h index 0b6a95d..60dc144 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h @@ -17,7 +17,7 @@ namespace Swift { class FakeDNSSDResolveHostnameQuery : public DNSSDResolveHostnameQuery, public FakeDNSSDQuery { public: - FakeDNSSDResolveHostnameQuery(const std::string& hostname, int interfaceIndex, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), hostname(hostname), interfaceIndex(interfaceIndex) { + FakeDNSSDResolveHostnameQuery(const std::string& hostname, int interfaceIndex, std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), hostname(hostname), interfaceIndex(interfaceIndex) { } void run() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h index 180fbb2..8a02e7b 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h @@ -15,7 +15,7 @@ namespace Swift { class FakeDNSSDResolveServiceQuery : public DNSSDResolveServiceQuery, public FakeDNSSDQuery { public: - FakeDNSSDResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), service(service) { + FakeDNSSDResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), service(service) { } void start() { diff --git a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp index f2bfa2e..e20326b 100644 --- a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp +++ b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,14 +18,14 @@ namespace Swift { PlatformDNSSDQuerierFactory::PlatformDNSSDQuerierFactory(EventLoop* eventLoop) : eventLoop(eventLoop) { } -boost::shared_ptr<DNSSDQuerier> PlatformDNSSDQuerierFactory::createQuerier() { +std::shared_ptr<DNSSDQuerier> PlatformDNSSDQuerierFactory::createQuerier() { #if defined(HAVE_BONJOUR) - return boost::shared_ptr<DNSSDQuerier>(new BonjourQuerier(eventLoop)); + return std::make_shared<BonjourQuerier>(eventLoop); #elif defined(HAVE_AVAHI) - return boost::shared_ptr<DNSSDQuerier>(new AvahiQuerier(eventLoop)); + return std::make_shared<AvahiQuerier>(eventLoop); #else (void)eventLoop; - return boost::shared_ptr<DNSSDQuerier>(); + return std::shared_ptr<DNSSDQuerier>(); #endif } diff --git a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h index dc40d01..68e10cf 100644 --- a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h +++ b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> @@ -18,7 +18,7 @@ namespace Swift { public: PlatformDNSSDQuerierFactory(EventLoop* eventLoop); - boost::shared_ptr<DNSSDQuerier> createQuerier(); + std::shared_ptr<DNSSDQuerier> createQuerier(); bool canCreate(); diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp index 435b065..9d446a9 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp @@ -6,8 +6,9 @@ #include <Swiften/LinkLocal/IncomingLinkLocalSession.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/IQ.h> #include <Swiften/Elements/ProtocolHeader.h> @@ -21,7 +22,7 @@ namespace Swift { IncomingLinkLocalSession::IncomingLinkLocalSession( const JID& localJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory) : @@ -42,15 +43,15 @@ void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingH getXMPPLayer()->writeHeader(header); if (incomingHeader.getVersion() == "1.0") { - getXMPPLayer()->writeElement(boost::make_shared<StreamFeatures>()); + getXMPPLayer()->writeElement(std::make_shared<StreamFeatures>()); } else { setInitialized(); } } -void IncomingLinkLocalSession::handleElement(boost::shared_ptr<ToplevelElement> element) { - boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element); +void IncomingLinkLocalSession::handleElement(std::shared_ptr<ToplevelElement> element) { + std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element); // If we get our first stanza before streamfeatures, our session is implicitly // initialized if (stanza && !isInitialized()) { diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.h b/Swiften/LinkLocal/IncomingLinkLocalSession.h index 44a8719..b3f0866 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.h +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -25,7 +25,7 @@ namespace Swift { public: IncomingLinkLocalSession( const JID& localJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); @@ -33,7 +33,7 @@ namespace Swift { boost::signal<void ()> onSessionStarted; private: - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); void setInitialized(); bool isInitialized() const { diff --git a/Swiften/LinkLocal/LinkLocalConnector.cpp b/Swiften/LinkLocal/LinkLocalConnector.cpp index 9123e8e..d961030 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.cpp +++ b/Swiften/LinkLocal/LinkLocalConnector.cpp @@ -19,8 +19,8 @@ namespace Swift { LinkLocalConnector::LinkLocalConnector( const LinkLocalService& service, - boost::shared_ptr<DNSSDQuerier> querier, - boost::shared_ptr<Connection> connection) : + std::shared_ptr<DNSSDQuerier> querier, + std::shared_ptr<Connection> connection) : service(service), querier(querier), connection(connection) { @@ -36,7 +36,7 @@ void LinkLocalConnector::connect() { service.getID().getNetworkInterfaceID()); resolveQueryHostNameResolvedConnection = resolveQuery->onHostnameResolved.connect(boost::bind( &LinkLocalConnector::handleHostnameResolved, - boost::dynamic_pointer_cast<LinkLocalConnector>(shared_from_this()), + std::dynamic_pointer_cast<LinkLocalConnector>(shared_from_this()), _1)); resolveQuery->run(); } @@ -71,7 +71,7 @@ void LinkLocalConnector::handleConnected(bool error) { connectionConnectFinishedConnection.disconnect(); } -void LinkLocalConnector::queueElement(boost::shared_ptr<ToplevelElement> element) { +void LinkLocalConnector::queueElement(std::shared_ptr<ToplevelElement> element) { queuedElements.push_back(element); } diff --git a/Swiften/LinkLocal/LinkLocalConnector.h b/Swiften/LinkLocal/LinkLocalConnector.h index 4e05dce..a55d1b6 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.h +++ b/Swiften/LinkLocal/LinkLocalConnector.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/LinkLocal/LinkLocalService.h> @@ -25,12 +23,12 @@ namespace Swift { class DNSSDQuerier; class DNSSDResolveHostnameQuery; - class SWIFTEN_API LinkLocalConnector : public boost::enable_shared_from_this<LinkLocalConnector> { + class SWIFTEN_API LinkLocalConnector : public std::enable_shared_from_this<LinkLocalConnector> { public: LinkLocalConnector( const LinkLocalService& service, - boost::shared_ptr<DNSSDQuerier> querier, - boost::shared_ptr<Connection> connection); + std::shared_ptr<DNSSDQuerier> querier, + std::shared_ptr<Connection> connection); ~LinkLocalConnector(); const LinkLocalService& getService() const { @@ -39,13 +37,13 @@ namespace Swift { void connect(); void cancel(); - void queueElement(boost::shared_ptr<ToplevelElement> element); + void queueElement(std::shared_ptr<ToplevelElement> element); - const std::vector<boost::shared_ptr<ToplevelElement> >& getQueuedElements() const { + const std::vector<std::shared_ptr<ToplevelElement> >& getQueuedElements() const { return queuedElements; } - boost::shared_ptr<Connection> getConnection() const { + std::shared_ptr<Connection> getConnection() const { return connection; } @@ -57,11 +55,11 @@ namespace Swift { private: LinkLocalService service; - boost::shared_ptr<DNSSDQuerier> querier; - boost::shared_ptr<DNSSDResolveHostnameQuery> resolveQuery; + std::shared_ptr<DNSSDQuerier> querier; + std::shared_ptr<DNSSDResolveHostnameQuery> resolveQuery; boost::bsignals::connection resolveQueryHostNameResolvedConnection; - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; boost::bsignals::connection connectionConnectFinishedConnection; - std::vector<boost::shared_ptr<ToplevelElement> > queuedElements; + std::vector<std::shared_ptr<ToplevelElement> > queuedElements; }; } diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp index d9dfd64..e3b6028 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp @@ -15,7 +15,7 @@ namespace Swift { -LinkLocalServiceBrowser::LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier) : querier(querier), haveError(false) { +LinkLocalServiceBrowser::LinkLocalServiceBrowser(std::shared_ptr<DNSSDQuerier> querier) : querier(querier), haveError(false) { } LinkLocalServiceBrowser::~LinkLocalServiceBrowser() { @@ -98,10 +98,10 @@ void LinkLocalServiceBrowser::handleServiceAdded(const DNSSDServiceID& service) return; } - std::pair<ResolveQueryMap::iterator, bool> r = resolveQueries.insert(std::make_pair(service, boost::shared_ptr<DNSSDResolveServiceQuery>())); + std::pair<ResolveQueryMap::iterator, bool> r = resolveQueries.insert(std::make_pair(service, std::shared_ptr<DNSSDResolveServiceQuery>())); if (r.second) { // There was no existing query yet. Start a new query. - boost::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(service); + std::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(service); resolveQuery->onServiceResolved.connect( boost::bind(&LinkLocalServiceBrowser::handleServiceResolved, this, service, _1)); r.first->second = resolveQuery; diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.h b/Swiften/LinkLocal/LinkLocalServiceBrowser.h index 3795258..2b0545e 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.h +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.h @@ -7,11 +7,11 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -25,7 +25,7 @@ namespace Swift { class SWIFTEN_API LinkLocalServiceBrowser { public: - LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier); + LinkLocalServiceBrowser(std::shared_ptr<DNSSDQuerier> querier); ~LinkLocalServiceBrowser(); void start(); @@ -45,7 +45,7 @@ namespace Swift { std::vector<LinkLocalService> getServices() const; // FIXME: Ugly that we need this - boost::shared_ptr<DNSSDQuerier> getQuerier() const { + std::shared_ptr<DNSSDQuerier> getQuerier() const { return querier; } @@ -63,11 +63,11 @@ namespace Swift { void handleBrowseError(); private: - boost::shared_ptr<DNSSDQuerier> querier; + std::shared_ptr<DNSSDQuerier> querier; boost::optional<DNSSDServiceID> selfService; - boost::shared_ptr<DNSSDBrowseQuery> browseQuery; - boost::shared_ptr<DNSSDRegisterQuery> registerQuery; - typedef std::map<DNSSDServiceID, boost::shared_ptr<DNSSDResolveServiceQuery> > ResolveQueryMap; + std::shared_ptr<DNSSDBrowseQuery> browseQuery; + std::shared_ptr<DNSSDRegisterQuery> registerQuery; + typedef std::map<DNSSDServiceID, std::shared_ptr<DNSSDResolveServiceQuery> > ResolveQueryMap; ResolveQueryMap resolveQueries; typedef std::map<DNSSDServiceID, DNSSDResolveServiceQuery::Result> ServiceMap; ServiceMap services; diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp index 89d0e89..f97d9a1 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp @@ -19,7 +19,7 @@ namespace Swift { OutgoingLinkLocalSession::OutgoingLinkLocalSession( const JID& localJID, const JID& remoteJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory) : @@ -35,17 +35,17 @@ void OutgoingLinkLocalSession::handleSessionStarted() { } void OutgoingLinkLocalSession::handleStreamStart(const ProtocolHeader&) { - foreach(const boost::shared_ptr<ToplevelElement>& stanza, queuedElements_) { + foreach(const std::shared_ptr<ToplevelElement>& stanza, queuedElements_) { sendElement(stanza); } queuedElements_.clear(); } -void OutgoingLinkLocalSession::handleElement(boost::shared_ptr<ToplevelElement> element) { +void OutgoingLinkLocalSession::handleElement(std::shared_ptr<ToplevelElement> element) { onElementReceived(element); } -void OutgoingLinkLocalSession::queueElement(boost::shared_ptr<ToplevelElement> element) { +void OutgoingLinkLocalSession::queueElement(std::shared_ptr<ToplevelElement> element) { queuedElements_.push_back(element); } diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h index b467918..2f08ed3 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> @@ -28,19 +26,19 @@ namespace Swift { OutgoingLinkLocalSession( const JID& localJID, const JID& remoteJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); - void queueElement(boost::shared_ptr<ToplevelElement> element); + void queueElement(std::shared_ptr<ToplevelElement> element); private: void handleSessionStarted(); - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); private: - std::vector<boost::shared_ptr<ToplevelElement> > queuedElements_; + std::vector<std::shared_ptr<ToplevelElement> > queuedElements_; }; } diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp index 3511f90..3c5e098 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp @@ -31,8 +31,8 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::make_shared<FakeDNSSDQuerier>("rabbithole.local", eventLoop); - connection = boost::make_shared<FakeConnection>(eventLoop); + querier = std::make_shared<FakeDNSSDQuerier>("rabbithole.local", eventLoop); + connection = std::make_shared<FakeConnection>(eventLoop); connectFinished = false; } @@ -42,7 +42,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testConnect() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", HostAddress("192.168.1.1")); @@ -57,7 +57,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testConnect_UnableToResolve() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", boost::optional<HostAddress>()); @@ -70,7 +70,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testConnect_UnableToConnect() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", HostAddress("192.168.1.1")); connection->setError(Connection::ReadError); @@ -84,7 +84,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testCancel_DuringResolve() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); testling->connect(); eventLoop->processEvents(); @@ -99,7 +99,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testCancel_DuringConnect() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", HostAddress("192.168.1.1")); connection->setDelayConnect(); @@ -114,13 +114,13 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, int port) { + std::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, int port) { LinkLocalService service( DNSSDServiceID("myname", "local."), DNSSDResolveServiceQuery::Result( "myname._presence._tcp.local", hostname, port, LinkLocalServiceInfo().toTXTRecord())); - boost::shared_ptr<LinkLocalConnector> result( + std::shared_ptr<LinkLocalConnector> result( new LinkLocalConnector(service, querier, connection)); result->onConnectFinished.connect( boost::bind(&LinkLocalConnectorTest::handleConnected, this, _1)); @@ -134,8 +134,8 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; - boost::shared_ptr<FakeDNSSDQuerier> querier; - boost::shared_ptr<FakeConnection> connection; + std::shared_ptr<FakeDNSSDQuerier> querier; + std::shared_ptr<FakeConnection> connection; bool connectFinished; bool connectError; }; diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp index 6d8ba97..a80d748 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp @@ -5,9 +5,9 @@ */ #include <map> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -45,7 +45,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::make_shared<FakeDNSSDQuerier>("wonderland.lit", eventLoop); + querier = std::make_shared<FakeDNSSDQuerier>("wonderland.lit", eventLoop); aliceServiceID = new DNSSDServiceID("alice", "wonderland.lit"); aliceServiceInfo = new DNSSDResolveServiceQuery::Result("_presence._tcp.wonderland.lit", "xmpp.wonderland.lit", 1234, LinkLocalServiceInfo().toTXTRecord()); testServiceID = new DNSSDServiceID("foo", "bar.local"); @@ -70,14 +70,14 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testConstructor() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); CPPUNIT_ASSERT(!testling->isRunning()); CPPUNIT_ASSERT(!testling->hasError()); } void testStart() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); CPPUNIT_ASSERT(testling->isRunning()); @@ -87,7 +87,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -109,7 +109,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_NoServiceInfo() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -123,7 +123,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_RegisteredService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -140,7 +140,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_UnregisteredService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); testling->registerService("alice", 1234, LinkLocalServiceInfo()); @@ -166,7 +166,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceRemoved_UnregisteredService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); testling->registerService("alice", 1234, LinkLocalServiceInfo()); @@ -183,7 +183,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_Twice() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -208,7 +208,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { void testServiceChanged() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setServiceInfo(*testServiceID,*testServiceInfo); querier->addService(*testServiceID); @@ -231,7 +231,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceRemoved() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setServiceInfo(*testServiceID,*testServiceInfo); querier->addService(*testServiceID); @@ -252,7 +252,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testError_BrowseErrorAfterStart() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setBrowseError(); @@ -264,7 +264,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testError_BrowseErrorAfterResolve() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setServiceInfo(*testServiceID,*testServiceInfo); querier->addService(*testServiceID); @@ -283,7 +283,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testRegisterService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -299,7 +299,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testRegisterService_Error() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); LinkLocalServiceInfo info; testling->registerService("foo@bar", 1234, info); @@ -315,7 +315,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testRegisterService_Reregister() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); LinkLocalServiceInfo info; @@ -335,7 +335,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testUpdateService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -352,8 +352,8 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<LinkLocalServiceBrowser> createTestling() { - boost::shared_ptr<LinkLocalServiceBrowser> testling( + std::shared_ptr<LinkLocalServiceBrowser> createTestling() { + std::shared_ptr<LinkLocalServiceBrowser> testling( new LinkLocalServiceBrowser(querier)); testling->onServiceAdded.connect(boost::bind( &LinkLocalServiceBrowserTest::handleServiceAdded, this, _1)); @@ -397,7 +397,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; - boost::shared_ptr<FakeDNSSDQuerier> querier; + std::shared_ptr<FakeDNSSDQuerier> querier; std::vector<LinkLocalService> addedServices; std::vector<LinkLocalService> changedServices; std::vector<LinkLocalService> removedServices; diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h index e8f953e..d0c2bab 100644 --- a/Swiften/MUC/MUC.h +++ b/Swiften/MUC/MUC.h @@ -7,9 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/signals/connection.hpp> #include <Swiften/Base/API.h> @@ -30,7 +30,7 @@ namespace Swift { class SWIFTEN_API MUC { public: - typedef boost::shared_ptr<MUC> ref; + typedef std::shared_ptr<MUC> ref; enum JoinResult { JoinSucceeded, JoinFailed }; enum LeavingType { LeavePart, LeaveKick, LeaveBan, LeaveDestroy, LeaveNotMember, Disconnect }; diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp index 1d8c2aa..570c613 100644 --- a/Swiften/MUC/MUCBookmarkManager.cpp +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -7,9 +7,9 @@ #include <Swiften/MUC/MUCBookmarkManager.h> #include <iostream> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Queries/IQRouter.h> @@ -26,7 +26,7 @@ MUCBookmarkManager::MUCBookmarkManager(IQRouter* iqRouter) { request->send(); } -void MUCBookmarkManager::handleBookmarksReceived(boost::shared_ptr<Storage> payload, ErrorPayload::ref error) { +void MUCBookmarkManager::handleBookmarksReceived(std::shared_ptr<Storage> payload, ErrorPayload::ref error) { if (error) { return; } @@ -99,7 +99,7 @@ void MUCBookmarkManager::removeBookmark(const MUCBookmark& bookmark) { void MUCBookmarkManager::flush() { if (!storage) { - storage = boost::make_shared<Storage>(); + storage = std::make_shared<Storage>(); } // Update the storage element storage->clearRooms(); diff --git a/Swiften/MUC/MUCBookmarkManager.h b/Swiften/MUC/MUCBookmarkManager.h index 18dd677..58aaeee 100644 --- a/Swiften/MUC/MUCBookmarkManager.h +++ b/Swiften/MUC/MUCBookmarkManager.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -40,13 +40,13 @@ namespace Swift { private: bool containsEquivalent(const std::vector<MUCBookmark>& list, const MUCBookmark& bookmark); - void handleBookmarksReceived(boost::shared_ptr<Storage> payload, ErrorPayload::ref error); + void handleBookmarksReceived(std::shared_ptr<Storage> payload, ErrorPayload::ref error); void flush(); private: bool ready_; std::vector<MUCBookmark> bookmarks_; IQRouter* iqRouter_; - boost::shared_ptr<Storage> storage; + std::shared_ptr<Storage> storage; }; } diff --git a/Swiften/MUC/MUCImpl.cpp b/Swiften/MUC/MUCImpl.cpp index 8562ec8..4bab39d 100644 --- a/Swiften/MUC/MUCImpl.cpp +++ b/Swiften/MUC/MUCImpl.cpp @@ -6,9 +6,9 @@ #include <Swiften/MUC/MUCImpl.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Client/StanzaChannel.h> @@ -92,10 +92,10 @@ void MUCImpl::internalJoin(const std::string &nick) { ownMUCJID = JID(ownMUCJID.getNode(), ownMUCJID.getDomain(), nick); - Presence::ref joinPresence = presenceSender->getLastSentUndirectedPresence() ? (*presenceSender->getLastSentUndirectedPresence())->clone() : boost::make_shared<Presence>(); + Presence::ref joinPresence = presenceSender->getLastSentUndirectedPresence() ? (*presenceSender->getLastSentUndirectedPresence())->clone() : std::make_shared<Presence>(); assert(joinPresence->getType() == Presence::Available); joinPresence->setTo(ownMUCJID); - MUCPayload::ref mucPayload = boost::make_shared<MUCPayload>(); + MUCPayload::ref mucPayload = std::make_shared<MUCPayload>(); if (joinSince_ != boost::posix_time::not_a_date_time) { mucPayload->setSince(joinSince_); } @@ -108,7 +108,7 @@ void MUCImpl::internalJoin(const std::string &nick) { } void MUCImpl::changeNickname(const std::string& newNickname) { - Presence::ref changeNicknamePresence = boost::make_shared<Presence>(); + Presence::ref changeNicknamePresence = std::make_shared<Presence>(); changeNicknamePresence->setTo(ownMUCJID.toBare().toString() + std::string("/") + newNickname); presenceSender->sendPresence(changeNicknamePresence); } @@ -157,7 +157,7 @@ void MUCImpl::handleIncomingPresence(Presence::ref presence) { presenceSender->addDirectedPresenceReceiver(ownMUCJID, DirectedPresenceSender::DontSendPresence); if (presenceSender->getLastSentUndirectedPresence() && !isEqualExceptID(**(presenceSender->getLastSentUndirectedPresence()), *joinRequestPresence_)) { // our presence changed between join request and join complete, send current presence to MUC - Presence::ref latestPresence = boost::make_shared<Presence>(**presenceSender->getLastSentUndirectedPresence()); + Presence::ref latestPresence = std::make_shared<Presence>(**presenceSender->getLastSentUndirectedPresence()); latestPresence->setTo(ownMUCJID); presenceSender->sendPresence(latestPresence); } @@ -185,7 +185,7 @@ void MUCImpl::handleIncomingPresence(Presence::ref presence) { LeavingType type = LeavePart; boost::optional<std::string> newNickname; if (mucPayload) { - if (boost::dynamic_pointer_cast<MUCDestroyPayload>(mucPayload->getPayload())) { + if (std::dynamic_pointer_cast<MUCDestroyPayload>(mucPayload->getPayload())) { type = LeaveDestroy; } else foreach (MUCUserPayload::StatusCode status, mucPayload->getStatusCodes()) { @@ -285,8 +285,8 @@ void MUCImpl::handleIncomingPresence(Presence::ref presence) { // Accept default room configuration and create an instant room http://xmpp.org/extensions/xep-0045.html#createroom-instant MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload()); presenceSender->addDirectedPresenceReceiver(ownMUCJID, DirectedPresenceSender::DontSendPresence); - mucPayload->setPayload(boost::make_shared<Form>(Form::SubmitType)); - boost::shared_ptr< GenericRequest<MUCOwnerPayload> > request = boost::make_shared< GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); + mucPayload->setPayload(std::make_shared<Form>(Form::SubmitType)); + std::shared_ptr< GenericRequest<MUCOwnerPayload> > request = std::make_shared< GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); request->onResponse.connect(boost::bind(&MUCImpl::handleCreationConfigResponse, this, _1, _2)); request->send(); } @@ -330,12 +330,12 @@ void MUCImpl::kickOccupant(const JID& jid) { * Call with the room JID, not the real JID. */ void MUCImpl::changeOccupantRole(const JID& jid, MUCOccupant::Role role) { - MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>(); + MUCAdminPayload::ref mucPayload = std::make_shared<MUCAdminPayload>(); MUCItem item; item.role = role; item.nick = jid.getResource(); mucPayload->addItem(item); - boost::shared_ptr<GenericRequest<MUCAdminPayload> > request = boost::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); + std::shared_ptr<GenericRequest<MUCAdminPayload> > request = std::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); request->onResponse.connect(boost::bind(&MUCImpl::handleOccupantRoleChangeResponse, this, _1, _2, jid, role)); request->send(); @@ -348,11 +348,11 @@ void MUCImpl::handleOccupantRoleChangeResponse(MUCAdminPayload::ref /*unused*/, } void MUCImpl::requestAffiliationList(MUCOccupant::Affiliation affiliation) { - MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>(); + MUCAdminPayload::ref mucPayload = std::make_shared<MUCAdminPayload>(); MUCItem item; item.affiliation = affiliation; mucPayload->addItem(item); - boost::shared_ptr<GenericRequest<MUCAdminPayload> > request = boost::make_shared< GenericRequest<MUCAdminPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_); + std::shared_ptr<GenericRequest<MUCAdminPayload> > request = std::make_shared< GenericRequest<MUCAdminPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_); request->onResponse.connect(boost::bind(&MUCImpl::handleAffiliationListResponse, this, _1, _2, affiliation)); request->send(); } @@ -361,12 +361,12 @@ void MUCImpl::requestAffiliationList(MUCOccupant::Affiliation affiliation) { * Must be called with the real JID, not the room JID. */ void MUCImpl::changeAffiliation(const JID& jid, MUCOccupant::Affiliation affiliation) { - MUCAdminPayload::ref mucPayload = boost::make_shared<MUCAdminPayload>(); + MUCAdminPayload::ref mucPayload = std::make_shared<MUCAdminPayload>(); MUCItem item; item.affiliation = affiliation; item.realJID = jid.toBare(); mucPayload->addItem(item); - boost::shared_ptr<GenericRequest<MUCAdminPayload> > request = boost::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); + std::shared_ptr<GenericRequest<MUCAdminPayload> > request = std::make_shared<GenericRequest<MUCAdminPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); request->onResponse.connect(boost::bind(&MUCImpl::handleAffiliationChangeResponse, this, _1, _2, jid, affiliation)); request->send(); } @@ -393,7 +393,7 @@ void MUCImpl::handleAffiliationChangeResponse(MUCAdminPayload::ref /*unused*/, E } void MUCImpl::changeSubject(const std::string& subject) { - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setSubject(subject); message->setType(Message::Groupchat); message->setTo(ownMUCJID.toBare()); @@ -402,15 +402,15 @@ void MUCImpl::changeSubject(const std::string& subject) { void MUCImpl::requestConfigurationForm() { MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload()); - boost::shared_ptr<GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_); + std::shared_ptr<GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Get, getJID(), mucPayload, iqRouter_); request->onResponse.connect(boost::bind(&MUCImpl::handleConfigurationFormReceived, this, _1, _2)); request->send(); } void MUCImpl::cancelConfigureRoom() { MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload()); - mucPayload->setPayload(boost::make_shared<Form>(Form::CancelType)); - boost::shared_ptr<GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); + mucPayload->setPayload(std::make_shared<Form>(Form::CancelType)); + std::shared_ptr<GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); request->send(); } @@ -435,7 +435,7 @@ void MUCImpl::handleConfigurationResultReceived(MUCOwnerPayload::ref /*payload*/ void MUCImpl::configureRoom(Form::ref form) { MUCOwnerPayload::ref mucPayload(new MUCOwnerPayload()); mucPayload->setPayload(form); - boost::shared_ptr<GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); + std::shared_ptr<GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); if (unlocking) { request->onResponse.connect(boost::bind(&MUCImpl::handleCreationConfigResponse, this, _1, _2)); } @@ -446,19 +446,19 @@ void MUCImpl::configureRoom(Form::ref form) { } void MUCImpl::destroyRoom() { - MUCOwnerPayload::ref mucPayload = boost::make_shared<MUCOwnerPayload>(); - MUCDestroyPayload::ref mucDestroyPayload = boost::make_shared<MUCDestroyPayload>(); + MUCOwnerPayload::ref mucPayload = std::make_shared<MUCOwnerPayload>(); + MUCDestroyPayload::ref mucDestroyPayload = std::make_shared<MUCDestroyPayload>(); mucPayload->setPayload(mucDestroyPayload); - boost::shared_ptr< GenericRequest<MUCOwnerPayload> > request = boost::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); + std::shared_ptr< GenericRequest<MUCOwnerPayload> > request = std::make_shared<GenericRequest<MUCOwnerPayload> >(IQ::Set, getJID(), mucPayload, iqRouter_); request->onResponse.connect(boost::bind(&MUCImpl::handleConfigurationResultReceived, this, _1, _2)); request->send(); } void MUCImpl::invitePerson(const JID& person, const std::string& reason, bool isImpromptu, bool isReuseChat) { - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setTo(person); message->setType(Message::Normal); - MUCInvitationPayload::ref invite = boost::make_shared<MUCInvitationPayload>(); + MUCInvitationPayload::ref invite = std::make_shared<MUCInvitationPayload>(); invite->setReason(reason); invite->setJID(ownMUCJID.toBare()); invite->setIsImpromptu(isImpromptu); diff --git a/Swiften/MUC/MUCImpl.h b/Swiften/MUC/MUCImpl.h index 9b4377a..f9802af 100644 --- a/Swiften/MUC/MUCImpl.h +++ b/Swiften/MUC/MUCImpl.h @@ -7,9 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/signals/connection.hpp> #include <Swiften/Base/API.h> @@ -31,7 +31,7 @@ namespace Swift { class SWIFTEN_API MUCImpl : public MUC { public: - typedef boost::shared_ptr<MUCImpl> ref; + typedef std::shared_ptr<MUCImpl> ref; public: MUCImpl(StanzaChannel* stanzaChannel, IQRouter* iqRouter, DirectedPresenceSender* presenceSender, const JID &muc, MUCRegistry* mucRegistry); diff --git a/Swiften/MUC/MUCManager.cpp b/Swiften/MUC/MUCManager.cpp index b4e3b00..81e5cd5 100644 --- a/Swiften/MUC/MUCManager.cpp +++ b/Swiften/MUC/MUCManager.cpp @@ -14,7 +14,7 @@ MUCManager::MUCManager(StanzaChannel* stanzaChannel, IQRouter* iqRouter, Directe } MUC::ref MUCManager::createMUC(const JID& jid) { - return boost::make_shared<MUCImpl>(stanzaChannel, iqRouter, presenceSender, jid, mucRegistry); + return std::make_shared<MUCImpl>(stanzaChannel, iqRouter, presenceSender, jid, mucRegistry); } } diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp index 548617c..115787e 100644 --- a/Swiften/MUC/UnitTest/MUCTest.cpp +++ b/Swiften/MUC/UnitTest/MUCTest.cpp @@ -4,9 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -102,7 +102,7 @@ class MUCTest : public CppUnit::TestFixture { void testCreateInstant() { MUC::ref testling = createMUC(JID("rabbithole@wonderland.lit")); testling->joinAs("Alice"); - Presence::ref serverRespondsLocked = boost::make_shared<Presence>(); + Presence::ref serverRespondsLocked = std::make_shared<Presence>(); serverRespondsLocked->setFrom(JID("rabbithole@wonderland.lit/Alice")); MUCUserPayload::ref mucPayload(new MUCUserPayload()); MUCItem myItem; @@ -122,12 +122,12 @@ class MUCTest : public CppUnit::TestFixture { } void testReplicateBug() { - Presence::ref initialPresence = boost::make_shared<Presence>(); + Presence::ref initialPresence = std::make_shared<Presence>(); initialPresence->setStatus(""); - VCard::ref vcard = boost::make_shared<VCard>(); + VCard::ref vcard = std::make_shared<VCard>(); vcard->setPhoto(createByteArray("15c30080ae98ec48be94bf0e191d43edd06e500a")); initialPresence->addPayload(vcard); - CapsInfo::ref caps = boost::make_shared<CapsInfo>(); + CapsInfo::ref caps = std::make_shared<CapsInfo>(); caps->setNode("http://swift.im"); caps->setVersion("p2UP0DrcVgKM6jJqYN/B92DKK0o="); initialPresence->addPayload(caps); @@ -135,7 +135,7 @@ class MUCTest : public CppUnit::TestFixture { MUC::ref testling = createMUC(JID("test@rooms.swift.im")); testling->joinAs("Test"); - Presence::ref serverRespondsLocked = boost::make_shared<Presence>(); + Presence::ref serverRespondsLocked = std::make_shared<Presence>(); serverRespondsLocked->setFrom(JID("test@rooms.swift.im/Test")); serverRespondsLocked->setTo(JID("test@swift.im/6913d576d55f0b67")); serverRespondsLocked->addPayload(vcard); @@ -163,14 +163,14 @@ class MUCTest : public CppUnit::TestFixture { testling->joinAs("Rabbit"); // Rabbit joins - Presence::ref rabbitJoins = boost::make_shared<Presence>(); + Presence::ref rabbitJoins = std::make_shared<Presence>(); rabbitJoins->setTo("test@swift.im/6913d576d55f0b67"); rabbitJoins->setFrom(testling->getJID().toString() + "/Rabbit"); channel->onPresenceReceived(rabbitJoins); CPPUNIT_ASSERT_EQUAL(true, testling->hasOccupant("Rabbit")); // Alice joins - Presence::ref aliceJoins = boost::make_shared<Presence>(); + Presence::ref aliceJoins = std::make_shared<Presence>(); aliceJoins->setTo("test@swift.im/6913d576d55f0b67"); aliceJoins->setFrom(testling->getJID().toString() + "/Alice"); channel->onPresenceReceived(aliceJoins); @@ -183,7 +183,7 @@ class MUCTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("Dodo"), stanza->getTo().getResource()); // Alice changes nick to Alice2 - stanza = boost::make_shared<Presence>(); + stanza = std::make_shared<Presence>(); stanza->setFrom(JID("foo@bar.com/Alice")); stanza->setTo(JID(router->getJID())); stanza->setType(Presence::Unavailable); @@ -201,7 +201,7 @@ class MUCTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(true, testling->hasOccupant("Alice2")); // We (Rabbit) change nick to Robot - stanza = boost::make_shared<Presence>(); + stanza = std::make_shared<Presence>(); stanza->setFrom(JID("foo@bar.com/Rabbit")); stanza->setTo(JID(router->getJID())); stanza->setType(Presence::Unavailable); @@ -235,7 +235,7 @@ class MUCTest : public CppUnit::TestFixture { private: MUC::ref createMUC(const JID& jid) { - MUC::ref muc = boost::make_shared<MUCImpl>(channel, router, presenceSender, jid, mucRegistry); + MUC::ref muc = std::make_shared<MUCImpl>(channel, router, presenceSender, jid, mucRegistry); muc->onOccupantNicknameChanged.connect(boost::bind(&MUCTest::handleOccupantNicknameChanged, this, _1, _2)); return muc; } @@ -250,7 +250,7 @@ class MUCTest : public CppUnit::TestFixture { void receivePresence(const JID& jid, const std::string& status) { Presence::ref p = Presence::create(status); p->setFrom(jid); - //MUCUserPayload::ref mucUserPayload = boost::make_shared<MUCUserPayload>(); + //MUCUserPayload::ref mucUserPayload = std::make_shared<MUCUserPayload>(); //mucUserPayload->addItem(item); //p->addPayload(mucUserPayload); channel->onPresenceReceived(p); diff --git a/Swiften/MUC/UnitTest/MockMUC.h b/Swiften/MUC/UnitTest/MockMUC.h index c61f8a9..575c8e7 100644 --- a/Swiften/MUC/UnitTest/MockMUC.h +++ b/Swiften/MUC/UnitTest/MockMUC.h @@ -7,9 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/signals/connection.hpp> #include <Swiften/Base/API.h> @@ -31,7 +31,7 @@ namespace Swift { class SWIFTEN_API MockMUC : public MUC{ public: - typedef boost::shared_ptr<MockMUC> ref; + typedef std::shared_ptr<MockMUC> ref; public: MockMUC(const JID &muc); diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp index 887a5f0..757b1db 100644 --- a/Swiften/Network/BOSHConnection.cpp +++ b/Swiften/Network/BOSHConnection.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -42,10 +42,10 @@ BOSHConnection::BOSHConnection(const URL& boshURL, Connector::ref connector, XML connectionReady_(false) { if (boshURL_.getScheme() == "https") { - tlsLayer_ = boost::make_shared<TLSLayer>(tlsContextFactory, tlsOptions); + tlsLayer_ = std::make_shared<TLSLayer>(tlsContextFactory, tlsOptions); // The following dummyLayer_ is needed as the TLSLayer will pass the decrypted data to its parent layer. // The dummyLayer_ will serve as the parent layer. - dummyLayer_ = boost::make_shared<DummyStreamLayer>(tlsLayer_.get()); + dummyLayer_ = std::make_shared<DummyStreamLayer>(tlsLayer_.get()); } } @@ -78,7 +78,7 @@ void BOSHConnection::handleTLSConnected() { void BOSHConnection::handleTLSApplicationDataRead(const SafeByteArray& data) { SWIFT_LOG(debug) << std::endl; - handleDataRead(boost::make_shared<SafeByteArray>(data)); + handleDataRead(std::make_shared<SafeByteArray>(data)); } void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) { @@ -86,12 +86,12 @@ void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) connection_->write(data); } -void BOSHConnection::handleRawDataRead(boost::shared_ptr<SafeByteArray> data) { +void BOSHConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) { SWIFT_LOG(debug) << std::endl; tlsLayer_->handleDataRead(*data.get()); } -void BOSHConnection::handleTLSError(boost::shared_ptr<TLSError> /* error */) { +void BOSHConnection::handleTLSError(std::shared_ptr<TLSError> /* error */) { } @@ -276,7 +276,7 @@ void BOSHConnection::startStream(const std::string& to, unsigned long long rid) SWIFT_LOG(debug) << "write stream header: " << safeByteArrayToString(safeHeader) << std::endl; } -void BOSHConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) { +void BOSHConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) { onBOSHDataRead(*data); buffer_ = concat(buffer_, *data); std::string response = safeByteArrayToString(buffer_); @@ -295,7 +295,7 @@ void BOSHConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) { if (parser.getBody()) { if (parser.getBody()->attributes.getAttribute("type") == "terminate") { BOSHError::Type errorType = parseTerminationCondition(parser.getBody()->attributes.getAttribute("condition")); - onSessionTerminated(errorType == BOSHError::NoError ? boost::shared_ptr<BOSHError>() : boost::make_shared<BOSHError>(errorType)); + onSessionTerminated(errorType == BOSHError::NoError ? std::shared_ptr<BOSHError>() : std::make_shared<BOSHError>(errorType)); } buffer_.clear(); if (waitingForStartResponse_) { diff --git a/Swiften/Network/BOSHConnection.h b/Swiften/Network/BOSHConnection.h index dc0f3a5..485e86a 100644 --- a/Swiften/Network/BOSHConnection.h +++ b/Swiften/Network/BOSHConnection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,7 +13,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> @@ -51,15 +51,15 @@ namespace Swift { BOSHError(Type type) : SessionStream::SessionStreamError(SessionStream::SessionStreamError::ConnectionReadError), type(type) {} Type getType() {return type;} - typedef boost::shared_ptr<BOSHError> ref; + typedef std::shared_ptr<BOSHError> ref; private: Type type; }; - class SWIFTEN_API BOSHConnection : public boost::enable_shared_from_this<BOSHConnection> { + class SWIFTEN_API BOSHConnection : public std::enable_shared_from_this<BOSHConnection> { public: - typedef boost::shared_ptr<BOSHConnection> ref; + typedef std::shared_ptr<BOSHConnection> ref; static ref create(const URL& boshURL, Connector::ref connector, XMLParserFactory* parserFactory, TLSContextFactory* tlsContextFactory, const TLSOptions& tlsOptions) { return ref(new BOSHConnection(boshURL, connector, parserFactory, tlsContextFactory, tlsOptions)); } @@ -97,7 +97,7 @@ namespace Swift { static std::pair<SafeByteArray, size_t> createHTTPRequest(const SafeByteArray& data, bool streamRestart, bool terminate, unsigned long long rid, const std::string& sid, const URL& boshURL); void handleConnectFinished(Connection::ref); - void handleDataRead(boost::shared_ptr<SafeByteArray> data); + void handleDataRead(std::shared_ptr<SafeByteArray> data); void handleDisconnected(const boost::optional<Connection::Error>& error); void write(const SafeByteArray& data, bool streamRestart, bool terminate); /* FIXME: refactor */ BOSHError::Type parseTerminationCondition(const std::string& text); @@ -106,16 +106,16 @@ namespace Swift { void handleTLSConnected(); void handleTLSApplicationDataRead(const SafeByteArray& data); void handleTLSNetowrkDataWriteRequest(const SafeByteArray& data); - void handleRawDataRead(boost::shared_ptr<SafeByteArray> data); - void handleTLSError(boost::shared_ptr<TLSError> error); + void handleRawDataRead(std::shared_ptr<SafeByteArray> data); + void handleTLSError(std::shared_ptr<TLSError> error); void writeData(const SafeByteArray& data); URL boshURL_; Connector::ref connector_; XMLParserFactory* parserFactory_; - boost::shared_ptr<Connection> connection_; - boost::shared_ptr<HighLayer> dummyLayer_; - boost::shared_ptr<TLSLayer> tlsLayer_; + std::shared_ptr<Connection> connection_; + std::shared_ptr<HighLayer> dummyLayer_; + std::shared_ptr<TLSLayer> tlsLayer_; std::string sid_; bool waitingForStartResponse_; unsigned long long rid_; diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp index 7d5c164..9ce40d3 100644 --- a/Swiften/Network/BOSHConnectionPool.cpp +++ b/Swiften/Network/BOSHConnectionPool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,7 +17,7 @@ #include <Swiften/Network/HTTPConnectProxiedConnectionFactory.h> namespace Swift { -BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* realResolver, ConnectionFactory* connectionFactoryParameter, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, boost::shared_ptr<HTTPTrafficFilter> trafficFilter) : +BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* realResolver, ConnectionFactory* connectionFactoryParameter, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, std::shared_ptr<HTTPTrafficFilter> trafficFilter) : boshURL(boshURL), connectionFactory(connectionFactoryParameter), xmlParserFactory(parserFactory), @@ -96,7 +96,7 @@ std::vector<Certificate::ref> BOSHConnectionPool::getPeerCertificateChain() cons return pinnedCertificateChain_; } -boost::shared_ptr<CertificateVerificationError> BOSHConnectionPool::getPeerCertificateVerificationError() const { +std::shared_ptr<CertificateVerificationError> BOSHConnectionPool::getPeerCertificateVerificationError() const { return lastVerificationError_; } @@ -132,7 +132,7 @@ void BOSHConnectionPool::handleSessionStarted(const std::string& sessionID, size void BOSHConnectionPool::handleConnectFinished(bool error, BOSHConnection::ref connection) { if (error) { - onSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition)); + onSessionTerminated(std::make_shared<BOSHError>(BOSHError::UndefinedCondition)); /*TODO: We can probably manage to not terminate the stream here and use the rid/ack retry * logic to just swallow the error and try again (some number of tries). */ @@ -235,7 +235,7 @@ void BOSHConnectionPool::tryToSendQueuedData() { } void BOSHConnectionPool::handleHTTPError(const std::string& /*errorCode*/) { - handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition)); + handleSessionTerminated(std::make_shared<BOSHError>(BOSHError::UndefinedCondition)); } void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnection::ref connection) { @@ -244,7 +244,7 @@ void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnec handleSessionTerminated(BOSHError::ref()); } //else if (error) { - // handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition)); + // handleSessionTerminated(std::make_shared<BOSHError>(BOSHError::UndefinedCondition)); //} else { /* We might have just freed up a connection slot to send with */ @@ -252,7 +252,7 @@ void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnec } } -boost::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() { +std::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() { Connector::ref connector = Connector::create(boshURL.getHost(), URL::getPortOrDefaultPort(boshURL), boost::optional<std::string>(), resolver, connectionFactory, timerFactory); BOSHConnection::ref connection = BOSHConnection::create(boshURL, connector, xmlParserFactory, tlsContextFactory_, tlsOptions_); connection->onXMPPDataRead.connect(boost::bind(&BOSHConnectionPool::handleDataRead, this, _1)); @@ -274,7 +274,7 @@ boost::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() { return connection; } -void BOSHConnectionPool::destroyConnection(boost::shared_ptr<BOSHConnection> connection) { +void BOSHConnectionPool::destroyConnection(std::shared_ptr<BOSHConnection> connection) { connections.erase(std::remove(connections.begin(), connections.end(), connection), connections.end()); connection->onXMPPDataRead.disconnect(boost::bind(&BOSHConnectionPool::handleDataRead, this, _1)); connection->onSessionStarted.disconnect(boost::bind(&BOSHConnectionPool::handleSessionStarted, this, _1, _2)); diff --git a/Swiften/Network/BOSHConnectionPool.h b/Swiften/Network/BOSHConnectionPool.h index 5088be6..b288505 100644 --- a/Swiften/Network/BOSHConnectionPool.h +++ b/Swiften/Network/BOSHConnectionPool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,7 +26,7 @@ namespace Swift { class SWIFTEN_API BOSHConnectionPool : public boost::bsignals::trackable { public: - BOSHConnectionPool(const URL& boshURL, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, boost::shared_ptr<HTTPTrafficFilter> trafficFilter = boost::shared_ptr<HTTPTrafficFilter>()); + BOSHConnectionPool(const URL& boshURL, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, std::shared_ptr<HTTPTrafficFilter> trafficFilter = std::shared_ptr<HTTPTrafficFilter>()); ~BOSHConnectionPool(); void open(); @@ -39,7 +39,7 @@ namespace Swift { bool isTLSEncrypted() const; Certificate::ref getPeerCertificate() const; std::vector<Certificate::ref> getPeerCertificateChain() const; - boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; boost::signal<void (BOSHError::ref)> onSessionTerminated; boost::signal<void ()> onSessionStarted; @@ -82,7 +82,7 @@ namespace Swift { CertificateWithKey::ref clientCertificate; TLSContextFactory* tlsContextFactory_; TLSOptions tlsOptions_; - std::vector<boost::shared_ptr<Certificate> > pinnedCertificateChain_; - boost::shared_ptr<CertificateVerificationError> lastVerificationError_; + std::vector<std::shared_ptr<Certificate> > pinnedCertificateChain_; + std::shared_ptr<CertificateVerificationError> lastVerificationError_; }; } diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp index 80cb6b8..a987790 100644 --- a/Swiften/Network/BoostConnection.cpp +++ b/Swiften/Network/BoostConnection.cpp @@ -7,13 +7,13 @@ #include <Swiften/Network/BoostConnection.h> #include <algorithm> +#include <memory> #include <string> #include <boost/asio/placeholders.hpp> #include <boost/asio/write.hpp> #include <boost/bind.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <boost/thread.hpp> #include <Swiften/Base/Algorithm.h> @@ -45,13 +45,13 @@ class SharedBuffer { const boost::asio::const_buffer* end() const { return &buffer_ + 1; } private: - boost::shared_ptr< std::vector<char, SafeAllocator<char> > > data_; + std::shared_ptr< std::vector<char, SafeAllocator<char> > > data_; boost::asio::const_buffer buffer_; }; // ----------------------------------------------------------------------------- -BoostConnection::BoostConnection(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : +BoostConnection::BoostConnection(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : eventLoop(eventLoop), ioService(ioService), socket_(*ioService), writing_(false), closeSocketAfterNextWrite_(false) { } @@ -119,7 +119,7 @@ void BoostConnection::handleConnectFinished(const boost::system::error_code& err } void BoostConnection::doRead() { - readBuffer_ = boost::make_shared<SafeByteArray>(BUFFER_SIZE); + readBuffer_ = std::make_shared<SafeByteArray>(BUFFER_SIZE); boost::lock_guard<boost::mutex> lock(readCloseMutex_); socket_.async_read_some( boost::asio::buffer(*readBuffer_), diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h index 9909455..82208a1 100644 --- a/Swiften/Network/BoostConnection.h +++ b/Swiften/Network/BoostConnection.h @@ -6,9 +6,10 @@ #pragma once +#include <memory> + #include <boost/asio/io_service.hpp> #include <boost/asio/ip/tcp.hpp> -#include <boost/enable_shared_from_this.hpp> #include <boost/thread/mutex.hpp> #include <Swiften/Base/API.h> @@ -29,13 +30,13 @@ namespace boost { namespace Swift { class EventLoop; - class SWIFTEN_API BoostConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<BoostConnection> { + class SWIFTEN_API BoostConnection : public Connection, public EventOwner, public std::enable_shared_from_this<BoostConnection> { public: - typedef boost::shared_ptr<BoostConnection> ref; + typedef std::shared_ptr<BoostConnection> ref; virtual ~BoostConnection(); - static ref create(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { + static ref create(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { return ref(new BoostConnection(ioService, eventLoop)); } @@ -55,10 +56,10 @@ namespace Swift { Certificate::ref getPeerCertificate() const; std::vector<Certificate::ref> getPeerCertificateChain() const; - boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; private: - BoostConnection(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); + BoostConnection(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); void handleConnectFinished(const boost::system::error_code& error); void handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred); @@ -69,9 +70,9 @@ namespace Swift { private: EventLoop* eventLoop; - boost::shared_ptr<boost::asio::io_service> ioService; + std::shared_ptr<boost::asio::io_service> ioService; boost::asio::ip::tcp::socket socket_; - boost::shared_ptr<SafeByteArray> readBuffer_; + std::shared_ptr<SafeByteArray> readBuffer_; boost::mutex writeMutex_; bool writing_; SafeByteArray writeQueue_; diff --git a/Swiften/Network/BoostConnectionFactory.cpp b/Swiften/Network/BoostConnectionFactory.cpp index d22f600..9ec30f5 100644 --- a/Swiften/Network/BoostConnectionFactory.cpp +++ b/Swiften/Network/BoostConnectionFactory.cpp @@ -10,10 +10,10 @@ namespace Swift { -BoostConnectionFactory::BoostConnectionFactory(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) { +BoostConnectionFactory::BoostConnectionFactory(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) { } -boost::shared_ptr<Connection> BoostConnectionFactory::createConnection() { +std::shared_ptr<Connection> BoostConnectionFactory::createConnection() { return BoostConnection::create(ioService, eventLoop); } diff --git a/Swiften/Network/BoostConnectionFactory.h b/Swiften/Network/BoostConnectionFactory.h index 46502de..a4e3b0d 100644 --- a/Swiften/Network/BoostConnectionFactory.h +++ b/Swiften/Network/BoostConnectionFactory.h @@ -17,12 +17,12 @@ namespace Swift { class SWIFTEN_API BoostConnectionFactory : public ConnectionFactory { public: - BoostConnectionFactory(boost::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); + BoostConnectionFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); - virtual boost::shared_ptr<Connection> createConnection(); + virtual std::shared_ptr<Connection> createConnection(); private: - boost::shared_ptr<boost::asio::io_service> ioService; + std::shared_ptr<boost::asio::io_service> ioService; EventLoop* eventLoop; }; } diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp index 99fe9b6..34b5799 100644 --- a/Swiften/Network/BoostConnectionServer.cpp +++ b/Swiften/Network/BoostConnectionServer.cpp @@ -19,10 +19,10 @@ namespace Swift { -BoostConnectionServer::BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) { +BoostConnectionServer::BoostConnectionServer(int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) { } -BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) { +BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) { } void BoostConnectionServer::start() { @@ -81,7 +81,7 @@ void BoostConnectionServer::acceptNextConnection() { boost::bind(&BoostConnectionServer::handleAccept, shared_from_this(), newConnection, boost::asio::placeholders::error)); } -void BoostConnectionServer::handleAccept(boost::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error) { +void BoostConnectionServer::handleAccept(std::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error) { if (error) { eventLoop->postEvent( boost::bind( diff --git a/Swiften/Network/BoostConnectionServer.h b/Swiften/Network/BoostConnectionServer.h index 8ee2a6d..b8a1c64 100644 --- a/Swiften/Network/BoostConnectionServer.h +++ b/Swiften/Network/BoostConnectionServer.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> + #include <boost/asio/io_service.hpp> #include <boost/asio/ip/tcp.hpp> -#include <boost/enable_shared_from_this.hpp> #include <boost/optional/optional_fwd.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -19,15 +19,15 @@ #include <Swiften/Network/ConnectionServer.h> namespace Swift { - class SWIFTEN_API BoostConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<BoostConnectionServer> { + class SWIFTEN_API BoostConnectionServer : public ConnectionServer, public EventOwner, public std::enable_shared_from_this<BoostConnectionServer> { public: - typedef boost::shared_ptr<BoostConnectionServer> ref; + typedef std::shared_ptr<BoostConnectionServer> ref; - static ref create(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { + static ref create(int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { return ref(new BoostConnectionServer(port, ioService, eventLoop)); } - static ref create(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { + static ref create(const HostAddress &address, int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) { return ref(new BoostConnectionServer(address, port, ioService, eventLoop)); } @@ -40,17 +40,17 @@ namespace Swift { boost::signal<void (boost::optional<Error>)> onStopped; private: - BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); - BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); + BoostConnectionServer(int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); + BoostConnectionServer(const HostAddress &address, int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); void stop(boost::optional<Error> e); void acceptNextConnection(); - void handleAccept(boost::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error); + void handleAccept(std::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error); private: HostAddress address_; int port_; - boost::shared_ptr<boost::asio::io_service> ioService_; + std::shared_ptr<boost::asio::io_service> ioService_; EventLoop* eventLoop; boost::asio::ip::tcp::acceptor* acceptor_; }; diff --git a/Swiften/Network/BoostConnectionServerFactory.cpp b/Swiften/Network/BoostConnectionServerFactory.cpp index 25afdb6..8b3fd2f 100644 --- a/Swiften/Network/BoostConnectionServerFactory.cpp +++ b/Swiften/Network/BoostConnectionServerFactory.cpp @@ -16,14 +16,14 @@ namespace Swift { -BoostConnectionServerFactory::BoostConnectionServerFactory(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) { +BoostConnectionServerFactory::BoostConnectionServerFactory(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) { } -boost::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(int port) { +std::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(int port) { return BoostConnectionServer::create(port, ioService, eventLoop); } -boost::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(const Swift::HostAddress &hostAddress, int port) { +std::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(const Swift::HostAddress &hostAddress, int port) { return BoostConnectionServer::create(hostAddress, port, ioService, eventLoop); } diff --git a/Swiften/Network/BoostConnectionServerFactory.h b/Swiften/Network/BoostConnectionServerFactory.h index 1e0daa3..033e63d 100644 --- a/Swiften/Network/BoostConnectionServerFactory.h +++ b/Swiften/Network/BoostConnectionServerFactory.h @@ -23,14 +23,14 @@ namespace Swift { class SWIFTEN_API BoostConnectionServerFactory : public ConnectionServerFactory { public: - BoostConnectionServerFactory(boost::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); + BoostConnectionServerFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port); + virtual std::shared_ptr<ConnectionServer> createConnectionServer(int port); - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress &hostAddress, int port); + virtual std::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress &hostAddress, int port); private: - boost::shared_ptr<boost::asio::io_service> ioService; + std::shared_ptr<boost::asio::io_service> ioService; EventLoop* eventLoop; }; } diff --git a/Swiften/Network/BoostIOServiceThread.cpp b/Swiften/Network/BoostIOServiceThread.cpp index 79112d8..0b0b7a4 100644 --- a/Swiften/Network/BoostIOServiceThread.cpp +++ b/Swiften/Network/BoostIOServiceThread.cpp @@ -6,17 +6,17 @@ #include <Swiften/Network/BoostIOServiceThread.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { -BoostIOServiceThread::BoostIOServiceThread(boost::shared_ptr<boost::asio::io_service> ioService) { +BoostIOServiceThread::BoostIOServiceThread(std::shared_ptr<boost::asio::io_service> ioService) { if (!!ioService) { ioService_ = ioService; thread_ = nullptr; } else { - ioService_ = boost::make_shared<boost::asio::io_service>(); + ioService_ = std::make_shared<boost::asio::io_service>(); thread_ = new boost::thread(boost::bind(&BoostIOServiceThread::doRun, this)); } } diff --git a/Swiften/Network/BoostIOServiceThread.h b/Swiften/Network/BoostIOServiceThread.h index 54f1840..18d5a5b 100644 --- a/Swiften/Network/BoostIOServiceThread.h +++ b/Swiften/Network/BoostIOServiceThread.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/asio/io_service.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include <Swiften/Base/API.h> @@ -23,10 +24,10 @@ namespace Swift { * you are re-using an io_service from elsewhere (particularly if you * are using the BoostASIOEventLoop). */ - BoostIOServiceThread(boost::shared_ptr<boost::asio::io_service> ioService = boost::shared_ptr<boost::asio::io_service>()); + BoostIOServiceThread(std::shared_ptr<boost::asio::io_service> ioService = std::shared_ptr<boost::asio::io_service>()); ~BoostIOServiceThread(); - boost::shared_ptr<boost::asio::io_service> getIOService() const { + std::shared_ptr<boost::asio::io_service> getIOService() const { return ioService_; } @@ -34,7 +35,7 @@ namespace Swift { void doRun(); private: - boost::shared_ptr<boost::asio::io_service> ioService_; + std::shared_ptr<boost::asio::io_service> ioService_; boost::thread* thread_; }; } diff --git a/Swiften/Network/BoostNetworkFactories.cpp b/Swiften/Network/BoostNetworkFactories.cpp index 40282f2..9fef73c 100644 --- a/Swiften/Network/BoostNetworkFactories.cpp +++ b/Swiften/Network/BoostNetworkFactories.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,7 +28,7 @@ namespace Swift { -BoostNetworkFactories::BoostNetworkFactories(EventLoop* eventLoop, boost::shared_ptr<boost::asio::io_service> ioService) : ioServiceThread(ioService), eventLoop(eventLoop) { +BoostNetworkFactories::BoostNetworkFactories(EventLoop* eventLoop, std::shared_ptr<boost::asio::io_service> ioService) : ioServiceThread(ioService), eventLoop(eventLoop) { timerFactory = new BoostTimerFactory(ioServiceThread.getIOService(), eventLoop); connectionFactory = new BoostConnectionFactory(ioServiceThread.getIOService(), eventLoop); connectionServerFactory = new BoostConnectionServerFactory(ioServiceThread.getIOService(), eventLoop); diff --git a/Swiften/Network/BoostNetworkFactories.h b/Swiften/Network/BoostNetworkFactories.h index ccacbf0..72afb04 100644 --- a/Swiften/Network/BoostNetworkFactories.h +++ b/Swiften/Network/BoostNetworkFactories.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ namespace Swift { * @param ioService If this optional parameter is provided, it will be * used for the construction of the BoostIOServiceThread. */ - BoostNetworkFactories(EventLoop* eventLoop, boost::shared_ptr<boost::asio::io_service> ioService = boost::shared_ptr<boost::asio::io_service>()); + BoostNetworkFactories(EventLoop* eventLoop, std::shared_ptr<boost::asio::io_service> ioService = std::shared_ptr<boost::asio::io_service>()); virtual ~BoostNetworkFactories(); virtual TimerFactory* getTimerFactory() const SWIFTEN_OVERRIDE { diff --git a/Swiften/Network/BoostTimer.cpp b/Swiften/Network/BoostTimer.cpp index 734a9c8..846192c 100644 --- a/Swiften/Network/BoostTimer.cpp +++ b/Swiften/Network/BoostTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,7 +14,7 @@ namespace Swift { -BoostTimer::BoostTimer(int milliseconds, boost::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) : +BoostTimer::BoostTimer(int milliseconds, std::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) : timeout(milliseconds), ioService(service), eventLoop(eventLoop), shuttingDown(false) { timer.reset(new boost::asio::deadline_timer(*service)); } diff --git a/Swiften/Network/BoostTimer.h b/Swiften/Network/BoostTimer.h index 79c71cd..c54b401 100644 --- a/Swiften/Network/BoostTimer.h +++ b/Swiften/Network/BoostTimer.h @@ -1,14 +1,15 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/asio/deadline_timer.hpp> #include <boost/asio/io_service.hpp> -#include <boost/enable_shared_from_this.hpp> #include <boost/scoped_ptr.hpp> #include <boost/thread/mutex.hpp> @@ -19,13 +20,13 @@ namespace Swift { class EventLoop; - class SWIFTEN_API BoostTimer : public Timer, public EventOwner, public boost::enable_shared_from_this<BoostTimer> { + class SWIFTEN_API BoostTimer : public Timer, public EventOwner, public std::enable_shared_from_this<BoostTimer> { public: - typedef boost::shared_ptr<BoostTimer> ref; + typedef std::shared_ptr<BoostTimer> ref; virtual ~BoostTimer(); - static ref create(int milliseconds, boost::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) { + static ref create(int milliseconds, std::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) { return ref(new BoostTimer(milliseconds, service, eventLoop)); } @@ -33,13 +34,13 @@ namespace Swift { virtual void stop(); private: - BoostTimer(int milliseconds, boost::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop); + BoostTimer(int milliseconds, std::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop); void handleTimerTick(const boost::system::error_code& error); private: int timeout; - boost::shared_ptr<boost::asio::io_service> ioService; + std::shared_ptr<boost::asio::io_service> ioService; boost::scoped_ptr<boost::asio::deadline_timer> timer; boost::mutex timerMutex; EventLoop* eventLoop; diff --git a/Swiften/Network/BoostTimerFactory.cpp b/Swiften/Network/BoostTimerFactory.cpp index 086eb60..ffa9b30 100644 --- a/Swiften/Network/BoostTimerFactory.cpp +++ b/Swiften/Network/BoostTimerFactory.cpp @@ -10,10 +10,10 @@ namespace Swift { -BoostTimerFactory::BoostTimerFactory(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) { +BoostTimerFactory::BoostTimerFactory(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) { } -boost::shared_ptr<Timer> BoostTimerFactory::createTimer(int milliseconds) { +std::shared_ptr<Timer> BoostTimerFactory::createTimer(int milliseconds) { return BoostTimer::create(milliseconds, ioService, eventLoop); } diff --git a/Swiften/Network/BoostTimerFactory.h b/Swiften/Network/BoostTimerFactory.h index 4fbabe9..ca9a833 100644 --- a/Swiften/Network/BoostTimerFactory.h +++ b/Swiften/Network/BoostTimerFactory.h @@ -18,12 +18,12 @@ namespace Swift { class SWIFTEN_API BoostTimerFactory : public TimerFactory { public: - BoostTimerFactory(boost::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); + BoostTimerFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop); - virtual boost::shared_ptr<Timer> createTimer(int milliseconds); + virtual std::shared_ptr<Timer> createTimer(int milliseconds); private: - boost::shared_ptr<boost::asio::io_service> ioService; + std::shared_ptr<boost::asio::io_service> ioService; EventLoop* eventLoop; }; } diff --git a/Swiften/Network/CachingDomainNameResolver.cpp b/Swiften/Network/CachingDomainNameResolver.cpp index d731eb9..8846e09 100644 --- a/Swiften/Network/CachingDomainNameResolver.cpp +++ b/Swiften/Network/CachingDomainNameResolver.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2012 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Network/CachingDomainNameResolver.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { diff --git a/Swiften/Network/CachingDomainNameResolver.h b/Swiften/Network/CachingDomainNameResolver.h index 25cb86c..9339a77 100644 --- a/Swiften/Network/CachingDomainNameResolver.h +++ b/Swiften/Network/CachingDomainNameResolver.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2012-2015 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Network/DomainNameResolver.h> diff --git a/Swiften/Network/ChainedConnector.cpp b/Swiften/Network/ChainedConnector.cpp index 08c4aac..fbea868 100644 --- a/Swiften/Network/ChainedConnector.cpp +++ b/Swiften/Network/ChainedConnector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -58,14 +58,14 @@ void ChainedConnector::stop() { currentConnector->stop(); currentConnector.reset(); } - finish(boost::shared_ptr<Connection>(), boost::shared_ptr<Error>()); + finish(std::shared_ptr<Connection>(), std::shared_ptr<Error>()); } void ChainedConnector::tryNextConnectionFactory() { assert(!currentConnector); if (connectionFactoryQueue.empty()) { SWIFT_LOG(debug) << "No more connection factories" << std::endl; - finish(boost::shared_ptr<Connection>(), lastError); + finish(std::shared_ptr<Connection>(), lastError); } else { ConnectionFactory* connectionFactory = connectionFactoryQueue.front(); @@ -78,7 +78,7 @@ void ChainedConnector::tryNextConnectionFactory() { } } -void ChainedConnector::handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) { +void ChainedConnector::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) { SWIFT_LOG(debug) << "Connector finished" << std::endl; currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2)); lastError = error; @@ -91,6 +91,6 @@ void ChainedConnector::handleConnectorFinished(boost::shared_ptr<Connection> con } } -void ChainedConnector::finish(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) { +void ChainedConnector::finish(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) { onConnectFinished(connection, error); } diff --git a/Swiften/Network/ChainedConnector.h b/Swiften/Network/ChainedConnector.h index 416dccb..bba9bfa 100644 --- a/Swiften/Network/ChainedConnector.h +++ b/Swiften/Network/ChainedConnector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,11 +7,11 @@ #pragma once #include <deque> +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> @@ -33,12 +33,12 @@ namespace Swift { void start(); void stop(); - boost::signal<void (boost::shared_ptr<Connection>, boost::shared_ptr<Error>)> onConnectFinished; + boost::signal<void (std::shared_ptr<Connection>, std::shared_ptr<Error>)> onConnectFinished; private: - void finish(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error>); + void finish(std::shared_ptr<Connection> connection, std::shared_ptr<Error>); void tryNextConnectionFactory(); - void handleConnectorFinished(boost::shared_ptr<Connection>, boost::shared_ptr<Error>); + void handleConnectorFinished(std::shared_ptr<Connection>, std::shared_ptr<Error>); private: std::string hostname; @@ -49,7 +49,7 @@ namespace Swift { TimerFactory* timerFactory; int timeoutMilliseconds; std::deque<ConnectionFactory*> connectionFactoryQueue; - boost::shared_ptr<Connector> currentConnector; - boost::shared_ptr<Error> lastError; + std::shared_ptr<Connector> currentConnector; + std::shared_ptr<Error> lastError; }; } diff --git a/Swiften/Network/Connection.h b/Swiften/Network/Connection.h index c38b98f..1ef5824 100644 --- a/Swiften/Network/Connection.h +++ b/Swiften/Network/Connection.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -17,7 +17,7 @@ namespace Swift { class SWIFTEN_API Connection { public: - typedef boost::shared_ptr<Connection> ref; + typedef std::shared_ptr<Connection> ref; enum Error { ReadError, @@ -38,7 +38,7 @@ namespace Swift { public: boost::signal<void (bool /* error */)> onConnectFinished; boost::signal<void (const boost::optional<Error>&)> onDisconnected; - boost::signal<void (boost::shared_ptr<SafeByteArray>)> onDataRead; + boost::signal<void (std::shared_ptr<SafeByteArray>)> onDataRead; boost::signal<void ()> onDataWritten; }; } diff --git a/Swiften/Network/ConnectionFactory.h b/Swiften/Network/ConnectionFactory.h index fd65908..e749fa3 100644 --- a/Swiften/Network/ConnectionFactory.h +++ b/Swiften/Network/ConnectionFactory.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> @@ -17,6 +17,6 @@ namespace Swift { public: virtual ~ConnectionFactory(); - virtual boost::shared_ptr<Connection> createConnection() = 0; + virtual std::shared_ptr<Connection> createConnection() = 0; }; } diff --git a/Swiften/Network/ConnectionServer.h b/Swiften/Network/ConnectionServer.h index a8c77eb..ae510e5 100644 --- a/Swiften/Network/ConnectionServer.h +++ b/Swiften/Network/ConnectionServer.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/optional/optional_fwd.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -32,6 +33,6 @@ namespace Swift { virtual void stop() = 0; - boost::signal<void (boost::shared_ptr<Connection>)> onNewConnection; + boost::signal<void (std::shared_ptr<Connection>)> onNewConnection; }; } diff --git a/Swiften/Network/ConnectionServerFactory.h b/Swiften/Network/ConnectionServerFactory.h index 7f988bf..413131e 100644 --- a/Swiften/Network/ConnectionServerFactory.h +++ b/Swiften/Network/ConnectionServerFactory.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> @@ -24,8 +24,8 @@ namespace Swift { public: virtual ~ConnectionServerFactory(); - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port) = 0; + virtual std::shared_ptr<ConnectionServer> createConnectionServer(int port) = 0; - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) = 0; + virtual std::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) = 0; }; } diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp index bd25e70..37cf35d 100644 --- a/Swiften/Network/Connector.cpp +++ b/Swiften/Network/Connector.cpp @@ -54,7 +54,7 @@ void Connector::stop() { currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1)); currentConnection->disconnect(); } - finish(boost::shared_ptr<Connection>()); + finish(std::shared_ptr<Connection>()); } void Connector::queryAddress(const std::string& hostname) { @@ -77,7 +77,7 @@ void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuer void Connector::tryNextServiceOrFallback() { if (queriedAllServices) { SWIFT_LOG(debug) << "Queried all services" << std::endl; - finish(boost::shared_ptr<Connection>()); + finish(std::shared_ptr<Connection>()); } else if (serviceQueryResults.empty()) { SWIFT_LOG(debug) << "Falling back on A resolution" << std::endl; @@ -165,7 +165,7 @@ void Connector::handleConnectionConnectFinished(bool error) { } } -void Connector::finish(boost::shared_ptr<Connection> connection) { +void Connector::finish(std::shared_ptr<Connection> connection) { if (timer) { timer->stop(); timer->onTick.disconnect(boost::bind(&Connector::handleTimeout, shared_from_this())); @@ -183,7 +183,7 @@ void Connector::finish(boost::shared_ptr<Connection> connection) { currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1)); currentConnection.reset(); } - onConnectFinished(connection, (connection || foundSomeDNS) ? boost::shared_ptr<Error>() : boost::make_shared<DomainNameResolveError>()); + onConnectFinished(connection, (connection || foundSomeDNS) ? std::shared_ptr<Error>() : std::make_shared<DomainNameResolveError>()); } void Connector::handleTimeout() { diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h index 52486b6..8114dd1 100644 --- a/Swiften/Network/Connector.h +++ b/Swiften/Network/Connector.h @@ -7,10 +7,10 @@ #pragma once #include <deque> +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -26,9 +26,9 @@ namespace Swift { class ConnectionFactory; class TimerFactory; - class SWIFTEN_API Connector : public boost::bsignals::trackable, public boost::enable_shared_from_this<Connector> { + class SWIFTEN_API Connector : public boost::bsignals::trackable, public std::enable_shared_from_this<Connector> { public: - typedef boost::shared_ptr<Connector> ref; + typedef std::shared_ptr<Connector> ref; static Connector::ref create(const std::string& hostname, int port, const boost::optional<std::string>& serviceLookupPrefix, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) { return ref(new Connector(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory)); @@ -43,7 +43,7 @@ namespace Swift { void start(); void stop(); - boost::signal<void (boost::shared_ptr<Connection>, boost::shared_ptr<Error>)> onConnectFinished; + boost::signal<void (std::shared_ptr<Connection>, std::shared_ptr<Error>)> onConnectFinished; private: Connector(const std::string& hostname, int port, const boost::optional<std::string>& serviceLookupPrefix, DomainNameResolver*, ConnectionFactory*, TimerFactory*); @@ -57,7 +57,7 @@ namespace Swift { void tryConnect(const HostAddressPort& target); void handleConnectionConnectFinished(bool error); - void finish(boost::shared_ptr<Connection>); + void finish(std::shared_ptr<Connection>); void handleTimeout(); @@ -69,13 +69,13 @@ namespace Swift { ConnectionFactory* connectionFactory; TimerFactory* timerFactory; int timeoutMilliseconds; - boost::shared_ptr<Timer> timer; - boost::shared_ptr<DomainNameServiceQuery> serviceQuery; + std::shared_ptr<Timer> timer; + std::shared_ptr<DomainNameServiceQuery> serviceQuery; std::deque<DomainNameServiceQuery::Result> serviceQueryResults; - boost::shared_ptr<DomainNameAddressQuery> addressQuery; + std::shared_ptr<DomainNameAddressQuery> addressQuery; std::deque<HostAddress> addressQueryResults; bool queriedAllServices; - boost::shared_ptr<Connection> currentConnection; + std::shared_ptr<Connection> currentConnection; bool foundSomeDNS; }; } diff --git a/Swiften/Network/DomainNameAddressQuery.h b/Swiften/Network/DomainNameAddressQuery.h index 10bcd5a..f6650c6 100644 --- a/Swiften/Network/DomainNameAddressQuery.h +++ b/Swiften/Network/DomainNameAddressQuery.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Network/DomainNameResolveError.h> @@ -16,7 +17,7 @@ namespace Swift { class DomainNameAddressQuery { public: - typedef boost::shared_ptr<DomainNameAddressQuery> ref; + typedef std::shared_ptr<DomainNameAddressQuery> ref; virtual ~DomainNameAddressQuery(); diff --git a/Swiften/Network/DomainNameResolver.h b/Swiften/Network/DomainNameResolver.h index 97997c9..5fe30d5 100644 --- a/Swiften/Network/DomainNameResolver.h +++ b/Swiften/Network/DomainNameResolver.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> namespace Swift { @@ -21,7 +20,7 @@ namespace Swift { public: virtual ~DomainNameResolver(); - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) = 0; - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name) = 0; + virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) = 0; + virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name) = 0; }; } diff --git a/Swiften/Network/DomainNameServiceQuery.h b/Swiften/Network/DomainNameServiceQuery.h index acbccf0..b8e0e7c 100644 --- a/Swiften/Network/DomainNameServiceQuery.h +++ b/Swiften/Network/DomainNameServiceQuery.h @@ -6,11 +6,11 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API DomainNameServiceQuery { public: - typedef boost::shared_ptr<DomainNameServiceQuery> ref; + typedef std::shared_ptr<DomainNameServiceQuery> ref; struct Result { Result(const std::string& hostname = "", int port = -1, int priority = -1, int weight = -1) : hostname(hostname), port(port), priority(priority), weight(weight) {} diff --git a/Swiften/Network/DummyConnection.cpp b/Swiften/Network/DummyConnection.cpp index a4e5419..3024b21 100644 --- a/Swiften/Network/DummyConnection.cpp +++ b/Swiften/Network/DummyConnection.cpp @@ -7,9 +7,9 @@ #include <Swiften/Network/DummyConnection.h> #include <cassert> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> namespace Swift { @@ -17,7 +17,7 @@ DummyConnection::DummyConnection(EventLoop* eventLoop) : eventLoop(eventLoop) { } void DummyConnection::receive(const SafeByteArray& data) { - eventLoop->postEvent(boost::bind(boost::ref(onDataRead), boost::make_shared<SafeByteArray>(data)), shared_from_this()); + eventLoop->postEvent(boost::bind(boost::ref(onDataRead), std::make_shared<SafeByteArray>(data)), shared_from_this()); } void DummyConnection::listen() { diff --git a/Swiften/Network/DummyConnection.h b/Swiften/Network/DummyConnection.h index fcfdb15..f7b9e29 100644 --- a/Swiften/Network/DummyConnection.h +++ b/Swiften/Network/DummyConnection.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/enable_shared_from_this.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/EventLoop/EventLoop.h> @@ -15,7 +15,7 @@ #include <Swiften/Network/HostAddressPort.h> namespace Swift { - class SWIFTEN_API DummyConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<DummyConnection> { + class SWIFTEN_API DummyConnection : public Connection, public EventOwner, public std::enable_shared_from_this<DummyConnection> { public: DummyConnection(EventLoop* eventLoop); diff --git a/Swiften/Network/DummyConnectionFactory.h b/Swiften/Network/DummyConnectionFactory.h index f861312..d723283 100644 --- a/Swiften/Network/DummyConnectionFactory.h +++ b/Swiften/Network/DummyConnectionFactory.h @@ -4,9 +4,15 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Network/ConnectionFactory.h> #include <Swiften/Network/DummyConnection.h> @@ -19,8 +25,8 @@ class DummyConnectionFactory : public ConnectionFactory { public: DummyConnectionFactory(EventLoop *eventLoop) : eventLoop(eventLoop) {} virtual ~DummyConnectionFactory() {} - virtual boost::shared_ptr<Connection> createConnection() { - return boost::make_shared<DummyConnection>(eventLoop); + virtual std::shared_ptr<Connection> createConnection() { + return std::make_shared<DummyConnection>(eventLoop); } private: EventLoop* eventLoop; diff --git a/Swiften/Network/DummyConnectionServer.h b/Swiften/Network/DummyConnectionServer.h index 0bf7386..970cbb7 100644 --- a/Swiften/Network/DummyConnectionServer.h +++ b/Swiften/Network/DummyConnectionServer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/EventLoop/EventLoop.h> @@ -15,7 +15,7 @@ #include <Swiften/Network/HostAddressPort.h> namespace Swift { - class SWIFTEN_API DummyConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<DummyConnectionServer> { + class SWIFTEN_API DummyConnectionServer : public ConnectionServer, public EventOwner, public std::enable_shared_from_this<DummyConnectionServer> { public: DummyConnectionServer(EventLoop* /*eventLoop*/, int port) : localAddressPort(HostAddress(), port) {} DummyConnectionServer(EventLoop* /*eventLoop*/, const Swift::HostAddress& hostAddress, int port) : localAddressPort(hostAddress, port) {} diff --git a/Swiften/Network/DummyConnectionServerFactory.h b/Swiften/Network/DummyConnectionServerFactory.h index 0952a38..822f95f 100644 --- a/Swiften/Network/DummyConnectionServerFactory.h +++ b/Swiften/Network/DummyConnectionServerFactory.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Network/ConnectionServerFactory.h> #include <Swiften/Network/DummyConnectionServer.h> @@ -20,12 +20,12 @@ public: DummyConnectionServerFactory(EventLoop* eventLoop) : eventLoop(eventLoop) {} virtual ~DummyConnectionServerFactory() {} - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port) { - return boost::make_shared<DummyConnectionServer>(eventLoop, port); + virtual std::shared_ptr<ConnectionServer> createConnectionServer(int port) { + return std::make_shared<DummyConnectionServer>(eventLoop, port); } - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) { - return boost::make_shared<DummyConnectionServer>(eventLoop, hostAddress, port); + virtual std::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) { + return std::make_shared<DummyConnectionServer>(eventLoop, hostAddress, port); } private: diff --git a/Swiften/Network/DummyTimerFactory.cpp b/Swiften/Network/DummyTimerFactory.cpp index cae5c84..cdc776c 100644 --- a/Swiften/Network/DummyTimerFactory.cpp +++ b/Swiften/Network/DummyTimerFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -41,15 +41,15 @@ class DummyTimerFactory::DummyTimer : public Timer { DummyTimerFactory::DummyTimerFactory() : currentTime(0) { } -boost::shared_ptr<Timer> DummyTimerFactory::createTimer(int milliseconds) { - boost::shared_ptr<DummyTimer> timer(new DummyTimer(milliseconds, this)); +std::shared_ptr<Timer> DummyTimerFactory::createTimer(int milliseconds) { + std::shared_ptr<DummyTimer> timer(new DummyTimer(milliseconds, this)); timers.push_back(timer); return timer; } void DummyTimerFactory::setTime(int time) { assert(time > currentTime); - foreach(boost::shared_ptr<DummyTimer> timer, timers) { + foreach(std::shared_ptr<DummyTimer> timer, timers) { if (timer->getAlarmTime() > currentTime && timer->getAlarmTime() <= time && timer->isRunning) { timer->onTick(); } diff --git a/Swiften/Network/DummyTimerFactory.h b/Swiften/Network/DummyTimerFactory.h index bb2f813..5ccbf93 100644 --- a/Swiften/Network/DummyTimerFactory.h +++ b/Swiften/Network/DummyTimerFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,12 +18,12 @@ namespace Swift { DummyTimerFactory(); - virtual boost::shared_ptr<Timer> createTimer(int milliseconds); + virtual std::shared_ptr<Timer> createTimer(int milliseconds); void setTime(int time); private: friend class DummyTimer; int currentTime; - std::list<boost::shared_ptr<DummyTimer> > timers; + std::list<std::shared_ptr<DummyTimer> > timers; }; } diff --git a/Swiften/Network/FakeConnection.h b/Swiften/Network/FakeConnection.h index c7d1f27..08c1d75 100644 --- a/Swiften/Network/FakeConnection.h +++ b/Swiften/Network/FakeConnection.h @@ -1,14 +1,14 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <vector> -#include <boost/enable_shared_from_this.hpp> #include <boost/optional.hpp> #include <Swiften/Base/API.h> @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API FakeConnection : public Connection, public EventOwner, - public boost::enable_shared_from_this<FakeConnection> { + public std::enable_shared_from_this<FakeConnection> { public: enum State { Initial, diff --git a/Swiften/Network/HTTPConnectProxiedConnection.cpp b/Swiften/Network/HTTPConnectProxiedConnection.cpp index 991e815..b9ab604 100644 --- a/Swiften/Network/HTTPConnectProxiedConnection.cpp +++ b/Swiften/Network/HTTPConnectProxiedConnection.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -49,7 +49,7 @@ HTTPConnectProxiedConnection::~HTTPConnectProxiedConnection() { } -void HTTPConnectProxiedConnection::setHTTPTrafficFilter(boost::shared_ptr<HTTPTrafficFilter> trafficFilter) { +void HTTPConnectProxiedConnection::setHTTPTrafficFilter(std::shared_ptr<HTTPTrafficFilter> trafficFilter) { trafficFilter_ = trafficFilter; } @@ -112,7 +112,7 @@ void HTTPConnectProxiedConnection::sendHTTPRequest(const std::string& statusLine write(createSafeByteArray(request.str())); } -void HTTPConnectProxiedConnection::handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data) { +void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) { std::string dataString = byteArrayToString(ByteArray(data->begin(), data->end())); SWIFT_LOG(debug) << data << std::endl; httpResponseBuffer_.append(dataString); diff --git a/Swiften/Network/HTTPConnectProxiedConnection.h b/Swiften/Network/HTTPConnectProxiedConnection.h index adb8d08..21b3960 100644 --- a/Swiften/Network/HTTPConnectProxiedConnection.h +++ b/Swiften/Network/HTTPConnectProxiedConnection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,7 +13,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Network/ProxiedConnection.h> @@ -27,7 +27,7 @@ namespace Swift { class SWIFTEN_API HTTPConnectProxiedConnection : public ProxiedConnection { public: - typedef boost::shared_ptr<HTTPConnectProxiedConnection> ref; + typedef std::shared_ptr<HTTPConnectProxiedConnection> ref; virtual ~HTTPConnectProxiedConnection(); @@ -35,13 +35,13 @@ namespace Swift { return ref(new HTTPConnectProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, authID, authPassword)); } - void setHTTPTrafficFilter(boost::shared_ptr<HTTPTrafficFilter> trafficFilter); + void setHTTPTrafficFilter(std::shared_ptr<HTTPTrafficFilter> trafficFilter); private: HTTPConnectProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword); virtual void initializeProxy(); - virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data); + virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data); void sendHTTPRequest(const std::string& statusLine, const std::vector<std::pair<std::string, std::string> >& headerFields); void parseHTTPHeader(const std::string& data, std::string& statusLine, std::vector<std::pair<std::string, std::string> >& headerFields); @@ -49,7 +49,7 @@ namespace Swift { private: SafeByteArray authID_; SafeByteArray authPassword_; - boost::shared_ptr<HTTPTrafficFilter> trafficFilter_; + std::shared_ptr<HTTPTrafficFilter> trafficFilter_; std::string httpResponseBuffer_; std::vector<std::pair<std::string, std::string> > nextHTTPRequestHeaders_; }; diff --git a/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp b/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp index 735791f..91ace3d 100644 --- a/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp +++ b/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,14 +16,14 @@ namespace Swift { -HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(""), authPassword_(""), httpTrafficFilter_(httpTrafficFilter) { +HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(""), authPassword_(""), httpTrafficFilter_(httpTrafficFilter) { } -HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(authID), authPassword_(authPassword), httpTrafficFilter_(httpTrafficFilter) { +HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(authID), authPassword_(authPassword), httpTrafficFilter_(httpTrafficFilter) { } -boost::shared_ptr<Connection> HTTPConnectProxiedConnectionFactory::createConnection() { +std::shared_ptr<Connection> HTTPConnectProxiedConnectionFactory::createConnection() { HTTPConnectProxiedConnection::ref proxyConnection = HTTPConnectProxiedConnection::create(resolver_, connectionFactory_, timerFactory_, proxyHost_, proxyPort_, authID_, authPassword_); proxyConnection->setHTTPTrafficFilter(httpTrafficFilter_); return proxyConnection; diff --git a/Swiften/Network/HTTPConnectProxiedConnectionFactory.h b/Swiften/Network/HTTPConnectProxiedConnectionFactory.h index 455fba0..74d6279 100644 --- a/Swiften/Network/HTTPConnectProxiedConnectionFactory.h +++ b/Swiften/Network/HTTPConnectProxiedConnectionFactory.h @@ -25,10 +25,10 @@ namespace Swift { class SWIFTEN_API HTTPConnectProxiedConnectionFactory : public ConnectionFactory { public: - HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = boost::shared_ptr<HTTPTrafficFilter>()); - HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = boost::shared_ptr<HTTPTrafficFilter>()); + HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = std::shared_ptr<HTTPTrafficFilter>()); + HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = std::shared_ptr<HTTPTrafficFilter>()); - virtual boost::shared_ptr<Connection> createConnection(); + virtual std::shared_ptr<Connection> createConnection(); private: DomainNameResolver* resolver_; @@ -38,6 +38,6 @@ namespace Swift { int proxyPort_; SafeString authID_; SafeString authPassword_; - boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter_; + std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter_; }; } diff --git a/Swiften/Network/MiniUPnPInterface.cpp b/Swiften/Network/MiniUPnPInterface.cpp index b298fc6..b2afd88 100644 --- a/Swiften/Network/MiniUPnPInterface.cpp +++ b/Swiften/Network/MiniUPnPInterface.cpp @@ -12,8 +12,9 @@ #include <Swiften/Network/MiniUPnPInterface.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <miniupnpc.h> #include <upnpcommands.h> @@ -31,7 +32,7 @@ struct MiniUPnPInterface::Private { IGDdatas data; }; -MiniUPnPInterface::MiniUPnPInterface() : p(boost::make_shared<Private>()) { +MiniUPnPInterface::MiniUPnPInterface() : p(std::make_shared<Private>()) { p->isValid = false; int error = 0; p->deviceList = upnpDiscover(1500 /* timeout in ms */, nullptr, nullptr, 0, 0 /* do IPv6? */, &error); diff --git a/Swiften/Network/MiniUPnPInterface.h b/Swiften/Network/MiniUPnPInterface.h index 5253e71..ea956d9 100644 --- a/Swiften/Network/MiniUPnPInterface.h +++ b/Swiften/Network/MiniUPnPInterface.h @@ -6,9 +6,10 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Network/NATPortMapping.h> #include <Swiften/Network/NATTraversalInterface.h> @@ -27,6 +28,6 @@ namespace Swift { private: struct Private; - boost::shared_ptr<Private> p; + std::shared_ptr<Private> p; }; } diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp index 3782f75..c811212 100644 --- a/Swiften/Network/NATPMPInterface.cpp +++ b/Swiften/Network/NATPMPInterface.cpp @@ -12,8 +12,9 @@ #include <Swiften/Network/NATPMPInterface.h> +#include <memory> + #include <boost/numeric/conversion/cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> @@ -29,7 +30,7 @@ struct NATPMPInterface::Private { natpmp_t natpmp; }; -NATPMPInterface::NATPMPInterface() : p(boost::make_shared<Private>()) { +NATPMPInterface::NATPMPInterface() : p(std::make_shared<Private>()) { initnatpmp(&p->natpmp, 0, 0); } diff --git a/Swiften/Network/NATPMPInterface.h b/Swiften/Network/NATPMPInterface.h index a4bb816..80f619c 100644 --- a/Swiften/Network/NATPMPInterface.h +++ b/Swiften/Network/NATPMPInterface.h @@ -6,9 +6,10 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Network/NATPortMapping.h> #include <Swiften/Network/NATTraversalInterface.h> @@ -27,6 +28,6 @@ namespace Swift { private: struct Private; - boost::shared_ptr<Private> p; + std::shared_ptr<Private> p; }; } diff --git a/Swiften/Network/NATTraverser.h b/Swiften/Network/NATTraverser.h index 0ff6bb3..716bfcb 100644 --- a/Swiften/Network/NATTraverser.h +++ b/Swiften/Network/NATTraverser.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> @@ -19,8 +19,8 @@ namespace Swift { public: virtual ~NATTraverser(); - virtual boost::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest() = 0; - virtual boost::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort) = 0; - virtual boost::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort) = 0; + virtual std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest() = 0; + virtual std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort) = 0; + virtual std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort) = 0; }; } diff --git a/Swiften/Network/NullNATTraverser.cpp b/Swiften/Network/NullNATTraverser.cpp index c4e121b..cc8bae0 100644 --- a/Swiften/Network/NullNATTraverser.cpp +++ b/Swiften/Network/NullNATTraverser.cpp @@ -6,8 +6,9 @@ #include <Swiften/Network/NullNATTraverser.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/EventLoop/EventLoop.h> #include <Swiften/Network/NATTraversalForwardPortRequest.h> @@ -67,16 +68,16 @@ class NullNATTraversalRemovePortForwardingRequest : public NATTraversalRemovePor NullNATTraverser::NullNATTraverser(EventLoop* eventLoop) : eventLoop(eventLoop) { } -boost::shared_ptr<NATTraversalGetPublicIPRequest> NullNATTraverser::createGetPublicIPRequest() { - return boost::make_shared<NullNATTraversalGetPublicIPRequest>(eventLoop); +std::shared_ptr<NATTraversalGetPublicIPRequest> NullNATTraverser::createGetPublicIPRequest() { + return std::make_shared<NullNATTraversalGetPublicIPRequest>(eventLoop); } -boost::shared_ptr<NATTraversalForwardPortRequest> NullNATTraverser::createForwardPortRequest(int, int) { - return boost::make_shared<NullNATTraversalForwardPortRequest>(eventLoop); +std::shared_ptr<NATTraversalForwardPortRequest> NullNATTraverser::createForwardPortRequest(int, int) { + return std::make_shared<NullNATTraversalForwardPortRequest>(eventLoop); } -boost::shared_ptr<NATTraversalRemovePortForwardingRequest> NullNATTraverser::createRemovePortForwardingRequest(int, int) { - return boost::make_shared<NullNATTraversalRemovePortForwardingRequest>(eventLoop); +std::shared_ptr<NATTraversalRemovePortForwardingRequest> NullNATTraverser::createRemovePortForwardingRequest(int, int) { + return std::make_shared<NullNATTraversalRemovePortForwardingRequest>(eventLoop); } } diff --git a/Swiften/Network/NullNATTraverser.h b/Swiften/Network/NullNATTraverser.h index 3492940..d3a6640 100644 --- a/Swiften/Network/NullNATTraverser.h +++ b/Swiften/Network/NullNATTraverser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,9 +15,9 @@ namespace Swift { public: NullNATTraverser(EventLoop* eventLoop); - boost::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest(); - boost::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort); - boost::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort); + std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest(); + std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort); + std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort); private: EventLoop* eventLoop; diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.h b/Swiften/Network/PlatformDomainNameAddressQuery.h index a5cfda7..6cb3e0a 100644 --- a/Swiften/Network/PlatformDomainNameAddressQuery.h +++ b/Swiften/Network/PlatformDomainNameAddressQuery.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> #include <boost/asio/io_service.hpp> -#include <boost/enable_shared_from_this.hpp> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Network/DomainNameAddressQuery.h> @@ -19,7 +19,7 @@ namespace Swift { class PlatformDomainNameResolver; class EventLoop; - class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner { + class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public std::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner { public: PlatformDomainNameAddressQuery(const boost::optional<std::string>& host, EventLoop* eventLoop, PlatformDomainNameResolver*); virtual ~PlatformDomainNameAddressQuery(); diff --git a/Swiften/Network/PlatformDomainNameQuery.h b/Swiften/Network/PlatformDomainNameQuery.h index 3c5e152..a279f20 100644 --- a/Swiften/Network/PlatformDomainNameQuery.h +++ b/Swiften/Network/PlatformDomainNameQuery.h @@ -1,19 +1,19 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> namespace Swift { class PlatformDomainNameResolver; class PlatformDomainNameQuery { public: - typedef boost::shared_ptr<PlatformDomainNameQuery> ref; + typedef std::shared_ptr<PlatformDomainNameQuery> ref; PlatformDomainNameQuery(PlatformDomainNameResolver* resolver) : resolver(resolver) {} virtual ~PlatformDomainNameQuery() {} diff --git a/Swiften/Network/PlatformDomainNameResolver.cpp b/Swiften/Network/PlatformDomainNameResolver.cpp index ed08057..ecb5247 100644 --- a/Swiften/Network/PlatformDomainNameResolver.cpp +++ b/Swiften/Network/PlatformDomainNameResolver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,22 +33,22 @@ PlatformDomainNameResolver::PlatformDomainNameResolver(IDNConverter* idnConverte PlatformDomainNameResolver::~PlatformDomainNameResolver() { stopRequested = true; - addQueryToQueue(boost::shared_ptr<PlatformDomainNameQuery>()); + addQueryToQueue(std::shared_ptr<PlatformDomainNameQuery>()); thread->join(); delete thread; } -boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { +std::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { boost::optional<std::string> encodedDomain = idnConverter->getIDNAEncoded(domain); std::string result; if (encodedDomain) { result = serviceLookupPrefix + *encodedDomain; } - return boost::shared_ptr<DomainNameServiceQuery>(new PlatformDomainNameServiceQuery(result, eventLoop, this)); + return std::make_shared<PlatformDomainNameServiceQuery>(result, eventLoop, this); } -boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const std::string& name) { - return boost::shared_ptr<DomainNameAddressQuery>(new PlatformDomainNameAddressQuery(idnConverter->getIDNAEncoded(name), eventLoop, this)); +std::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const std::string& name) { + return std::make_shared<PlatformDomainNameAddressQuery>(idnConverter->getIDNAEncoded(name), eventLoop, this); } void PlatformDomainNameResolver::run() { diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.h b/Swiften/Network/PlatformDomainNameServiceQuery.h index e415005..0d690f3 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.h +++ b/Swiften/Network/PlatformDomainNameServiceQuery.h @@ -1,15 +1,14 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> -#include <boost/enable_shared_from_this.hpp> - #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Network/DomainNameServiceQuery.h> #include <Swiften/Network/PlatformDomainNameQuery.h> @@ -17,7 +16,7 @@ namespace Swift { class EventLoop; - class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner { + class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public std::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner { public: PlatformDomainNameServiceQuery(const boost::optional<std::string>& serviceName, EventLoop* eventLoop, PlatformDomainNameResolver* resolver); virtual ~PlatformDomainNameServiceQuery(); diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp index cb5758e..9b5ec2b 100644 --- a/Swiften/Network/PlatformNATTraversalWorker.cpp +++ b/Swiften/Network/PlatformNATTraversalWorker.cpp @@ -12,8 +12,8 @@ #include "PlatformNATTraversalWorker.h" -#include <boost/smart_ptr/make_shared.hpp> -#include <boost/enable_shared_from_this.hpp> +#include <memory> +#include <memory> #include <boost/numeric/conversion/cast.hpp> #include <Swiften/Base/Log.h> @@ -31,9 +31,9 @@ namespace Swift { -class PlatformNATTraversalRequest : public boost::enable_shared_from_this<PlatformNATTraversalRequest>, public EventOwner { +class PlatformNATTraversalRequest : public std::enable_shared_from_this<PlatformNATTraversalRequest>, public EventOwner { public: - typedef boost::shared_ptr<PlatformNATTraversalRequest> ref; + typedef std::shared_ptr<PlatformNATTraversalRequest> ref; public: PlatformNATTraversalRequest(PlatformNATTraversalWorker* worker) : worker(worker) { @@ -139,7 +139,7 @@ PlatformNATTraversalWorker::PlatformNATTraversalWorker(EventLoop* eventLoop) : e PlatformNATTraversalWorker::~PlatformNATTraversalWorker() { stopRequested = true; - addRequestToQueue(boost::shared_ptr<PlatformNATTraversalRequest>()); + addRequestToQueue(std::shared_ptr<PlatformNATTraversalRequest>()); thread->join(); delete thread; #ifdef HAVE_LIBNATPMP @@ -177,17 +177,17 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co return nullNATTraversalInterface; } -boost::shared_ptr<NATTraversalGetPublicIPRequest> PlatformNATTraversalWorker::createGetPublicIPRequest() { - return boost::make_shared<PlatformNATTraversalGetPublicIPRequest>(this); +std::shared_ptr<NATTraversalGetPublicIPRequest> PlatformNATTraversalWorker::createGetPublicIPRequest() { + return std::make_shared<PlatformNATTraversalGetPublicIPRequest>(this); } -boost::shared_ptr<NATTraversalForwardPortRequest> PlatformNATTraversalWorker::createForwardPortRequest(int localPort, int publicPort) { - return boost::make_shared<PlatformNATTraversalForwardPortRequest>(this, localPort, publicPort); +std::shared_ptr<NATTraversalForwardPortRequest> PlatformNATTraversalWorker::createForwardPortRequest(int localPort, int publicPort) { + return std::make_shared<PlatformNATTraversalForwardPortRequest>(this, localPort, publicPort); } -boost::shared_ptr<NATTraversalRemovePortForwardingRequest> PlatformNATTraversalWorker::createRemovePortForwardingRequest(int localPort, int publicPort) { +std::shared_ptr<NATTraversalRemovePortForwardingRequest> PlatformNATTraversalWorker::createRemovePortForwardingRequest(int localPort, int publicPort) { NATPortMapping mapping(localPort, publicPort, NATPortMapping::TCP); // FIXME - return boost::make_shared<PlatformNATTraversalRemovePortForwardingRequest>(this, mapping); + return std::make_shared<PlatformNATTraversalRemovePortForwardingRequest>(this, mapping); } void PlatformNATTraversalWorker::start() { diff --git a/Swiften/Network/PlatformNATTraversalWorker.h b/Swiften/Network/PlatformNATTraversalWorker.h index 280a537..35f4ea6 100644 --- a/Swiften/Network/PlatformNATTraversalWorker.h +++ b/Swiften/Network/PlatformNATTraversalWorker.h @@ -44,13 +44,13 @@ namespace Swift { PlatformNATTraversalWorker(EventLoop* eventLoop); virtual ~PlatformNATTraversalWorker(); - boost::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest(); - boost::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort); - boost::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort); + std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest(); + std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort); + std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort); private: NATTraversalInterface* getNATTraversalInterface() const; - void addRequestToQueue(boost::shared_ptr<PlatformNATTraversalRequest>); + void addRequestToQueue(std::shared_ptr<PlatformNATTraversalRequest>); void start(); void stop(); @@ -62,7 +62,7 @@ namespace Swift { EventLoop* eventLoop; Atomic<bool> stopRequested; boost::thread* thread; - std::deque<boost::shared_ptr<PlatformNATTraversalRequest> > queue; + std::deque<std::shared_ptr<PlatformNATTraversalRequest> > queue; boost::mutex queueMutex; boost::condition_variable queueNonEmpty; diff --git a/Swiften/Network/ProxiedConnection.cpp b/Swiften/Network/ProxiedConnection.cpp index 27f5cd9..16bab0d 100644 --- a/Swiften/Network/ProxiedConnection.cpp +++ b/Swiften/Network/ProxiedConnection.cpp @@ -92,7 +92,7 @@ void ProxiedConnection::handleConnectFinished(Connection::ref connection) { } } -void ProxiedConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) { +void ProxiedConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) { if (!connected_) { handleProxyInitializeData(data); } diff --git a/Swiften/Network/ProxiedConnection.h b/Swiften/Network/ProxiedConnection.h index 80f748c..38194aa 100644 --- a/Swiften/Network/ProxiedConnection.h +++ b/Swiften/Network/ProxiedConnection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,7 +7,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeString.h> @@ -25,7 +25,7 @@ namespace boost { namespace Swift { class ConnectionFactory; - class SWIFTEN_API ProxiedConnection : public Connection, public boost::enable_shared_from_this<ProxiedConnection> { + class SWIFTEN_API ProxiedConnection : public Connection, public std::enable_shared_from_this<ProxiedConnection> { public: ProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort); virtual ~ProxiedConnection(); @@ -40,7 +40,7 @@ namespace Swift { private: void handleConnectFinished(Connection::ref connection); - void handleDataRead(boost::shared_ptr<SafeByteArray> data); + void handleDataRead(std::shared_ptr<SafeByteArray> data); void handleDisconnected(const boost::optional<Error>& error); void cancelConnector(); @@ -48,7 +48,7 @@ namespace Swift { void setProxyInitializeFinished(bool success); virtual void initializeProxy() = 0; - virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data) = 0; + virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) = 0; const HostAddressPort& getServer() const { return server_; @@ -65,7 +65,7 @@ namespace Swift { int proxyPort_; HostAddressPort server_; Connector::ref connector_; - boost::shared_ptr<Connection> connection_; + std::shared_ptr<Connection> connection_; }; } diff --git a/Swiften/Network/SOCKS5ProxiedConnection.cpp b/Swiften/Network/SOCKS5ProxiedConnection.cpp index 2b7a3f3..67ef4ad 100644 --- a/Swiften/Network/SOCKS5ProxiedConnection.cpp +++ b/Swiften/Network/SOCKS5ProxiedConnection.cpp @@ -47,7 +47,7 @@ void SOCKS5ProxiedConnection::initializeProxy() { write(socksConnect); } -void SOCKS5ProxiedConnection::handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data) { +void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) { SafeByteArray socksConnect; boost::asio::ip::address rawAddress = getServer().getAddress().getRawAddress(); assert(rawAddress.is_v4() || rawAddress.is_v6()); diff --git a/Swiften/Network/SOCKS5ProxiedConnection.h b/Swiften/Network/SOCKS5ProxiedConnection.h index edbc56c..c8faae9 100644 --- a/Swiften/Network/SOCKS5ProxiedConnection.h +++ b/Swiften/Network/SOCKS5ProxiedConnection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ namespace Swift { class SWIFTEN_API SOCKS5ProxiedConnection : public ProxiedConnection { public: - typedef boost::shared_ptr<SOCKS5ProxiedConnection> ref; + typedef std::shared_ptr<SOCKS5ProxiedConnection> ref; static ref create(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort) { return ref(new SOCKS5ProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort)); @@ -32,7 +32,7 @@ namespace Swift { SOCKS5ProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort); virtual void initializeProxy(); - virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data); + virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data); private: enum { diff --git a/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp b/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp index 3e24f00..01ce8ac 100644 --- a/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp +++ b/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <Swiften/Network/SOCKS5ProxiedConnectionFactory.h> #include <Swiften/Network/SOCKS5ProxiedConnection.h> @@ -13,7 +19,7 @@ namespace Swift { SOCKS5ProxiedConnectionFactory::SOCKS5ProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort) { } -boost::shared_ptr<Connection> SOCKS5ProxiedConnectionFactory::createConnection() { +std::shared_ptr<Connection> SOCKS5ProxiedConnectionFactory::createConnection() { return SOCKS5ProxiedConnection::create(resolver_, connectionFactory_, timerFactory_, proxyHost_, proxyPort_); } diff --git a/Swiften/Network/SOCKS5ProxiedConnectionFactory.h b/Swiften/Network/SOCKS5ProxiedConnectionFactory.h index 1092381..8631239 100644 --- a/Swiften/Network/SOCKS5ProxiedConnectionFactory.h +++ b/Swiften/Network/SOCKS5ProxiedConnectionFactory.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,7 +25,7 @@ namespace Swift { public: SOCKS5ProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort); - virtual boost::shared_ptr<Connection> createConnection(); + virtual std::shared_ptr<Connection> createConnection(); private: DomainNameResolver* resolver_; diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp index 45e6c5f..3601bf2 100644 --- a/Swiften/Network/StaticDomainNameResolver.cpp +++ b/Swiften/Network/StaticDomainNameResolver.cpp @@ -17,8 +17,8 @@ using namespace Swift; namespace { - struct ServiceQuery : public DomainNameServiceQuery, public boost::enable_shared_from_this<ServiceQuery> { - ServiceQuery(const std::string& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop, boost::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), service(service), resolver(resolver), owner(owner) {} + struct ServiceQuery : public DomainNameServiceQuery, public std::enable_shared_from_this<ServiceQuery> { + ServiceQuery(const std::string& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop, std::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), service(service), resolver(resolver), owner(owner) {} virtual void run() { if (!resolver->getIsResponsive()) { @@ -40,11 +40,11 @@ namespace { EventLoop* eventLoop; std::string service; StaticDomainNameResolver* resolver; - boost::shared_ptr<EventOwner> owner; + std::shared_ptr<EventOwner> owner; }; - struct AddressQuery : public DomainNameAddressQuery, public boost::enable_shared_from_this<AddressQuery> { - AddressQuery(const std::string& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop, boost::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), host(host), resolver(resolver), owner(owner) {} + struct AddressQuery : public DomainNameAddressQuery, public std::enable_shared_from_this<AddressQuery> { + AddressQuery(const std::string& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop, std::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), host(host), resolver(resolver), owner(owner) {} virtual void run() { if (!resolver->getIsResponsive()) { @@ -67,7 +67,7 @@ namespace { EventLoop* eventLoop; std::string host; StaticDomainNameResolver* resolver; - boost::shared_ptr<EventOwner> owner; + std::shared_ptr<EventOwner> owner; }; } @@ -109,12 +109,12 @@ void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, c addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, port, 0, 0)); } -boost::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { - return boost::shared_ptr<DomainNameServiceQuery>(new ServiceQuery(serviceLookupPrefix + domain, this, eventLoop, owner)); +std::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { + return std::make_shared<ServiceQuery>(serviceLookupPrefix + domain, this, eventLoop, owner); } -boost::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const std::string& name) { - return boost::shared_ptr<DomainNameAddressQuery>(new AddressQuery(name, this, eventLoop, owner)); +std::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const std::string& name) { + return std::make_shared<AddressQuery>(name, this, eventLoop, owner); } } diff --git a/Swiften/Network/StaticDomainNameResolver.h b/Swiften/Network/StaticDomainNameResolver.h index 6d38a26..76394d0 100644 --- a/Swiften/Network/StaticDomainNameResolver.h +++ b/Swiften/Network/StaticDomainNameResolver.h @@ -7,6 +7,7 @@ #pragma once #include <map> +#include <memory> #include <vector> #include <Swiften/Base/API.h> @@ -48,13 +49,13 @@ namespace Swift { isResponsive = b; } - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain); - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); + virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain); + virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); private: EventLoop* eventLoop; bool isResponsive; AddressesMap addresses; ServicesCollection services; - boost::shared_ptr<EventOwner> owner; + std::shared_ptr<EventOwner> owner; }; } diff --git a/Swiften/Network/TLSConnection.cpp b/Swiften/Network/TLSConnection.cpp index 4099de7..7c293d1 100644 --- a/Swiften/Network/TLSConnection.cpp +++ b/Swiften/Network/TLSConnection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -47,7 +47,7 @@ void TLSConnection::handleTLSDataForNetwork(const SafeByteArray& data) { } void TLSConnection::handleTLSDataForApplication(const SafeByteArray& data) { - onDataRead(boost::make_shared<SafeByteArray>(data)); + onDataRead(std::make_shared<SafeByteArray>(data)); } void TLSConnection::connect(const HostAddressPort& address) { @@ -88,7 +88,7 @@ void TLSConnection::handleRawDisconnected(const boost::optional<Error>& error) { onDisconnected(error); } -void TLSConnection::handleRawDataRead(boost::shared_ptr<SafeByteArray> data) { +void TLSConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) { context->handleDataFromNetwork(*data); } diff --git a/Swiften/Network/TLSConnection.h b/Swiften/Network/TLSConnection.h index 41543a2..fdcdb6d 100644 --- a/Swiften/Network/TLSConnection.h +++ b/Swiften/Network/TLSConnection.h @@ -1,13 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -39,7 +38,7 @@ namespace Swift { private: void handleRawConnectFinished(bool error); void handleRawDisconnected(const boost::optional<Error>& error); - void handleRawDataRead(boost::shared_ptr<SafeByteArray> data); + void handleRawDataRead(std::shared_ptr<SafeByteArray> data); void handleRawDataWritten(); void handleTLSConnectFinished(bool error); void handleTLSDataForNetwork(const SafeByteArray& data); diff --git a/Swiften/Network/TLSConnectionFactory.cpp b/Swiften/Network/TLSConnectionFactory.cpp index e0396e2..b311c7d 100644 --- a/Swiften/Network/TLSConnectionFactory.cpp +++ b/Swiften/Network/TLSConnectionFactory.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Network/TLSConnectionFactory.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Network/TLSConnection.h> @@ -21,8 +21,8 @@ TLSConnectionFactory::~TLSConnectionFactory() { } -boost::shared_ptr<Connection> TLSConnectionFactory::createConnection() { - return boost::make_shared<TLSConnection>(connectionFactory->createConnection(), contextFactory, options_); +std::shared_ptr<Connection> TLSConnectionFactory::createConnection() { + return std::make_shared<TLSConnection>(connectionFactory->createConnection(), contextFactory, options_); } } diff --git a/Swiften/Network/TLSConnectionFactory.h b/Swiften/Network/TLSConnectionFactory.h index 8e39c35..148e345 100644 --- a/Swiften/Network/TLSConnectionFactory.h +++ b/Swiften/Network/TLSConnectionFactory.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Network/ConnectionFactory.h> @@ -21,7 +21,7 @@ namespace Swift { TLSConnectionFactory(TLSContextFactory* contextFactory, ConnectionFactory* connectionFactory, const TLSOptions&); virtual ~TLSConnectionFactory(); - virtual boost::shared_ptr<Connection> createConnection(); + virtual std::shared_ptr<Connection> createConnection(); private: TLSContextFactory* contextFactory; ConnectionFactory* connectionFactory; diff --git a/Swiften/Network/Timer.h b/Swiften/Network/Timer.h index 1abf5bc..501fbd8 100644 --- a/Swiften/Network/Timer.h +++ b/Swiften/Network/Timer.h @@ -15,7 +15,7 @@ namespace Swift { */ class SWIFTEN_API Timer { public: - typedef boost::shared_ptr<Timer> ref; + typedef std::shared_ptr<Timer> ref; virtual ~Timer(); diff --git a/Swiften/Network/TimerFactory.h b/Swiften/Network/TimerFactory.h index 47e89f8..ebb1b6e 100644 --- a/Swiften/Network/TimerFactory.h +++ b/Swiften/Network/TimerFactory.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Network/Timer.h> diff --git a/Swiften/Network/UnboundDomainNameResolver.cpp b/Swiften/Network/UnboundDomainNameResolver.cpp index a9fed24..380e087 100755 --- a/Swiften/Network/UnboundDomainNameResolver.cpp +++ b/Swiften/Network/UnboundDomainNameResolver.cpp @@ -10,11 +10,10 @@ * See the COPYING file for more information. */ +#include <memory> #include <vector> #include <boost/bind.hpp> -#include <boost/enable_shared_from_this.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <UnboundDomainNameResolver.h> #include <arpa/inet.h> @@ -44,12 +43,12 @@ class UnboundQuery { }; struct UnboundWrapperHelper { - UnboundWrapperHelper(UnboundDomainNameResolver* resolver, boost::shared_ptr<UnboundQuery> query) : resolver(resolver), query(query) {} + UnboundWrapperHelper(UnboundDomainNameResolver* resolver, std::shared_ptr<UnboundQuery> query) : resolver(resolver), query(query) {} UnboundDomainNameResolver* resolver; - boost::shared_ptr<UnboundQuery> query; + std::shared_ptr<UnboundQuery> query; }; -class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public UnboundQuery, public boost::enable_shared_from_this<UnboundDomainNameServiceQuery> { +class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public UnboundQuery, public std::enable_shared_from_this<UnboundDomainNameServiceQuery> { public: UnboundDomainNameServiceQuery(UnboundDomainNameResolver* resolver, ub_ctx* context, std::string name) : UnboundQuery(resolver, context), name(name) { } @@ -121,7 +120,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo std::string name; }; -class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public UnboundQuery, public boost::enable_shared_from_this<UnboundDomainNameAddressQuery> { +class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public UnboundQuery, public std::enable_shared_from_this<UnboundDomainNameAddressQuery> { public: UnboundDomainNameAddressQuery(UnboundDomainNameResolver* resolver, ub_ctx* context, std::string name) : UnboundQuery(resolver, context), name(name) { } @@ -179,12 +178,12 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo std::string name; }; -UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) { +UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) { ubContext = ub_ctx_create(); if(!ubContext) { SWIFT_LOG(debug) << "could not create unbound context" << std::endl; } - eventOwner = boost::make_shared<EventOwner>(); + eventOwner = std::make_shared<EventOwner>(); ub_ctx_async(ubContext, true); @@ -211,7 +210,7 @@ UnboundDomainNameResolver::~UnboundDomainNameResolver() { } } -void UnboundDomainNameResolver::unbound_callback(boost::shared_ptr<UnboundQuery> query, int err, ub_result* result) { +void UnboundDomainNameResolver::unbound_callback(std::shared_ptr<UnboundQuery> query, int err, ub_result* result) { query->handleResult(err, result); } @@ -236,17 +235,17 @@ void UnboundDomainNameResolver::processData() { } } -boost::shared_ptr<DomainNameServiceQuery> UnboundDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { +std::shared_ptr<DomainNameServiceQuery> UnboundDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { boost::optional<std::string> encodedDomain = idnConverter->getIDNAEncoded(domain); std::string result; if (encodedDomain) { result = serviceLookupPrefix + *encodedDomain; } - return boost::make_shared<UnboundDomainNameServiceQuery>(this, ubContext, result); + return std::make_shared<UnboundDomainNameServiceQuery>(this, ubContext, result); } -boost::shared_ptr<DomainNameAddressQuery> UnboundDomainNameResolver::createAddressQuery(const std::string& name) { - return boost::make_shared<UnboundDomainNameAddressQuery>(this, ubContext, idnConverter->getIDNAEncoded(name).get_value_or("")); +std::shared_ptr<DomainNameAddressQuery> UnboundDomainNameResolver::createAddressQuery(const std::string& name) { + return std::make_shared<UnboundDomainNameAddressQuery>(this, ubContext, idnConverter->getIDNAEncoded(name).get_value_or("")); } } diff --git a/Swiften/Network/UnboundDomainNameResolver.h b/Swiften/Network/UnboundDomainNameResolver.h index afb21c8..a97e385 100755 --- a/Swiften/Network/UnboundDomainNameResolver.h +++ b/Swiften/Network/UnboundDomainNameResolver.h @@ -12,9 +12,9 @@ #pragma once +#include <memory> + #include <boost/asio.hpp> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Network/DomainNameResolver.h> @@ -31,26 +31,26 @@ namespace Swift { class UnboundDomainNameResolver; class UnboundQuery; - class UnboundDomainNameResolver : public DomainNameResolver, public EventOwner, public boost::enable_shared_from_this<UnboundDomainNameResolver> { + class UnboundDomainNameResolver : public DomainNameResolver, public EventOwner, public std::enable_shared_from_this<UnboundDomainNameResolver> { public: - UnboundDomainNameResolver(IDNConverter* idnConverter, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); + UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop); virtual ~UnboundDomainNameResolver(); - virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain); - virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); + virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain); + virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name); static void unbound_callback_wrapper(void* data, int err, ub_result* result); private: - void unbound_callback(boost::shared_ptr<UnboundQuery> query, int err, ub_result* result); + void unbound_callback(std::shared_ptr<UnboundQuery> query, int err, ub_result* result); void handleUBSocketReadable(boost::system::error_code); void processData(); private: IDNConverter* idnConverter; - boost::shared_ptr<EventOwner> eventOwner; - boost::shared_ptr<boost::asio::io_service> ioService; + std::shared_ptr<EventOwner> eventOwner; + std::shared_ptr<boost::asio::io_service> ioService; boost::asio::posix::stream_descriptor ubDescriptior; EventLoop* eventLoop; ub_ctx* ubContext; diff --git a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp index 12b48a9..8dbd09e 100644 --- a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp +++ b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp @@ -4,11 +4,11 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QA/Checker/IO.h> @@ -29,7 +29,7 @@ using namespace Swift; -typedef boost::shared_ptr<BOSHConnectionPool> PoolRef; +typedef std::shared_ptr<BOSHConnectionPool> PoolRef; class BOSHConnectionPoolTest : public CppUnit::TestFixture { @@ -167,8 +167,8 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { } void testConnectionCount_ThreeWritesTwoReads() { - boost::shared_ptr<MockConnection> c0; - boost::shared_ptr<MockConnection> c1; + std::shared_ptr<MockConnection> c0; + std::shared_ptr<MockConnection> c1; unsigned long long rid = initialRID; PoolRef testling = createTestling(); @@ -294,7 +294,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { } void testWrite_Empty() { - boost::shared_ptr<MockConnection> c0; + std::shared_ptr<MockConnection> c0; PoolRef testling = createTestling(); CPPUNIT_ASSERT_EQUAL(st(1), connectionFactory->connections.size()); @@ -406,32 +406,32 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { MockConnectionFactory(EventLoop* eventLoop, bool autoFinishConnect = true) : eventLoop(eventLoop), autoFinishConnect(autoFinishConnect) { } - boost::shared_ptr<Connection> createConnection() { - boost::shared_ptr<MockConnection> connection = boost::make_shared<MockConnection>(failingPorts, eventLoop, autoFinishConnect); + std::shared_ptr<Connection> createConnection() { + std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop, autoFinishConnect); connections.push_back(connection); return connection; } EventLoop* eventLoop; - std::vector< boost::shared_ptr<MockConnection> > connections; + std::vector< std::shared_ptr<MockConnection> > connections; std::vector<HostAddressPort> failingPorts; bool autoFinishConnect; }; - void readResponse(const std::string& response, boost::shared_ptr<MockConnection> connection) { + void readResponse(const std::string& response, std::shared_ptr<MockConnection> connection) { connection->pending = false; - boost::shared_ptr<SafeByteArray> data1 = boost::make_shared<SafeByteArray>(createSafeByteArray( + std::shared_ptr<SafeByteArray> data1 = std::make_shared<SafeByteArray>(createSafeByteArray( "HTTP/1.1 200 OK\r\n" "Content-Type: text/xml; charset=utf-8\r\n" "Access-Control-Allow-Origin: *\r\n" "Access-Control-Allow-Headers: Content-Type\r\n" "Content-Length: ")); connection->onDataRead(data1); - boost::shared_ptr<SafeByteArray> data2 = boost::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size()))); + std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size()))); connection->onDataRead(data2); - boost::shared_ptr<SafeByteArray> data3 = boost::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n")); + std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n")); connection->onDataRead(data3); - boost::shared_ptr<SafeByteArray> data4 = boost::make_shared<SafeByteArray>(createSafeByteArray(response)); + std::shared_ptr<SafeByteArray> data4 = std::make_shared<SafeByteArray>(createSafeByteArray(response)); connection->onDataRead(data4); } diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp index abd020f..a791e96 100644 --- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp +++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp @@ -4,11 +4,11 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QA/Checker/IO.h> @@ -151,17 +151,17 @@ class BOSHConnectionTest : public CppUnit::TestFixture { testling->connect(); eventLoop->processEvents(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), connectionFactory->connections.size()); - boost::shared_ptr<MockConnection> connection = connectionFactory->connections[0]; - boost::shared_ptr<SafeByteArray> data1 = boost::make_shared<SafeByteArray>(createSafeByteArray( + std::shared_ptr<MockConnection> connection = connectionFactory->connections[0]; + std::shared_ptr<SafeByteArray> data1 = std::make_shared<SafeByteArray>(createSafeByteArray( "HTTP/1.1 200 OK\r\n" "Content-Type: text/xml; charset=utf-8\r\n" "Access-Control-Allow-Origin: *\r\n" "Access-Control-Allow-Headers: Content-Type\r\n" "Content-Length: 64\r\n")); - boost::shared_ptr<SafeByteArray> data2 = boost::make_shared<SafeByteArray>(createSafeByteArray( + std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray( "\r\n<body xmlns='http://jabber.org/protocol/httpbind'>" "<bl")); - boost::shared_ptr<SafeByteArray> data3 = boost::make_shared<SafeByteArray>(createSafeByteArray( + std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray( "ah/>" "</body>")); connection->onDataRead(data1); @@ -258,30 +258,30 @@ class BOSHConnectionTest : public CppUnit::TestFixture { MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop) { } - boost::shared_ptr<Connection> createConnection() { - boost::shared_ptr<MockConnection> connection = boost::make_shared<MockConnection>(failingPorts, eventLoop); + std::shared_ptr<Connection> createConnection() { + std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop); connections.push_back(connection); return connection; } EventLoop* eventLoop; - std::vector< boost::shared_ptr<MockConnection> > connections; + std::vector< std::shared_ptr<MockConnection> > connections; std::vector<HostAddressPort> failingPorts; }; - void readResponse(const std::string& response, boost::shared_ptr<MockConnection> connection) { - boost::shared_ptr<SafeByteArray> data1 = boost::make_shared<SafeByteArray>(createSafeByteArray( + void readResponse(const std::string& response, std::shared_ptr<MockConnection> connection) { + std::shared_ptr<SafeByteArray> data1 = std::make_shared<SafeByteArray>(createSafeByteArray( "HTTP/1.1 200 OK\r\n" "Content-Type: text/xml; charset=utf-8\r\n" "Access-Control-Allow-Origin: *\r\n" "Access-Control-Allow-Headers: Content-Type\r\n" "Content-Length: ")); connection->onDataRead(data1); - boost::shared_ptr<SafeByteArray> data2 = boost::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size()))); + std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size()))); connection->onDataRead(data2); - boost::shared_ptr<SafeByteArray> data3 = boost::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n")); + std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n")); connection->onDataRead(data3); - boost::shared_ptr<SafeByteArray> data4 = boost::make_shared<SafeByteArray>(createSafeByteArray(response)); + std::shared_ptr<SafeByteArray> data4 = std::make_shared<SafeByteArray>(createSafeByteArray(response)); connection->onDataRead(data4); } diff --git a/Swiften/Network/UnitTest/ChainedConnectorTest.cpp b/Swiften/Network/UnitTest/ChainedConnectorTest.cpp index 9496e13..3fad433 100644 --- a/Swiften/Network/UnitTest/ChainedConnectorTest.cpp +++ b/Swiften/Network/UnitTest/ChainedConnectorTest.cpp @@ -1,11 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -51,7 +52,7 @@ class ChainedConnectorTest : public CppUnit::TestFixture { } void testConnect_FirstConnectorSucceeds() { - boost::shared_ptr<ChainedConnector> testling(createConnector()); + std::shared_ptr<ChainedConnector> testling(createConnector()); connectionFactory1->connects = true; connectionFactory2->connects = false; @@ -60,12 +61,12 @@ class ChainedConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); - CPPUNIT_ASSERT_EQUAL(1, boost::dynamic_pointer_cast<MockConnection>(connections[0])->id); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT_EQUAL(1, std::dynamic_pointer_cast<MockConnection>(connections[0])->id); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_SecondConnectorSucceeds() { - boost::shared_ptr<ChainedConnector> testling(createConnector()); + std::shared_ptr<ChainedConnector> testling(createConnector()); connectionFactory1->connects = false; connectionFactory2->connects = true; @@ -74,12 +75,12 @@ class ChainedConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); - CPPUNIT_ASSERT_EQUAL(2, boost::dynamic_pointer_cast<MockConnection>(connections[0])->id); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT_EQUAL(2, std::dynamic_pointer_cast<MockConnection>(connections[0])->id); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_NoConnectorSucceeds() { - boost::shared_ptr<ChainedConnector> testling(createConnector()); + std::shared_ptr<ChainedConnector> testling(createConnector()); connectionFactory1->connects = false; connectionFactory2->connects = false; @@ -88,14 +89,14 @@ class ChainedConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_NoDNS() { /* Reset resolver so there's no record */ delete resolver; resolver = new StaticDomainNameResolver(eventLoop); - boost::shared_ptr<ChainedConnector> testling(createConnector()); + std::shared_ptr<ChainedConnector> testling(createConnector()); connectionFactory1->connects = false; connectionFactory2->connects = false; @@ -105,11 +106,11 @@ class ChainedConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testStop() { - boost::shared_ptr<ChainedConnector> testling(createConnector()); + std::shared_ptr<ChainedConnector> testling(createConnector()); connectionFactory1->connects = true; connectionFactory2->connects = false; @@ -122,18 +123,18 @@ class ChainedConnectorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<ChainedConnector> createConnector() { + std::shared_ptr<ChainedConnector> createConnector() { std::vector<ConnectionFactory*> factories; factories.push_back(connectionFactory1); factories.push_back(connectionFactory2); - boost::shared_ptr<ChainedConnector> connector = boost::make_shared<ChainedConnector>("foo.com", -1, boost::optional<std::string>("_xmpp-client._tcp."), resolver, factories, timerFactory); + std::shared_ptr<ChainedConnector> connector = std::make_shared<ChainedConnector>("foo.com", -1, boost::optional<std::string>("_xmpp-client._tcp."), resolver, factories, timerFactory); connector->onConnectFinished.connect(boost::bind(&ChainedConnectorTest::handleConnectorFinished, this, _1, _2)); return connector; } - void handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> resultError) { + void handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> resultError) { error = resultError; - boost::shared_ptr<MockConnection> c(boost::dynamic_pointer_cast<MockConnection>(connection)); + std::shared_ptr<MockConnection> c(std::dynamic_pointer_cast<MockConnection>(connection)); if (connection) { assert(c); } @@ -164,8 +165,8 @@ class ChainedConnectorTest : public CppUnit::TestFixture { MockConnectionFactory(EventLoop* eventLoop, int id) : eventLoop(eventLoop), connects(true), id(id) { } - boost::shared_ptr<Connection> createConnection() { - return boost::make_shared<MockConnection>(connects, id, eventLoop); + std::shared_ptr<Connection> createConnection() { + return std::make_shared<MockConnection>(connects, id, eventLoop); } EventLoop* eventLoop; @@ -180,8 +181,8 @@ class ChainedConnectorTest : public CppUnit::TestFixture { MockConnectionFactory* connectionFactory1; MockConnectionFactory* connectionFactory2; DummyTimerFactory* timerFactory; - std::vector< boost::shared_ptr<MockConnection> > connections; - boost::shared_ptr<Error> error; + std::vector< std::shared_ptr<MockConnection> > connections; + std::shared_ptr<Error> error; }; CPPUNIT_TEST_SUITE_REGISTRATION(ChainedConnectorTest); diff --git a/Swiften/Network/UnitTest/ConnectorTest.cpp b/Swiften/Network/UnitTest/ConnectorTest.cpp index ac2bc83..20ad68d 100644 --- a/Swiften/Network/UnitTest/ConnectorTest.cpp +++ b/Swiften/Network/UnitTest/ConnectorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -71,7 +71,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(host1 == *(connections[0]->hostAddressPort)); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_NoServiceLookups() { @@ -87,7 +87,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(host3.getAddress() == (*(connections[0]->hostAddressPort)).getAddress()); CPPUNIT_ASSERT(4321 == (*(connections[0]->hostAddressPort)).getPort()); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_NoServiceLookups_DefaultPort() { @@ -103,7 +103,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(host3.getAddress() == (*(connections[0]->hostAddressPort)).getAddress()); CPPUNIT_ASSERT_EQUAL(5222, (*(connections[0]->hostAddressPort)).getPort()); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_NoSRVHost() { @@ -116,7 +116,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(host3 == *(connections[0]->hostAddressPort)); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_FirstAddressHostFails() { @@ -135,7 +135,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(HostAddressPort(address2, 1234) == *(connections[0]->hostAddressPort)); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_NoHosts() { @@ -146,7 +146,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_FirstSRVHostFails() { @@ -160,7 +160,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(host2 == *(connections[0]->hostAddressPort)); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_AllSRVHostsFailWithoutFallbackHost() { @@ -175,7 +175,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_AllSRVHostsFailWithFallbackHost() { @@ -192,7 +192,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(host3 == *(connections[0]->hostAddressPort)); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_SRVAndFallbackHostsFail() { @@ -207,7 +207,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } /*void testConnect_TimeoutDuringResolve() { @@ -221,7 +221,7 @@ class ConnectorTest : public CppUnit::TestFixture { eventLoop->processEvents(); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error)); CPPUNIT_ASSERT(!connections[0]); }*/ @@ -238,7 +238,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testConnect_TimeoutDuringConnectToCandidateFallsBack() { @@ -261,7 +261,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); CPPUNIT_ASSERT(HostAddressPort(address2, 1234) == *(connections[0]->hostAddressPort)); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } @@ -277,7 +277,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(connections[0]); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testStop_DuringSRVQuery() { @@ -291,7 +291,7 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size())); CPPUNIT_ASSERT(!connections[0]); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error)); } void testStop_Timeout() { @@ -318,8 +318,8 @@ class ConnectorTest : public CppUnit::TestFixture { return connector; } - void handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> resultError) { - boost::shared_ptr<MockConnection> c(boost::dynamic_pointer_cast<MockConnection>(connection)); + void handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> resultError) { + std::shared_ptr<MockConnection> c(std::dynamic_pointer_cast<MockConnection>(connection)); if (connection) { assert(c); } @@ -355,8 +355,8 @@ class ConnectorTest : public CppUnit::TestFixture { MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop), isResponsive(true) { } - boost::shared_ptr<Connection> createConnection() { - return boost::shared_ptr<Connection>(new MockConnection(failingPorts, isResponsive, eventLoop)); + std::shared_ptr<Connection> createConnection() { + return std::make_shared<MockConnection>(failingPorts, isResponsive, eventLoop); } EventLoop* eventLoop; @@ -372,8 +372,8 @@ class ConnectorTest : public CppUnit::TestFixture { StaticDomainNameResolver* resolver; MockConnectionFactory* connectionFactory; DummyTimerFactory* timerFactory; - std::vector< boost::shared_ptr<MockConnection> > connections; - boost::shared_ptr<Error> error; + std::vector< std::shared_ptr<MockConnection> > connections; + std::shared_ptr<Error> error; }; diff --git a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp index aa3d578..232847b 100644 --- a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp +++ b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> + #include <boost/algorithm/string.hpp> #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QA/Checker/IO.h> @@ -254,7 +254,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture { void testTrafficFilter() { HTTPConnectProxiedConnection::ref testling(createTestling()); - boost::shared_ptr<ExampleHTTPTrafficFilter> httpTrafficFilter = boost::make_shared<ExampleHTTPTrafficFilter>(); + std::shared_ptr<ExampleHTTPTrafficFilter> httpTrafficFilter = std::make_shared<ExampleHTTPTrafficFilter>(); testling->setHTTPTrafficFilter(httpTrafficFilter); connect(testling, HostAddressPort(HostAddress("2.2.2.2"), 2345)); @@ -295,7 +295,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture { void testTrafficFilterNoConnectionReuse() { HTTPConnectProxiedConnection::ref testling = createTestling(); - boost::shared_ptr<ProxyAuthenticationHTTPTrafficFilter> httpTrafficFilter = boost::make_shared<ProxyAuthenticationHTTPTrafficFilter>(); + std::shared_ptr<ProxyAuthenticationHTTPTrafficFilter> httpTrafficFilter = std::make_shared<ProxyAuthenticationHTTPTrafficFilter>(); testling->setHTTPTrafficFilter(httpTrafficFilter); connect(testling, HostAddressPort(HostAddress("2.2.2.2"), 2345)); @@ -351,7 +351,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture { private: HTTPConnectProxiedConnection::ref createTestling() { - boost::shared_ptr<HTTPConnectProxiedConnection> c = HTTPConnectProxiedConnection::create(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, "", ""); + std::shared_ptr<HTTPConnectProxiedConnection> c = HTTPConnectProxiedConnection::create(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, "", ""); c->onConnectFinished.connect(boost::bind(&HTTPConnectProxiedConnectionTest::handleConnectFinished, this, _1)); c->onDisconnected.connect(boost::bind(&HTTPConnectProxiedConnectionTest::handleDisconnected, this, _1)); c->onDataRead.connect(boost::bind(&HTTPConnectProxiedConnectionTest::handleDataRead, this, _1)); @@ -368,7 +368,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture { disconnectedError = e; } - void handleDataRead(boost::shared_ptr<SafeByteArray> d) { + void handleDataRead(std::shared_ptr<SafeByteArray> d) { append(dataRead, *d); } @@ -408,15 +408,15 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture { MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop) { } - boost::shared_ptr<Connection> createConnection() { - boost::shared_ptr<MockConnection> connection = boost::make_shared<MockConnection>(failingPorts, eventLoop); + std::shared_ptr<Connection> createConnection() { + std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop); connections.push_back(connection); SWIFT_LOG(debug) << "new connection created" << std::endl; return connection; } EventLoop* eventLoop; - std::vector< boost::shared_ptr<MockConnection> > connections; + std::vector< std::shared_ptr<MockConnection> > connections; std::vector<HostAddressPort> failingPorts; }; diff --git a/Swiften/Parser/BOSHBodyExtractor.cpp b/Swiften/Parser/BOSHBodyExtractor.cpp index c5723be..c45d338 100644 --- a/Swiften/Parser/BOSHBodyExtractor.cpp +++ b/Swiften/Parser/BOSHBodyExtractor.cpp @@ -6,8 +6,9 @@ #include <Swiften/Parser/BOSHBodyExtractor.h> +#include <memory> + #include <boost/numeric/conversion/cast.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Parser/XMLParser.h> #include <Swiften/Parser/XMLParserClient.h> @@ -125,7 +126,7 @@ BOSHBodyExtractor::BOSHBodyExtractor(XMLParserFactory* parserFactory, const Byte // Parse the body element BOSHBodyParserClient parserClient(this); - boost::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient)); + std::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient)); if (!parser->parse(std::string( reinterpret_cast<const char*>(vecptr(data)), boost::numeric_cast<size_t>(std::distance(data.begin(), i))))) { diff --git a/Swiften/Parser/ElementParser.h b/Swiften/Parser/ElementParser.h index 12c6c38..71d4bce 100644 --- a/Swiften/Parser/ElementParser.h +++ b/Swiften/Parser/ElementParser.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Parser/AttributeMap.h> @@ -23,6 +22,6 @@ namespace Swift { virtual void handleEndElement(const std::string& element, const std::string& ns) = 0; virtual void handleCharacterData(const std::string& data) = 0; - virtual boost::shared_ptr<ToplevelElement> getElement() const = 0; + virtual std::shared_ptr<ToplevelElement> getElement() const = 0; }; } diff --git a/Swiften/Parser/ExpatParser.h b/Swiften/Parser/ExpatParser.h index 581847b..6580a7a 100644 --- a/Swiften/Parser/ExpatParser.h +++ b/Swiften/Parser/ExpatParser.h @@ -1,13 +1,14 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Parser/XMLParser.h> @@ -24,6 +25,6 @@ namespace Swift { private: struct Private; - boost::shared_ptr<Private> p; + std::shared_ptr<Private> p; }; } diff --git a/Swiften/Parser/GenericElementParser.h b/Swiften/Parser/GenericElementParser.h index 7a0f989..5aa62c9 100644 --- a/Swiften/Parser/GenericElementParser.h +++ b/Swiften/Parser/GenericElementParser.h @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/ElementParser.h> @@ -20,14 +19,14 @@ namespace Swift { class SWIFTEN_API GenericElementParser : public ElementParser { public: GenericElementParser() { - stanza_ = boost::make_shared<ElementType>(); + stanza_ = std::make_shared<ElementType>(); } - virtual boost::shared_ptr<ToplevelElement> getElement() const { + virtual std::shared_ptr<ToplevelElement> getElement() const { return stanza_; } - virtual boost::shared_ptr<ElementType> getElementGeneric() const { + virtual std::shared_ptr<ElementType> getElementGeneric() const { return stanza_; } @@ -42,6 +41,6 @@ namespace Swift { } private: - boost::shared_ptr<ElementType> stanza_; + std::shared_ptr<ElementType> stanza_; }; } diff --git a/Swiften/Parser/GenericPayloadParser.h b/Swiften/Parser/GenericPayloadParser.h index be0172c..ea0a7bd 100644 --- a/Swiften/Parser/GenericPayloadParser.h +++ b/Swiften/Parser/GenericPayloadParser.h @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParser.h> @@ -26,18 +25,18 @@ namespace Swift { class GenericPayloadParser : public PayloadParser { public: GenericPayloadParser() : PayloadParser() { - payload_ = boost::make_shared<PAYLOAD_TYPE>(); + payload_ = std::make_shared<PAYLOAD_TYPE>(); } - virtual boost::shared_ptr<Payload> getPayload() const { + virtual std::shared_ptr<Payload> getPayload() const { return payload_; } - virtual boost::shared_ptr<PAYLOAD_TYPE> getPayloadInternal() const { + virtual std::shared_ptr<PAYLOAD_TYPE> getPayloadInternal() const { return payload_; } private: - boost::shared_ptr<PAYLOAD_TYPE> payload_; + std::shared_ptr<PAYLOAD_TYPE> payload_; }; } diff --git a/Swiften/Parser/GenericPayloadTreeParser.h b/Swiften/Parser/GenericPayloadTreeParser.h index 2a7e190..b4da1a9 100644 --- a/Swiften/Parser/GenericPayloadTreeParser.h +++ b/Swiften/Parser/GenericPayloadTreeParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -7,9 +7,7 @@ #pragma once #include <deque> - -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/GenericPayloadParser.h> @@ -24,7 +22,7 @@ namespace Swift { public: virtual void handleStartElement(const std::string& element, const std::string& xmlns, const AttributeMap& attributes) { if (!root_) { - root_ = boost::make_shared<ParserElement>(element, xmlns, attributes); + root_ = std::make_shared<ParserElement>(element, xmlns, attributes); elementStack_.push_back(root_); } else { diff --git a/Swiften/Parser/GenericStanzaParser.h b/Swiften/Parser/GenericStanzaParser.h index 7d16a0c..2686f2f 100644 --- a/Swiften/Parser/GenericStanzaParser.h +++ b/Swiften/Parser/GenericStanzaParser.h @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/StanzaParser.h> @@ -21,18 +20,18 @@ namespace Swift { public: GenericStanzaParser(PayloadParserFactoryCollection* collection) : StanzaParser(collection) { - stanza_ = boost::make_shared<STANZA_TYPE>(); + stanza_ = std::make_shared<STANZA_TYPE>(); } - virtual boost::shared_ptr<ToplevelElement> getElement() const { + virtual std::shared_ptr<ToplevelElement> getElement() const { return stanza_; } - virtual boost::shared_ptr<STANZA_TYPE> getStanzaGeneric() const { + virtual std::shared_ptr<STANZA_TYPE> getStanzaGeneric() const { return stanza_; } private: - boost::shared_ptr<STANZA_TYPE> stanza_; + std::shared_ptr<STANZA_TYPE> stanza_; }; } diff --git a/Swiften/Parser/LibXMLParser.h b/Swiften/Parser/LibXMLParser.h index eb2a038..e63a628 100644 --- a/Swiften/Parser/LibXMLParser.h +++ b/Swiften/Parser/LibXMLParser.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Parser/XMLParser.h> @@ -27,6 +28,6 @@ namespace Swift { static bool initialized; struct Private; - boost::shared_ptr<Private> p; + std::shared_ptr<Private> p; }; } diff --git a/Swiften/Parser/PayloadParser.h b/Swiften/Parser/PayloadParser.h index cb50061..a824922 100644 --- a/Swiften/Parser/PayloadParser.h +++ b/Swiften/Parser/PayloadParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -45,6 +45,6 @@ namespace Swift { /** * Retrieve a pointer to the payload. */ - virtual boost::shared_ptr<Payload> getPayload() const = 0; + virtual std::shared_ptr<Payload> getPayload() const = 0; }; } diff --git a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp index d6fb6be..e4f8ab9 100644 --- a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp +++ b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,7 +16,7 @@ namespace Swift { void CarbonsReceivedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level_ == PayloadLevel) { if (element == "forwarded") { - forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_)); + forwardedParser_ = std::dynamic_pointer_cast<ForwardedParser>(std::make_shared<ForwardedParser>(factories_)); } } if (forwardedParser_) { diff --git a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h index 666f20b..6cc1f43 100644 --- a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h +++ b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -29,7 +29,7 @@ namespace Swift { private: PayloadParserFactoryCollection* factories_; - boost::shared_ptr<ForwardedParser> forwardedParser_; + std::shared_ptr<ForwardedParser> forwardedParser_; int level_; }; } diff --git a/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp index e616211..f446042 100644 --- a/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp +++ b/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,7 +16,7 @@ namespace Swift { void CarbonsSentParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level_ == PayloadLevel) { if (element == "forwarded") { - forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_)); + forwardedParser_ = std::dynamic_pointer_cast<ForwardedParser>(std::make_shared<ForwardedParser>(factories_)); } } if (forwardedParser_) { diff --git a/Swiften/Parser/PayloadParsers/CarbonsSentParser.h b/Swiften/Parser/PayloadParsers/CarbonsSentParser.h index 9faf62d..d4e12ba 100644 --- a/Swiften/Parser/PayloadParsers/CarbonsSentParser.h +++ b/Swiften/Parser/PayloadParsers/CarbonsSentParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -29,7 +29,7 @@ namespace Swift { private: PayloadParserFactoryCollection* factories_; - boost::shared_ptr<ForwardedParser> forwardedParser_; + std::shared_ptr<ForwardedParser> forwardedParser_; int level_; }; } diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp index bdfeaec..cb6fc0a 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.cpp +++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp @@ -89,7 +89,7 @@ void CommandParser::handleEndElement(const std::string& element, const std::stri if (level_ == FormOrNoteOrActionsLevel) { if (formParser_) { - Form::ref form(boost::dynamic_pointer_cast<Form>(formParser_->getPayload())); + Form::ref form(std::dynamic_pointer_cast<Form>(formParser_->getPayload())); assert(form); getPayloadInternal()->setForm(form); delete formParser_; diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.h b/Swiften/Parser/PayloadParsers/ErrorParser.h index dd1aa95..10f5431 100644 --- a/Swiften/Parser/PayloadParsers/ErrorParser.h +++ b/Swiften/Parser/PayloadParsers/ErrorParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,6 +28,6 @@ namespace Swift { PayloadParserFactoryCollection* factories; int level_; std::string currentText_; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/FormParser.cpp b/Swiften/Parser/PayloadParsers/FormParser.cpp index 3a2c880..4a0a26f 100644 --- a/Swiften/Parser/PayloadParsers/FormParser.cpp +++ b/Swiften/Parser/PayloadParsers/FormParser.cpp @@ -45,7 +45,7 @@ void FormParser::handleStartElement(const std::string& element, const std::strin parsingItem_ = true; } else if (element == "page") { - currentPage_ = boost::make_shared<FormPage>(); + currentPage_ = std::make_shared<FormPage>(); currentPage_->setLabel(attributes.getAttribute("label")); } } @@ -59,7 +59,7 @@ void FormParser::handleStartElement(const std::string& element, const std::strin } if (level_ >= PayloadLevel) { if (element == "field") { - currentField_ = boost::make_shared<FormField>(); + currentField_ = std::make_shared<FormField>(); std::string type = attributes.getAttribute("type"); FormField::Type fieldType = FormField::UnknownType; if (type == "boolean") { @@ -102,13 +102,13 @@ void FormParser::handleStartElement(const std::string& element, const std::strin } if (level_ > PayloadLevel) { if (element == "section") { - currentSection_ = boost::make_shared<FormSection>(); + currentSection_ = std::make_shared<FormSection>(); currentSection_->setLabel(attributes.getAttribute("label")); sectionStack_.push_back(currentSection_); currentSections_.push_back(currentSection_); } if (element == "reportedref") { - currentReportedRef_ = boost::make_shared<FormReportedRef>(); + currentReportedRef_ = std::make_shared<FormReportedRef>(); } if (element == "fieldref") { currentText_.clear(); @@ -121,7 +121,7 @@ void FormParser::handleStartElement(const std::string& element, const std::strin } if (element == "text") { currentText_.clear(); - currentTextElement_ = boost::make_shared<FormText>(); + currentTextElement_ = std::make_shared<FormText>(); } } ++level_; @@ -191,14 +191,14 @@ void FormParser::handleEndElement(const std::string& element, const std::string& } else { if (currentPages_.size() > 0) { - foreach (boost::shared_ptr<FormPage> page, currentPages_) { + foreach (std::shared_ptr<FormPage> page, currentPages_) { foreach (std::string pageRef, page->getFieldRefs()) { if (pageRef == currentField_->getName()) { page->addField(currentField_); } } } - foreach (boost::shared_ptr<FormSection> section, currentSections_) { + foreach (std::shared_ptr<FormSection> section, currentSections_) { foreach (std::string sectionRef, section->getFieldRefs()) { if (sectionRef == currentField_->getName()) { section->addField(currentField_); diff --git a/Swiften/Parser/PayloadParsers/FormParser.h b/Swiften/Parser/PayloadParsers/FormParser.h index 81032ee..e1491b1 100644 --- a/Swiften/Parser/PayloadParsers/FormParser.h +++ b/Swiften/Parser/PayloadParsers/FormParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -39,8 +39,8 @@ namespace Swift { FormReportedRef::ref currentReportedRef_; FormPage::page currentPage_; FormSection::section currentSection_; - std::vector<boost::shared_ptr<FormPage> > currentPages_; - std::vector<boost::shared_ptr<FormSection> > sectionStack_; - std::vector<boost::shared_ptr<FormSection> > currentSections_; + std::vector<std::shared_ptr<FormPage> > currentPages_; + std::vector<std::shared_ptr<FormSection> > sectionStack_; + std::vector<std::shared_ptr<FormSection> > currentSections_; }; } diff --git a/Swiften/Parser/PayloadParsers/ForwardedParser.cpp b/Swiften/Parser/PayloadParsers/ForwardedParser.cpp index 35d20a9..72a665a 100644 --- a/Swiften/Parser/PayloadParsers/ForwardedParser.cpp +++ b/Swiften/Parser/PayloadParsers/ForwardedParser.cpp @@ -25,13 +25,13 @@ ForwardedParser::ForwardedParser(PayloadParserFactoryCollection* factories) : fa void ForwardedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level_ == PayloadLevel) { if (element == "iq" && ns == "jabber:client") { /* begin parsing a nested stanza? */ - childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<IQParser>(factories_)); + childParser_ = std::dynamic_pointer_cast<StanzaParser>(std::make_shared<IQParser>(factories_)); } else if (element == "message" && ns == "jabber:client") { - childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<MessageParser>(factories_)); + childParser_ = std::dynamic_pointer_cast<StanzaParser>(std::make_shared<MessageParser>(factories_)); } else if (element == "presence" && ns == "jabber:client") { - childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<PresenceParser>(factories_)); + childParser_ = std::dynamic_pointer_cast<StanzaParser>(std::make_shared<PresenceParser>(factories_)); } else if (element == "delay" && ns == "urn:xmpp:delay") { /* nested delay payload */ - delayParser_ = boost::make_shared<DelayParser>(); + delayParser_ = std::make_shared<DelayParser>(); } } if (childParser_) { /* parsing a nested stanza? */ @@ -58,7 +58,7 @@ void ForwardedParser::handleEndElement(const std::string& element, const std::st } if (delayParser_ && level_ == PayloadLevel) { /* done parsing nested delay payload */ - getPayloadInternal()->setDelay(boost::dynamic_pointer_cast<Delay>(delayParser_->getPayload())); + getPayloadInternal()->setDelay(std::dynamic_pointer_cast<Delay>(delayParser_->getPayload())); delayParser_.reset(); } } diff --git a/Swiften/Parser/PayloadParsers/ForwardedParser.h b/Swiften/Parser/PayloadParsers/ForwardedParser.h index 70eecdf..f91fda5 100644 --- a/Swiften/Parser/PayloadParsers/ForwardedParser.h +++ b/Swiften/Parser/PayloadParsers/ForwardedParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -33,8 +33,8 @@ namespace Swift { private: PayloadParserFactoryCollection* factories_; - boost::shared_ptr<StanzaParser> childParser_; - boost::shared_ptr<DelayParser> delayParser_; + std::shared_ptr<StanzaParser> childParser_; + std::shared_ptr<DelayParser> delayParser_; int level_; }; } diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp index d59d9a0..a231397 100644 --- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp @@ -89,87 +89,85 @@ #include <Swiften/Parser/PayloadParsers/VCardUpdateParser.h> #include <Swiften/Parser/PayloadParsers/WhiteboardParser.h> -using namespace boost; - namespace Swift { FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() { - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<IBBParser> >("", "http://jabber.org/protocol/ibb")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StatusShowParser> >("show")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StatusParser> >("status")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "http://swift.im/protocol/replace")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "urn:xmpp:message-correct:0")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<LastParser> >("query", "jabber:iq:last")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BodyParser> >("body")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SubjectParser> >("subject")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ThreadParser> >("thread")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<PriorityParser> >("priority")); - factories_.push_back(boost::make_shared<ErrorParserFactory>(this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DelayParser> >("delay", "urn:xmpp:delay")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SoftwareVersionParser> >("query", "jabber:iq:version")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StorageParser> >("storage", "storage:bookmarks")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<RosterItemExchangeParser> >("x", "http://jabber.org/protocol/rosterx")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<RosterParser> >("query", "jabber:iq:roster")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DiscoInfoParser> >("query", "http://jabber.org/protocol/disco#info")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DiscoItemsParser> >("query", "http://jabber.org/protocol/disco#items")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CapsInfoParser> >("c", "http://jabber.org/protocol/caps")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ResourceBindParser> >("bind", "urn:ietf:params:xml:ns:xmpp-bind")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StartSessionParser> >("session", "urn:ietf:params:xml:ns:xmpp-session")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<BlockPayload> > >("block", "urn:xmpp:blocking")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<BlockListPayload> > >("blocklist", "urn:xmpp:blocking")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<UnblockPayload> > >("unblock", "urn:xmpp:blocking")); - factories_.push_back(boost::make_shared<SecurityLabelParserFactory>()); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SecurityLabelsCatalogParser> >("catalog", "urn:xmpp:sec-label:catalog:2")); - factories_.push_back(boost::make_shared<FormParserFactory>()); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CommandParser> >("command", "http://jabber.org/protocol/commands")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<InBandRegistrationPayloadParser> >("query", "jabber:iq:register")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SearchPayloadParser> >("query", "jabber:iq:search")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationParser> >("si", "http://jabber.org/protocol/si")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BytestreamsParser> >("query", "http://jabber.org/protocol/bytestreams")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<VCardUpdateParser> >("x", "vcard-temp:x:update")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<VCardParser> >("vCard", "vcard-temp")); - factories_.push_back(boost::make_shared<PrivateStorageParserFactory>(this)); - factories_.push_back(boost::make_shared<ChatStateParserFactory>()); - factories_.push_back(boost::make_shared<MUCUserPayloadParserFactory>(this)); - factories_.push_back(boost::make_shared<MUCOwnerPayloadParserFactory>(this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCInvitationPayloadParser> >("x", "jabber:x:conference")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCAdminPayloadParser> >("query", "http://jabber.org/protocol/muc#admin")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#user")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#owner")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<NicknameParser> >("nick", "http://jabber.org/protocol/nick")); - factories_.push_back(boost::make_shared<JingleParserFactory>(this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleReasonParser> >("reason", "urn:xmpp:jingle:1")); - factories_.push_back(boost::make_shared<JingleContentPayloadParserFactory>(this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleIBBTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:ibb:1")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleS5BTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:s5b:1")); - factories_.push_back(boost::make_shared<JingleFileTransferDescriptionParserFactory>(this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationFileInfoParser> >("file", "http://jabber.org/protocol/si/profile/file-transfer")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferFileInfoParser> >("file", "urn:xmpp:jingle:apps:file-transfer:4")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferHashParser> >("checksum")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<S5BProxyRequestParser> >("query", "http://jabber.org/protocol/bytestreams")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<WhiteboardParser> >("wb", "http://swift.im/whiteboard")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<UserLocationParser> >("geoloc", "http://jabber.org/protocol/geoloc")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<UserTuneParser> >("tune", "http://jabber.org/protocol/tune")); - factories_.push_back(boost::make_shared<DeliveryReceiptParserFactory>()); - factories_.push_back(boost::make_shared<DeliveryReceiptRequestParserFactory>()); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<IdleParser> >("idle", "urn:xmpp:idle:1")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubOwnerPubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub#owner", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubEventParser> >("event", "http://jabber.org/protocol/pubsub#event", this)); - factories_.push_back(boost::make_shared<PubSubErrorParserFactory>()); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ResultSetParser> >("set", "http://jabber.org/protocol/rsm")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<ForwardedParser> >("forwarded", "urn:xmpp:forward:0", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<MAMResultParser> >("result", "urn:xmpp:mam:0", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMQueryParser> >("query", "urn:xmpp:mam:0")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMFinParser> >("fin", "urn:xmpp:mam:0")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<IsodeIQDelegationParser> >("delegate", "http://isode.com/iq_delegation", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsEnableParser> >("enable", "urn:xmpp:carbons:2")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsDisableParser> >("disable", "urn:xmpp:carbons:2")); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<CarbonsReceivedParser> >("received", "urn:xmpp:carbons:2", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<CarbonsSentParser> >("sent", "urn:xmpp:carbons:2", this)); - factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsPrivateParser> >("private", "urn:xmpp:carbons:2")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<IBBParser> >("", "http://jabber.org/protocol/ibb")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<StatusShowParser> >("show")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<StatusParser> >("status")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "http://swift.im/protocol/replace")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "urn:xmpp:message-correct:0")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<LastParser> >("query", "jabber:iq:last")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<BodyParser> >("body")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<SubjectParser> >("subject")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<ThreadParser> >("thread")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<PriorityParser> >("priority")); + factories_.push_back(std::make_shared<ErrorParserFactory>(this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<DelayParser> >("delay", "urn:xmpp:delay")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<SoftwareVersionParser> >("query", "jabber:iq:version")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<StorageParser> >("storage", "storage:bookmarks")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<RosterItemExchangeParser> >("x", "http://jabber.org/protocol/rosterx")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<RosterParser> >("query", "jabber:iq:roster")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<DiscoInfoParser> >("query", "http://jabber.org/protocol/disco#info")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<DiscoItemsParser> >("query", "http://jabber.org/protocol/disco#items")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<CapsInfoParser> >("c", "http://jabber.org/protocol/caps")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<ResourceBindParser> >("bind", "urn:ietf:params:xml:ns:xmpp-bind")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<StartSessionParser> >("session", "urn:ietf:params:xml:ns:xmpp-session")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<BlockParser<BlockPayload> > >("block", "urn:xmpp:blocking")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<BlockParser<BlockListPayload> > >("blocklist", "urn:xmpp:blocking")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<BlockParser<UnblockPayload> > >("unblock", "urn:xmpp:blocking")); + factories_.push_back(std::make_shared<SecurityLabelParserFactory>()); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<SecurityLabelsCatalogParser> >("catalog", "urn:xmpp:sec-label:catalog:2")); + factories_.push_back(std::make_shared<FormParserFactory>()); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<CommandParser> >("command", "http://jabber.org/protocol/commands")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<InBandRegistrationPayloadParser> >("query", "jabber:iq:register")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<SearchPayloadParser> >("query", "jabber:iq:search")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<StreamInitiationParser> >("si", "http://jabber.org/protocol/si")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<BytestreamsParser> >("query", "http://jabber.org/protocol/bytestreams")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<VCardUpdateParser> >("x", "vcard-temp:x:update")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<VCardParser> >("vCard", "vcard-temp")); + factories_.push_back(std::make_shared<PrivateStorageParserFactory>(this)); + factories_.push_back(std::make_shared<ChatStateParserFactory>()); + factories_.push_back(std::make_shared<MUCUserPayloadParserFactory>(this)); + factories_.push_back(std::make_shared<MUCOwnerPayloadParserFactory>(this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<MUCInvitationPayloadParser> >("x", "jabber:x:conference")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<MUCAdminPayloadParser> >("query", "http://jabber.org/protocol/muc#admin")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#user")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#owner")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<NicknameParser> >("nick", "http://jabber.org/protocol/nick")); + factories_.push_back(std::make_shared<JingleParserFactory>(this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<JingleReasonParser> >("reason", "urn:xmpp:jingle:1")); + factories_.push_back(std::make_shared<JingleContentPayloadParserFactory>(this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<JingleIBBTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:ibb:1")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<JingleS5BTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:s5b:1")); + factories_.push_back(std::make_shared<JingleFileTransferDescriptionParserFactory>(this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<StreamInitiationFileInfoParser> >("file", "http://jabber.org/protocol/si/profile/file-transfer")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<JingleFileTransferFileInfoParser> >("file", "urn:xmpp:jingle:apps:file-transfer:4")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<JingleFileTransferHashParser> >("checksum")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<S5BProxyRequestParser> >("query", "http://jabber.org/protocol/bytestreams")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<WhiteboardParser> >("wb", "http://swift.im/whiteboard")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<UserLocationParser> >("geoloc", "http://jabber.org/protocol/geoloc")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<UserTuneParser> >("tune", "http://jabber.org/protocol/tune")); + factories_.push_back(std::make_shared<DeliveryReceiptParserFactory>()); + factories_.push_back(std::make_shared<DeliveryReceiptRequestParserFactory>()); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<IdleParser> >("idle", "urn:xmpp:idle:1")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<PubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<PubSubOwnerPubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub#owner", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<PubSubEventParser> >("event", "http://jabber.org/protocol/pubsub#event", this)); + factories_.push_back(std::make_shared<PubSubErrorParserFactory>()); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<ResultSetParser> >("set", "http://jabber.org/protocol/rsm")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<ForwardedParser> >("forwarded", "urn:xmpp:forward:0", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<MAMResultParser> >("result", "urn:xmpp:mam:0", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<MAMQueryParser> >("query", "urn:xmpp:mam:0")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<MAMFinParser> >("fin", "urn:xmpp:mam:0")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<IsodeIQDelegationParser> >("delegate", "http://isode.com/iq_delegation", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<CarbonsEnableParser> >("enable", "urn:xmpp:carbons:2")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<CarbonsDisableParser> >("disable", "urn:xmpp:carbons:2")); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<CarbonsReceivedParser> >("received", "urn:xmpp:carbons:2", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory2<CarbonsSentParser> >("sent", "urn:xmpp:carbons:2", this)); + factories_.push_back(std::make_shared<GenericPayloadParserFactory<CarbonsPrivateParser> >("private", "urn:xmpp:carbons:2")); - foreach(shared_ptr<PayloadParserFactory> factory, factories_) { + foreach(std::shared_ptr<PayloadParserFactory> factory, factories_) { addFactory(factory.get()); } defaultFactory_ = new RawXMLPayloadParserFactory(); @@ -179,7 +177,7 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() { FullPayloadParserFactoryCollection::~FullPayloadParserFactoryCollection() { setDefaultFactory(nullptr); delete defaultFactory_; - foreach(shared_ptr<PayloadParserFactory> factory, factories_) { + foreach(std::shared_ptr<PayloadParserFactory> factory, factories_) { removeFactory(factory.get()); } } diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h index 210e85e..e59a6e0 100644 --- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h +++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParserFactory.h> #include <Swiften/Parser/PayloadParserFactoryCollection.h> @@ -21,7 +20,7 @@ namespace Swift { ~FullPayloadParserFactoryCollection(); private: - std::vector< boost::shared_ptr<PayloadParserFactory> > factories_; + std::vector< std::shared_ptr<PayloadParserFactory> > factories_; PayloadParserFactory* defaultFactory_; }; } diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp index 6bdd517..ddcd425 100644 --- a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp +++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -46,7 +46,7 @@ void IsodeIQDelegationParser::handleEndElement(const std::string& element, const } if (level == 1) { - getPayloadInternal()->setForward(boost::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload())); + getPayloadInternal()->setForward(std::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload())); currentPayloadParser.reset(); } } diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h index cf86a1a..eaedd27 100644 --- a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h +++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp index 30404f3..3a01676 100644 --- a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp @@ -59,12 +59,12 @@ namespace Swift { } if (level == 1) { - boost::shared_ptr<JingleTransportPayload> transport = boost::dynamic_pointer_cast<JingleTransportPayload>(currentPayloadParser->getPayload()); + std::shared_ptr<JingleTransportPayload> transport = std::dynamic_pointer_cast<JingleTransportPayload>(currentPayloadParser->getPayload()); if (transport) { getPayloadInternal()->addTransport(transport); } - boost::shared_ptr<JingleDescription> description = boost::dynamic_pointer_cast<JingleDescription>(currentPayloadParser->getPayload()); + std::shared_ptr<JingleDescription> description = std::dynamic_pointer_cast<JingleDescription>(currentPayloadParser->getPayload()); if (description) { getPayloadInternal()->addDescription(description); } diff --git a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h index eaa8ff6..fde07cb 100644 --- a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -31,7 +31,7 @@ class SWIFTEN_API JingleContentPayloadParser : public GenericPayloadParser<Jingl private: PayloadParserFactoryCollection* factories; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp index 32a6e4c..1e433a6 100644 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp +++ b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp @@ -46,7 +46,7 @@ void JingleFileTransferDescriptionParser::handleEndElement(const std::string& el } if (level == 0) { - boost::shared_ptr<JingleFileTransferFileInfo> info = boost::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload()); + std::shared_ptr<JingleFileTransferFileInfo> info = std::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload()); if (info) { getPayloadInternal()->setFileInfo(*info); } diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h index c7f80e1..b148d9b 100644 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h +++ b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ class SWIFTEN_API JingleFileTransferDescriptionParser : public GenericPayloadPar private: PayloadParserFactoryCollection* factories; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp index a890a99..4adf3bd 100644 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp +++ b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp @@ -12,8 +12,9 @@ #include <Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h> +#include <memory> + #include <boost/algorithm/string.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Parser/GenericPayloadParserFactory.h> #include <Swiften/Parser/PayloadParserFactory.h> @@ -26,7 +27,7 @@ JingleFileTransferHashParser::JingleFileTransferHashParser() : level(0) { void JingleFileTransferHashParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == 1 && element == "file") { - currentPayloadParser = boost::make_shared<JingleFileTransferFileInfoParser>(); + currentPayloadParser = std::make_shared<JingleFileTransferFileInfoParser>(); } if (level >= 1 && currentPayloadParser) { @@ -42,7 +43,7 @@ void JingleFileTransferHashParser::handleEndElement(const std::string& element, } if (level == 1) { - boost::shared_ptr<JingleFileTransferFileInfo> info = boost::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload()); + std::shared_ptr<JingleFileTransferFileInfo> info = std::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload()); if (info) { getPayloadInternal()->setFileInfo(*info); } diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h index 8a28d5a..1b47921 100644 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h +++ b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,7 +28,7 @@ public: private: int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/JingleParser.cpp b/Swiften/Parser/PayloadParsers/JingleParser.cpp index 48507af..a88a5b2 100644 --- a/Swiften/Parser/PayloadParsers/JingleParser.cpp +++ b/Swiften/Parser/PayloadParsers/JingleParser.cpp @@ -57,17 +57,17 @@ namespace Swift { } if (level == 1) { - boost::shared_ptr<JinglePayload::Reason> reason = boost::dynamic_pointer_cast<JinglePayload::Reason>(currentPayloadParser->getPayload()); + std::shared_ptr<JinglePayload::Reason> reason = std::dynamic_pointer_cast<JinglePayload::Reason>(currentPayloadParser->getPayload()); if (reason) { getPayloadInternal()->setReason(*reason); } - boost::shared_ptr<JingleContentPayload> payload = boost::dynamic_pointer_cast<JingleContentPayload>(currentPayloadParser->getPayload()); + std::shared_ptr<JingleContentPayload> payload = std::dynamic_pointer_cast<JingleContentPayload>(currentPayloadParser->getPayload()); if (payload) { getPayloadInternal()->addContent(payload); } - boost::shared_ptr<JingleFileTransferHash> hash = boost::dynamic_pointer_cast<JingleFileTransferHash>(currentPayloadParser->getPayload()); + std::shared_ptr<JingleFileTransferHash> hash = std::dynamic_pointer_cast<JingleFileTransferHash>(currentPayloadParser->getPayload()); if (hash) { getPayloadInternal()->addPayload(hash); } diff --git a/Swiften/Parser/PayloadParsers/JingleParser.h b/Swiften/Parser/PayloadParsers/JingleParser.h index 28850e2..1dcc9e7 100644 --- a/Swiften/Parser/PayloadParsers/JingleParser.h +++ b/Swiften/Parser/PayloadParsers/JingleParser.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,7 +33,7 @@ class SWIFTEN_API JingleParser : public GenericPayloadParser<JinglePayload> { private: PayloadParserFactoryCollection* factories; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/MAMFinParser.cpp b/Swiften/Parser/PayloadParsers/MAMFinParser.cpp index a29a7c4..88dd571 100644 --- a/Swiften/Parser/PayloadParsers/MAMFinParser.cpp +++ b/Swiften/Parser/PayloadParsers/MAMFinParser.cpp @@ -30,7 +30,7 @@ void MAMFinParser::handleStartElement(const std::string& element, const std::str } else if (level_ == PayloadLevel) { if (element == "set" && ns == "http://jabber.org/protocol/rsm") { - resultSetParser_ = boost::make_shared<ResultSetParser>(); + resultSetParser_ = std::make_shared<ResultSetParser>(); } } @@ -49,7 +49,7 @@ void MAMFinParser::handleEndElement(const std::string& element, const std::strin } if (resultSetParser_ && level_ == PayloadLevel) { /* done parsing nested ResultSet */ - getPayloadInternal()->setResultSet(boost::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload())); + getPayloadInternal()->setResultSet(std::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload())); resultSetParser_.reset(); } } diff --git a/Swiften/Parser/PayloadParsers/MAMFinParser.h b/Swiften/Parser/PayloadParsers/MAMFinParser.h index 2e805ad..f08231e 100644 --- a/Swiften/Parser/PayloadParsers/MAMFinParser.h +++ b/Swiften/Parser/PayloadParsers/MAMFinParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -30,7 +30,7 @@ namespace Swift { }; private: - boost::shared_ptr<ResultSetParser> resultSetParser_; + std::shared_ptr<ResultSetParser> resultSetParser_; int level_; }; } diff --git a/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp b/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp index 41fbbb7..4919d22 100644 --- a/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp +++ b/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp @@ -29,9 +29,9 @@ void MAMQueryParser::handleStartElement(const std::string& element, const std::s } } else if (level_ == PayloadLevel) { if (element == "x" && ns == "jabber:x:data") { - formParser_ = boost::make_shared<FormParser>(); + formParser_ = std::make_shared<FormParser>(); } else if (element == "set" && ns == "http://jabber.org/protocol/rsm") { - resultSetParser_ = boost::make_shared<ResultSetParser>(); + resultSetParser_ = std::make_shared<ResultSetParser>(); } } @@ -54,7 +54,7 @@ void MAMQueryParser::handleEndElement(const std::string& element, const std::str } if (formParser_ && level_ == PayloadLevel) { /* done parsing nested Form */ - getPayloadInternal()->setForm(boost::dynamic_pointer_cast<Form>(formParser_->getPayload())); + getPayloadInternal()->setForm(std::dynamic_pointer_cast<Form>(formParser_->getPayload())); formParser_.reset(); } @@ -63,7 +63,7 @@ void MAMQueryParser::handleEndElement(const std::string& element, const std::str } if (resultSetParser_ && level_ == PayloadLevel) { /* done parsing nested ResultSet */ - getPayloadInternal()->setResultSet(boost::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload())); + getPayloadInternal()->setResultSet(std::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload())); resultSetParser_.reset(); } } diff --git a/Swiften/Parser/PayloadParsers/MAMQueryParser.h b/Swiften/Parser/PayloadParsers/MAMQueryParser.h index 4f5bd47..7e4b58a 100644 --- a/Swiften/Parser/PayloadParsers/MAMQueryParser.h +++ b/Swiften/Parser/PayloadParsers/MAMQueryParser.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/MAMQuery.h> @@ -33,8 +32,8 @@ namespace Swift { }; private: - boost::shared_ptr<FormParser> formParser_; - boost::shared_ptr<ResultSetParser> resultSetParser_; + std::shared_ptr<FormParser> formParser_; + std::shared_ptr<ResultSetParser> resultSetParser_; int level_; }; } diff --git a/Swiften/Parser/PayloadParsers/MAMResultParser.cpp b/Swiften/Parser/PayloadParsers/MAMResultParser.cpp index e39ed94..b810b87 100644 --- a/Swiften/Parser/PayloadParsers/MAMResultParser.cpp +++ b/Swiften/Parser/PayloadParsers/MAMResultParser.cpp @@ -28,7 +28,7 @@ void MAMResultParser::handleStartElement(const std::string& element, const std:: } } else if (level_ == PayloadLevel) { if (element == "forwarded" && ns == "urn:xmpp:forward:0") { - payloadParser_ = boost::make_shared<ForwardedParser>(factories_); + payloadParser_ = std::make_shared<ForwardedParser>(factories_); } } @@ -47,7 +47,7 @@ void MAMResultParser::handleEndElement(const std::string& element, const std::st } if (payloadParser_ && level_ == PayloadLevel) { /* done parsing nested stanza */ - getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<Forwarded>(payloadParser_->getPayload())); + getPayloadInternal()->setPayload(std::dynamic_pointer_cast<Forwarded>(payloadParser_->getPayload())); payloadParser_.reset(); } } diff --git a/Swiften/Parser/PayloadParsers/MAMResultParser.h b/Swiften/Parser/PayloadParsers/MAMResultParser.h index 5177f8b..e68e365 100644 --- a/Swiften/Parser/PayloadParsers/MAMResultParser.h +++ b/Swiften/Parser/PayloadParsers/MAMResultParser.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/MAMResult.h> @@ -33,7 +32,7 @@ namespace Swift { }; private: - boost::shared_ptr<ForwardedParser> payloadParser_; + std::shared_ptr<ForwardedParser> payloadParser_; PayloadParserFactoryCollection* factories_; int level_; }; diff --git a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp index 20e5f2b..14d6d16 100644 --- a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp @@ -18,7 +18,7 @@ void MUCInvitationPayloadParser::handleTree(ParserElement::ref root) { invite->setReason(root->getAttributes().getAttribute("reason")); invite->setThread(root->getAttributes().getAttribute("thread")); ParserElement::ref impromptuNode = root->getChild("impromptu", "http://swift.im/impromptu"); - invite->setIsImpromptu(!boost::dynamic_pointer_cast<NullParserElement>(impromptuNode)); + invite->setIsImpromptu(!std::dynamic_pointer_cast<NullParserElement>(impromptuNode)); } } diff --git a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h index 6502512..4c1f048 100644 --- a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h +++ b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -27,6 +27,6 @@ namespace Swift { private: PayloadParserFactoryCollection* factories; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h index 761a019..c1d695c 100644 --- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h +++ b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -27,6 +27,6 @@ namespace Swift { private: PayloadParserFactoryCollection* factories; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h index 1d3f4fd..6c38f37 100644 --- a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp index 8a11553..9c44f31 100644 --- a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubAffiliationsParser::handleStartElement(const std::string& element, co if (level == 1) { if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubAffiliationParser>(parsers); + currentPayloadParser = std::make_shared<PubSubAffiliationParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubAffiliationsParser::handleEndElement(const std::string& element, cons if (level == 1) { if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub") { - getPayloadInternal()->addAffiliation(boost::dynamic_pointer_cast<PubSubAffiliation>(currentPayloadParser->getPayload())); + getPayloadInternal()->addAffiliation(std::dynamic_pointer_cast<PubSubAffiliation>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h index a26942f..2f80dbd 100644 --- a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp index f3af12f..0abfe0b 100644 --- a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,7 +28,7 @@ void PubSubConfigureParser::handleStartElement(const std::string& element, const if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - currentPayloadParser = boost::make_shared<FormParser>(); + currentPayloadParser = std::make_shared<FormParser>(); } } @@ -47,7 +47,7 @@ void PubSubConfigureParser::handleEndElement(const std::string& element, const s if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); + getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h index 33a3da5..16f1cd9 100644 --- a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubCreateParser.h b/Swiften/Parser/PayloadParsers/PubSubCreateParser.h index 3f277ed..fa1f98c 100644 --- a/Swiften/Parser/PayloadParsers/PubSubCreateParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubCreateParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h index b0f0e25..e4d4834 100644 --- a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h index 749fb1a..adc36e9 100644 --- a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> diff --git a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h index c2cc9f6..5e1fc45 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp index bb167e3..bfa9cf5 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,10 +33,10 @@ void PubSubEventCollectionParser::handleStartElement(const std::string& element, if (level == 1) { if (element == "disassociate" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventDisassociateParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventDisassociateParser>(parsers); } if (element == "associate" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventAssociateParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventAssociateParser>(parsers); } } @@ -55,10 +55,10 @@ void PubSubEventCollectionParser::handleEndElement(const std::string& element, c if (level == 1) { if (element == "disassociate" && ns == "http://jabber.org/protocol/pubsub#event") { - getPayloadInternal()->setDisassociate(boost::dynamic_pointer_cast<PubSubEventDisassociate>(currentPayloadParser->getPayload())); + getPayloadInternal()->setDisassociate(std::dynamic_pointer_cast<PubSubEventDisassociate>(currentPayloadParser->getPayload())); } if (element == "associate" && ns == "http://jabber.org/protocol/pubsub#event") { - getPayloadInternal()->setAssociate(boost::dynamic_pointer_cast<PubSubEventAssociate>(currentPayloadParser->getPayload())); + getPayloadInternal()->setAssociate(std::dynamic_pointer_cast<PubSubEventAssociate>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h index a2b1663..ffdafcf 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp index d118ab8..73112da 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubEventConfigurationParser::handleStartElement(const std::string& eleme if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - currentPayloadParser = boost::make_shared<FormParser>(); + currentPayloadParser = std::make_shared<FormParser>(); } } @@ -51,7 +51,7 @@ void PubSubEventConfigurationParser::handleEndElement(const std::string& element if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); + getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h index e3fcab6..a79ee07 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp index 167a682..da308db 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubEventDeleteParser::handleStartElement(const std::string& element, con if (level == 1) { if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventRedirectParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventRedirectParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubEventDeleteParser::handleEndElement(const std::string& element, const if (level == 1) { if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#event") { - getPayloadInternal()->setRedirects(boost::dynamic_pointer_cast<PubSubEventRedirect>(currentPayloadParser->getPayload())); + getPayloadInternal()->setRedirects(std::dynamic_pointer_cast<PubSubEventRedirect>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h index 24d6b6b..270430e 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h index 6835602..9088359 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h index 4b34a26..bd2e72e 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp index 90d3fe8..0264275 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,10 +33,10 @@ void PubSubEventItemsParser::handleStartElement(const std::string& element, cons if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventItemParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventItemParser>(parsers); } if (element == "retract" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventRetractParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventRetractParser>(parsers); } } @@ -55,10 +55,10 @@ void PubSubEventItemsParser::handleEndElement(const std::string& element, const if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub#event") { - getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubEventItem>(currentPayloadParser->getPayload())); + getPayloadInternal()->addItem(std::dynamic_pointer_cast<PubSubEventItem>(currentPayloadParser->getPayload())); } if (element == "retract" && ns == "http://jabber.org/protocol/pubsub#event") { - getPayloadInternal()->addRetract(boost::dynamic_pointer_cast<PubSubEventRetract>(currentPayloadParser->getPayload())); + getPayloadInternal()->addRetract(std::dynamic_pointer_cast<PubSubEventRetract>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h index 6cb0148..34b3669 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp index ae0439c..7677369 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,22 +33,22 @@ void PubSubEventParser::handleStartElement(const std::string& element, const std if (level == 1) { if (element == "items" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventItemsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventItemsParser>(parsers); } if (element == "collection" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventCollectionParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventCollectionParser>(parsers); } if (element == "purge" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventPurgeParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventPurgeParser>(parsers); } if (element == "configuration" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventConfigurationParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventConfigurationParser>(parsers); } if (element == "delete" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventDeleteParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventDeleteParser>(parsers); } if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#event") { - currentPayloadParser = boost::make_shared<PubSubEventSubscriptionParser>(parsers); + currentPayloadParser = std::make_shared<PubSubEventSubscriptionParser>(parsers); } } @@ -67,7 +67,7 @@ void PubSubEventParser::handleEndElement(const std::string& element, const std:: if (level == 1) { if (currentPayloadParser) { - getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubEventPayload>(currentPayloadParser->getPayload())); + getPayloadInternal()->setPayload(std::dynamic_pointer_cast<PubSubEventPayload>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventParser.h b/Swiften/Parser/PayloadParsers/PubSubEventParser.h index a4fc5a6..3b231b0 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h index 7afc754..e1b1d05 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h index ecdeca5..63f0f98 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h index 8bc6a9c..eacaac2 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h index b43e64a..b1d065a 100644 --- a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubItemParser.h b/Swiften/Parser/PayloadParsers/PubSubItemParser.h index 39d24bc..c6e4ccf 100644 --- a/Swiften/Parser/PayloadParsers/PubSubItemParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubItemParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp index 643eb85..7cbeb70 100644 --- a/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -42,7 +42,7 @@ void PubSubItemsParser::handleStartElement(const std::string& element, const std if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers); + currentPayloadParser = std::make_shared<PubSubItemParser>(parsers); } } @@ -61,7 +61,7 @@ void PubSubItemsParser::handleEndElement(const std::string& element, const std:: if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub") { - getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload())); + getPayloadInternal()->addItem(std::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubItemsParser.h b/Swiften/Parser/PayloadParsers/PubSubItemsParser.h index 84c8f79..ad6e746 100644 --- a/Swiften/Parser/PayloadParsers/PubSubItemsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubItemsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp index 2683ae6..04d11a1 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -40,7 +40,7 @@ void PubSubOptionsParser::handleStartElement(const std::string& element, const s if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - currentPayloadParser = boost::make_shared<FormParser>(); + currentPayloadParser = std::make_shared<FormParser>(); } } @@ -59,7 +59,7 @@ void PubSubOptionsParser::handleEndElement(const std::string& element, const std if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); + getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h index 52d374c..b4ee87a 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h index 972930c..8b74106 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp index 247bf4c..265c404 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubOwnerAffiliationsParser::handleStartElement(const std::string& elemen if (level == 1) { if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerAffiliationParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerAffiliationParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubOwnerAffiliationsParser::handleEndElement(const std::string& element, if (level == 1) { if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub#owner") { - getPayloadInternal()->addAffiliation(boost::dynamic_pointer_cast<PubSubOwnerAffiliation>(currentPayloadParser->getPayload())); + getPayloadInternal()->addAffiliation(std::dynamic_pointer_cast<PubSubOwnerAffiliation>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h index 870d809..52c7fa9 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp index 62dd1ac..ce9ccff 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubOwnerConfigureParser::handleStartElement(const std::string& element, if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - currentPayloadParser = boost::make_shared<FormParser>(); + currentPayloadParser = std::make_shared<FormParser>(); } } @@ -51,7 +51,7 @@ void PubSubOwnerConfigureParser::handleEndElement(const std::string& element, co if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); + getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h index 914a309..e23e257 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp index 36ccbaf..e65aa2a 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,7 +28,7 @@ void PubSubOwnerDefaultParser::handleStartElement(const std::string& element, co if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - currentPayloadParser = boost::make_shared<FormParser>(); + currentPayloadParser = std::make_shared<FormParser>(); } } @@ -47,7 +47,7 @@ void PubSubOwnerDefaultParser::handleEndElement(const std::string& element, cons if (level == 1) { if (element == "x" && ns == "jabber:x:data") { - getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); + getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h index 3106854..82e4825 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp index 047fe8b..0051ee7 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubOwnerDeleteParser::handleStartElement(const std::string& element, con if (level == 1) { if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerRedirectParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerRedirectParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubOwnerDeleteParser::handleEndElement(const std::string& element, const if (level == 1) { if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#owner") { - getPayloadInternal()->setRedirect(boost::dynamic_pointer_cast<PubSubOwnerRedirect>(currentPayloadParser->getPayload())); + getPayloadInternal()->setRedirect(std::dynamic_pointer_cast<PubSubOwnerRedirect>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h index f56ae3c..99a8c0e 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp index aa7310e..ca73b00 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,22 +33,22 @@ void PubSubOwnerPubSubParser::handleStartElement(const std::string& element, con if (level == 1) { if (element == "configure" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerConfigureParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerConfigureParser>(parsers); } if (element == "subscriptions" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerSubscriptionsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerSubscriptionsParser>(parsers); } if (element == "default" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerDefaultParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerDefaultParser>(parsers); } if (element == "purge" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerPurgeParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerPurgeParser>(parsers); } if (element == "affiliations" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerAffiliationsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerAffiliationsParser>(parsers); } if (element == "delete" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerDeleteParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerDeleteParser>(parsers); } } @@ -67,7 +67,7 @@ void PubSubOwnerPubSubParser::handleEndElement(const std::string& element, const if (level == 1) { if (currentPayloadParser) { - getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubOwnerPayload>(currentPayloadParser->getPayload())); + getPayloadInternal()->setPayload(std::dynamic_pointer_cast<PubSubOwnerPayload>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h index d4d67f9..35420f7 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h index 364de29..044ac04 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h index fd48dbb..5714d46 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h index 46df820..48e2786 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp index e08d782..da82600 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubOwnerSubscriptionsParser::handleStartElement(const std::string& eleme if (level == 1) { if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#owner") { - currentPayloadParser = boost::make_shared<PubSubOwnerSubscriptionParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOwnerSubscriptionParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubOwnerSubscriptionsParser::handleEndElement(const std::string& element if (level == 1) { if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#owner") { - getPayloadInternal()->addSubscription(boost::dynamic_pointer_cast<PubSubOwnerSubscription>(currentPayloadParser->getPayload())); + getPayloadInternal()->addSubscription(std::dynamic_pointer_cast<PubSubOwnerSubscription>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h index 10c11e4..541d225 100644 --- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubParser.cpp b/Swiften/Parser/PayloadParsers/PubSubParser.cpp index 9c86c21..b527d4c 100644 --- a/Swiften/Parser/PayloadParsers/PubSubParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -38,40 +38,40 @@ PubSubParser::~PubSubParser() { void PubSubParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (level == 1) { if (element == "items" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubItemsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubItemsParser>(parsers); } if (element == "create" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubCreateParser>(parsers); + currentPayloadParser = std::make_shared<PubSubCreateParser>(parsers); } if (element == "publish" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubPublishParser>(parsers); + currentPayloadParser = std::make_shared<PubSubPublishParser>(parsers); } if (element == "affiliations" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubAffiliationsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubAffiliationsParser>(parsers); } if (element == "retract" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubRetractParser>(parsers); + currentPayloadParser = std::make_shared<PubSubRetractParser>(parsers); } if (element == "options" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubOptionsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubOptionsParser>(parsers); } if (element == "configure" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubConfigureParser>(parsers); + currentPayloadParser = std::make_shared<PubSubConfigureParser>(parsers); } if (element == "default" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubDefaultParser>(parsers); + currentPayloadParser = std::make_shared<PubSubDefaultParser>(parsers); } if (element == "subscriptions" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubSubscriptionsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubSubscriptionsParser>(parsers); } if (element == "subscribe" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubSubscribeParser>(parsers); + currentPayloadParser = std::make_shared<PubSubSubscribeParser>(parsers); } if (element == "unsubscribe" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubUnsubscribeParser>(parsers); + currentPayloadParser = std::make_shared<PubSubUnsubscribeParser>(parsers); } if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubSubscriptionParser>(parsers); + currentPayloadParser = std::make_shared<PubSubSubscriptionParser>(parsers); } } @@ -91,25 +91,25 @@ void PubSubParser::handleEndElement(const std::string& element, const std::strin if (level == 1) { if (currentPayloadParser) { if (element == "options" && ns == "http://jabber.org/protocol/pubsub") { - optionsPayload = boost::dynamic_pointer_cast<PubSubOptions>(currentPayloadParser->getPayload()); + optionsPayload = std::dynamic_pointer_cast<PubSubOptions>(currentPayloadParser->getPayload()); } else if (element == "configure" && ns == "http://jabber.org/protocol/pubsub") { - configurePayload = boost::dynamic_pointer_cast<PubSubConfigure>(currentPayloadParser->getPayload()); + configurePayload = std::dynamic_pointer_cast<PubSubConfigure>(currentPayloadParser->getPayload()); } else { - getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubPayload>(currentPayloadParser->getPayload())); + getPayloadInternal()->setPayload(std::dynamic_pointer_cast<PubSubPayload>(currentPayloadParser->getPayload())); } } currentPayloadParser.reset(); } if (level == 0) { - if (boost::shared_ptr<PubSubCreate> create = boost::dynamic_pointer_cast<PubSubCreate>(getPayloadInternal()->getPayload())) { + if (std::shared_ptr<PubSubCreate> create = std::dynamic_pointer_cast<PubSubCreate>(getPayloadInternal()->getPayload())) { if (configurePayload) { create->setConfigure(configurePayload); } } - if (boost::shared_ptr<PubSubSubscribe> subscribe = boost::dynamic_pointer_cast<PubSubSubscribe>(getPayloadInternal()->getPayload())) { + if (std::shared_ptr<PubSubSubscribe> subscribe = std::dynamic_pointer_cast<PubSubSubscribe>(getPayloadInternal()->getPayload())) { if (optionsPayload) { subscribe->setOptions(optionsPayload); } diff --git a/Swiften/Parser/PayloadParsers/PubSubParser.h b/Swiften/Parser/PayloadParsers/PubSubParser.h index a8043fc..1f40ca9 100644 --- a/Swiften/Parser/PayloadParsers/PubSubParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -31,8 +31,8 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; - boost::shared_ptr<PubSubConfigure> configurePayload; - boost::shared_ptr<PubSubOptions> optionsPayload; + std::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PubSubConfigure> configurePayload; + std::shared_ptr<PubSubOptions> optionsPayload; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp b/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp index 3bd3ac0..3fd2951 100644 --- a/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubPublishParser::handleStartElement(const std::string& element, const s if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers); + currentPayloadParser = std::make_shared<PubSubItemParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubPublishParser::handleEndElement(const std::string& element, const std if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub") { - getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload())); + getPayloadInternal()->addItem(std::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubPublishParser.h b/Swiften/Parser/PayloadParsers/PubSubPublishParser.h index 1df7c6f..ad7dd11 100644 --- a/Swiften/Parser/PayloadParsers/PubSubPublishParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubPublishParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp b/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp index e710fad..b011b76 100644 --- a/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -35,7 +35,7 @@ void PubSubRetractParser::handleStartElement(const std::string& element, const s if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers); + currentPayloadParser = std::make_shared<PubSubItemParser>(parsers); } } @@ -54,7 +54,7 @@ void PubSubRetractParser::handleEndElement(const std::string& element, const std if (level == 1) { if (element == "item" && ns == "http://jabber.org/protocol/pubsub") { - getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload())); + getPayloadInternal()->addItem(std::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubRetractParser.h b/Swiften/Parser/PayloadParsers/PubSubRetractParser.h index ece2a52..6bea498 100644 --- a/Swiften/Parser/PayloadParsers/PubSubRetractParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubRetractParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h index 9136f44..4e995dd 100644 --- a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h index 823c086..2b1788f 100644 --- a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp index 5954bf1..4ce83cc 100644 --- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -46,7 +46,7 @@ void PubSubSubscriptionParser::handleStartElement(const std::string& element, co if (level == 1) { if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubSubscribeOptionsParser>(parsers); + currentPayloadParser = std::make_shared<PubSubSubscribeOptionsParser>(parsers); } } @@ -65,7 +65,7 @@ void PubSubSubscriptionParser::handleEndElement(const std::string& element, cons if (level == 1) { if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") { - getPayloadInternal()->setOptions(boost::dynamic_pointer_cast<PubSubSubscribeOptions>(currentPayloadParser->getPayload())); + getPayloadInternal()->setOptions(std::dynamic_pointer_cast<PubSubSubscribeOptions>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h index 771a74a..7075a99 100644 --- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp index 30198a5..3badaa2 100644 --- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ void PubSubSubscriptionsParser::handleStartElement(const std::string& element, c if (level == 1) { if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") { - currentPayloadParser = boost::make_shared<PubSubSubscriptionParser>(parsers); + currentPayloadParser = std::make_shared<PubSubSubscriptionParser>(parsers); } } @@ -51,7 +51,7 @@ void PubSubSubscriptionsParser::handleEndElement(const std::string& element, con if (level == 1) { if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") { - getPayloadInternal()->addSubscription(boost::dynamic_pointer_cast<PubSubSubscription>(currentPayloadParser->getPayload())); + getPayloadInternal()->addSubscription(std::dynamic_pointer_cast<PubSubSubscription>(currentPayloadParser->getPayload())); } currentPayloadParser.reset(); } diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h index 9f18376..2371a56 100644 --- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h index d33d33c..d63dd70 100644 --- a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h +++ b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -29,6 +29,6 @@ namespace Swift { private: PayloadParserFactoryCollection* parsers; int level; - boost::shared_ptr<PayloadParser> currentPayloadParser; + std::shared_ptr<PayloadParser> currentPayloadParser; }; } diff --git a/Swiften/Parser/PayloadParsers/ResultSetParser.h b/Swiften/Parser/PayloadParsers/ResultSetParser.h index 335a798..aa18ae6 100644 --- a/Swiften/Parser/PayloadParsers/ResultSetParser.h +++ b/Swiften/Parser/PayloadParsers/ResultSetParser.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp index b3a8c67..3dd5811 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp @@ -63,7 +63,7 @@ void SecurityLabelParser::handleCharacterData(const std::string& data) { } } -boost::shared_ptr<SecurityLabel> SecurityLabelParser::getLabelPayload() const { +std::shared_ptr<SecurityLabel> SecurityLabelParser::getLabelPayload() const { return getPayloadInternal(); } diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h index d5b0466..cc444a4 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h +++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ namespace Swift { virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); virtual void handleEndElement(const std::string& element, const std::string&); virtual void handleCharacterData(const std::string& data); - boost::shared_ptr<SecurityLabel> getLabelPayload() const; + std::shared_ptr<SecurityLabel> getLabelPayload() const; private: enum Level { TopLevel = 0, diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp index 024d587..0de7544 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp @@ -6,7 +6,7 @@ #include <Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Parser/PayloadParsers/SecurityLabelParser.h> #include <Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h> @@ -29,7 +29,7 @@ void SecurityLabelsCatalogParser::handleStartElement(const std::string& element, getPayloadInternal()->setDescription(attributes.getAttribute("desc")); } else if (level_ == ItemLevel && element == "item" && ns == "urn:xmpp:sec-label:catalog:2") { - currentItem_ = boost::make_shared<SecurityLabelsCatalog::Item>(); + currentItem_ = std::make_shared<SecurityLabelsCatalog::Item>(); currentItem_->setSelector(attributes.getAttribute("selector")); currentItem_->setIsDefault(attributes.getBoolAttribute("default", false)); } @@ -51,7 +51,7 @@ void SecurityLabelsCatalogParser::handleEndElement(const std::string& element, c labelParser_->handleEndElement(element, ns); } if (level_ == LabelLevel && labelParser_ && currentItem_) { - boost::shared_ptr<SecurityLabel> currentLabel = labelParser_->getLabelPayload(); + std::shared_ptr<SecurityLabel> currentLabel = labelParser_->getLabelPayload(); assert(currentLabel); currentItem_->setLabel(currentLabel); delete labelParser_; diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h index bb44369..edfa86b 100644 --- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h +++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,6 +33,6 @@ namespace Swift { int level_; SecurityLabelParserFactory* labelParserFactory_; SecurityLabelParser* labelParser_; - boost::shared_ptr<SecurityLabelsCatalog::Item> currentItem_; + std::shared_ptr<SecurityLabelsCatalog::Item> currentItem_; }; } diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp index 12dace9..ca6f644 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp @@ -88,7 +88,7 @@ void StreamInitiationParser::handleEndElement(const std::string& element, const else if (formParser) { Form::ref form = formParser->getPayloadInternal(); if (form) { - FormField::ref field = boost::dynamic_pointer_cast<FormField>(form->getField("stream-method")); + FormField::ref field = std::dynamic_pointer_cast<FormField>(form->getField("stream-method")); if (field) { if (form->getType() == Form::FormType) { foreach (const FormField::Option& option, field->getOptions()) { diff --git a/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp index f85efb2..b5b9995 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp @@ -73,14 +73,14 @@ class CarbonsParserTest : public CppUnit::TestFixture { CarbonsReceived::ref received = parser.getPayload<CarbonsReceived>(); CPPUNIT_ASSERT(received); - boost::shared_ptr<Forwarded> forwarded = received->getForwarded(); + std::shared_ptr<Forwarded> forwarded = received->getForwarded(); CPPUNIT_ASSERT(forwarded); - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(forwarded->getStanza()); + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(forwarded->getStanza()); CPPUNIT_ASSERT(message); CPPUNIT_ASSERT_EQUAL(JID("juliet@capulet.example/balcony"), message->getFrom()); - boost::shared_ptr<Thread> thread = message->getPayload<Thread>(); + std::shared_ptr<Thread> thread = message->getPayload<Thread>(); CPPUNIT_ASSERT(thread); CPPUNIT_ASSERT_EQUAL(std::string("0e3141cd80894871a68e6fe6b1ec56fa"), thread->getText()); } @@ -105,10 +105,10 @@ class CarbonsParserTest : public CppUnit::TestFixture { CarbonsSent::ref sent = parser.getPayload<CarbonsSent>(); CPPUNIT_ASSERT(sent); - boost::shared_ptr<Forwarded> forwarded = sent->getForwarded(); + std::shared_ptr<Forwarded> forwarded = sent->getForwarded(); CPPUNIT_ASSERT(forwarded); - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(forwarded->getStanza()); + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(forwarded->getStanza()); CPPUNIT_ASSERT(message); CPPUNIT_ASSERT_EQUAL(JID("juliet@capulet.example/balcony"), message->getTo()); } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp index d18e1b4..d93fd1f 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp @@ -4,6 +4,12 @@ * See http://www.opensource.org/licenses/bsd-license.php for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -25,7 +31,7 @@ class DeliveryReceiptParserTest : public CppUnit::TestFixture { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse("<request xmlns='urn:xmpp:receipts'/>")); - DeliveryReceiptRequest::ref request = boost::dynamic_pointer_cast<DeliveryReceiptRequest>(parser.getPayload()); + DeliveryReceiptRequest::ref request = std::dynamic_pointer_cast<DeliveryReceiptRequest>(parser.getPayload()); CPPUNIT_ASSERT(request); } @@ -34,7 +40,7 @@ class DeliveryReceiptParserTest : public CppUnit::TestFixture { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse("<received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>")); - DeliveryReceipt::ref receipt = boost::dynamic_pointer_cast<DeliveryReceipt>(parser.getPayload()); + DeliveryReceipt::ref receipt = std::dynamic_pointer_cast<DeliveryReceipt>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(std::string("richard2-4.1.247"), receipt->getReceivedID()); } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp index c23b1d0..6e866fc 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -32,7 +32,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture { "<feature var=\"baz-feature\"/>" "</query>")); - DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); + DiscoInfo::ref payload = std::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size())); CPPUNIT_ASSERT_EQUAL(std::string("Swift"), payload->getIdentities()[0].getName()); CPPUNIT_ASSERT_EQUAL(std::string("pc"), payload->getIdentities()[0].getType()); @@ -61,7 +61,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture { "<feature var=\"baz-feature\"/>" "</query>")); - DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); + DiscoInfo::ref payload = std::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size())); CPPUNIT_ASSERT_EQUAL(std::string("Swift"), payload->getIdentities()[0].getName()); CPPUNIT_ASSERT_EQUAL(std::string("pc"), payload->getIdentities()[0].getType()); @@ -91,7 +91,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture { "<feature var=\"bar-feature\"/>" "</query>")); - DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); + DiscoInfo::ref payload = std::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(payload->getExtensions().size())); CPPUNIT_ASSERT_EQUAL(std::string("Bot Configuration"), payload->getExtensions()[0]->getTitle()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getFeatures().size())); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp index 01db978..977ef8e 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -27,7 +33,7 @@ class DiscoItemsParserTest : public CppUnit::TestFixture { "<item jid='responder@domain' node='config' name='Configure Service'/>" "</query>")); - boost::shared_ptr<DiscoItems> payload = boost::dynamic_pointer_cast<DiscoItems>(parser.getPayload()); + std::shared_ptr<DiscoItems> payload = std::dynamic_pointer_cast<DiscoItems>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getItems().size())); CPPUNIT_ASSERT_EQUAL(std::string("List Service Configurations"), payload->getItems()[0].getName()); CPPUNIT_ASSERT_EQUAL(std::string("list"), payload->getItems()[0].getNode()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp index 529d573..5402614 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp @@ -29,7 +29,7 @@ class ErrorParserTest : public CppUnit::TestFixture { "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>" "</error>")); - ErrorPayload::ref payload = boost::dynamic_pointer_cast<ErrorPayload>(parser.getPayload()); + ErrorPayload::ref payload = std::dynamic_pointer_cast<ErrorPayload>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType()); CPPUNIT_ASSERT_EQUAL(std::string("boo"), payload->getText()); @@ -46,11 +46,11 @@ class ErrorParserTest : public CppUnit::TestFixture { "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>" "</error>")); - ErrorPayload::ref payload = boost::dynamic_pointer_cast<ErrorPayload>(parser.getPayload()); + ErrorPayload::ref payload = std::dynamic_pointer_cast<ErrorPayload>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition()); CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType()); CPPUNIT_ASSERT_EQUAL(std::string("boo"), payload->getText()); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<Delay>(payload->getPayload())); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<Delay>(payload->getPayload())); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp index 4ffc776..ace6bcb 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp @@ -203,7 +203,7 @@ class FormParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("first"), item[0]->getName()); CPPUNIT_ASSERT_EQUAL(std::string("Montague"), item[1]->getValues()[0]); CPPUNIT_ASSERT_EQUAL(std::string("last"), item[1]->getName()); - boost::shared_ptr<FormField> jidField = item[2]; + std::shared_ptr<FormField> jidField = item[2]; CPPUNIT_ASSERT_EQUAL(JID("benvolio@montague.net"), jidField->getJIDSingleValue()); CPPUNIT_ASSERT_EQUAL(std::string("jid"), item[2]->getName()); CPPUNIT_ASSERT_EQUAL(std::string("male"), item[3]->getValues()[0]); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp index 30af3ec..a807d4e 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp @@ -35,12 +35,12 @@ class ForwardedParserTest : public CppUnit::TestFixture "<iq xmlns=\"jabber:client\" type=\"get\" from=\"kindanormal@example.com/IM\" to=\"stupidnewbie@example.com\" id=\"id0\"/>" "</forwarded>")); - boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); + std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getDelay()); CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(payload->getDelay()->getStamp())); - boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(payload->getStanza()); + std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(payload->getStanza()); CPPUNIT_ASSERT(!!iq); CPPUNIT_ASSERT_EQUAL(JID("stupidnewbie@example.com"), iq->getTo()); CPPUNIT_ASSERT_EQUAL(JID("kindanormal@example.com/IM"), iq->getFrom()); @@ -58,12 +58,12 @@ class ForwardedParserTest : public CppUnit::TestFixture "</message>" "</forwarded>")); - boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); + std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getDelay()); CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(payload->getDelay()->getStamp())); - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(payload->getStanza()); + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(payload->getStanza()); CPPUNIT_ASSERT(!!message); const std::string expectedBody = "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."; CPPUNIT_ASSERT_EQUAL(expectedBody, message->getBody().get()); @@ -81,11 +81,11 @@ class ForwardedParserTest : public CppUnit::TestFixture "</message>" "</forwarded>")); - boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); + std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(!payload->getDelay()); - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(payload->getStanza()); + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(payload->getStanza()); CPPUNIT_ASSERT(!!message); const std::string expectedBody = "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."; CPPUNIT_ASSERT_EQUAL(expectedBody, message->getBody().get()); @@ -102,12 +102,12 @@ class ForwardedParserTest : public CppUnit::TestFixture "<presence xmlns=\"jabber:client\" from=\"alice@wonderland.lit/rabbithole\" to=\"madhatter@wonderland.lit\" type=\"unavailable\"/>" "</forwarded>")); - boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); + std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getDelay()); CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(payload->getDelay()->getStamp())); - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(payload->getStanza()); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(payload->getStanza()); CPPUNIT_ASSERT(!!presence); CPPUNIT_ASSERT_EQUAL(JID("madhatter@wonderland.lit"), presence->getTo()); CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/rabbithole"), presence->getFrom()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp index b045ca5..6a8e2ed 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,7 +25,7 @@ class MAMFinParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse( "<fin xmlns='urn:xmpp:mam:0' queryid='f27' />")); - boost::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>(); + std::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT_EQUAL(false, payload->isComplete()); CPPUNIT_ASSERT_EQUAL(true, payload->isStable()); @@ -46,13 +46,13 @@ class MAMFinParserTest : public CppUnit::TestFixture "</set>" "</fin>")); - boost::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>(); + std::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT_EQUAL(true, payload->isComplete()); CPPUNIT_ASSERT_EQUAL(true, payload->isStable()); CPPUNIT_ASSERT(!!payload->getResultSet()); - boost::shared_ptr<ResultSet> resultSet = payload->getResultSet(); + std::shared_ptr<ResultSet> resultSet = payload->getResultSet(); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp index 8bdefc1..8750c2e 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -41,22 +41,22 @@ class MAMQueryParserTest : public CppUnit::TestFixture "</query>")); - boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); + std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getQueryID()); CPPUNIT_ASSERT_EQUAL(std::string("id0"), *payload->getQueryID()); CPPUNIT_ASSERT_EQUAL(std::string("node1"), *payload->getNode()); CPPUNIT_ASSERT(payload->getForm()); - boost::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE"); + std::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE"); CPPUNIT_ASSERT(fieldType); CPPUNIT_ASSERT_EQUAL(std::string("urn:xmpp:mam:0"), fieldType->getTextSingleValue()); - boost::shared_ptr<FormField> fieldStart = payload->getForm()->getField("start"); + std::shared_ptr<FormField> fieldStart = payload->getForm()->getField("start"); CPPUNIT_ASSERT(fieldStart); CPPUNIT_ASSERT_EQUAL(std::string("2010-08-07T00:00:00Z"), fieldStart->getTextSingleValue()); CPPUNIT_ASSERT(payload->getResultSet()); - boost::shared_ptr<ResultSet> resultSet = payload->getResultSet(); + std::shared_ptr<ResultSet> resultSet = payload->getResultSet(); CPPUNIT_ASSERT(resultSet->getMaxItems()); CPPUNIT_ASSERT_EQUAL(*resultSet->getMaxItems(), 10); } @@ -75,7 +75,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture "</x>" "</query>")); - boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); + std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); CPPUNIT_ASSERT(!!payload && !!payload->getForm() && !!payload->getForm()->getField("FORM_TYPE") && !!payload->getForm()->getField("with")); CPPUNIT_ASSERT_EQUAL(std::string("urn:xmpp:mam:0"), payload->getForm()->getField("FORM_TYPE")->getTextSingleValue()); CPPUNIT_ASSERT_EQUAL(std::string("juliet@capulet.lit"), payload->getForm()->getField("with")->getTextSingleValue()); @@ -97,7 +97,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture "</field>" "</x>" "</query>")); - boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); + std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); CPPUNIT_ASSERT(!!payload && !!payload->getForm() && !!payload->getForm()->getField("FORM_TYPE") && !!payload->getForm()->getField("start") && !!payload->getForm()->getField("start")); CPPUNIT_ASSERT_EQUAL(std::string("urn:xmpp:mam:0"), payload->getForm()->getField("FORM_TYPE")->getTextSingleValue()); CPPUNIT_ASSERT_EQUAL(std::string("2010-06-07T00:00:00Z"), payload->getForm()->getField("start")->getTextSingleValue()); @@ -110,7 +110,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture "<query queryid=\"id0\" xmlns=\"urn:xmpp:mam:0\">" "</query>")); - boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); + std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getQueryID()); CPPUNIT_ASSERT_EQUAL(std::string("id0"), *payload->getQueryID()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp index 7393630..15912b1 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp @@ -35,17 +35,17 @@ class MAMResultParserTest : public CppUnit::TestFixture "</forwarded>" "</result>")); - boost::shared_ptr<MAMResult> payload = parser.getPayload<MAMResult>(); + std::shared_ptr<MAMResult> payload = parser.getPayload<MAMResult>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT_EQUAL(std::string("28482-98726-73623"), payload->getID()); CPPUNIT_ASSERT(payload->getQueryID()); CPPUNIT_ASSERT_EQUAL(std::string("f27"), *payload->getQueryID()); - boost::shared_ptr<Forwarded> forwarded = payload->getPayload(); + std::shared_ptr<Forwarded> forwarded = payload->getPayload(); CPPUNIT_ASSERT(forwarded->getDelay()); CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(forwarded->getDelay()->getStamp())); - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(forwarded->getStanza()); + std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(forwarded->getStanza()); CPPUNIT_ASSERT(!!message); const std::string expectedBody = "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."; CPPUNIT_ASSERT_EQUAL(expectedBody, message->getBody().get()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp index 495aefe..d403872 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,7 +26,7 @@ class MUCAdminPayloadParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<query xmlns=\"http://jabber.org/protocol/muc#admin\"><item affiliation=\"owner\" role=\"visitor\"><actor jid=\"kev@tester.lit\"/><reason>malice</reason></item></query>")); - MUCAdminPayload::ref payload = boost::dynamic_pointer_cast<MUCAdminPayload>(parser.getPayload()); + MUCAdminPayload::ref payload = std::dynamic_pointer_cast<MUCAdminPayload>(parser.getPayload()); MUCItem item = payload->getItems()[0]; CPPUNIT_ASSERT_EQUAL(MUCOccupant::Owner, item.affiliation.get()); CPPUNIT_ASSERT_EQUAL(MUCOccupant::Visitor, item.role.get()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp index a8cf246..18597bd 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp @@ -34,7 +34,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture bool found110 = false; bool found210 = false; - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); foreach (MUCUserPayload::StatusCode status, payload->getStatusCodes()) { if (status.code == 110) found110 = true; @@ -55,7 +55,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"/>")); - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT(payload->getItems().empty()); } @@ -65,9 +65,9 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><destroy jid='alice@wonderland.lit'><reason>bert</reason></destroy></x>")); - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); CPPUNIT_ASSERT(payload); - MUCDestroyPayload::ref destroy = boost::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload()); + MUCDestroyPayload::ref destroy = std::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload()); CPPUNIT_ASSERT(destroy); CPPUNIT_ASSERT_EQUAL(std::string("bert"), destroy->getReason()); CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit"), destroy->getNewVenue()); @@ -78,7 +78,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><invite from='crone1@shakespeare.lit/desktop' to='alice@wonderland.lit/xxx'> <reason>Hey Hecate, this is the place for all good witches!</reason> </invite> <password>cauldronburn</password></x>")); - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT(payload->getInvite()); CPPUNIT_ASSERT(payload->getPassword()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h index 8e871b2..89b990c 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h +++ b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h @@ -48,19 +48,19 @@ namespace Swift { payloadParser->handleCharacterData(data); } - boost::shared_ptr<Payload> getPayload() const { + std::shared_ptr<Payload> getPayload() const { return payloadParser->getPayload(); } template<typename T> - boost::shared_ptr<T> getPayload() const { - return boost::dynamic_pointer_cast<T>(payloadParser->getPayload()); + std::shared_ptr<T> getPayload() const { + return std::dynamic_pointer_cast<T>(payloadParser->getPayload()); } private: XMLParser* xmlParser; FullPayloadParserFactoryCollection factories; - boost::shared_ptr<PayloadParser> payloadParser; + std::shared_ptr<PayloadParser> payloadParser; int level; }; } diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp index e724090..2c89f0f 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -24,7 +24,7 @@ class PriorityParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(parser.parse("<priority>-120</priority>")); - boost::shared_ptr<Priority> payload = boost::dynamic_pointer_cast<Priority>(parser.getPayload()); + std::shared_ptr<Priority> payload = std::dynamic_pointer_cast<Priority>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(-120, payload->getPriority()); } @@ -33,7 +33,7 @@ class PriorityParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(parser.parse("<priority>invalid</priority>")); - boost::shared_ptr<Priority> payload = boost::dynamic_pointer_cast<Priority>(parser.getPayload()); + std::shared_ptr<Priority> payload = std::dynamic_pointer_cast<Priority>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(0, payload->getPriority()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp index 2975485..06f3ae5 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp @@ -36,9 +36,9 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { "</storage>" "</query>")); - boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload()); + std::shared_ptr<PrivateStorage> payload = std::dynamic_pointer_cast<PrivateStorage>(parser.getPayload()); CPPUNIT_ASSERT(payload); - boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload()); + std::shared_ptr<Storage> storage = std::dynamic_pointer_cast<Storage>(payload->getPayload()); CPPUNIT_ASSERT(storage); CPPUNIT_ASSERT_EQUAL(std::string("Alice"), storage->getRooms()[0].nick); CPPUNIT_ASSERT_EQUAL(JID("swift@rooms.swift.im"), storage->getRooms()[0].jid); @@ -49,7 +49,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(parser.parse("<query xmlns='jabber:iq:private'/>")); - boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload()); + std::shared_ptr<PrivateStorage> payload = std::dynamic_pointer_cast<PrivateStorage>(parser.getPayload()); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT(!payload->getPayload()); } @@ -71,9 +71,9 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { "</storage>" "</query>")); - boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload()); + std::shared_ptr<PrivateStorage> payload = std::dynamic_pointer_cast<PrivateStorage>(parser.getPayload()); CPPUNIT_ASSERT(payload); - boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload()); + std::shared_ptr<Storage> storage = std::dynamic_pointer_cast<Storage>(payload->getPayload()); CPPUNIT_ASSERT(storage); CPPUNIT_ASSERT_EQUAL(std::string("Rabbit"), storage->getRooms()[0].nick); } @@ -88,7 +88,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture { "<foo>Bar</foo>" "</query>")); - CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<PrivateStorage>(testling.getPayload())->getPayload()); + CPPUNIT_ASSERT(!std::dynamic_pointer_cast<PrivateStorage>(testling.getPayload())->getPayload()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp index 3e42788..6d77d4a 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -22,13 +28,13 @@ class ReplaceParserTest : public CppUnit::TestFixture { void testParseTrivial() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse("<replace id='bad1' xmlns='http://swift.im/protocol/replace'/>")); - Replace::ref payload = boost::dynamic_pointer_cast <Replace>(parser.getPayload()); + Replace::ref payload = std::dynamic_pointer_cast <Replace>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(std::string("bad1"), payload->getID()); } void testParseChild() { PayloadsParserTester parser; CPPUNIT_ASSERT(parser.parse("<replace id='bad1' xmlns='http://swift.im/protocol/replace' ><child xmlns='blah' id=\"hi\"/></replace>")); - Replace::ref payload = boost::dynamic_pointer_cast <Replace>(parser.getPayload()); + Replace::ref payload = std::dynamic_pointer_cast <Replace>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(std::string("bad1"), payload->getID()); } }; diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp index 7924e05..da5d978 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -33,7 +33,7 @@ class ResultSetParserTest : public CppUnit::TestFixture "<after>09af3-cc343-b409f</after>" "</set>")); - boost::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>(); + std::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getMaxItems()); CPPUNIT_ASSERT_EQUAL(100, *payload->getMaxItems()); @@ -60,7 +60,7 @@ class ResultSetParserTest : public CppUnit::TestFixture "<first>stpeter@jabber.org</first>" "</set>")); - boost::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>(); + std::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>(); CPPUNIT_ASSERT(!!payload); CPPUNIT_ASSERT(payload->getFirstID()); CPPUNIT_ASSERT_EQUAL(std::string("stpeter@jabber.org"), *payload->getFirstID()); diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp index e02eb7a..bc29921 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp @@ -84,7 +84,7 @@ class VCardParserTest : public CppUnit::TestFixture { "<MAILER>mutt</MAILER>" "</vCard>")); - boost::shared_ptr<VCard> payload = boost::dynamic_pointer_cast<VCard>(parser.getPayload()); + std::shared_ptr<VCard> payload = std::dynamic_pointer_cast<VCard>(parser.getPayload()); CPPUNIT_ASSERT_EQUAL(std::string("2.0"), payload->getVersion()); CPPUNIT_ASSERT_EQUAL(std::string("Alice In Wonderland"), payload->getFullName()); CPPUNIT_ASSERT_EQUAL(std::string("Alice"), payload->getGivenName()); diff --git a/Swiften/Parser/PayloadParsers/UserLocationParser.h b/Swiften/Parser/PayloadParsers/UserLocationParser.h index c2a226e..1445d3e 100644 --- a/Swiften/Parser/PayloadParsers/UserLocationParser.h +++ b/Swiften/Parser/PayloadParsers/UserLocationParser.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/UserLocation.h> diff --git a/Swiften/Parser/PayloadParsers/UserTuneParser.h b/Swiften/Parser/PayloadParsers/UserTuneParser.h index 5c35074..5a27273 100644 --- a/Swiften/Parser/PayloadParsers/UserTuneParser.h +++ b/Swiften/Parser/PayloadParsers/UserTuneParser.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/UserTune.h> diff --git a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp index b9786c9..d3a7211 100644 --- a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp +++ b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp @@ -12,9 +12,10 @@ #include <Swiften/Parser/PayloadParsers/WhiteboardParser.h> +#include <memory> + #include <boost/lexical_cast.hpp> #include <boost/optional.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Whiteboard/WhiteboardColor.h> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> @@ -37,15 +38,15 @@ namespace Swift { } else if (level_ == 1) { std::string type = attributes.getAttributeValue("type").get_value_or(""); if (type == "insert") { - WhiteboardInsertOperation::ref insertOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref insertOp = std::make_shared<WhiteboardInsertOperation>(); operation = insertOp; } else if (type == "update") { - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(); std::string move = attributes.getAttributeValue("newpos").get_value_or("0"); updateOp->setNewPos(boost::lexical_cast<int>(attributes.getAttributeValue("newpos").get_value_or("0"))); operation = updateOp; } else if (type == "delete") { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); deleteOp->setElementID(attributes.getAttributeValue("elementid").get_value_or("")); operation = deleteOp; } @@ -71,7 +72,7 @@ namespace Swift { y2 = boost::lexical_cast<int>(attributes.getAttributeValue("y2").get_value_or("0")); } catch (boost::bad_lexical_cast&) { } - WhiteboardLineElement::ref whiteboardElement = boost::make_shared<WhiteboardLineElement>(x1, y1, x2, y2); + WhiteboardLineElement::ref whiteboardElement = std::make_shared<WhiteboardLineElement>(x1, y1, x2, y2); WhiteboardColor color(attributes.getAttributeValue("stroke").get_value_or("#000000")); color.setAlpha(opacityToAlpha(attributes.getAttributeValue("opacity").get_value_or("1"))); @@ -87,7 +88,7 @@ namespace Swift { getPayloadInternal()->setElement(whiteboardElement); wbElement = whiteboardElement; } else if (element == "path") { - WhiteboardFreehandPathElement::ref whiteboardElement = boost::make_shared<WhiteboardFreehandPathElement>(); + WhiteboardFreehandPathElement::ref whiteboardElement = std::make_shared<WhiteboardFreehandPathElement>(); std::string pathData = attributes.getAttributeValue("d").get_value_or(""); std::vector<std::pair<int, int> > points; if (pathData[0] == 'M') { @@ -148,7 +149,7 @@ namespace Swift { } catch (boost::bad_lexical_cast&) { } - WhiteboardRectElement::ref whiteboardElement = boost::make_shared<WhiteboardRectElement>(x, y, width, height); + WhiteboardRectElement::ref whiteboardElement = std::make_shared<WhiteboardRectElement>(x, y, width, height); int penWidth = 1; try { @@ -167,7 +168,7 @@ namespace Swift { getPayloadInternal()->setElement(whiteboardElement); wbElement = whiteboardElement; } else if (element == "polygon") { - WhiteboardPolygonElement::ref whiteboardElement = boost::make_shared<WhiteboardPolygonElement>(); + WhiteboardPolygonElement::ref whiteboardElement = std::make_shared<WhiteboardPolygonElement>(); std::string pointsData = attributes.getAttributeValue("points").get_value_or(""); std::vector<std::pair<int, int> > points; @@ -214,7 +215,7 @@ namespace Swift { } catch (boost::bad_lexical_cast&) { } - WhiteboardTextElement::ref whiteboardElement = boost::make_shared<WhiteboardTextElement>(x, y); + WhiteboardTextElement::ref whiteboardElement = std::make_shared<WhiteboardTextElement>(x, y); actualIsText = true; WhiteboardColor color(attributes.getAttributeValue("fill").get_value_or("#000000")); @@ -243,7 +244,7 @@ namespace Swift { } catch (boost::bad_lexical_cast&) { } - WhiteboardEllipseElement::ref whiteboardElement = boost::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); + WhiteboardEllipseElement::ref whiteboardElement = std::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); int penWidth = 1; try { @@ -271,12 +272,12 @@ namespace Swift { if (level_ == 0) { getPayloadInternal()->setData(data_); } else if (level_ == 1) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { insertOp->setElement(wbElement); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { updateOp->setElement(wbElement); } @@ -290,7 +291,7 @@ namespace Swift { void WhiteboardParser::handleCharacterData(const std::string& data) { if (level_ == 3 && actualIsText) { - WhiteboardTextElement::ref element = boost::dynamic_pointer_cast<WhiteboardTextElement>(getPayloadInternal()->getElement()); + WhiteboardTextElement::ref element = std::dynamic_pointer_cast<WhiteboardTextElement>(getPayloadInternal()->getElement()); element->setText(data); } } diff --git a/Swiften/Parser/SerializingParser.cpp b/Swiften/Parser/SerializingParser.cpp index b58ccd6..9e39279 100644 --- a/Swiften/Parser/SerializingParser.cpp +++ b/Swiften/Parser/SerializingParser.cpp @@ -6,7 +6,7 @@ #include <Swiften/Parser/SerializingParser.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -17,7 +17,7 @@ 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); + std::shared_ptr<XMLElement> element = std::make_shared<XMLElement>(tag, ns); // FIXME: Ignoring attribute namespace foreach (const AttributeMap::Entry& e, attributes.getEntries()) { element->setAttribute(e.getAttribute().getName(), e.getValue()); @@ -39,7 +39,7 @@ void SerializingParser::handleEndElement(const std::string&, const std::string&) void SerializingParser::handleCharacterData(const std::string& data) { if (!elementStack_.empty()) { - (*(elementStack_.end()-1))->addNode(boost::make_shared<XMLTextNode>(data)); + (*(elementStack_.end()-1))->addNode(std::make_shared<XMLTextNode>(data)); } } diff --git a/Swiften/Parser/SerializingParser.h b/Swiften/Parser/SerializingParser.h index b94d2b8..bc2d872 100644 --- a/Swiften/Parser/SerializingParser.h +++ b/Swiften/Parser/SerializingParser.h @@ -24,7 +24,7 @@ namespace Swift { std::string getResult() const; private: - std::vector< boost::shared_ptr<XMLElement> > elementStack_; - boost::shared_ptr<XMLElement> rootElement_; + std::vector< std::shared_ptr<XMLElement> > elementStack_; + std::shared_ptr<XMLElement> rootElement_; }; } diff --git a/Swiften/Parser/StanzaParser.cpp b/Swiften/Parser/StanzaParser.cpp index 82ddb5c..da252bf 100644 --- a/Swiften/Parser/StanzaParser.cpp +++ b/Swiften/Parser/StanzaParser.cpp @@ -65,7 +65,7 @@ void StanzaParser::handleEndElement(const std::string& element, const std::strin currentPayloadParser_->handleEndElement(element, ns); --currentDepth_; if (!inPayload()) { - boost::shared_ptr<Payload> payload(currentPayloadParser_->getPayload()); + std::shared_ptr<Payload> payload(currentPayloadParser_->getPayload()); if (payload) { getStanza()->addPayload(payload); } diff --git a/Swiften/Parser/StanzaParser.h b/Swiften/Parser/StanzaParser.h index 866df04..7b83e99 100644 --- a/Swiften/Parser/StanzaParser.h +++ b/Swiften/Parser/StanzaParser.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/Stanza.h> @@ -29,11 +29,11 @@ namespace Swift { void handleEndElement(const std::string& element, const std::string& ns); void handleCharacterData(const std::string& data); - virtual boost::shared_ptr<ToplevelElement> getElement() const = 0; + virtual std::shared_ptr<ToplevelElement> getElement() const = 0; virtual void handleStanzaAttributes(const AttributeMap&) {} - virtual boost::shared_ptr<Stanza> getStanza() const { - return boost::dynamic_pointer_cast<Stanza>(getElement()); + virtual std::shared_ptr<Stanza> getStanza() const { + return std::dynamic_pointer_cast<Stanza>(getElement()); } private: @@ -49,6 +49,6 @@ namespace Swift { private: int currentDepth_; PayloadParserFactoryCollection* factories_; - boost::shared_ptr<PayloadParser> currentPayloadParser_; + std::shared_ptr<PayloadParser> currentPayloadParser_; }; } diff --git a/Swiften/Parser/Tree/NullParserElement.cpp b/Swiften/Parser/Tree/NullParserElement.cpp index 4a2db8f..7b52926 100644 --- a/Swiften/Parser/Tree/NullParserElement.cpp +++ b/Swiften/Parser/Tree/NullParserElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,6 +8,6 @@ namespace Swift { -boost::shared_ptr<NullParserElement> NullParserElement::element = boost::make_shared<NullParserElement>(); +std::shared_ptr<NullParserElement> NullParserElement::element = std::make_shared<NullParserElement>(); } diff --git a/Swiften/Parser/Tree/NullParserElement.h b/Swiften/Parser/Tree/NullParserElement.h index 8dae25d..320e098 100644 --- a/Swiften/Parser/Tree/NullParserElement.h +++ b/Swiften/Parser/Tree/NullParserElement.h @@ -18,6 +18,6 @@ namespace Swift { virtual operator bool() { return false; } - static boost::shared_ptr<NullParserElement> element; + static std::shared_ptr<NullParserElement> element; }; } diff --git a/Swiften/Parser/Tree/ParserElement.cpp b/Swiften/Parser/Tree/ParserElement.cpp index 6bbd93e..27bd790 100644 --- a/Swiften/Parser/Tree/ParserElement.cpp +++ b/Swiften/Parser/Tree/ParserElement.cpp @@ -25,7 +25,7 @@ ParserElement::~ParserElement() { } ParserElement::ref ParserElement::addChild(const std::string& name, const std::string& xmlns, const AttributeMap& attributes) { - ParserElement::ref child = boost::make_shared<ParserElement>(name, xmlns, attributes); + ParserElement::ref child = std::make_shared<ParserElement>(name, xmlns, attributes); children_.push_back(child); return child; } diff --git a/Swiften/Parser/Tree/ParserElement.h b/Swiften/Parser/Tree/ParserElement.h index dc9f31c..cffd59a 100644 --- a/Swiften/Parser/Tree/ParserElement.h +++ b/Swiften/Parser/Tree/ParserElement.h @@ -7,12 +7,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Parser/AttributeMap.h> @@ -20,7 +18,7 @@ namespace Swift { class SWIFTEN_API ParserElement { public: - typedef boost::shared_ptr<ParserElement> ref; + typedef std::shared_ptr<ParserElement> ref; ParserElement(const std::string& name, const std::string& xmlns, const AttributeMap& attributes); virtual ~ParserElement(); diff --git a/Swiften/Parser/Tree/TreeReparser.cpp b/Swiften/Parser/Tree/TreeReparser.cpp index 269b2ea..7fc74cf 100644 --- a/Swiften/Parser/Tree/TreeReparser.cpp +++ b/Swiften/Parser/Tree/TreeReparser.cpp @@ -21,7 +21,7 @@ namespace Swift { typedef std::pair<ParserElement::ref, bool> ElementState; -boost::shared_ptr<Payload> TreeReparser::parseTree(ParserElement::ref root, PayloadParserFactoryCollection* collection) { +std::shared_ptr<Payload> TreeReparser::parseTree(ParserElement::ref root, PayloadParserFactoryCollection* collection) { PayloadParser* parser = collection->getPayloadParserFactory(root->getName(), root->getNamespace(), root->getAttributes())->createPayloadParser(); std::deque<ElementState > stack; stack.push_back(ElementState(root, true)); @@ -41,7 +41,7 @@ boost::shared_ptr<Payload> TreeReparser::parseTree(ParserElement::ref root, Payl } - boost::shared_ptr<Payload> payload = parser->getPayload(); + std::shared_ptr<Payload> payload = parser->getPayload(); delete parser; return payload; } diff --git a/Swiften/Parser/Tree/TreeReparser.h b/Swiften/Parser/Tree/TreeReparser.h index fb96c1b..435922b 100644 --- a/Swiften/Parser/Tree/TreeReparser.h +++ b/Swiften/Parser/Tree/TreeReparser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,7 +14,7 @@ namespace Swift { class PayloadParserFactoryCollection; class SWIFTEN_API TreeReparser { public: - static boost::shared_ptr<Payload> parseTree(ParserElement::ref root, PayloadParserFactoryCollection* collection); + static std::shared_ptr<Payload> parseTree(ParserElement::ref root, PayloadParserFactoryCollection* collection); }; } diff --git a/Swiften/Parser/UnitTest/StanzaParserTest.cpp b/Swiften/Parser/UnitTest/StanzaParserTest.cpp index c081b1b..6febdbc 100644 --- a/Swiften/Parser/UnitTest/StanzaParserTest.cpp +++ b/Swiften/Parser/UnitTest/StanzaParserTest.cpp @@ -193,15 +193,15 @@ class StanzaParserTest : public CppUnit::TestFixture { public: MyStanzaParser(PayloadParserFactoryCollection* collection) : StanzaParser(collection) { - stanza_ = boost::make_shared<MyStanza>(); + stanza_ = std::make_shared<MyStanza>(); } - virtual boost::shared_ptr<ToplevelElement> getElement() const { + virtual std::shared_ptr<ToplevelElement> getElement() const { return stanza_; } private: - boost::shared_ptr<MyStanza> stanza_; + std::shared_ptr<MyStanza> stanza_; }; MyPayload1ParserFactory factory1_; diff --git a/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp b/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp index 031f2f3..4664df2 100644 --- a/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp +++ b/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -42,7 +42,7 @@ class StreamFeaturesParserTest : public CppUnit::TestFixture { "<ver xmlns=\"urn:xmpp:features:rosterver\"/>" "</stream:features>")); - StreamFeatures::ref element = boost::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); + StreamFeatures::ref element = std::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); CPPUNIT_ASSERT(element->hasStartTLS()); CPPUNIT_ASSERT(element->hasSession()); CPPUNIT_ASSERT(element->hasResourceBind()); @@ -62,7 +62,7 @@ class StreamFeaturesParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(parser.parse("<stream:features xmlns:stream='http://etherx.jabber.org/streams'/>")); - StreamFeatures::ref element = boost::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); + StreamFeatures::ref element = std::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); CPPUNIT_ASSERT(!element->hasStartTLS()); CPPUNIT_ASSERT(!element->hasSession()); CPPUNIT_ASSERT(!element->hasResourceBind()); @@ -82,7 +82,7 @@ class StreamFeaturesParserTest : public CppUnit::TestFixture { "</mechanisms>" "</stream:features>")); - StreamFeatures::ref element = boost::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); + StreamFeatures::ref element = std::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); CPPUNIT_ASSERT(element->hasAuthenticationMechanism("GSSAPI")); CPPUNIT_ASSERT_EQUAL(*element->getAuthenticationHostname(), hostname); } @@ -99,7 +99,7 @@ class StreamFeaturesParserTest : public CppUnit::TestFixture { "</mechanisms>" "</stream:features>")); - StreamFeatures::ref element = boost::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); + StreamFeatures::ref element = std::dynamic_pointer_cast<StreamFeatures>(testling.getElement()); CPPUNIT_ASSERT(element->hasAuthenticationMechanism("GSSAPI")); CPPUNIT_ASSERT(element->getAuthenticationHostname()->empty()); } diff --git a/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp b/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp index 7b4a9cc..704a89f 100644 --- a/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp +++ b/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,7 +25,7 @@ class StreamManagementEnabledParserTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(parser.parse( "<enabled xmlns=\"urn:xmpp:sm:3\" id=\"some-long-sm-id\" resume=\"true\"/>")); - boost::shared_ptr<StreamManagementEnabled> element = boost::dynamic_pointer_cast<StreamManagementEnabled>(testling.getElement()); + std::shared_ptr<StreamManagementEnabled> element = std::dynamic_pointer_cast<StreamManagementEnabled>(testling.getElement()); CPPUNIT_ASSERT(element->getResumeSupported()); CPPUNIT_ASSERT_EQUAL(std::string("some-long-sm-id"), element->getResumeID()); } diff --git a/Swiften/Parser/UnitTest/XMPPParserTest.cpp b/Swiften/Parser/UnitTest/XMPPParserTest.cpp index a4cb7b8..2424d4d 100644 --- a/Swiften/Parser/UnitTest/XMPPParserTest.cpp +++ b/Swiften/Parser/UnitTest/XMPPParserTest.cpp @@ -163,7 +163,7 @@ class XMPPParserTest : public CppUnit::TestFixture { public: enum Type { StreamStart, ElementEvent, StreamEnd }; struct Event { - Event(Type type, boost::shared_ptr<ToplevelElement> element) + Event(Type type, std::shared_ptr<ToplevelElement> element) : type(type), element(element) {} Event(Type type, const ProtocolHeader& header) : type(type), header(header) {} @@ -171,7 +171,7 @@ class XMPPParserTest : public CppUnit::TestFixture { Type type; boost::optional<ProtocolHeader> header; - boost::shared_ptr<ToplevelElement> element; + std::shared_ptr<ToplevelElement> element; }; Client() {} @@ -180,7 +180,7 @@ class XMPPParserTest : public CppUnit::TestFixture { events.push_back(Event(StreamStart, header)); } - void handleElement(boost::shared_ptr<ToplevelElement> element) { + void handleElement(std::shared_ptr<ToplevelElement> element) { events.push_back(Event(ElementEvent, element)); } diff --git a/Swiften/Parser/UnknownPayloadParser.h b/Swiften/Parser/UnknownPayloadParser.h index ca49269..1553704 100644 --- a/Swiften/Parser/UnknownPayloadParser.h +++ b/Swiften/Parser/UnknownPayloadParser.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Parser/PayloadParser.h> @@ -20,8 +20,8 @@ namespace Swift { virtual void handleEndElement(const std::string&, const std::string&) {} virtual void handleCharacterData(const std::string&) {} - virtual boost::shared_ptr<Payload> getPayload() const { - return boost::shared_ptr<Payload>(); + virtual std::shared_ptr<Payload> getPayload() const { + return std::shared_ptr<Payload>(); } }; } diff --git a/Swiften/Parser/XMPPParser.h b/Swiften/Parser/XMPPParser.h index 52b2921..09fae38 100644 --- a/Swiften/Parser/XMPPParser.h +++ b/Swiften/Parser/XMPPParser.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Parser/AttributeMap.h> diff --git a/Swiften/Parser/XMPPParserClient.h b/Swiften/Parser/XMPPParserClient.h index 73f8119..97c0c64 100644 --- a/Swiften/Parser/XMPPParserClient.h +++ b/Swiften/Parser/XMPPParserClient.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ToplevelElement.h> @@ -20,7 +20,7 @@ namespace Swift { virtual ~XMPPParserClient(); virtual void handleStreamStart(const ProtocolHeader&) = 0; - virtual void handleElement(boost::shared_ptr<ToplevelElement>) = 0; + virtual void handleElement(std::shared_ptr<ToplevelElement>) = 0; virtual void handleStreamEnd() = 0; }; } diff --git a/Swiften/Presence/DirectedPresenceSender.cpp b/Swiften/Presence/DirectedPresenceSender.cpp index a3deea5..c1ce3a0 100644 --- a/Swiften/Presence/DirectedPresenceSender.cpp +++ b/Swiften/Presence/DirectedPresenceSender.cpp @@ -13,7 +13,7 @@ namespace Swift { DirectedPresenceSender::DirectedPresenceSender(PresenceSender* sender) : sender(sender) { } -void DirectedPresenceSender::sendPresence(boost::shared_ptr<Presence> presence) { +void DirectedPresenceSender::sendPresence(std::shared_ptr<Presence> presence) { if (!sender->isAvailable()) { return; } @@ -21,7 +21,7 @@ void DirectedPresenceSender::sendPresence(boost::shared_ptr<Presence> presence) sender->sendPresence(presence); if (!presence->getTo().isValid()) { - boost::shared_ptr<Presence> presenceCopy(new Presence(*presence)); + std::shared_ptr<Presence> presenceCopy(new Presence(*presence)); foreach(const JID& jid, directedPresenceReceivers) { presenceCopy->setTo(jid); sender->sendPresence(presenceCopy); @@ -48,7 +48,7 @@ void DirectedPresenceSender::addDirectedPresenceReceiver(const JID& jid, SendPre directedPresenceReceivers.insert(jid); if (sendPresence == AndSendPresence && sender->isAvailable()) { if (lastSentUndirectedPresence && (*lastSentUndirectedPresence)->getType() == Presence::Available) { - boost::shared_ptr<Presence> presenceCopy((*lastSentUndirectedPresence)->clone()); + std::shared_ptr<Presence> presenceCopy((*lastSentUndirectedPresence)->clone()); presenceCopy->setTo(jid); sender->sendPresence(presenceCopy); } @@ -63,7 +63,7 @@ void DirectedPresenceSender::addDirectedPresenceReceiver(const JID& jid, SendPre void DirectedPresenceSender::removeDirectedPresenceReceiver(const JID& jid, SendPresence sendPresence) { directedPresenceReceivers.erase(jid); if (sendPresence == AndSendPresence && sender->isAvailable()) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); presence->setType(Presence::Unavailable); presence->setTo(jid); sender->sendPresence(presence); diff --git a/Swiften/Presence/PayloadAddingPresenceSender.cpp b/Swiften/Presence/PayloadAddingPresenceSender.cpp index 2f55374..e5d2688 100644 --- a/Swiften/Presence/PayloadAddingPresenceSender.cpp +++ b/Swiften/Presence/PayloadAddingPresenceSender.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -34,7 +34,7 @@ bool PayloadAddingPresenceSender::isAvailable() const { return sender->isAvailable(); } -void PayloadAddingPresenceSender::setPayload(boost::shared_ptr<Payload> payload) { +void PayloadAddingPresenceSender::setPayload(std::shared_ptr<Payload> payload) { this->payload = payload; if (lastSentPresence) { sendPresence(lastSentPresence); diff --git a/Swiften/Presence/PayloadAddingPresenceSender.h b/Swiften/Presence/PayloadAddingPresenceSender.h index edb9484..3a55183 100644 --- a/Swiften/Presence/PayloadAddingPresenceSender.h +++ b/Swiften/Presence/PayloadAddingPresenceSender.h @@ -22,7 +22,7 @@ namespace Swift { public: PayloadAddingPresenceSender(PresenceSender*); - void sendPresence(boost::shared_ptr<Presence>); + void sendPresence(std::shared_ptr<Presence>); bool isAvailable() const; /** @@ -31,7 +31,7 @@ namespace Swift { * with an updated payload. Initial presence is reset when unavailable presence is * sent, or when reset() is called. */ - void setPayload(boost::shared_ptr<Payload>); + void setPayload(std::shared_ptr<Payload>); /** * Resets the presence sender. @@ -42,8 +42,8 @@ namespace Swift { void reset(); private: - boost::shared_ptr<Presence> lastSentPresence; + std::shared_ptr<Presence> lastSentPresence; PresenceSender* sender; - boost::shared_ptr<Payload> payload; + std::shared_ptr<Payload> payload; }; } diff --git a/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp b/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp index 37679a9..2ce67dc 100644 --- a/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp +++ b/Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,9 +28,9 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { public: void setUp() { channel = new DummyStanzaChannel(); - testPresence = boost::make_shared<Presence>(); + testPresence = std::make_shared<Presence>(); testPresence->setStatus("Foo"); - secondTestPresence = boost::make_shared<Presence>(); + secondTestPresence = std::make_shared<Presence>(); secondTestPresence->setStatus("Bar"); stanzaChannelPresenceSender = new StanzaChannelPresenceSender(channel); } @@ -41,30 +41,30 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { } void testSendPresence() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->sendPresence(testPresence); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->sentStanzas.size())); - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); CPPUNIT_ASSERT(testPresence == presence); } void testSendPresence_UndirectedPresenceWithDirectedPresenceReceivers() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->addDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::AndSendPresence); testling->sendPresence(testPresence); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(channel->sentStanzas.size())); - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); CPPUNIT_ASSERT(testPresence == presence); - presence = boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[1]); + presence = std::dynamic_pointer_cast<Presence>(channel->sentStanzas[1]); CPPUNIT_ASSERT_EQUAL(testPresence->getStatus(), presence->getStatus()); CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/teaparty"), presence->getTo()); } void testSendPresence_DirectedPresenceWithDirectedPresenceReceivers() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->addDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::AndSendPresence); channel->sentStanzas.clear(); @@ -72,25 +72,25 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { testling->sendPresence(testPresence); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->sentStanzas.size())); - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); CPPUNIT_ASSERT(testPresence == presence); } void testAddDirectedPresenceReceiver() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->sendPresence(testPresence); channel->sentStanzas.clear(); testling->addDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::AndSendPresence); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->sentStanzas.size())); - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); CPPUNIT_ASSERT_EQUAL(testPresence->getStatus(), presence->getStatus()); CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/teaparty"), presence->getTo()); } void testAddDirectedPresenceReceiver_WithoutSendingPresence() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->sendPresence(testPresence); channel->sentStanzas.clear(); @@ -100,7 +100,7 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { } void testAddDirectedPresenceReceiver_AfterSendingDirectedPresence() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->sendPresence(testPresence); secondTestPresence->setTo(JID("foo@bar.com")); testling->sendPresence(secondTestPresence); @@ -109,25 +109,25 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { testling->addDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::AndSendPresence); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->sentStanzas.size())); - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); + std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(channel->sentStanzas[0]); CPPUNIT_ASSERT_EQUAL(testPresence->getStatus(), presence->getStatus()); CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/teaparty"), presence->getTo()); } void testRemoveDirectedPresenceReceiver() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->addDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::DontSendPresence); testling->removeDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::AndSendPresence); testling->sendPresence(testPresence); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(channel->sentStanzas.size())); - CPPUNIT_ASSERT_EQUAL(boost::dynamic_pointer_cast<Presence>(channel->sentStanzas[0])->getType(), Presence::Unavailable); + CPPUNIT_ASSERT_EQUAL(std::dynamic_pointer_cast<Presence>(channel->sentStanzas[0])->getType(), Presence::Unavailable); CPPUNIT_ASSERT(channel->sentStanzas[1] == testPresence); } void testRemoveDirectedPresenceReceiver_WithoutSendingPresence() { - boost::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); + std::shared_ptr<DirectedPresenceSender> testling(createPresenceSender()); testling->addDirectedPresenceReceiver(JID("alice@wonderland.lit/teaparty"), DirectedPresenceSender::AndSendPresence); channel->sentStanzas.clear(); @@ -146,8 +146,8 @@ class DirectedPresenceSenderTest : public CppUnit::TestFixture { private: DummyStanzaChannel* channel; StanzaChannelPresenceSender* stanzaChannelPresenceSender; - boost::shared_ptr<Presence> testPresence; - boost::shared_ptr<Presence> secondTestPresence; + std::shared_ptr<Presence> testPresence; + std::shared_ptr<Presence> secondTestPresence; }; CPPUNIT_TEST_SUITE_REGISTRATION(DirectedPresenceSenderTest); diff --git a/Swiften/Presence/UnitTest/PayloadAddingPresenceSenderTest.cpp b/Swiften/Presence/UnitTest/PayloadAddingPresenceSenderTest.cpp index 84c0838..234f303 100644 --- a/Swiften/Presence/UnitTest/PayloadAddingPresenceSenderTest.cpp +++ b/Swiften/Presence/UnitTest/PayloadAddingPresenceSenderTest.cpp @@ -41,7 +41,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSetPayloadAddsPayloadOnPresenceSend() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->setPayload(MyPayload::create("foo")); testling->sendPresence(Presence::create("bar")); @@ -52,7 +52,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSetNullPayloadDoesNotAddPayloadOnPresenceSend() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->setPayload(MyPayload::ref()); testling->sendPresence(Presence::create("bar")); @@ -63,7 +63,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSendPresenceDoesNotAlterOriginalPayload() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->setPayload(MyPayload::create("foo")); Presence::ref presence(Presence::create("bar")); @@ -73,7 +73,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSetPayloadAfterInitialPresenceResendsPresence() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->sendPresence(Presence::create("bar")); testling->setPayload(MyPayload::create("foo")); @@ -84,7 +84,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSetPayloadAfterUnavailablePresenceDoesNotResendPresence() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->sendPresence(Presence::create("bar")); @@ -98,7 +98,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSetPayloadAfterResetDoesNotResendPresence() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->sendPresence(Presence::create("bar")); testling->reset(); @@ -108,7 +108,7 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } void testSendDirectedPresenceIsNotResent() { - boost::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); + std::shared_ptr<PayloadAddingPresenceSender> testling(createSender()); testling->sendPresence(Presence::create("bar")); Presence::ref directedPresence = Presence::create("baz"); @@ -121,13 +121,13 @@ class PayloadAddingPresenceSenderTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<PayloadAddingPresenceSender> createSender() { - boost::shared_ptr<PayloadAddingPresenceSender> sender(new PayloadAddingPresenceSender(presenceSender)); + std::shared_ptr<PayloadAddingPresenceSender> createSender() { + std::shared_ptr<PayloadAddingPresenceSender> sender(new PayloadAddingPresenceSender(presenceSender)); return sender; } struct MyPayload : public Payload { - typedef boost::shared_ptr<MyPayload> ref; + typedef std::shared_ptr<MyPayload> ref; MyPayload(const std::string& body) : body(body) {} diff --git a/Swiften/Presence/UnitTest/PresenceOracleTest.cpp b/Swiften/Presence/UnitTest/PresenceOracleTest.cpp index 4f066c7..86a7925 100644 --- a/Swiften/Presence/UnitTest/PresenceOracleTest.cpp +++ b/Swiften/Presence/UnitTest/PresenceOracleTest.cpp @@ -1,11 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -109,7 +110,7 @@ class PresenceOracleTest : public CppUnit::TestFixture { } void testReceivePresence() { - boost::shared_ptr<Presence> sentPresence(createPresence(user1)); + std::shared_ptr<Presence> sentPresence(createPresence(user1)); stanzaChannel_->onPresenceReceived(sentPresence); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size())); @@ -119,8 +120,8 @@ class PresenceOracleTest : public CppUnit::TestFixture { } void testReceivePresenceFromDifferentResources() { - boost::shared_ptr<Presence> sentPresence1(createPresence(user1)); - boost::shared_ptr<Presence> sentPresence2(createPresence(user1alt)); + std::shared_ptr<Presence> sentPresence1(createPresence(user1)); + std::shared_ptr<Presence> sentPresence2(createPresence(user1alt)); stanzaChannel_->onPresenceReceived(sentPresence1); stanzaChannel_->onPresenceReceived(sentPresence2); @@ -132,7 +133,7 @@ class PresenceOracleTest : public CppUnit::TestFixture { std::string reasonText = "Because I want to"; JID sentJID = JID("me@example.com"); - boost::shared_ptr<Presence> sentPresence(new Presence()); + std::shared_ptr<Presence> sentPresence(new Presence()); sentPresence->setType(Presence::Subscribe); sentPresence->setFrom(sentJID); sentPresence->setStatus(reasonText); @@ -145,7 +146,7 @@ class PresenceOracleTest : public CppUnit::TestFixture { } void testReconnectResetsPresences() { - boost::shared_ptr<Presence> sentPresence(createPresence(user1)); + std::shared_ptr<Presence> sentPresence(createPresence(user1)); stanzaChannel_->onPresenceReceived(sentPresence); stanzaChannel_->setAvailable(false); stanzaChannel_->setAvailable(true); @@ -189,7 +190,7 @@ class PresenceOracleTest : public CppUnit::TestFixture { private: Presence::ref createPresence(const JID &jid, int priority, Presence::Type type, const StatusShow::Type& statusShow) { - Presence::ref presence = boost::make_shared<Presence>(); + Presence::ref presence = std::make_shared<Presence>(); presence->setFrom(jid); presence->setPriority(priority); presence->setType(type); @@ -212,7 +213,7 @@ class PresenceOracleTest : public CppUnit::TestFixture { return presence; } - void handlePresenceChange(boost::shared_ptr<Presence> newPresence) { + void handlePresenceChange(std::shared_ptr<Presence> newPresence) { changes.push_back(newPresence); } @@ -223,8 +224,8 @@ class PresenceOracleTest : public CppUnit::TestFixture { subscriptionRequests.push_back(subscriptionRequest); } - boost::shared_ptr<Presence> createPresence(const JID& jid) { - boost::shared_ptr<Presence> sentPresence(new Presence("blarb")); + std::shared_ptr<Presence> createPresence(const JID& jid) { + std::shared_ptr<Presence> sentPresence(new Presence("blarb")); sentPresence->setFrom(jid); return sentPresence; } diff --git a/Swiften/PubSub/PubSubManager.h b/Swiften/PubSub/PubSubManager.h index daed7e5..c143a81 100644 --- a/Swiften/PubSub/PubSubManager.h +++ b/Swiften/PubSub/PubSubManager.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -34,8 +34,8 @@ #include <Swiften/PubSub/PubSubUtil.h> #include <Swiften/Queries/PubSubRequest.h> #define SWIFTEN_PUBSUBMANAGER_DECLARE_CREATE_REQUEST(payload, container, response) \ - virtual boost::shared_ptr< PubSubRequest<payload> > \ - createRequest(IQ::Type, const JID&, boost::shared_ptr<payload>) = 0; + virtual std::shared_ptr< PubSubRequest<payload> > \ + createRequest(IQ::Type, const JID&, std::shared_ptr<payload>) = 0; namespace Swift { class JID; @@ -47,6 +47,6 @@ namespace Swift { SWIFTEN_PUBSUB_FOREACH_PUBSUB_PAYLOAD_TYPE( SWIFTEN_PUBSUBMANAGER_DECLARE_CREATE_REQUEST) - boost::signal<void (const JID&, const boost::shared_ptr<PubSubEventPayload>)> onEvent; + boost::signal<void (const JID&, const std::shared_ptr<PubSubEventPayload>)> onEvent; }; } diff --git a/Swiften/PubSub/PubSubManagerImpl.cpp b/Swiften/PubSub/PubSubManagerImpl.cpp index b186a08..12eb25c 100644 --- a/Swiften/PubSub/PubSubManagerImpl.cpp +++ b/Swiften/PubSub/PubSubManagerImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -24,8 +24,8 @@ PubSubManagerImpl::~PubSubManagerImpl() { stanzaChannel->onMessageReceived.disconnect(boost::bind(&PubSubManagerImpl::handleMessageRecevied, this, _1)); } -void PubSubManagerImpl::handleMessageRecevied(boost::shared_ptr<Message> message) { - if (boost::shared_ptr<PubSubEvent> event = message->getPayload<PubSubEvent>()) { +void PubSubManagerImpl::handleMessageRecevied(std::shared_ptr<Message> message) { + if (std::shared_ptr<PubSubEvent> event = message->getPayload<PubSubEvent>()) { onEvent(message->getFrom(), event->getPayload()); } } diff --git a/Swiften/PubSub/PubSubManagerImpl.h b/Swiften/PubSub/PubSubManagerImpl.h index c752b84..58c5fc0 100644 --- a/Swiften/PubSub/PubSubManagerImpl.h +++ b/Swiften/PubSub/PubSubManagerImpl.h @@ -6,15 +6,15 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/PubSub/PubSubManager.h> #define SWIFTEN_PUBSUBMANAGERIMPL_DECLARE_CREATE_REQUEST(payload, container, response) \ - virtual boost::shared_ptr< PubSubRequest<payload> > \ - createRequest(IQ::Type type, const JID& receiver, boost::shared_ptr<payload> p) SWIFTEN_OVERRIDE { \ - return boost::make_shared< PubSubRequest<payload> >(type, receiver, p, router); \ + virtual std::shared_ptr< PubSubRequest<payload> > \ + createRequest(IQ::Type type, const JID& receiver, std::shared_ptr<payload> p) SWIFTEN_OVERRIDE { \ + return std::make_shared< PubSubRequest<payload> >(type, receiver, p, router); \ } namespace Swift { @@ -31,7 +31,7 @@ namespace Swift { SWIFTEN_PUBSUBMANAGERIMPL_DECLARE_CREATE_REQUEST) private: - void handleMessageRecevied(boost::shared_ptr<Message>); + void handleMessageRecevied(std::shared_ptr<Message>); private: StanzaChannel* stanzaChannel; diff --git a/Swiften/QA/ClientTest/ClientTest.cpp b/Swiften/QA/ClientTest/ClientTest.cpp index f34a501..9684234 100644 --- a/Swiften/QA/ClientTest/ClientTest.cpp +++ b/Swiften/QA/ClientTest/ClientTest.cpp @@ -42,7 +42,7 @@ static void handleDisconnected(boost::optional<ClientError> e) { } } -static void handleRosterReceived(boost::shared_ptr<Payload>) { +static void handleRosterReceived(std::shared_ptr<Payload>) { rosterReceived = true; std::cout << "Disconnecting" << std::endl; client->disconnect(); diff --git a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp index b9ec7b8..8122c63 100644 --- a/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp +++ b/Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp @@ -36,8 +36,8 @@ using namespace Swift; static const std::string CLIENT_NAME = "Swiften FT Test"; static const std::string CLIENT_NODE = "http://swift.im"; -static boost::shared_ptr<SimpleEventLoop> eventLoop; -static boost::shared_ptr<BoostNetworkFactories> networkFactories; +static std::shared_ptr<SimpleEventLoop> eventLoop; +static std::shared_ptr<BoostNetworkFactories> networkFactories; BoostRandomGenerator randGen; @@ -56,12 +56,12 @@ class ConcurrentFileTransferTest { private: int clientACandidates_; - boost::shared_ptr<Client> clientA_; + std::shared_ptr<Client> clientA_; std::map<std::string, ByteArray> clientASendFiles_; int clientBCandidates_; - boost::shared_ptr<Client> clientB_; + std::shared_ptr<Client> clientB_; }; /** diff --git a/Swiften/QA/DNSSDTest/DNSSDTest.cpp b/Swiften/QA/DNSSDTest/DNSSDTest.cpp index 3b7191d..ae2fafd 100644 --- a/Swiften/QA/DNSSDTest/DNSSDTest.cpp +++ b/Swiften/QA/DNSSDTest/DNSSDTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -35,7 +35,7 @@ class DNSSDTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::shared_ptr<DNSSDQuerier>(new DNSSDQuerierType()); + querier = std::make_shared<DNSSDQuerier>(); querier->start(); } @@ -46,7 +46,7 @@ class DNSSDTest : public CppUnit::TestFixture { } void testPublish() { - boost::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); + std::shared_ptr<DNSSDBrowseQuery> browseQuery = querier->createBrowseQuery(); browseQuery->onServiceAdded.connect(boost::bind(&DNSSDTest::handleServiceAdded, this, _1)); browseQuery->onServiceRemoved.connect(boost::bind(&DNSSDTest::handleServiceRemoved, this, _1)); browseQuery->onError.connect(boost::bind(&DNSSDTest::handleBrowseError, this)); @@ -55,7 +55,7 @@ class DNSSDTest : public CppUnit::TestFixture { // Publish the service LinkLocalServiceInfo info; - boost::shared_ptr<DNSSDRegisterQuery> registerQuery = querier->createRegisterQuery("DNSSDTest", 1234, info.toTXTRecord()); + std::shared_ptr<DNSSDRegisterQuery> registerQuery = querier->createRegisterQuery("DNSSDTest", 1234, info.toTXTRecord()); registerQuery->onRegisterFinished.connect(boost::bind(&DNSSDTest::handleRegisterFinished, this, _1)); registerQuery->registerService(); @@ -82,7 +82,7 @@ class DNSSDTest : public CppUnit::TestFixture { // Resolve all added services for (size_t i = 0; i < added.size(); ++i) { resolvedServices.clear(); - boost::shared_ptr<DNSSDResolveServiceQuery> resolveServiceQuery = querier->createResolveServiceQuery(added[i]); + std::shared_ptr<DNSSDResolveServiceQuery> resolveServiceQuery = querier->createResolveServiceQuery(added[i]); resolveServiceQuery->onServiceResolved.connect(boost::bind(&DNSSDTest::handleResolveFinished, this, _1)); resolveServiceQuery->start(); wait(); @@ -137,7 +137,7 @@ class DNSSDTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; - boost::shared_ptr<DNSSDQuerier> querier; + std::shared_ptr<DNSSDQuerier> querier; std::vector<DNSSDServiceID> added; std::vector<DNSSDServiceID> registered; std::vector<DNSSDServiceID> toRemove; diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp index 8017927..dd8c139 100644 --- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp +++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp @@ -35,8 +35,8 @@ using namespace Swift; static const std::string CLIENT_NAME = "Swiften FT Test"; static const std::string CLIENT_NODE = "http://swift.im"; -static boost::shared_ptr<SimpleEventLoop> eventLoop; -static boost::shared_ptr<BoostNetworkFactories> networkFactories; +static std::shared_ptr<SimpleEventLoop> eventLoop; +static std::shared_ptr<BoostNetworkFactories> networkFactories; BoostRandomGenerator randGen; @@ -50,12 +50,12 @@ enum Candidate { class FileTransferTest { public: FileTransferTest(int senderCandidates, int receiverCandidates) : senderCandidates_(senderCandidates), senderError_(FileTransferError::UnknownError), senderIsDone_(false), receiverCandidates_(receiverCandidates), receiverError_(FileTransferError::UnknownError), receiverIsDone_(false) { - sender_ = boost::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST_JID")), getenv("SWIFT_FILETRANSFERTEST_PASS"), networkFactories.get()); + sender_ = std::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST_JID")), getenv("SWIFT_FILETRANSFERTEST_PASS"), networkFactories.get()); sender_->onDisconnected.connect(boost::bind(&FileTransferTest::handleSenderDisconnected, this, _1)); sender_->onConnected.connect(boost::bind(&FileTransferTest::handleSenderConnected, this)); sender_->getEntityCapsProvider()->onCapsChanged.connect(boost::bind(&FileTransferTest::handleSenderCapsChanged, this, _1)); - receiver_ = boost::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST2_JID")), getenv("SWIFT_FILETRANSFERTEST2_PASS"), networkFactories.get()); + receiver_ = std::make_shared<Client>(JID(getenv("SWIFT_FILETRANSFERTEST2_JID")), getenv("SWIFT_FILETRANSFERTEST2_PASS"), networkFactories.get()); receiver_->onConnected.connect(boost::bind(&FileTransferTest::handleReceiverConnected, this)); receiver_->onDisconnected.connect(boost::bind(&FileTransferTest::handleReceiverDisconnected, this, _1)); @@ -145,7 +145,7 @@ class FileTransferTest { void handleReceiverIncomingFileTransfer(IncomingFileTransfer::ref transfer) { incomingFileTransfers_.push_back(transfer); - boost::shared_ptr<FileWriteBytestream> out = boost::make_shared<FileWriteBytestream>(receiveFilePath_.native()); + std::shared_ptr<FileWriteBytestream> out = std::make_shared<FileWriteBytestream>(receiveFilePath_.native()); transfer->onFinished.connect(boost::bind(&FileTransferTest::handleReceiverFileTransferFinished, this, _1, out)); FileTransferOptions options; @@ -164,7 +164,7 @@ class FileTransferTest { void handleSenderCapsChanged(const JID &jid) { if (receiver_ && (receiver_->getJID().toBare() == jid.toBare())) { - boost::shared_ptr<FileReadBytestream> fileStream = boost::make_shared<FileReadBytestream>(sendFilePath_); + std::shared_ptr<FileReadBytestream> fileStream = std::make_shared<FileReadBytestream>(sendFilePath_); FileTransferOptions options; options = options.withInBandAllowed(senderCandidates_ & InBandBytestream); @@ -191,7 +191,7 @@ class FileTransferTest { } } - void handleReceiverFileTransferFinished(const boost::optional<FileTransferError>& error, boost::shared_ptr<FileWriteBytestream> out) { + void handleReceiverFileTransferFinished(const boost::optional<FileTransferError>& error, std::shared_ptr<FileWriteBytestream> out) { out->close(); receiverError_ = error; receiverIsDone_ = true; @@ -276,7 +276,7 @@ class FileTransferTest { private: int senderCandidates_; - boost::shared_ptr<Client> sender_; + std::shared_ptr<Client> sender_; ClientXMLTracer* senderTracer_; ByteArray sendData_; OutgoingFileTransfer::ref outgoingFileTransfer_; @@ -285,7 +285,7 @@ class FileTransferTest { bool senderIsDone_; int receiverCandidates_; - boost::shared_ptr<Client> receiver_; + std::shared_ptr<Client> receiver_; ClientXMLTracer* receiverTracer_; ByteArray receiveData_; std::vector<IncomingFileTransfer::ref> incomingFileTransfers_; @@ -302,10 +302,10 @@ static bool runTest(int senderCandidates, int receiverCandidates) { std::cout << "senderCandidates: " << senderCandidates << ", receiverCandidates: " << receiverCandidates << std::endl; bool expectSuccess = (senderCandidates & receiverCandidates) > 0; - eventLoop = boost::make_shared<SimpleEventLoop>(); - networkFactories = boost::make_shared<BoostNetworkFactories>(eventLoop.get()); + eventLoop = std::make_shared<SimpleEventLoop>(); + networkFactories = std::make_shared<BoostNetworkFactories>(eventLoop.get()); - boost::shared_ptr<FileTransferTest> testRun = boost::make_shared<FileTransferTest>(senderCandidates, receiverCandidates); + std::shared_ptr<FileTransferTest> testRun = std::make_shared<FileTransferTest>(senderCandidates, receiverCandidates); testRun->run(); diff --git a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp index a415a0f..11b0eb5 100644 --- a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp +++ b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -194,7 +193,7 @@ class BoostConnectionServerTest : public CppUnit::TestFixture { stoppedError_ = e; } - void handleNewConnection(boost::shared_ptr<Connection> connection) { + void handleNewConnection(std::shared_ptr<Connection> connection) { receivedNewConnection_ = true; remoteAddress_ = connection->getRemoteAddress(); } diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp index f09e1a7..12c4a77 100755 --- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp +++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp @@ -4,11 +4,10 @@ * See the COPYING file for more information. */ +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -38,7 +37,7 @@ class BoostConnectionTest : public CppUnit::TestFixture { void setUp() { eventLoop_ = new DummyEventLoop(); boostIOServiceThread_ = new BoostIOServiceThread(); - boostIOService_ = boost::make_shared<boost::asio::io_service>(); + boostIOService_ = std::make_shared<boost::asio::io_service>(); disconnected_ = false; connectFinished_ = false; } @@ -145,7 +144,7 @@ class BoostConnectionTest : public CppUnit::TestFixture { connection->write(createSafeByteArray("\r\n\r\n")); // Temporarily, while we don't have an xmpp server running on ipv6 } - void handleDataRead(boost::shared_ptr<SafeByteArray> data) { + void handleDataRead(std::shared_ptr<SafeByteArray> data) { append(receivedData_, *data); } @@ -159,7 +158,7 @@ class BoostConnectionTest : public CppUnit::TestFixture { private: BoostIOServiceThread* boostIOServiceThread_; - boost::shared_ptr<boost::asio::io_service> boostIOService_; + std::shared_ptr<boost::asio::io_service> boostIOService_; DummyEventLoop* eventLoop_; ByteArray receivedData_; bool disconnected_; diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp index 05dd3a1..d45d118 100644 --- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp +++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp @@ -67,7 +67,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { void setUp() { ioServiceThread = new BoostIOServiceThread(); eventLoop = new DummyEventLoop(); - idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + idnConverter = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); #ifdef USE_UNBOUND resolver = new UnboundDomainNameResolver(idnConverter.get(), ioServiceThread->getIOService(), eventLoop); #else @@ -83,7 +83,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp.test.swift.im")); query->run(); waitForResults(); @@ -94,7 +94,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_Error() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("invalid.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("invalid.test.swift.im")); query->run(); waitForResults(); @@ -103,7 +103,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_IPv6() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv6.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv6.test.swift.im")); query->run(); waitForResults(); @@ -113,7 +113,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_IPv4and6() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv46.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("xmpp-ipv46.test.swift.im")); query->run(); waitForResults(); @@ -125,7 +125,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_International() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("tron\xc3\xa7on.test.swift.im")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("tron\xc3\xa7on.test.swift.im")); query->run(); waitForResults(); @@ -136,7 +136,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveAddress_Localhost() { - boost::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("localhost")); + std::shared_ptr<DomainNameAddressQuery> query(createAddressQuery("localhost")); query->run(); waitForResults(); @@ -172,7 +172,7 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } void testResolveService() { - boost::shared_ptr<DomainNameServiceQuery> query(createServiceQuery("_xmpp-client._tcp.", "xmpp-srv.test.swift.im")); + std::shared_ptr<DomainNameServiceQuery> query(createServiceQuery("_xmpp-client._tcp.", "xmpp-srv.test.swift.im")); query->run(); waitForResults(); @@ -200,8 +200,8 @@ class DomainNameResolverTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& domain) { - boost::shared_ptr<DomainNameAddressQuery> result = resolver->createAddressQuery(domain); + std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& domain) { + std::shared_ptr<DomainNameAddressQuery> result = resolver->createAddressQuery(domain); result->onResult.connect(boost::bind(&DomainNameResolverTest::handleAddressQueryResult, this, _1, _2)); return result; } @@ -214,8 +214,8 @@ class DomainNameResolverTest : public CppUnit::TestFixture { resultsAvailable = true; } - boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { - boost::shared_ptr<DomainNameServiceQuery> result = resolver->createServiceQuery(serviceLookupPrefix, domain); + std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) { + std::shared_ptr<DomainNameServiceQuery> result = resolver->createServiceQuery(serviceLookupPrefix, domain); result->onResult.connect(boost::bind(&DomainNameResolverTest::handleServiceQueryResult, this, _1)); return result; } @@ -241,8 +241,8 @@ class DomainNameResolverTest : public CppUnit::TestFixture { private: BoostIOServiceThread* ioServiceThread; DummyEventLoop* eventLoop; - boost::shared_ptr<IDNConverter> idnConverter; - boost::shared_ptr<TimerFactory> timerFactory; + std::shared_ptr<IDNConverter> idnConverter; + std::shared_ptr<TimerFactory> timerFactory; bool resultsAvailable; std::vector<HostAddress> addressQueryResult; std::vector<HostAddress> allAddressQueryResults; diff --git a/Swiften/QA/ReconnectTest/ReconnectTest.cpp b/Swiften/QA/ReconnectTest/ReconnectTest.cpp index 611c846..27c7e23 100644 --- a/Swiften/QA/ReconnectTest/ReconnectTest.cpp +++ b/Swiften/QA/ReconnectTest/ReconnectTest.cpp @@ -25,7 +25,7 @@ Client* client_; SimpleEventLoop eventLoop_; int count = 0; -void handleTick(boost::shared_ptr<BoostTimer> timer) { +void handleTick(std::shared_ptr<BoostTimer> timer) { std::cout << "Count " << count++ << std::endl; if (timer) { timer->stop(); @@ -43,7 +43,7 @@ void handleTick(boost::shared_ptr<BoostTimer> timer) { int delay = 500; // int delay = 0; - boost::shared_ptr<BoostTimer> newTimer(BoostTimer::create(delay, &MainBoostIOServiceThread::getInstance().getIOService())); + std::shared_ptr<BoostTimer> newTimer(BoostTimer::create(delay, &MainBoostIOServiceThread::getInstance().getIOService())); newTimer->onTick.connect(boost::bind(&handleTick, timer)); newTimer->start(); } @@ -64,7 +64,7 @@ int main(int, char**) { std::string pass(passChars); client_ = new Swift::Client(jid, pass); - handleTick(boost::shared_ptr<BoostTimer>()); + handleTick(std::shared_ptr<BoostTimer>()); eventLoop_.run(); delete client_; diff --git a/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp b/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp index 5b3867c..e601de9 100644 --- a/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp +++ b/Swiften/QA/StorageTest/FileReadBytestreamTest.cpp @@ -32,24 +32,24 @@ class FileReadBytestreamTest : public CppUnit::TestFixture { } void testRead() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); - boost::shared_ptr< std::vector<unsigned char> > result = testling->read(10); + std::shared_ptr< std::vector<unsigned char> > result = testling->read(10); CPPUNIT_ASSERT(createByteArray("/*\n * Copy") == *result.get()); } void testRead_Twice() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); testling->read(10); - boost::shared_ptr< std::vector<unsigned char> > result = testling->read(10); + std::shared_ptr< std::vector<unsigned char> > result = testling->read(10); CPPUNIT_ASSERT_EQUAL(std::string("right (c) "), byteArrayToString(*result)); } void testIsFinished_NotFinished() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); testling->read(10); @@ -57,7 +57,7 @@ class FileReadBytestreamTest : public CppUnit::TestFixture { } void testIsFinished_IsFinished() { - boost::shared_ptr<FileReadBytestream> testling(createTestling()); + std::shared_ptr<FileReadBytestream> testling(createTestling()); testling->read(4096); diff --git a/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp b/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp index e847c28..d6963a4 100644 --- a/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp +++ b/Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp @@ -29,7 +29,7 @@ class FileWriteBytestreamTest : public CppUnit::TestFixture { void testSuccessfulWrite() { boost::filesystem::path filename = boost::filesystem::unique_path("write_file_bytestream_test_%%%%%%%%%%%%%%%%.bin"); - boost::shared_ptr<WriteBytestream> writeBytestream = boost::make_shared<FileWriteBytestream>(filename.string()); + std::shared_ptr<WriteBytestream> writeBytestream = std::make_shared<FileWriteBytestream>(filename.string()); writeBytestream->onWrite.connect(boost::bind(&FileWriteBytestreamTest::handleOnWrite, this, _1)); CPPUNIT_ASSERT_EQUAL(true, writeBytestream->write(createByteArray("Some data."))); @@ -39,7 +39,7 @@ class FileWriteBytestreamTest : public CppUnit::TestFixture { } void testFailingWrite() { - boost::shared_ptr<WriteBytestream> writeBytestream = boost::make_shared<FileWriteBytestream>(""); + std::shared_ptr<WriteBytestream> writeBytestream = std::make_shared<FileWriteBytestream>(""); writeBytestream->onWrite.connect(boost::bind(&FileWriteBytestreamTest::handleOnWrite, this, _1)); CPPUNIT_ASSERT_EQUAL(false, writeBytestream->write(createByteArray("Some data."))); diff --git a/Swiften/QA/StorageTest/VCardFileStorageTest.cpp b/Swiften/QA/StorageTest/VCardFileStorageTest.cpp index 69e5917..0dae2f3 100644 --- a/Swiften/QA/StorageTest/VCardFileStorageTest.cpp +++ b/Swiften/QA/StorageTest/VCardFileStorageTest.cpp @@ -43,7 +43,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture { } void testSetVCard() { - boost::shared_ptr<VCardFileStorage> testling(createTestling()); + std::shared_ptr<VCardFileStorage> testling(createTestling()); VCard::ref vcard(new VCard()); vcard->setFullName("Alice In Wonderland"); @@ -73,7 +73,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture { } void testGetVCard() { - boost::shared_ptr<VCardFileStorage> testling(createTestling()); + std::shared_ptr<VCardFileStorage> testling(createTestling()); VCard::ref vcard(new VCard()); vcard->setFullName("Alice In Wonderland"); testling->setVCard(JID("alice@wonderland.lit"), vcard); @@ -99,7 +99,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture { } void testGetVCard_FileDoesNotExist() { - boost::shared_ptr<VCardFileStorage> testling(createTestling()); + std::shared_ptr<VCardFileStorage> testling(createTestling()); VCard::ref result = testling->getVCard(JID("alice@wonderland.lit")); CPPUNIT_ASSERT(!result); } diff --git a/Swiften/QA/TLSTest/CertificateErrorTest.cpp b/Swiften/QA/TLSTest/CertificateErrorTest.cpp index b928a3f..abd004e 100644 --- a/Swiften/QA/TLSTest/CertificateErrorTest.cpp +++ b/Swiften/QA/TLSTest/CertificateErrorTest.cpp @@ -50,7 +50,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { void setUp() { eventLoop_ = new DummyEventLoop(); boostIOServiceThread_ = new BoostIOServiceThread(); - boostIOService_ = boost::make_shared<boost::asio::io_service>(); + boostIOService_ = std::make_shared<boost::asio::io_service>(); connectionFactory_ = new BoostConnectionFactory(boostIOServiceThread_->getIOService(), eventLoop_); idnConverter_ = PlatformIDNConverter::create(); domainNameResolver_ = new PlatformDomainNameResolver(idnConverter_, eventLoop_); @@ -81,7 +81,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } HostAddress resolveName(const std::string& name) { - boost::shared_ptr<DomainNameAddressQuery> query = domainNameResolver_->createAddressQuery(name); + std::shared_ptr<DomainNameAddressQuery> query = domainNameResolver_->createAddressQuery(name); query->onResult.connect(boost::bind(&CertificateErrorTest::handleAddressQueryResult, this, _1, _2)); lastResoverResult_ = HostAddress(); resolvingDone_ = false; @@ -94,7 +94,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { return lastResoverResult_; } - void connectToServer(boost::shared_ptr<TLSConnection> connection, const std::string& hostname, int port) { + void connectToServer(std::shared_ptr<TLSConnection> connection, const std::string& hostname, int port) { connection->onConnectFinished.connect(boost::bind(&CertificateErrorTest::handleConnectFinished, this, _1)); HostAddress address = resolveName(hostname); @@ -107,7 +107,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticTrusted() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test1.tls-o-matic.com", 443); @@ -117,7 +117,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticCertificateFromTheFuture() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test5.tls-o-matic.com", 405); @@ -133,7 +133,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticCertificateFromThePast() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test6.tls-o-matic.com", 406); @@ -144,7 +144,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { } void testTLS_O_MaticCertificateFromUnknownCA() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test7.tls-o-matic.com", 407); @@ -156,7 +156,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { // test14.tls-o-matic.com:414 void testTLS_O_MaticCertificateWrongPurpose() { - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "test14.tls-o-matic.com", 414); @@ -168,7 +168,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { void testRevokedCertificateRevocationDisabled() { tlsContextFactory_->setCheckCertificateRevocation(false); - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "revoked.grc.com", 443); @@ -179,7 +179,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { void testRevokedCertificateRevocationEnabled() { tlsContextFactory_->setCheckCertificateRevocation(true); - boost::shared_ptr<TLSConnection> connection = boost::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); + std::shared_ptr<TLSConnection> connection = std::dynamic_pointer_cast<TLSConnection>(tlsConnectionFactory_->createConnection()); TLSContext* context = connection->getTLSContext(); connectToServer(connection, "revoked.grc.com", 443); @@ -204,7 +204,7 @@ class CertificateErrorTest : public CppUnit::TestFixture { private: BoostIOServiceThread* boostIOServiceThread_; - boost::shared_ptr<boost::asio::io_service> boostIOService_; + std::shared_ptr<boost::asio::io_service> boostIOService_; DummyEventLoop* eventLoop_; ConnectionFactory* connectionFactory_; PlatformTLSFactories* tlsFactories_; diff --git a/Swiften/Queries/DummyIQChannel.h b/Swiften/Queries/DummyIQChannel.h index 3f896e0..5ec68ca 100644 --- a/Swiften/Queries/DummyIQChannel.h +++ b/Swiften/Queries/DummyIQChannel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,7 +15,7 @@ namespace Swift { public: DummyIQChannel() {} - virtual void sendIQ(boost::shared_ptr<IQ> iq) { + virtual void sendIQ(std::shared_ptr<IQ> iq) { iqs_.push_back(iq); } @@ -27,6 +27,6 @@ namespace Swift { return true; } - std::vector<boost::shared_ptr<IQ> > iqs_; + std::vector<std::shared_ptr<IQ> > iqs_; }; } diff --git a/Swiften/Queries/GenericRequest.h b/Swiften/Queries/GenericRequest.h index ad3ec19..2795a54 100644 --- a/Swiften/Queries/GenericRequest.h +++ b/Swiften/Queries/GenericRequest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ namespace Swift { template<typename PAYLOAD_TYPE> class SWIFTEN_API GenericRequest : public Request { public: - typedef boost::shared_ptr<GenericRequest<PAYLOAD_TYPE> > ref; + typedef std::shared_ptr<GenericRequest<PAYLOAD_TYPE> > ref; public: /** @@ -36,7 +36,7 @@ namespace Swift { GenericRequest( IQ::Type type, const JID& receiver, - boost::shared_ptr<Payload> payload, + std::shared_ptr<Payload> payload, IQRouter* router) : Request(type, receiver, payload, router) { } @@ -53,7 +53,7 @@ namespace Swift { IQ::Type type, const JID& sender, const JID& receiver, - boost::shared_ptr<Payload> payload, + std::shared_ptr<Payload> payload, IQRouter* router) : Request(type, sender, receiver, payload, router) { } @@ -61,19 +61,19 @@ namespace Swift { /** * Internal method, do not use. */ - virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { - onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error); + virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) { + onResponse(std::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error); } public: - boost::shared_ptr<PAYLOAD_TYPE> getPayloadGeneric() const { - return boost::dynamic_pointer_cast<PAYLOAD_TYPE>(getPayload()); + std::shared_ptr<PAYLOAD_TYPE> getPayloadGeneric() const { + return std::dynamic_pointer_cast<PAYLOAD_TYPE>(getPayload()); } public: /** * Signal emitted when a reply to the iq has been received. Contains a payload if one was present, and an error if one was present. */ - boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse; + boost::signal<void (std::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/GetResponder.h b/Swiften/Queries/GetResponder.h index cda23d6..18dd694 100644 --- a/Swiften/Queries/GetResponder.h +++ b/Swiften/Queries/GetResponder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,6 +16,6 @@ namespace Swift { GetResponder(IQRouter* router) : Responder<T>(router) {} private: - virtual bool handleSetRequest(const JID&, const JID&, const std::string&, boost::shared_ptr<T>) { return false; } + virtual bool handleSetRequest(const JID&, const JID&, const std::string&, std::shared_ptr<T>) { return false; } }; } diff --git a/Swiften/Queries/IQChannel.h b/Swiften/Queries/IQChannel.h index d762847..2974ecc 100644 --- a/Swiften/Queries/IQChannel.h +++ b/Swiften/Queries/IQChannel.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/IQ.h> @@ -19,11 +18,11 @@ namespace Swift { public: virtual ~IQChannel(); - virtual void sendIQ(boost::shared_ptr<IQ>) = 0; + virtual void sendIQ(std::shared_ptr<IQ>) = 0; virtual std::string getNewIQID() = 0; virtual bool isAvailable() const = 0; - boost::signal<void (boost::shared_ptr<IQ>)> onIQReceived; + boost::signal<void (std::shared_ptr<IQ>)> onIQReceived; }; } diff --git a/Swiften/Queries/IQHandler.h b/Swiften/Queries/IQHandler.h index 3581b85..1bfdf0f 100644 --- a/Swiften/Queries/IQHandler.h +++ b/Swiften/Queries/IQHandler.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/IQ.h> @@ -18,6 +18,6 @@ namespace Swift { public: virtual ~IQHandler(); - virtual bool handleIQ(boost::shared_ptr<IQ>) = 0; + virtual bool handleIQ(std::shared_ptr<IQ>) = 0; }; } diff --git a/Swiften/Queries/IQRouter.cpp b/Swiften/Queries/IQRouter.cpp index b32cdf1..e28c2f4 100644 --- a/Swiften/Queries/IQRouter.cpp +++ b/Swiften/Queries/IQRouter.cpp @@ -30,13 +30,13 @@ bool IQRouter::isAvailable() { return channel_->isAvailable(); } -void IQRouter::handleIQ(boost::shared_ptr<IQ> iq) { +void IQRouter::handleIQ(std::shared_ptr<IQ> iq) { queueRemoves_ = true; bool handled = false; // Go through the handlers in reverse order, to give precedence to the last added handler - std::vector<boost::shared_ptr<IQHandler> >::const_reverse_iterator i = handlers_.rbegin(); - std::vector<boost::shared_ptr<IQHandler> >::const_reverse_iterator rend = handlers_.rend(); + std::vector<std::shared_ptr<IQHandler> >::const_reverse_iterator i = handlers_.rbegin(); + std::vector<std::shared_ptr<IQHandler> >::const_reverse_iterator rend = handlers_.rend(); for (; i != rend; ++i) { handled |= (*i)->handleIQ(iq); if (handled) { @@ -53,25 +53,25 @@ void IQRouter::handleIQ(boost::shared_ptr<IQ> iq) { } void IQRouter::processPendingRemoves() { - foreach(boost::shared_ptr<IQHandler> handler, queuedRemoves_) { + foreach(std::shared_ptr<IQHandler> handler, queuedRemoves_) { erase(handlers_, handler); } queuedRemoves_.clear(); } void IQRouter::addHandler(IQHandler* handler) { - addHandler(boost::shared_ptr<IQHandler>(handler, noop)); + addHandler(std::shared_ptr<IQHandler>(handler, noop)); } void IQRouter::removeHandler(IQHandler* handler) { - removeHandler(boost::shared_ptr<IQHandler>(handler, noop)); + removeHandler(std::shared_ptr<IQHandler>(handler, noop)); } -void IQRouter::addHandler(boost::shared_ptr<IQHandler> handler) { +void IQRouter::addHandler(std::shared_ptr<IQHandler> handler) { handlers_.push_back(handler); } -void IQRouter::removeHandler(boost::shared_ptr<IQHandler> handler) { +void IQRouter::removeHandler(std::shared_ptr<IQHandler> handler) { if (queueRemoves_) { queuedRemoves_.push_back(handler); } @@ -80,7 +80,7 @@ void IQRouter::removeHandler(boost::shared_ptr<IQHandler> handler) { } } -void IQRouter::sendIQ(boost::shared_ptr<IQ> iq) { +void IQRouter::sendIQ(std::shared_ptr<IQ> iq) { if (from_.isValid() && !iq->getFrom().isValid()) { iq->setFrom(from_); } diff --git a/Swiften/Queries/IQRouter.h b/Swiften/Queries/IQRouter.h index 376fb08..eda7cfb 100644 --- a/Swiften/Queries/IQRouter.h +++ b/Swiften/Queries/IQRouter.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/IQ.h> @@ -50,8 +49,8 @@ namespace Swift { void addHandler(IQHandler* handler); void removeHandler(IQHandler* handler); - void addHandler(boost::shared_ptr<IQHandler> handler); - void removeHandler(boost::shared_ptr<IQHandler> handler); + void addHandler(std::shared_ptr<IQHandler> handler); + void removeHandler(std::shared_ptr<IQHandler> handler); /** * Sends an IQ stanza. @@ -60,7 +59,7 @@ namespace Swift { * be set as the 'from' address on iq before sending * it. */ - void sendIQ(boost::shared_ptr<IQ> iq); + void sendIQ(std::shared_ptr<IQ> iq); std::string getNewIQID(); bool isAvailable(); @@ -76,15 +75,15 @@ namespace Swift { } private: - void handleIQ(boost::shared_ptr<IQ> iq); + void handleIQ(std::shared_ptr<IQ> iq); void processPendingRemoves(); private: IQChannel* channel_; JID jid_; JID from_; - std::vector< boost::shared_ptr<IQHandler> > handlers_; - std::vector< boost::shared_ptr<IQHandler> > queuedRemoves_; + std::vector< std::shared_ptr<IQHandler> > handlers_; + std::vector< std::shared_ptr<IQHandler> > queuedRemoves_; bool queueRemoves_; }; } diff --git a/Swiften/Queries/PubSubRequest.h b/Swiften/Queries/PubSubRequest.h index 7218f83..888b531 100644 --- a/Swiften/Queries/PubSubRequest.h +++ b/Swiften/Queries/PubSubRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -56,10 +56,10 @@ namespace Swift { PubSubRequest( IQ::Type type, const JID& receiver, - boost::shared_ptr<T> payload, + std::shared_ptr<T> payload, IQRouter* router) : Request(type, receiver, router) { - boost::shared_ptr<ContainerType> wrapper = boost::make_shared<ContainerType>(); + std::shared_ptr<ContainerType> wrapper = std::make_shared<ContainerType>(); wrapper->setPayload(payload); setPayload(wrapper); } @@ -68,24 +68,24 @@ namespace Swift { IQ::Type type, const JID& sender, const JID& receiver, - boost::shared_ptr<T> payload, + std::shared_ptr<T> payload, IQRouter* router) : Request(type, sender, receiver, router) { - boost::shared_ptr<ContainerType> wrapper = boost::make_shared<ContainerType>(); + std::shared_ptr<ContainerType> wrapper = std::make_shared<ContainerType>(); wrapper->setPayload(payload); setPayload(wrapper); } virtual void handleResponse( - boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { - boost::shared_ptr<ResponseType> result; - if (boost::shared_ptr<ContainerType> container = boost::dynamic_pointer_cast<ContainerType>(payload)) { - result = boost::dynamic_pointer_cast<ResponseType>(container->getPayload()); + std::shared_ptr<Payload> payload, ErrorPayload::ref error) { + std::shared_ptr<ResponseType> result; + if (std::shared_ptr<ContainerType> container = std::dynamic_pointer_cast<ContainerType>(payload)) { + result = std::dynamic_pointer_cast<ResponseType>(container->getPayload()); } onResponse(result, error); } public: - boost::signal<void (boost::shared_ptr<ResponseType>, ErrorPayload::ref)> onResponse; + boost::signal<void (std::shared_ptr<ResponseType>, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/RawRequest.h b/Swiften/Queries/RawRequest.h index c4ab85c..90290e8 100644 --- a/Swiften/Queries/RawRequest.h +++ b/Swiften/Queries/RawRequest.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <typeinfo> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/ErrorPayload.h> @@ -22,7 +21,7 @@ namespace Swift { class SWIFTEN_API RawRequest : public Request { public: - typedef boost::shared_ptr<RawRequest> ref; + typedef std::shared_ptr<RawRequest> ref; static ref create(IQ::Type type, const JID& recipient, const std::string& data, IQRouter* router) { return ref(new RawRequest(type, recipient, data, router)); @@ -31,10 +30,10 @@ namespace Swift { boost::signal<void (const std::string&)> onResponse; private: - RawRequest(IQ::Type type, const JID& receiver, const std::string& data, IQRouter* router) : Request(type, receiver, boost::make_shared<RawXMLPayload>(data), router) { + RawRequest(IQ::Type type, const JID& receiver, const std::string& data, IQRouter* router) : Request(type, receiver, std::make_shared<RawXMLPayload>(data), router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { + virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) { if (error) { onResponse(ErrorSerializer(&serializers).serializePayload(error)); } diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp index a8dff24..12eaae5 100644 --- a/Swiften/Queries/Request.cpp +++ b/Swiften/Queries/Request.cpp @@ -12,13 +12,13 @@ namespace Swift { -Request::Request(IQ::Type type, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), receiver_(receiver), payload_(payload), sent_(false) { +Request::Request(IQ::Type type, const JID& receiver, std::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), receiver_(receiver), payload_(payload), sent_(false) { } Request::Request(IQ::Type type, const JID& receiver, IQRouter* router) : router_(router), type_(type), receiver_(receiver), sent_(false) { } -Request::Request(IQ::Type type, const JID& sender, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), payload_(payload), sent_(false) { +Request::Request(IQ::Type type, const JID& sender, const JID& receiver, std::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), payload_(payload), sent_(false) { } Request::Request(IQ::Type type, const JID& sender, const JID& receiver, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), sent_(false) { @@ -29,7 +29,7 @@ std::string Request::send() { assert(!sent_); sent_ = true; - boost::shared_ptr<IQ> iq(new IQ(type_)); + std::shared_ptr<IQ> iq(new IQ(type_)); iq->setTo(receiver_); iq->setFrom(sender_); iq->addPayload(payload_); @@ -47,14 +47,14 @@ std::string Request::send() { return id_; } -bool Request::handleIQ(boost::shared_ptr<IQ> iq) { +bool Request::handleIQ(std::shared_ptr<IQ> iq) { bool handled = false; if (iq->getType() == IQ::Result || iq->getType() == IQ::Error) { if (sent_ && iq->getID() == id_) { if (isCorrectSender(iq->getFrom())) { if (iq->getType() == IQ::Result) { - boost::shared_ptr<Payload> payload = iq->getPayloadOfSameType(payload_); - if (!payload && boost::dynamic_pointer_cast<RawXMLPayload>(payload_) && !iq->getPayloads().empty()) { + std::shared_ptr<Payload> payload = iq->getPayloadOfSameType(payload_); + if (!payload && std::dynamic_pointer_cast<RawXMLPayload>(payload_) && !iq->getPayloads().empty()) { payload = iq->getPayloads().front(); } handleResponse(payload, ErrorPayload::ref()); @@ -62,10 +62,10 @@ bool Request::handleIQ(boost::shared_ptr<IQ> iq) { else { ErrorPayload::ref errorPayload = iq->getPayload<ErrorPayload>(); if (errorPayload) { - handleResponse(boost::shared_ptr<Payload>(), errorPayload); + handleResponse(std::shared_ptr<Payload>(), errorPayload); } else { - handleResponse(boost::shared_ptr<Payload>(), ErrorPayload::ref(new ErrorPayload(ErrorPayload::UndefinedCondition))); + handleResponse(std::shared_ptr<Payload>(), ErrorPayload::ref(new ErrorPayload(ErrorPayload::UndefinedCondition))); } } router_->removeHandler(this); diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h index 7ad0dd6..a62c103 100644 --- a/Swiften/Queries/Request.h +++ b/Swiften/Queries/Request.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> -#include <boost/enable_shared_from_this.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/ErrorPayload.h> @@ -23,7 +22,7 @@ namespace Swift { /** * An IQ get/set request query. */ - class SWIFTEN_API Request : public IQHandler, public boost::enable_shared_from_this<Request> { + class SWIFTEN_API Request : public IQHandler, public std::enable_shared_from_this<Request> { public: std::string send(); @@ -48,7 +47,7 @@ namespace Swift { Request( IQ::Type type, const JID& receiver, - boost::shared_ptr<Payload> payload, + std::shared_ptr<Payload> payload, IQRouter* router); /** @@ -59,7 +58,7 @@ namespace Swift { IQ::Type type, const JID& sender, const JID& receiver, - boost::shared_ptr<Payload> payload, + std::shared_ptr<Payload> payload, IQRouter* router); @@ -81,18 +80,18 @@ namespace Swift { IQRouter* router); - virtual void setPayload(boost::shared_ptr<Payload> payload) { + virtual void setPayload(std::shared_ptr<Payload> payload) { payload_ = payload; } - boost::shared_ptr<Payload> getPayload() const { + std::shared_ptr<Payload> getPayload() const { return payload_; } - virtual void handleResponse(boost::shared_ptr<Payload>, boost::shared_ptr<ErrorPayload>) = 0; + virtual void handleResponse(std::shared_ptr<Payload>, std::shared_ptr<ErrorPayload>) = 0; private: - bool handleIQ(boost::shared_ptr<IQ>); + bool handleIQ(std::shared_ptr<IQ>); bool isCorrectSender(const JID& jid); private: @@ -100,7 +99,7 @@ namespace Swift { IQ::Type type_; JID sender_; JID receiver_; - boost::shared_ptr<Payload> payload_; + std::shared_ptr<Payload> payload_; std::string id_; bool sent_; }; diff --git a/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h b/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h index ad4caf7..b187fa5 100644 --- a/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h +++ b/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h @@ -13,7 +13,7 @@ namespace Swift { class SWIFTEN_API GetInBandRegistrationFormRequest : public GenericRequest<InBandRegistrationPayload> { public: - typedef boost::shared_ptr<GetInBandRegistrationFormRequest> ref; + typedef std::shared_ptr<GetInBandRegistrationFormRequest> ref; static ref create(const JID& to, IQRouter* router) { return ref(new GetInBandRegistrationFormRequest(to, router)); diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h index eecd4d4..e5904fe 100644 --- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/GetPrivateStorageRequest.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -19,27 +18,27 @@ namespace Swift { template<typename PAYLOAD_TYPE> class SWIFTEN_API GetPrivateStorageRequest : public Request { public: - typedef boost::shared_ptr<GetPrivateStorageRequest<PAYLOAD_TYPE> > ref; + typedef std::shared_ptr<GetPrivateStorageRequest<PAYLOAD_TYPE> > ref; static ref create(IQRouter* router) { return ref(new GetPrivateStorageRequest(router)); } private: - GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::make_shared<PrivateStorage>(boost::shared_ptr<Payload>(new PAYLOAD_TYPE())), router) { + GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), std::make_shared<PrivateStorage>(std::make_shared<PAYLOAD_TYPE>()), router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { - boost::shared_ptr<PrivateStorage> storage = boost::dynamic_pointer_cast<PrivateStorage>(payload); + virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) { + std::shared_ptr<PrivateStorage> storage = std::dynamic_pointer_cast<PrivateStorage>(payload); if (storage) { - onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error); + onResponse(std::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error); } else { - onResponse(boost::shared_ptr<PAYLOAD_TYPE>(), error); + onResponse(std::shared_ptr<PAYLOAD_TYPE>(), error); } } public: - boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse; + boost::signal<void (std::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h index a474be5..0a3502f 100644 --- a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h +++ b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/SecurityLabelsCatalog.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog> { public: - typedef boost::shared_ptr<GetSecurityLabelsCatalogRequest> ref; + typedef std::shared_ptr<GetSecurityLabelsCatalogRequest> ref; static ref create(const JID& recipient, IQRouter* router) { return ref(new GetSecurityLabelsCatalogRequest(recipient, router)); @@ -26,7 +26,7 @@ namespace Swift { const JID& recipient, IQRouter* router) : GenericRequest<SecurityLabelsCatalog>( - IQ::Get, JID(), boost::make_shared<SecurityLabelsCatalog>(recipient), router) { + IQ::Get, JID(), std::make_shared<SecurityLabelsCatalog>(recipient), router) { } }; } diff --git a/Swiften/Queries/Requests/GetSoftwareVersionRequest.h b/Swiften/Queries/Requests/GetSoftwareVersionRequest.h index 9533651..5660dd8 100644 --- a/Swiften/Queries/Requests/GetSoftwareVersionRequest.h +++ b/Swiften/Queries/Requests/GetSoftwareVersionRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/SoftwareVersion.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API GetSoftwareVersionRequest : public GenericRequest<SoftwareVersion> { public: - typedef boost::shared_ptr<GetSoftwareVersionRequest> ref; + typedef std::shared_ptr<GetSoftwareVersionRequest> ref; static ref create(const JID& recipient, IQRouter* router) { return ref(new GetSoftwareVersionRequest(recipient, router)); @@ -26,7 +26,7 @@ namespace Swift { const JID& recipient, IQRouter* router) : GenericRequest<SoftwareVersion>( - IQ::Get, recipient, boost::make_shared<SoftwareVersion>(), router) { + IQ::Get, recipient, std::make_shared<SoftwareVersion>(), router) { } }; } diff --git a/Swiften/Queries/Requests/SetPrivateStorageRequest.h b/Swiften/Queries/Requests/SetPrivateStorageRequest.h index 703b749..7cc47fb 100644 --- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/SetPrivateStorageRequest.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -19,17 +18,17 @@ namespace Swift { template<typename PAYLOAD_TYPE> class SWIFTEN_API SetPrivateStorageRequest : public Request { public: - typedef boost::shared_ptr<SetPrivateStorageRequest<PAYLOAD_TYPE> > ref; + typedef std::shared_ptr<SetPrivateStorageRequest<PAYLOAD_TYPE> > ref; - static ref create(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) { + static ref create(std::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) { return ref(new SetPrivateStorageRequest<PAYLOAD_TYPE>(payload, router)); } private: - SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::make_shared<PrivateStorage>(payload), router) { + SetPrivateStorageRequest(std::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), std::make_shared<PrivateStorage>(payload), router) { } - virtual void handleResponse(boost::shared_ptr<Payload>, ErrorPayload::ref error) { + virtual void handleResponse(std::shared_ptr<Payload>, ErrorPayload::ref error) { onResponse(error); } diff --git a/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h b/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h index 94a497b..e2ed751 100644 --- a/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h +++ b/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -16,7 +16,7 @@ namespace Swift { class SWIFTEN_API SetInBandRegistrationRequest : public Request { public: - typedef boost::shared_ptr<SetInBandRegistrationRequest> ref; + typedef std::shared_ptr<SetInBandRegistrationRequest> ref; static ref create(const JID& to, InBandRegistrationPayload::ref payload, IQRouter* router) { return ref(new SetInBandRegistrationRequest(to, payload, router)); @@ -26,11 +26,11 @@ namespace Swift { SetInBandRegistrationRequest(const JID& to, InBandRegistrationPayload::ref payload, IQRouter* router) : Request(IQ::Set, to, InBandRegistrationPayload::ref(payload), router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { + virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) { onResponse(payload, error); } public: - boost::signal<void (boost::shared_ptr<Payload>, ErrorPayload::ref)> onResponse; + boost::signal<void (std::shared_ptr<Payload>, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp index 1efe523..6c4c495 100644 --- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp +++ b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp @@ -4,8 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -49,9 +50,9 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->iqs_.size())); CPPUNIT_ASSERT_EQUAL(JID(), channel->iqs_[0]->getTo()); CPPUNIT_ASSERT_EQUAL(IQ::Get, channel->iqs_[0]->getType()); - boost::shared_ptr<PrivateStorage> storage = channel->iqs_[0]->getPayload<PrivateStorage>(); + std::shared_ptr<PrivateStorage> storage = channel->iqs_[0]->getPayload<PrivateStorage>(); CPPUNIT_ASSERT(storage); - boost::shared_ptr<MyPayload> payload = boost::dynamic_pointer_cast<MyPayload>(storage->getPayload()); + std::shared_ptr<MyPayload> payload = std::dynamic_pointer_cast<MyPayload>(storage->getPayload()); CPPUNIT_ASSERT(payload); } @@ -62,7 +63,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture { channel->onIQReceived(createResponse("test-id", "foo")); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(responses.size())); - CPPUNIT_ASSERT_EQUAL(std::string("foo"), boost::dynamic_pointer_cast<MyPayload>(responses[0])->text); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), std::dynamic_pointer_cast<MyPayload>(responses[0])->text); } void testHandleResponse_Error() { @@ -76,7 +77,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture { } private: - void handleResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) { + void handleResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) { if (e) { errors.push_back(*e); } @@ -85,17 +86,17 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture { } } - boost::shared_ptr<IQ> createResponse(const std::string& id, const std::string& text) { - boost::shared_ptr<IQ> iq(new IQ(IQ::Result)); - boost::shared_ptr<PrivateStorage> storage(new PrivateStorage()); - storage->setPayload(boost::shared_ptr<Payload>(new MyPayload(text))); + std::shared_ptr<IQ> createResponse(const std::string& id, const std::string& text) { + std::shared_ptr<IQ> iq(new IQ(IQ::Result)); + std::shared_ptr<PrivateStorage> storage(new PrivateStorage()); + storage->setPayload(std::make_shared<MyPayload>(text)); iq->addPayload(storage); iq->setID(id); return iq; } - boost::shared_ptr<IQ> createError(const std::string& id) { - boost::shared_ptr<IQ> iq(new IQ(IQ::Error)); + std::shared_ptr<IQ> createError(const std::string& id) { + std::shared_ptr<IQ> iq(new IQ(IQ::Error)); iq->setID(id); return iq; } @@ -104,7 +105,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture { IQRouter* router; DummyIQChannel* channel; std::vector< ErrorPayload > errors; - std::vector< boost::shared_ptr<Payload> > responses; + std::vector< std::shared_ptr<Payload> > responses; }; CPPUNIT_TEST_SUITE_REGISTRATION(GetPrivateStorageRequestTest); diff --git a/Swiften/Queries/Responder.h b/Swiften/Queries/Responder.h index 94195f8..0974adf 100644 --- a/Swiften/Queries/Responder.h +++ b/Swiften/Queries/Responder.h @@ -58,26 +58,26 @@ namespace Swift { * * This method is implemented in the concrete subclasses. */ - virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) = 0; + virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) = 0; /** * Handle an incoming IQ-Set request containing a payload of class PAYLOAD_TYPE. * * This method is implemented in the concrete subclasses. */ - virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) = 0; + virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) = 0; /** * Convenience function for sending an IQ response. */ - void sendResponse(const JID& to, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) { + void sendResponse(const JID& to, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) { router_->sendIQ(IQ::createResult(to, id, payload)); } /** * Convenience function for sending an IQ response, with a specific from address. */ - void sendResponse(const JID& to, const JID& from, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) { + void sendResponse(const JID& to, const JID& from, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) { router_->sendIQ(IQ::createResult(to, from, id, payload)); } @@ -104,9 +104,9 @@ namespace Swift { } private: - virtual bool handleIQ(boost::shared_ptr<IQ> iq) { + virtual bool handleIQ(std::shared_ptr<IQ> iq) { if (iq->getType() == IQ::Set || iq->getType() == IQ::Get) { - boost::shared_ptr<PAYLOAD_TYPE> payload(iq->getPayload<PAYLOAD_TYPE>()); + std::shared_ptr<PAYLOAD_TYPE> payload(iq->getPayload<PAYLOAD_TYPE>()); if (payload) { bool result; if (iq->getType() == IQ::Set) { diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp index df73dc6..5071f6e 100644 --- a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp +++ b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp @@ -6,7 +6,7 @@ #include <Swiften/Queries/Responders/SoftwareVersionResponder.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Queries/IQRouter.h> @@ -21,8 +21,8 @@ void SoftwareVersionResponder::setVersion(const std::string& client, const std:: this->os = os; } -bool SoftwareVersionResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<SoftwareVersion>) { - sendResponse(from, id, boost::make_shared<SoftwareVersion>(client, version, os)); +bool SoftwareVersionResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<SoftwareVersion>) { + sendResponse(from, id, std::make_shared<SoftwareVersion>(client, version, os)); return true; } diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.h b/Swiften/Queries/Responders/SoftwareVersionResponder.h index e336341..4bb3425 100644 --- a/Swiften/Queries/Responders/SoftwareVersionResponder.h +++ b/Swiften/Queries/Responders/SoftwareVersionResponder.h @@ -20,7 +20,7 @@ namespace Swift { void setVersion(const std::string& client, const std::string& version, const std::string& os = ""); private: - virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<SoftwareVersion> payload); + virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<SoftwareVersion> payload); private: std::string client; diff --git a/Swiften/Queries/SetResponder.h b/Swiften/Queries/SetResponder.h index 44d5b66..e2842f4 100644 --- a/Swiften/Queries/SetResponder.h +++ b/Swiften/Queries/SetResponder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,6 +16,6 @@ namespace Swift { SetResponder(IQRouter* router) : Responder<T>(router) {} private: - virtual bool handleGetRequest(const JID&, const JID&, const std::string&, boost::shared_ptr<T>) { return false; } + virtual bool handleGetRequest(const JID&, const JID&, const std::string&, std::shared_ptr<T>) { return false; } }; } diff --git a/Swiften/Queries/UnitTest/IQRouterTest.cpp b/Swiften/Queries/UnitTest/IQRouterTest.cpp index d0d4911..0acb87b 100644 --- a/Swiften/Queries/UnitTest/IQRouterTest.cpp +++ b/Swiften/Queries/UnitTest/IQRouterTest.cpp @@ -4,9 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -45,7 +45,7 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); testling.removeHandler(&handler1); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(0, handler1.called); CPPUNIT_ASSERT_EQUAL(1, handler2.called); @@ -56,9 +56,9 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); DummyIQHandler handler1(true, &testling); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); testling.removeHandler(&handler1); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(1, handler2.called); @@ -69,7 +69,7 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(false, &testling); DummyIQHandler handler1(true, &testling); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(0, handler2.called); @@ -81,7 +81,7 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); DummyIQHandler handler1(false, &testling); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(1, handler2.called); @@ -92,7 +92,7 @@ class IQRouterTest : public CppUnit::TestFixture { IQRouter testling(channel_); DummyIQHandler handler(false, &testling); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); CPPUNIT_ASSERT(channel_->iqs_[0]->getPayload<ErrorPayload>()); @@ -104,8 +104,8 @@ class IQRouterTest : public CppUnit::TestFixture { DummyIQHandler handler2(true, &testling); RemovingIQHandler handler1(&testling); - channel_->onIQReceived(boost::make_shared<IQ>()); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(1, handler1.called); CPPUNIT_ASSERT_EQUAL(2, handler2.called); @@ -115,7 +115,7 @@ class IQRouterTest : public CppUnit::TestFixture { IQRouter testling(channel_); testling.setFrom(JID("foo@bar.com/baz")); - testling.sendIQ(boost::make_shared<IQ>()); + testling.sendIQ(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), channel_->iqs_[0]->getFrom()); } @@ -123,7 +123,7 @@ class IQRouterTest : public CppUnit::TestFixture { void testSendIQ_WithoutFrom() { IQRouter testling(channel_); - testling.sendIQ(boost::make_shared<IQ>()); + testling.sendIQ(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(JID(), channel_->iqs_[0]->getFrom()); } @@ -133,7 +133,7 @@ class IQRouterTest : public CppUnit::TestFixture { testling.setFrom(JID("foo@bar.com/baz")); DummyIQHandler handler(false, &testling); - channel_->onIQReceived(boost::make_shared<IQ>()); + channel_->onIQReceived(std::make_shared<IQ>()); CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), channel_->iqs_[0]->getFrom()); } @@ -148,7 +148,7 @@ class IQRouterTest : public CppUnit::TestFixture { router->removeHandler(this); } - virtual bool handleIQ(boost::shared_ptr<IQ>) { + virtual bool handleIQ(std::shared_ptr<IQ>) { called++; return handle; } @@ -162,7 +162,7 @@ class IQRouterTest : public CppUnit::TestFixture { router->addHandler(this); } - virtual bool handleIQ(boost::shared_ptr<IQ>) { + virtual bool handleIQ(std::shared_ptr<IQ>) { called++; router->removeHandler(this); return false; diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp index 93aa9b1..56daffa 100644 --- a/Swiften/Queries/UnitTest/RequestTest.cpp +++ b/Swiften/Queries/UnitTest/RequestTest.cpp @@ -4,9 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -56,25 +56,25 @@ class RequestTest : public CppUnit::TestFixture { MyRequest( IQ::Type type, const JID& receiver, - boost::shared_ptr<Payload> payload, + std::shared_ptr<Payload> payload, IQRouter* router) : Request(type, receiver, payload, router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { + virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) { onResponse(payload, error); } public: - boost::signal<void (boost::shared_ptr<Payload>, ErrorPayload::ref)> onResponse; + boost::signal<void (std::shared_ptr<Payload>, ErrorPayload::ref)> onResponse; }; public: void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); - payload_ = boost::shared_ptr<Payload>(new MyPayload("foo")); - responsePayload_ = boost::shared_ptr<Payload>(new MyPayload("bar")); + payload_ = std::make_shared<MyPayload>("foo"); + responsePayload_ = std::make_shared<MyPayload>("bar"); responsesReceived_ = 0; } @@ -131,8 +131,8 @@ class RequestTest : public CppUnit::TestFixture { testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2)); testling.send(); - boost::shared_ptr<IQ> error = createError(JID("foo@bar.com/baz"),"test-id"); - boost::shared_ptr<Payload> errorPayload = boost::make_shared<ErrorPayload>(ErrorPayload::InternalServerError); + std::shared_ptr<IQ> error = createError(JID("foo@bar.com/baz"),"test-id"); + std::shared_ptr<Payload> errorPayload = std::make_shared<ErrorPayload>(ErrorPayload::InternalServerError); error->addPayload(errorPayload); channel_->onIQReceived(error); @@ -170,7 +170,7 @@ class RequestTest : public CppUnit::TestFixture { testling.onResponse.connect(boost::bind(&RequestTest::handleDifferentResponse, this, _1, _2)); testling.send(); - responsePayload_ = boost::make_shared<MyOtherPayload>(); + responsePayload_ = std::make_shared<MyOtherPayload>(); channel_->onIQReceived(createResponse(JID("foo@bar.com/baz"),"test-id")); CPPUNIT_ASSERT_EQUAL(1, responsesReceived_); @@ -179,12 +179,12 @@ class RequestTest : public CppUnit::TestFixture { } void testHandleIQ_RawXMLPayload() { - payload_ = boost::make_shared<RawXMLPayload>("<bla/>"); + payload_ = std::make_shared<RawXMLPayload>("<bla/>"); MyRequest testling(IQ::Get, JID("foo@bar.com/baz"), payload_, router_); testling.onResponse.connect(boost::bind(&RequestTest::handleRawXMLResponse, this, _1, _2)); testling.send(); - responsePayload_ = boost::make_shared<MyOtherPayload>(); + responsePayload_ = std::make_shared<MyOtherPayload>(); channel_->onIQReceived(createResponse(JID("foo@bar.com/baz"),"test-id")); CPPUNIT_ASSERT_EQUAL(1, responsesReceived_); @@ -197,7 +197,7 @@ class RequestTest : public CppUnit::TestFixture { testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2)); testling.send(); - boost::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"),"test-id"); + std::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"),"test-id"); response->setType(IQ::Get); channel_->onIQReceived(response); @@ -211,7 +211,7 @@ class RequestTest : public CppUnit::TestFixture { testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2)); testling.send(); - boost::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"), "test-id"); + std::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"), "test-id"); response->setType(IQ::Set); channel_->onIQReceived(response); @@ -315,41 +315,41 @@ class RequestTest : public CppUnit::TestFixture { private: - void handleResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) { + void handleResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) { if (e) { receivedErrors.push_back(*e); } else { - boost::shared_ptr<MyPayload> payload(boost::dynamic_pointer_cast<MyPayload>(p)); + std::shared_ptr<MyPayload> payload(std::dynamic_pointer_cast<MyPayload>(p)); CPPUNIT_ASSERT(payload); CPPUNIT_ASSERT_EQUAL(std::string("bar"), payload->text_); ++responsesReceived_; } } - void handleDifferentResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) { + void handleDifferentResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) { CPPUNIT_ASSERT(!e); CPPUNIT_ASSERT(!p); ++responsesReceived_; } - void handleRawXMLResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) { + void handleRawXMLResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) { CPPUNIT_ASSERT(!e); CPPUNIT_ASSERT(p); - CPPUNIT_ASSERT(boost::dynamic_pointer_cast<MyOtherPayload>(p)); + CPPUNIT_ASSERT(std::dynamic_pointer_cast<MyOtherPayload>(p)); ++responsesReceived_; } - boost::shared_ptr<IQ> createResponse(const JID& from, const std::string& id) { - boost::shared_ptr<IQ> iq(new IQ(IQ::Result)); + std::shared_ptr<IQ> createResponse(const JID& from, const std::string& id) { + std::shared_ptr<IQ> iq(new IQ(IQ::Result)); iq->setFrom(from); iq->addPayload(responsePayload_); iq->setID(id); return iq; } - boost::shared_ptr<IQ> createError(const JID& from, const std::string& id) { - boost::shared_ptr<IQ> iq(new IQ(IQ::Error)); + std::shared_ptr<IQ> createError(const JID& from, const std::string& id) { + std::shared_ptr<IQ> iq(new IQ(IQ::Error)); iq->setFrom(from); iq->setID(id); return iq; @@ -358,8 +358,8 @@ class RequestTest : public CppUnit::TestFixture { private: IQRouter* router_; DummyIQChannel* channel_; - boost::shared_ptr<Payload> payload_; - boost::shared_ptr<Payload> responsePayload_; + std::shared_ptr<Payload> payload_; + std::shared_ptr<Payload> responsePayload_; int responsesReceived_; std::vector<ErrorPayload> receivedErrors; }; diff --git a/Swiften/Queries/UnitTest/ResponderTest.cpp b/Swiften/Queries/UnitTest/ResponderTest.cpp index c3474f2..98c1448 100644 --- a/Swiften/Queries/UnitTest/ResponderTest.cpp +++ b/Swiften/Queries/UnitTest/ResponderTest.cpp @@ -4,9 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -34,7 +34,7 @@ class ResponderTest : public CppUnit::TestFixture { void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); - payload_ = boost::make_shared<SoftwareVersion>("foo"); + payload_ = std::make_shared<SoftwareVersion>("foo"); } void tearDown() { @@ -110,15 +110,15 @@ class ResponderTest : public CppUnit::TestFixture { void testHandleIQ_NoPayload() { MyResponder testling(router_); - CPPUNIT_ASSERT(!dynamic_cast<IQHandler*>(&testling)->handleIQ(boost::make_shared<IQ>(IQ::Get))); + CPPUNIT_ASSERT(!dynamic_cast<IQHandler*>(&testling)->handleIQ(std::make_shared<IQ>(IQ::Get))); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.getPayloads_.size())); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.setPayloads_.size())); } private: - boost::shared_ptr<IQ> createRequest(IQ::Type type) { - boost::shared_ptr<IQ> iq(new IQ(type)); + std::shared_ptr<IQ> createRequest(IQ::Type type) { + std::shared_ptr<IQ> iq(new IQ(type)); iq->addPayload(payload_); iq->setID("myid"); iq->setFrom(JID("foo@bar.com/baz")); @@ -130,13 +130,13 @@ class ResponderTest : public CppUnit::TestFixture { public: MyResponder(IQRouter* router) : Responder<SoftwareVersion>(router), getRequestResponse_(true), setRequestResponse_(true) {} - virtual bool handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<SoftwareVersion> payload) { + virtual bool handleGetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<SoftwareVersion> payload) { CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from); CPPUNIT_ASSERT_EQUAL(std::string("myid"), id); getPayloads_.push_back(payload); return getRequestResponse_; } - virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<SoftwareVersion> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<SoftwareVersion> payload) { CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from); CPPUNIT_ASSERT_EQUAL(std::string("myid"), id); setPayloads_.push_back(payload); @@ -145,14 +145,14 @@ class ResponderTest : public CppUnit::TestFixture { bool getRequestResponse_; bool setRequestResponse_; - std::vector<boost::shared_ptr<SoftwareVersion> > getPayloads_; - std::vector<boost::shared_ptr<SoftwareVersion> > setPayloads_; + std::vector<std::shared_ptr<SoftwareVersion> > getPayloads_; + std::vector<std::shared_ptr<SoftwareVersion> > setPayloads_; }; private: IQRouter* router_; DummyIQChannel* channel_; - boost::shared_ptr<SoftwareVersion> payload_; + std::shared_ptr<SoftwareVersion> payload_; }; CPPUNIT_TEST_SUITE_REGISTRATION(ResponderTest); diff --git a/Swiften/Roster/GetRosterRequest.h b/Swiften/Roster/GetRosterRequest.h index 6ca16cb..1a0499f 100644 --- a/Swiften/Roster/GetRosterRequest.h +++ b/Swiften/Roster/GetRosterRequest.h @@ -13,7 +13,7 @@ namespace Swift { class SWIFTEN_API GetRosterRequest : public GenericRequest<RosterPayload> { public: - typedef boost::shared_ptr<GetRosterRequest> ref; + typedef std::shared_ptr<GetRosterRequest> ref; static ref create(IQRouter* router) { return ref(new GetRosterRequest(router)); @@ -27,7 +27,7 @@ namespace Swift { private: GetRosterRequest(IQRouter* router) : - GenericRequest<RosterPayload>(IQ::Get, JID(), boost::shared_ptr<Payload>(new RosterPayload()), router) { + GenericRequest<RosterPayload>(IQ::Get, JID(), std::make_shared<RosterPayload>(), router) { } }; } diff --git a/Swiften/Roster/RosterMemoryStorage.cpp b/Swiften/Roster/RosterMemoryStorage.cpp index f187116..1b72a85 100644 --- a/Swiften/Roster/RosterMemoryStorage.cpp +++ b/Swiften/Roster/RosterMemoryStorage.cpp @@ -1,22 +1,22 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Roster/RosterMemoryStorage.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { RosterMemoryStorage::RosterMemoryStorage() { } -void RosterMemoryStorage::setRoster(boost::shared_ptr<RosterPayload> r) { +void RosterMemoryStorage::setRoster(std::shared_ptr<RosterPayload> r) { roster.reset(); if (r) { - roster = boost::make_shared<RosterPayload>(*r); + roster = std::make_shared<RosterPayload>(*r); } } diff --git a/Swiften/Roster/RosterMemoryStorage.h b/Swiften/Roster/RosterMemoryStorage.h index 4058f84..19e7802 100644 --- a/Swiften/Roster/RosterMemoryStorage.h +++ b/Swiften/Roster/RosterMemoryStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,13 +14,13 @@ namespace Swift { public: RosterMemoryStorage(); - virtual boost::shared_ptr<RosterPayload> getRoster() const { + virtual std::shared_ptr<RosterPayload> getRoster() const { return roster; } - virtual void setRoster(boost::shared_ptr<RosterPayload>); + virtual void setRoster(std::shared_ptr<RosterPayload>); private: - boost::shared_ptr<RosterPayload> roster; + std::shared_ptr<RosterPayload> roster; }; } diff --git a/Swiften/Roster/RosterPushResponder.h b/Swiften/Roster/RosterPushResponder.h index 06ba797..10986f5 100644 --- a/Swiften/Roster/RosterPushResponder.h +++ b/Swiften/Roster/RosterPushResponder.h @@ -17,13 +17,13 @@ namespace Swift { RosterPushResponder(IQRouter* router) : SetResponder<RosterPayload>(router) {} public: - boost::signal<void (boost::shared_ptr<RosterPayload>)> onRosterReceived; + boost::signal<void (std::shared_ptr<RosterPayload>)> onRosterReceived; private: - virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<RosterPayload> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<RosterPayload> payload) { if (getIQRouter()->isAccountJID(from)) { onRosterReceived(payload); - sendResponse(from, id, boost::shared_ptr<RosterPayload>()); + sendResponse(from, id, std::shared_ptr<RosterPayload>()); } else { sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel); diff --git a/Swiften/Roster/RosterStorage.h b/Swiften/Roster/RosterStorage.h index 92c40f9..1c1461d 100644 --- a/Swiften/Roster/RosterStorage.h +++ b/Swiften/Roster/RosterStorage.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/RosterPayload.h> @@ -16,7 +16,7 @@ namespace Swift { public: virtual ~RosterStorage(); - virtual boost::shared_ptr<RosterPayload> getRoster() const = 0; - virtual void setRoster(boost::shared_ptr<RosterPayload>) = 0; + virtual std::shared_ptr<RosterPayload> getRoster() const = 0; + virtual void setRoster(std::shared_ptr<RosterPayload>) = 0; }; } diff --git a/Swiften/Roster/SetRosterRequest.h b/Swiften/Roster/SetRosterRequest.h index 64c0984..7615abc 100644 --- a/Swiften/Roster/SetRosterRequest.h +++ b/Swiften/Roster/SetRosterRequest.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -16,7 +16,7 @@ namespace Swift { class SWIFTEN_API SetRosterRequest : public Request { public: - typedef boost::shared_ptr<SetRosterRequest> ref; + typedef std::shared_ptr<SetRosterRequest> ref; static ref create(RosterPayload::ref payload, IQRouter* router) { return ref(new SetRosterRequest(JID(), payload, router)); @@ -27,10 +27,10 @@ namespace Swift { } private: - SetRosterRequest(const JID& to, boost::shared_ptr<RosterPayload> payload, IQRouter* router) : Request(IQ::Set, to, boost::shared_ptr<RosterPayload>(payload), router) { + SetRosterRequest(const JID& to, std::shared_ptr<RosterPayload> payload, IQRouter* router) : Request(IQ::Set, to, std::shared_ptr<RosterPayload>(payload), router) { } - virtual void handleResponse(boost::shared_ptr<Payload> /*payload*/, ErrorPayload::ref error) { + virtual void handleResponse(std::shared_ptr<Payload> /*payload*/, ErrorPayload::ref error) { onResponse(error); } diff --git a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp index 6850c21..b646aba 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -61,10 +61,10 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { } void testGet_Response() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->requestRoster(); - boost::shared_ptr<RosterPayload> payload = boost::make_shared<RosterPayload>(); + std::shared_ptr<RosterPayload> payload = std::make_shared<RosterPayload>(); payload->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); payload->addItem(RosterItemPayload(jid2_, "Alice", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createResult("foo@bar.com", channel_->sentStanzas[0]->getID(), payload)); @@ -79,13 +79,13 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { controller.requestRoster(); - channel_->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), channel_->sentStanzas[0]->getID(), boost::shared_ptr<RosterPayload>())); + channel_->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), channel_->sentStanzas[0]->getID(), std::shared_ptr<RosterPayload>())); } void testAdd() { XMPPRosterController controller(router_, xmppRoster_, rosterStorage_); - boost::shared_ptr<RosterPayload> payload(new RosterPayload()); + std::shared_ptr<RosterPayload> payload(new RosterPayload()); payload->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "eou", payload)); @@ -97,65 +97,65 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { } void testGet_NoRosterInStorage() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->setUseVersioning(true); testling->requestRoster(); - boost::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); + std::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); CPPUNIT_ASSERT(roster->getVersion()); CPPUNIT_ASSERT_EQUAL(std::string(""), *roster->getVersion()); } void testGet_NoVersionInStorage() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->setUseVersioning(true); - rosterStorage_->setRoster(boost::make_shared<RosterPayload>()); + rosterStorage_->setRoster(std::make_shared<RosterPayload>()); testling->requestRoster(); - boost::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); + std::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); CPPUNIT_ASSERT(roster->getVersion()); CPPUNIT_ASSERT_EQUAL(std::string(""), *roster->getVersion()); } void testGet_VersionInStorage() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->setUseVersioning(true); - boost::shared_ptr<RosterPayload> payload(new RosterPayload()); + std::shared_ptr<RosterPayload> payload(new RosterPayload()); payload->setVersion("foover"); rosterStorage_->setRoster(payload); testling->requestRoster(); - boost::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); + std::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); CPPUNIT_ASSERT(roster->getVersion()); CPPUNIT_ASSERT_EQUAL(std::string("foover"), *roster->getVersion()); } void testGet_ServerDoesNotSupportVersion() { - boost::shared_ptr<XMPPRosterController> testling(createController()); - boost::shared_ptr<RosterPayload> payload(new RosterPayload()); + std::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<RosterPayload> payload(new RosterPayload()); payload->setVersion("foover"); rosterStorage_->setRoster(payload); testling->requestRoster(); - boost::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); + std::shared_ptr<RosterPayload> roster = channel_->sentStanzas[0]->getPayload<RosterPayload>(); CPPUNIT_ASSERT(!roster->getVersion()); } void testGet_ResponseWithoutNewVersion() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->setUseVersioning(true); - boost::shared_ptr<RosterPayload> storedRoster(new RosterPayload()); + std::shared_ptr<RosterPayload> storedRoster(new RosterPayload()); storedRoster->setVersion("version10"); storedRoster->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); storedRoster->addItem(RosterItemPayload(jid2_, "Alice", RosterItemPayload::Both)); rosterStorage_->setRoster(storedRoster); testling->requestRoster(); - channel_->onIQReceived(IQ::createResult("foo@bar.com", channel_->sentStanzas[0]->getID(), boost::shared_ptr<RosterPayload>())); + channel_->onIQReceived(IQ::createResult("foo@bar.com", channel_->sentStanzas[0]->getID(), std::shared_ptr<RosterPayload>())); CPPUNIT_ASSERT_EQUAL(2, handler_->getEventCount()); CPPUNIT_ASSERT(xmppRoster_->getItem(jid1_)); @@ -170,15 +170,15 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { } void testGet_ResponseWithNewVersion() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->setUseVersioning(true); - boost::shared_ptr<RosterPayload> storedRoster(new RosterPayload()); + std::shared_ptr<RosterPayload> storedRoster(new RosterPayload()); storedRoster->setVersion("version10"); storedRoster->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); rosterStorage_->setRoster(storedRoster); testling->requestRoster(); - boost::shared_ptr<RosterPayload> serverRoster(new RosterPayload()); + std::shared_ptr<RosterPayload> serverRoster(new RosterPayload()); serverRoster->setVersion("version12"); serverRoster->addItem(RosterItemPayload(jid2_, "Alice", RosterItemPayload::Both)); std::vector<std::string> groups; @@ -204,9 +204,9 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { } void testAddFromNonAccount() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); - boost::shared_ptr<RosterPayload> payload(new RosterPayload()); + std::shared_ptr<RosterPayload> payload(new RosterPayload()); payload->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); IQ::ref request = IQ::createRequest(IQ::Set, JID(), "eou", payload); request->setFrom(jid2_); @@ -217,7 +217,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { void testModify() { XMPPRosterController controller(router_, xmppRoster_, rosterStorage_); - boost::shared_ptr<RosterPayload> payload1(new RosterPayload()); + std::shared_ptr<RosterPayload> payload1(new RosterPayload()); payload1->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id1", payload1)); @@ -225,7 +225,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); handler_->reset(); - boost::shared_ptr<RosterPayload> payload2(new RosterPayload()); + std::shared_ptr<RosterPayload> payload2(new RosterPayload()); payload2->addItem(RosterItemPayload(jid1_, "Bob2", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id2", payload2)); @@ -237,7 +237,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { void testRemove() { XMPPRosterController controller(router_, xmppRoster_, rosterStorage_); - boost::shared_ptr<RosterPayload> payload1(new RosterPayload()); + std::shared_ptr<RosterPayload> payload1(new RosterPayload()); payload1->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id1", payload1)); @@ -245,7 +245,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); handler_->reset(); - boost::shared_ptr<RosterPayload> payload2(new RosterPayload()); + std::shared_ptr<RosterPayload> payload2(new RosterPayload()); payload2->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Remove)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id2", payload2)); CPPUNIT_ASSERT(!xmppRoster_->containsJID(jid1_)); @@ -255,17 +255,17 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { } void testRemove_RosterStorageUpdated() { - boost::shared_ptr<XMPPRosterController> testling(createController()); + std::shared_ptr<XMPPRosterController> testling(createController()); testling->setUseVersioning(true); - boost::shared_ptr<RosterPayload> storedRoster(new RosterPayload()); + std::shared_ptr<RosterPayload> storedRoster(new RosterPayload()); storedRoster->setVersion("version10"); storedRoster->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); storedRoster->addItem(RosterItemPayload(jid2_, "Alice", RosterItemPayload::Both)); rosterStorage_->setRoster(storedRoster); testling->requestRoster(); - channel_->onIQReceived(IQ::createResult("foo@bar.com", channel_->sentStanzas[0]->getID(), boost::shared_ptr<RosterPayload>())); + channel_->onIQReceived(IQ::createResult("foo@bar.com", channel_->sentStanzas[0]->getID(), std::shared_ptr<RosterPayload>())); - boost::shared_ptr<RosterPayload> payload2(new RosterPayload()); + std::shared_ptr<RosterPayload> payload2(new RosterPayload()); payload2->setVersion("version15"); payload2->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Remove)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id2", payload2)); @@ -279,7 +279,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { void testMany() { XMPPRosterController controller(router_, xmppRoster_, rosterStorage_); - boost::shared_ptr<RosterPayload> payload1(new RosterPayload()); + std::shared_ptr<RosterPayload> payload1(new RosterPayload()); payload1->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id1", payload1)); @@ -287,7 +287,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); handler_->reset(); - boost::shared_ptr<RosterPayload> payload2(new RosterPayload()); + std::shared_ptr<RosterPayload> payload2(new RosterPayload()); payload2->addItem(RosterItemPayload(jid2_, "Alice", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id2", payload2)); @@ -295,7 +295,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid2_, handler_->getLastJID()); handler_->reset(); - boost::shared_ptr<RosterPayload> payload3(new RosterPayload()); + std::shared_ptr<RosterPayload> payload3(new RosterPayload()); payload3->addItem(RosterItemPayload(jid1_, "Ernie", RosterItemPayload::Both)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id3", payload3)); @@ -303,7 +303,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); handler_->reset(); - boost::shared_ptr<RosterPayload> payload4(new RosterPayload()); + std::shared_ptr<RosterPayload> payload4(new RosterPayload()); RosterItemPayload item(jid3_, "Jane", RosterItemPayload::Both); std::string janesGroup("Jane's Group"); item.addGroup(janesGroup); @@ -316,7 +316,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(janesGroup, xmppRoster_->getGroupsForJID(jid3_)[0]); handler_->reset(); - boost::shared_ptr<RosterPayload> payload5(new RosterPayload()); + std::shared_ptr<RosterPayload> payload5(new RosterPayload()); payload5->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Remove)); channel_->onIQReceived(IQ::createRequest(IQ::Set, JID(), "id5", payload5)); CPPUNIT_ASSERT(!xmppRoster_->containsJID(jid1_)); @@ -324,7 +324,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(jid1_, handler_->getLastJID()); handler_->reset(); - boost::shared_ptr<RosterPayload> payload6(new RosterPayload()); + std::shared_ptr<RosterPayload> payload6(new RosterPayload()); RosterItemPayload item2(jid2_, "Little Alice", RosterItemPayload::Both); std::string alicesGroup("Alice's Group"); item2.addGroup(alicesGroup); diff --git a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp index f611fec..f0d92e9 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp @@ -4,8 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> diff --git a/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h b/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h index 9c9afad..0535578 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h +++ b/Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Roster/XMPPRosterImpl.h> enum XMPPRosterEvents {None, Add, Remove, Update}; diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp index 10803f3..b5e72f5 100644 --- a/Swiften/Roster/XMPPRosterController.cpp +++ b/Swiften/Roster/XMPPRosterController.cpp @@ -23,7 +23,7 @@ namespace Swift { * The controller does not gain ownership of these parameters. */ XMPPRosterController::XMPPRosterController(IQRouter* iqRouter, XMPPRosterImpl* xmppRoster, RosterStorage* rosterStorage) : iqRouter_(iqRouter), rosterPushResponder_(iqRouter), xmppRoster_(xmppRoster), rosterStorage_(rosterStorage), useVersioning(false) { - rosterPushResponder_.onRosterReceived.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1, false, boost::shared_ptr<RosterPayload>())); + rosterPushResponder_.onRosterReceived.connect(boost::bind(&XMPPRosterController::handleRosterReceived, this, _1, false, std::shared_ptr<RosterPayload>())); rosterPushResponder_.start(); } @@ -34,7 +34,7 @@ XMPPRosterController::~XMPPRosterController() { void XMPPRosterController::requestRoster() { xmppRoster_->clear(); - boost::shared_ptr<RosterPayload> storedRoster = rosterStorage_->getRoster(); + std::shared_ptr<RosterPayload> storedRoster = rosterStorage_->getRoster(); GetRosterRequest::ref rosterRequest; if (useVersioning) { std::string version = ""; @@ -50,7 +50,7 @@ void XMPPRosterController::requestRoster() { rosterRequest->send(); } -void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload, bool initial, boost::shared_ptr<RosterPayload> previousRoster) { +void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> rosterPayload, bool initial, std::shared_ptr<RosterPayload> previousRoster) { if (rosterPayload) { foreach(const RosterItemPayload& item, rosterPayload->getItems()) { //Don't worry about the updated case, the XMPPRoster sorts that out. @@ -82,7 +82,7 @@ void XMPPRosterController::handleRosterReceived(boost::shared_ptr<RosterPayload> void XMPPRosterController::saveRoster(const std::string& version) { std::vector<XMPPRosterItem> items = xmppRoster_->getItems(); - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->setVersion(version); foreach(const XMPPRosterItem& item, items) { roster->addItem(RosterItemPayload(item.getJID(), item.getName(), item.getSubscription(), item.getGroups())); diff --git a/Swiften/Roster/XMPPRosterController.h b/Swiften/Roster/XMPPRosterController.h index d40ba1e..3803cd5 100644 --- a/Swiften/Roster/XMPPRosterController.h +++ b/Swiften/Roster/XMPPRosterController.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/IQ.h> @@ -34,7 +33,7 @@ namespace Swift { } private: - void handleRosterReceived(boost::shared_ptr<RosterPayload> rosterPayload, bool initial, boost::shared_ptr<RosterPayload> previousRoster); + void handleRosterReceived(std::shared_ptr<RosterPayload> rosterPayload, bool initial, std::shared_ptr<RosterPayload> previousRoster); void saveRoster(const std::string& version); private: diff --git a/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp index 04e2df5..d29af59 100644 --- a/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp +++ b/Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp @@ -26,7 +26,7 @@ class DIGESTMD5ClientAuthenticatorTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); } void testGetInitialResponse() { @@ -64,7 +64,7 @@ class DIGESTMD5ClientAuthenticatorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(DIGESTMD5ClientAuthenticatorTest); diff --git a/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp index 3d5d161..7f408c6 100644 --- a/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp +++ b/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp @@ -43,8 +43,8 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { public: void setUp() { - idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + idnConverter = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); } void testGetInitialResponse() { @@ -226,8 +226,8 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(!testling.getResponse()); } - boost::shared_ptr<IDNConverter> idnConverter; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<IDNConverter> idnConverter; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(SCRAMSHA1ClientAuthenticatorTest); diff --git a/Swiften/SASL/WindowsAuthentication.cpp b/Swiften/SASL/WindowsAuthentication.cpp index 5917b66..b86381b 100644 --- a/Swiften/SASL/WindowsAuthentication.cpp +++ b/Swiften/SASL/WindowsAuthentication.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,7 +15,7 @@ #define ASSIGN_ERROR(status, errorCode) \ { \ - errorCode = boost::make_shared<boost::system::error_code>(status, boost::system::system_category()); \ + errorCode = std::make_shared<boost::system::error_code>(status, boost::system::system_category()); \ SWIFT_LOG(debug) << std::hex << "status: 0x" << status << ": " << errorCode->message() << std::endl; \ } @@ -32,11 +32,11 @@ namespace Swift { -boost::shared_ptr<boost::system::error_code> getUserNameEx(std::string& userName, std::string& clientName, std::string& serverName) { +std::shared_ptr<boost::system::error_code> getUserNameEx(std::string& userName, std::string& clientName, std::string& serverName) { ULONG length = 512; DWORD status = ERROR_MORE_DATA; bool firstCall = true; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; while (status == ERROR_MORE_DATA) { std::vector<wchar_t> value(length); @@ -70,9 +70,9 @@ boost::shared_ptr<boost::system::error_code> getUserNameEx(std::string& userName return errorCode; } -boost::shared_ptr<boost::system::error_code> acquireCredentialsHandle(PCredHandle credentialsHandle) { +std::shared_ptr<boost::system::error_code> acquireCredentialsHandle(PCredHandle credentialsHandle) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; TimeStamp validity; status = AcquireCredentialsHandle( @@ -90,9 +90,9 @@ boost::shared_ptr<boost::system::error_code> acquireCredentialsHandle(PCredHandl return errorCode; } -boost::shared_ptr<boost::system::error_code> freeCredentialsHandle(PCredHandle credentialsHandle) { +std::shared_ptr<boost::system::error_code> freeCredentialsHandle(PCredHandle credentialsHandle) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; status = FreeCredentialsHandle(credentialsHandle); ASSIGN_SEC_ERROR(status, errorCode); @@ -100,9 +100,9 @@ boost::shared_ptr<boost::system::error_code> freeCredentialsHandle(PCredHandle c return errorCode; } -boost::shared_ptr<boost::system::error_code> initializeSecurityContext(const boost::optional<ByteArray>& inputToken, const std::string& servicePrincipalNameString, const PCredHandle credentialsHandle, bool haveContextHandle, PCtxtHandle contextHandle, ULONG contextRequested, ULONG* contextSupported, bool* haveCompleteContext, SafeByteArray& outputToken) { +std::shared_ptr<boost::system::error_code> initializeSecurityContext(const boost::optional<ByteArray>& inputToken, const std::string& servicePrincipalNameString, const PCredHandle credentialsHandle, bool haveContextHandle, PCtxtHandle contextHandle, ULONG contextRequested, ULONG* contextSupported, bool* haveCompleteContext, SafeByteArray& outputToken) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; SecBufferDesc input; SecBufferDesc output; SecBuffer inputTokenBuffer; @@ -164,15 +164,15 @@ boost::shared_ptr<boost::system::error_code> initializeSecurityContext(const boo SWIFT_LOG(debug) << "outputToken.size(): " << outputToken.size() << std::endl; freeContextBuffer(outputTokenBuffer.pvBuffer); - return boost::shared_ptr<boost::system::error_code>(); /* success */ + return std::shared_ptr<boost::system::error_code>(); /* success */ } return errorCode; } -boost::shared_ptr<boost::system::error_code> deleteSecurityContext(PCtxtHandle contextHandle) { +std::shared_ptr<boost::system::error_code> deleteSecurityContext(PCtxtHandle contextHandle) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; status = DeleteSecurityContext(contextHandle); ASSIGN_SEC_ERROR(status, errorCode); @@ -180,9 +180,9 @@ boost::shared_ptr<boost::system::error_code> deleteSecurityContext(PCtxtHandle c return errorCode; } -boost::shared_ptr<boost::system::error_code> completeAuthToken(const PCtxtHandle contextHandle, PSecBufferDesc token) { +std::shared_ptr<boost::system::error_code> completeAuthToken(const PCtxtHandle contextHandle, PSecBufferDesc token) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; status = CompleteAuthToken( contextHandle, /* partial context */ @@ -192,9 +192,9 @@ boost::shared_ptr<boost::system::error_code> completeAuthToken(const PCtxtHandle return errorCode; } -boost::shared_ptr<boost::system::error_code> freeContextBuffer(PVOID contextBuffer) { +std::shared_ptr<boost::system::error_code> freeContextBuffer(PVOID contextBuffer) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; if (contextBuffer == NULL) { return errorCode; @@ -206,11 +206,11 @@ boost::shared_ptr<boost::system::error_code> freeContextBuffer(PVOID contextBuff return errorCode; } -boost::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle contextHandle, const ByteArray& message, SafeByteArray& decrypted) { +std::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle contextHandle, const ByteArray& message, SafeByteArray& decrypted) { /* Following https://msdn.microsoft.com/en-us/library/windows/desktop/aa380496%28v=vs.85%29.aspx */ SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; SecBufferDesc inOut; SecBuffer messageBuffer[2]; SafeByteArray inputMessage; @@ -253,11 +253,11 @@ boost::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle co return errorCode; } -boost::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle contextHandle, const SecPkgContext_Sizes& sizes, const SafeByteArray& message, SafeByteArray& output) { +std::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle contextHandle, const SecPkgContext_Sizes& sizes, const SafeByteArray& message, SafeByteArray& output) { /* Following https://msdn.microsoft.com/en-us/library/windows/desktop/aa380496%28v=vs.85%29.aspx */ SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; SecBufferDesc inOut; SecBuffer messageBuffer[3]; SafeByteArray securityTrailer(sizes.cbSecurityTrailer); @@ -311,9 +311,9 @@ boost::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle co return errorCode; } -boost::shared_ptr<boost::system::error_code> queryContextAttributes(const PCtxtHandle contextHandle, ULONG attribute, PVOID buffer) { +std::shared_ptr<boost::system::error_code> queryContextAttributes(const PCtxtHandle contextHandle, ULONG attribute, PVOID buffer) { SECURITY_STATUS status; - boost::shared_ptr<boost::system::error_code> errorCode; + std::shared_ptr<boost::system::error_code> errorCode; status = QueryContextAttributes( contextHandle, diff --git a/Swiften/SASL/WindowsAuthentication.h b/Swiften/SASL/WindowsAuthentication.h index e0cf4bc..e5705a3 100644 --- a/Swiften/SASL/WindowsAuthentication.h +++ b/Swiften/SASL/WindowsAuthentication.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,7 +28,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> getUserNameEx(std::string& userName, std::string& clientName, std::string& serverName); + SWIFTEN_API std::shared_ptr<boost::system::error_code> getUserNameEx(std::string& userName, std::string& clientName, std::string& serverName); /** * Retrieves the handle to preexisting client credentials for the @@ -42,7 +42,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> acquireCredentialsHandle(PCredHandle credentialsHandle); + SWIFTEN_API std::shared_ptr<boost::system::error_code> acquireCredentialsHandle(PCredHandle credentialsHandle); /** * Releases the credentials handle obtained by the @@ -55,7 +55,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> freeCredentialsHandle(PCredHandle credentialsHandle); + SWIFTEN_API std::shared_ptr<boost::system::error_code> freeCredentialsHandle(PCredHandle credentialsHandle); /** * Builds the security context between the client and remote peer. @@ -87,7 +87,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> initializeSecurityContext(const boost::optional<ByteArray>& inputToken, const std::string& servicePrincipalNameString, const PCredHandle credentialsHandle, bool haveContextHandle, PCtxtHandle contextHandle, ULONG contextRequested, ULONG* contextSupported, bool* haveCompleteContext, SafeByteArray& outputToken); + SWIFTEN_API std::shared_ptr<boost::system::error_code> initializeSecurityContext(const boost::optional<ByteArray>& inputToken, const std::string& servicePrincipalNameString, const PCredHandle credentialsHandle, bool haveContextHandle, PCtxtHandle contextHandle, ULONG contextRequested, ULONG* contextSupported, bool* haveCompleteContext, SafeByteArray& outputToken); /** * Releases the context handle obtained by the @@ -100,7 +100,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> deleteSecurityContext(PCtxtHandle contextHandle); + SWIFTEN_API std::shared_ptr<boost::system::error_code> deleteSecurityContext(PCtxtHandle contextHandle); /** * Completes an authentication token for a partial security context. @@ -111,7 +111,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> completeAuthToken(const PCtxtHandle contextHandle, PSecBufferDesc token); + SWIFTEN_API std::shared_ptr<boost::system::error_code> completeAuthToken(const PCtxtHandle contextHandle, PSecBufferDesc token); /** * Frees a memory buffer allocated by the security package. @@ -121,7 +121,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> freeContextBuffer(PVOID contextBuffer); + SWIFTEN_API std::shared_ptr<boost::system::error_code> freeContextBuffer(PVOID contextBuffer); /** * Decrypt message (assumes that sequence numbers are not maintained). @@ -133,7 +133,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle contextHandle, const ByteArray& message, SafeByteArray& decrypted); + SWIFTEN_API std::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle contextHandle, const ByteArray& message, SafeByteArray& decrypted); /** * Produces a header or trailer for the message but does not encrypt it @@ -147,7 +147,7 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle contextHandle, const SecPkgContext_Sizes& sizes, const SafeByteArray& message, SafeByteArray& output); + SWIFTEN_API std::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle contextHandle, const SecPkgContext_Sizes& sizes, const SafeByteArray& message, SafeByteArray& output); /** * Queries the security package for attributes of the security context. @@ -165,6 +165,6 @@ namespace Swift { * @return NULL for success, otherwise the error code returned by * Windows. */ - SWIFTEN_API boost::shared_ptr<boost::system::error_code> queryContextAttributes(const PCtxtHandle contextHandle, ULONG attribute, PVOID buffer); + SWIFTEN_API std::shared_ptr<boost::system::error_code> queryContextAttributes(const PCtxtHandle contextHandle, ULONG attribute, PVOID buffer); } diff --git a/Swiften/SASL/WindowsGSSAPIClientAuthenticator.h b/Swiften/SASL/WindowsGSSAPIClientAuthenticator.h index c48d4dc..72616ed 100644 --- a/Swiften/SASL/WindowsGSSAPIClientAuthenticator.h +++ b/Swiften/SASL/WindowsGSSAPIClientAuthenticator.h @@ -88,7 +88,7 @@ namespace Swift { * * @return Error details. */ - boost::shared_ptr<boost::system::error_code> getErrorCode() { + std::shared_ptr<boost::system::error_code> getErrorCode() { return errorCode_; } @@ -102,7 +102,7 @@ namespace Swift { ServerAuthenticated } step_; bool error_; - boost::shared_ptr<boost::system::error_code> errorCode_; + std::shared_ptr<boost::system::error_code> errorCode_; std::string servicePrincipalNameString_; bool haveCredentialsHandle_; bool haveContextHandle_; diff --git a/Swiften/Serializer/AuthChallengeSerializer.cpp b/Swiften/Serializer/AuthChallengeSerializer.cpp index 2796a2d..8f963ff 100644 --- a/Swiften/Serializer/AuthChallengeSerializer.cpp +++ b/Swiften/Serializer/AuthChallengeSerializer.cpp @@ -15,8 +15,8 @@ namespace Swift { AuthChallengeSerializer::AuthChallengeSerializer() { } -SafeByteArray AuthChallengeSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<AuthChallenge> authChallenge(boost::dynamic_pointer_cast<AuthChallenge>(element)); +SafeByteArray AuthChallengeSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<AuthChallenge> authChallenge(std::dynamic_pointer_cast<AuthChallenge>(element)); std::string value; boost::optional<std::vector<unsigned char> > message = authChallenge->getValue(); if (message) { diff --git a/Swiften/Serializer/AuthChallengeSerializer.h b/Swiften/Serializer/AuthChallengeSerializer.h index 6c88d0a..9bcf68b 100644 --- a/Swiften/Serializer/AuthChallengeSerializer.h +++ b/Swiften/Serializer/AuthChallengeSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/AuthChallenge.h> @@ -17,6 +17,6 @@ namespace Swift { public: AuthChallengeSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/AuthFailureSerializer.h b/Swiften/Serializer/AuthFailureSerializer.h index fe85d2c..a410e8c 100644 --- a/Swiften/Serializer/AuthFailureSerializer.h +++ b/Swiften/Serializer/AuthFailureSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/AuthFailure.h> @@ -19,7 +19,7 @@ namespace Swift { AuthFailureSerializer() : GenericElementSerializer<AuthFailure>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failure", "urn:ietf:params:xml:ns:xmpp-sasl").serialize()); } }; diff --git a/Swiften/Serializer/AuthRequestSerializer.cpp b/Swiften/Serializer/AuthRequestSerializer.cpp index f479eac..2c9a4dd 100644 --- a/Swiften/Serializer/AuthRequestSerializer.cpp +++ b/Swiften/Serializer/AuthRequestSerializer.cpp @@ -16,8 +16,8 @@ namespace Swift { AuthRequestSerializer::AuthRequestSerializer() { } -SafeByteArray AuthRequestSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<AuthRequest> authRequest(boost::dynamic_pointer_cast<AuthRequest>(element)); +SafeByteArray AuthRequestSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<AuthRequest> authRequest(std::dynamic_pointer_cast<AuthRequest>(element)); SafeByteArray value; boost::optional<SafeByteArray> message = authRequest->getMessage(); if (message) { diff --git a/Swiften/Serializer/AuthRequestSerializer.h b/Swiften/Serializer/AuthRequestSerializer.h index 8522c35..ae85cf6 100644 --- a/Swiften/Serializer/AuthRequestSerializer.h +++ b/Swiften/Serializer/AuthRequestSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/AuthRequest.h> @@ -17,6 +17,6 @@ namespace Swift { public: AuthRequestSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/AuthResponseSerializer.cpp b/Swiften/Serializer/AuthResponseSerializer.cpp index b4be521..9d3e2e0 100644 --- a/Swiften/Serializer/AuthResponseSerializer.cpp +++ b/Swiften/Serializer/AuthResponseSerializer.cpp @@ -16,8 +16,8 @@ namespace Swift { AuthResponseSerializer::AuthResponseSerializer() { } -SafeByteArray AuthResponseSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<AuthResponse> authResponse(boost::dynamic_pointer_cast<AuthResponse>(element)); +SafeByteArray AuthResponseSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<AuthResponse> authResponse(std::dynamic_pointer_cast<AuthResponse>(element)); SafeByteArray value; boost::optional<SafeByteArray> message = authResponse->getValue(); if (message) { diff --git a/Swiften/Serializer/AuthResponseSerializer.h b/Swiften/Serializer/AuthResponseSerializer.h index 2017f75..25ffbbb 100644 --- a/Swiften/Serializer/AuthResponseSerializer.h +++ b/Swiften/Serializer/AuthResponseSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/AuthResponse.h> @@ -17,6 +17,6 @@ namespace Swift { public: AuthResponseSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/AuthSuccessSerializer.cpp b/Swiften/Serializer/AuthSuccessSerializer.cpp index 78fe6a1..48d512b 100644 --- a/Swiften/Serializer/AuthSuccessSerializer.cpp +++ b/Swiften/Serializer/AuthSuccessSerializer.cpp @@ -15,8 +15,8 @@ namespace Swift { AuthSuccessSerializer::AuthSuccessSerializer() { } -SafeByteArray AuthSuccessSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<AuthSuccess> authSuccess(boost::dynamic_pointer_cast<AuthSuccess>(element)); +SafeByteArray AuthSuccessSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<AuthSuccess> authSuccess(std::dynamic_pointer_cast<AuthSuccess>(element)); std::string value; boost::optional<std::vector<unsigned char> > message = authSuccess->getValue(); if (message) { diff --git a/Swiften/Serializer/AuthSuccessSerializer.h b/Swiften/Serializer/AuthSuccessSerializer.h index 99133fa..102e6a0 100644 --- a/Swiften/Serializer/AuthSuccessSerializer.h +++ b/Swiften/Serializer/AuthSuccessSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/AuthSuccess.h> @@ -17,6 +17,6 @@ namespace Swift { public: AuthSuccessSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.cpp b/Swiften/Serializer/ComponentHandshakeSerializer.cpp index 1ac1ce7..0e94917 100644 --- a/Swiften/Serializer/ComponentHandshakeSerializer.cpp +++ b/Swiften/Serializer/ComponentHandshakeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,8 +13,8 @@ namespace Swift { ComponentHandshakeSerializer::ComponentHandshakeSerializer() { } -SafeByteArray ComponentHandshakeSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<ComponentHandshake> handshake(boost::dynamic_pointer_cast<ComponentHandshake>(element)); +SafeByteArray ComponentHandshakeSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<ComponentHandshake> handshake(std::dynamic_pointer_cast<ComponentHandshake>(element)); return createSafeByteArray("<handshake>" + handshake->getData() + "</handshake>"); } diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.h b/Swiften/Serializer/ComponentHandshakeSerializer.h index 651903f..d6ee156 100644 --- a/Swiften/Serializer/ComponentHandshakeSerializer.h +++ b/Swiften/Serializer/ComponentHandshakeSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/ComponentHandshake.h> @@ -17,6 +17,6 @@ namespace Swift { public: ComponentHandshakeSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/CompressFailureSerializer.h b/Swiften/Serializer/CompressFailureSerializer.h index 154f167..045c7d2 100644 --- a/Swiften/Serializer/CompressFailureSerializer.h +++ b/Swiften/Serializer/CompressFailureSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/CompressFailure.h> @@ -19,7 +19,7 @@ namespace Swift { CompressFailureSerializer() : GenericElementSerializer<CompressFailure>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failure", "http://jabber.org/protocol/compress").serialize()); } }; diff --git a/Swiften/Serializer/CompressRequestSerializer.cpp b/Swiften/Serializer/CompressRequestSerializer.cpp index e6bc4ff..9deb702 100644 --- a/Swiften/Serializer/CompressRequestSerializer.cpp +++ b/Swiften/Serializer/CompressRequestSerializer.cpp @@ -13,13 +13,13 @@ namespace Swift { CompressRequestSerializer::CompressRequestSerializer() { } -SafeByteArray CompressRequestSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<CompressRequest> compressRequest(boost::dynamic_pointer_cast<CompressRequest>(element)); +SafeByteArray CompressRequestSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<CompressRequest> compressRequest(std::dynamic_pointer_cast<CompressRequest>(element)); return createSafeByteArray("<compress xmlns='http://jabber.org/protocol/compress'><method>" + compressRequest->getMethod() + "</method></compress>"); } -bool CompressRequestSerializer::canSerialize(boost::shared_ptr<ToplevelElement> element) const { - return boost::dynamic_pointer_cast<CompressRequest>(element) != nullptr; +bool CompressRequestSerializer::canSerialize(std::shared_ptr<ToplevelElement> element) const { + return std::dynamic_pointer_cast<CompressRequest>(element) != nullptr; } } diff --git a/Swiften/Serializer/CompressRequestSerializer.h b/Swiften/Serializer/CompressRequestSerializer.h index 1472a81..d768023 100644 --- a/Swiften/Serializer/CompressRequestSerializer.h +++ b/Swiften/Serializer/CompressRequestSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Serializer/ElementSerializer.h> @@ -16,7 +16,7 @@ namespace Swift { public: CompressRequestSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; - virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; + virtual bool canSerialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/ElementSerializer.h b/Swiften/Serializer/ElementSerializer.h index 15f69da..3bef58b 100644 --- a/Swiften/Serializer/ElementSerializer.h +++ b/Swiften/Serializer/ElementSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Elements/ToplevelElement.h> @@ -16,7 +16,7 @@ namespace Swift { public: virtual ~ElementSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const = 0; - virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const = 0; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const = 0; + virtual bool canSerialize(std::shared_ptr<ToplevelElement> element) const = 0; }; } diff --git a/Swiften/Serializer/EnableStreamManagementSerializer.h b/Swiften/Serializer/EnableStreamManagementSerializer.h index ffbcf8b..ba92843 100644 --- a/Swiften/Serializer/EnableStreamManagementSerializer.h +++ b/Swiften/Serializer/EnableStreamManagementSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/EnableStreamManagement.h> @@ -19,7 +19,7 @@ namespace Swift { EnableStreamManagementSerializer() : GenericElementSerializer<EnableStreamManagement>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("enable", "urn:xmpp:sm:2").serialize()); } }; diff --git a/Swiften/Serializer/GenericElementSerializer.h b/Swiften/Serializer/GenericElementSerializer.h index 053a163..b5f4119 100644 --- a/Swiften/Serializer/GenericElementSerializer.h +++ b/Swiften/Serializer/GenericElementSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Serializer/ElementSerializer.h> @@ -15,10 +15,10 @@ namespace Swift { template<typename T> class SWIFTEN_API GenericElementSerializer : public ElementSerializer { public: - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const = 0; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const = 0; - virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const { - return !!boost::dynamic_pointer_cast<T>(element); + virtual bool canSerialize(std::shared_ptr<ToplevelElement> element) const { + return !!std::dynamic_pointer_cast<T>(element); } }; } diff --git a/Swiften/Serializer/GenericPayloadSerializer.h b/Swiften/Serializer/GenericPayloadSerializer.h index 080d04b..804ccaf 100644 --- a/Swiften/Serializer/GenericPayloadSerializer.h +++ b/Swiften/Serializer/GenericPayloadSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Serializer/PayloadSerializer.h> @@ -15,14 +15,14 @@ namespace Swift { template<typename PAYLOAD_TYPE> class GenericPayloadSerializer : public PayloadSerializer { public: - virtual std::string serialize(boost::shared_ptr<Payload> element) const { - return serializePayload(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(element)); + virtual std::string serialize(std::shared_ptr<Payload> element) const { + return serializePayload(std::dynamic_pointer_cast<PAYLOAD_TYPE>(element)); } - virtual bool canSerialize(boost::shared_ptr<Payload> element) const { - return !!boost::dynamic_pointer_cast<PAYLOAD_TYPE>(element); + virtual bool canSerialize(std::shared_ptr<Payload> element) const { + return !!std::dynamic_pointer_cast<PAYLOAD_TYPE>(element); } - virtual std::string serializePayload(boost::shared_ptr<PAYLOAD_TYPE>) const = 0; + virtual std::string serializePayload(std::shared_ptr<PAYLOAD_TYPE>) const = 0; }; } diff --git a/Swiften/Serializer/GenericStanzaSerializer.h b/Swiften/Serializer/GenericStanzaSerializer.h index 32fcbe9..badd55c 100644 --- a/Swiften/Serializer/GenericStanzaSerializer.h +++ b/Swiften/Serializer/GenericStanzaSerializer.h @@ -15,19 +15,19 @@ namespace Swift { public: GenericStanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers, const boost::optional<std::string>& explicitNS = boost::optional<std::string>()) : StanzaSerializer(tag, payloadSerializers, explicitNS) {} - virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const { + virtual bool canSerialize(std::shared_ptr<ToplevelElement> element) const { return dynamic_cast<STANZA_TYPE*>(element.get()) != nullptr; } virtual void setStanzaSpecificAttributes( - boost::shared_ptr<ToplevelElement> stanza, + std::shared_ptr<ToplevelElement> stanza, XMLElement& element) const { setStanzaSpecificAttributesGeneric( - boost::dynamic_pointer_cast<STANZA_TYPE>(stanza), element); + std::dynamic_pointer_cast<STANZA_TYPE>(stanza), element); } virtual void setStanzaSpecificAttributesGeneric( - boost::shared_ptr<STANZA_TYPE>, + std::shared_ptr<STANZA_TYPE>, XMLElement&) const = 0; }; } diff --git a/Swiften/Serializer/IQSerializer.h b/Swiften/Serializer/IQSerializer.h index db052fb..1bdbb07 100644 --- a/Swiften/Serializer/IQSerializer.h +++ b/Swiften/Serializer/IQSerializer.h @@ -22,7 +22,7 @@ namespace Swift { private: virtual void setStanzaSpecificAttributesGeneric( - boost::shared_ptr<IQ> iq, + std::shared_ptr<IQ> iq, XMLElement& element) const { switch (iq->getType()) { case IQ::Get: element.setAttribute("type","get"); break; diff --git a/Swiften/Serializer/MessageSerializer.cpp b/Swiften/Serializer/MessageSerializer.cpp index fb16393..774d9a3 100644 --- a/Swiften/Serializer/MessageSerializer.cpp +++ b/Swiften/Serializer/MessageSerializer.cpp @@ -15,7 +15,7 @@ MessageSerializer::MessageSerializer(PayloadSerializerCollection* payloadSeriali } void MessageSerializer::setStanzaSpecificAttributesGeneric( - boost::shared_ptr<Message> message, + std::shared_ptr<Message> message, XMLElement& element) const { if (message->getType() == Message::Chat) { element.setAttribute("type", "chat"); diff --git a/Swiften/Serializer/MessageSerializer.h b/Swiften/Serializer/MessageSerializer.h index 50df353..812b647 100644 --- a/Swiften/Serializer/MessageSerializer.h +++ b/Swiften/Serializer/MessageSerializer.h @@ -21,7 +21,7 @@ namespace Swift { private: void setStanzaSpecificAttributesGeneric( - boost::shared_ptr<Message> message, + std::shared_ptr<Message> message, XMLElement& element) const; }; } diff --git a/Swiften/Serializer/PayloadSerializer.h b/Swiften/Serializer/PayloadSerializer.h index 642247d..fe14e3d 100644 --- a/Swiften/Serializer/PayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializer.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> namespace Swift { @@ -19,7 +18,7 @@ namespace Swift { public: virtual ~PayloadSerializer(); - virtual bool canSerialize(boost::shared_ptr<Payload>) const = 0; - virtual std::string serialize(boost::shared_ptr<Payload>) const = 0; + virtual bool canSerialize(std::shared_ptr<Payload>) const = 0; + virtual std::string serialize(std::shared_ptr<Payload>) const = 0; }; } diff --git a/Swiften/Serializer/PayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializerCollection.cpp index 05fe445..dd20364 100644 --- a/Swiften/Serializer/PayloadSerializerCollection.cpp +++ b/Swiften/Serializer/PayloadSerializerCollection.cpp @@ -25,7 +25,7 @@ void PayloadSerializerCollection::removeSerializer(PayloadSerializer* serializer serializers_.erase(std::remove(serializers_.begin(), serializers_.end(), serializer), serializers_.end()); } -PayloadSerializer* PayloadSerializerCollection::getPayloadSerializer(boost::shared_ptr<Payload> payload) const { +PayloadSerializer* PayloadSerializerCollection::getPayloadSerializer(std::shared_ptr<Payload> payload) const { std::vector<PayloadSerializer*>::const_iterator i = std::find_if( serializers_.begin(), serializers_.end(), boost::bind(&PayloadSerializer::canSerialize, _1, payload)); diff --git a/Swiften/Serializer/PayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializerCollection.h index 47ba6a1..a0fe2ea 100644 --- a/Swiften/Serializer/PayloadSerializerCollection.h +++ b/Swiften/Serializer/PayloadSerializerCollection.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> @@ -23,7 +22,7 @@ namespace Swift { void addSerializer(PayloadSerializer* factory); void removeSerializer(PayloadSerializer* factory); - PayloadSerializer* getPayloadSerializer(boost::shared_ptr<Payload>) const; + PayloadSerializer* getPayloadSerializer(std::shared_ptr<Payload>) const; private: std::vector<PayloadSerializer*> serializers_; diff --git a/Swiften/Serializer/PayloadSerializers/BlockSerializer.h b/Swiften/Serializer/PayloadSerializers/BlockSerializer.h index 7490e4f..86aa321 100644 --- a/Swiften/Serializer/PayloadSerializers/BlockSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/BlockSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> @@ -20,11 +20,11 @@ namespace Swift { BlockSerializer(std::string tag) : GenericPayloadSerializer<BLOCK_ELEMENT>(), tag(tag) { } - virtual std::string serializePayload(boost::shared_ptr<BLOCK_ELEMENT> payload) const { + virtual std::string serializePayload(std::shared_ptr<BLOCK_ELEMENT> payload) const { XMLElement element(tag, "urn:xmpp:blocking"); const std::vector<JID>& items = payload->getItems(); for (std::vector<JID>::const_iterator i = items.begin(); i != items.end(); ++i) { - boost::shared_ptr<XMLElement> item = boost::make_shared<XMLElement>("item"); + std::shared_ptr<XMLElement> item = std::make_shared<XMLElement>("item"); item->setAttribute("jid", *i); element.addNode(item); } diff --git a/Swiften/Serializer/PayloadSerializers/BodySerializer.h b/Swiften/Serializer/PayloadSerializers/BodySerializer.h index f2d7a8d..faad411 100644 --- a/Swiften/Serializer/PayloadSerializers/BodySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/BodySerializer.h @@ -16,7 +16,7 @@ namespace Swift { public: BodySerializer() : GenericPayloadSerializer<Body>() {} - virtual std::string serializePayload(boost::shared_ptr<Body> body) const { + virtual std::string serializePayload(std::shared_ptr<Body> body) const { XMLTextNode textNode(body->getText()); return "<body>" + textNode.serialize() + "</body>"; } diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp index b5218ee..93eab75 100644 --- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializerCollection.h> @@ -18,11 +19,11 @@ namespace Swift { BytestreamsSerializer::BytestreamsSerializer() { } -std::string BytestreamsSerializer::serializePayload(boost::shared_ptr<Bytestreams> bytestreams) const { +std::string BytestreamsSerializer::serializePayload(std::shared_ptr<Bytestreams> bytestreams) const { XMLElement queryElement("query", "http://jabber.org/protocol/bytestreams"); queryElement.setAttribute("sid", bytestreams->getStreamID()); foreach(const Bytestreams::StreamHost& streamHost, bytestreams->getStreamHosts()) { - boost::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost")); + std::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost")); streamHostElement->setAttribute("host", streamHost.host); streamHostElement->setAttribute("jid", streamHost.jid.toString()); streamHostElement->setAttribute("port", boost::lexical_cast<std::string>(streamHost.port)); @@ -30,7 +31,7 @@ std::string BytestreamsSerializer::serializePayload(boost::shared_ptr<Bytestream } if (bytestreams->getUsedStreamHost()) { - boost::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost-used")); + std::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost-used")); streamHostElement->setAttribute("jid", *bytestreams->getUsedStreamHost()); queryElement.addNode(streamHostElement); } diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h index 6056cad..533be61 100644 --- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h @@ -17,6 +17,6 @@ namespace Swift { public: BytestreamsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Bytestreams>) const; + virtual std::string serializePayload(std::shared_ptr<Bytestreams>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp index 799e662..19f8a27 100644 --- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Serializer/XML/XMLElement.h> @@ -15,7 +15,7 @@ namespace Swift { CapsInfoSerializer::CapsInfoSerializer() : GenericPayloadSerializer<CapsInfo>() { } -std::string CapsInfoSerializer::serializePayload(boost::shared_ptr<CapsInfo> capsInfo) const { +std::string CapsInfoSerializer::serializePayload(std::shared_ptr<CapsInfo> capsInfo) const { XMLElement capsElement("c", "http://jabber.org/protocol/caps"); capsElement.setAttribute("node", capsInfo->getNode()); capsElement.setAttribute("hash", capsInfo->getHash()); diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h index bbf4c09..ac168e4 100644 --- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: CapsInfoSerializer(); - virtual std::string serializePayload(boost::shared_ptr<CapsInfo>) const; + virtual std::string serializePayload(std::shared_ptr<CapsInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp index 406fdbc..9938bd9 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,7 +17,7 @@ namespace Swift { } - std::string CarbonsDisableSerializer::serializePayload(boost::shared_ptr<CarbonsDisable>) const { + std::string CarbonsDisableSerializer::serializePayload(std::shared_ptr<CarbonsDisable>) const { XMLElement element("disable", "urn:xmpp:carbons:2"); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h index da01ead..a6bf16f 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,6 +16,6 @@ namespace Swift { CarbonsDisableSerializer(); virtual ~CarbonsDisableSerializer(); - virtual std::string serializePayload(boost::shared_ptr<CarbonsDisable>) const; + virtual std::string serializePayload(std::shared_ptr<CarbonsDisable>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp index a2520f9..424c6fc 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,7 +16,7 @@ namespace Swift { } - std::string CarbonsEnableSerializer::serializePayload(boost::shared_ptr<CarbonsEnable>) const { + std::string CarbonsEnableSerializer::serializePayload(std::shared_ptr<CarbonsEnable>) const { XMLElement element("enable", "urn:xmpp:carbons:2"); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h index 8b26901..eb0f6fa 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,6 +17,6 @@ namespace Swift { CarbonsEnableSerializer(); virtual ~CarbonsEnableSerializer(); - virtual std::string serializePayload(boost::shared_ptr<CarbonsEnable>) const; + virtual std::string serializePayload(std::shared_ptr<CarbonsEnable>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp index 6fbfc26..fb92017 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,7 +16,7 @@ namespace Swift { } - std::string CarbonsPrivateSerializer::serializePayload(boost::shared_ptr<CarbonsPrivate>) const { + std::string CarbonsPrivateSerializer::serializePayload(std::shared_ptr<CarbonsPrivate>) const { XMLElement element("private", "urn:xmpp:carbons:2"); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h index a93d87f..d148a26 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,6 +17,6 @@ namespace Swift { CarbonsPrivateSerializer(); virtual ~CarbonsPrivateSerializer(); - virtual std::string serializePayload(boost::shared_ptr<CarbonsPrivate>) const; + virtual std::string serializePayload(std::shared_ptr<CarbonsPrivate>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp index 981421b..cc87929 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h> -#include <boost/make_shared.hpp> +#include <memory> namespace Swift { CarbonsReceivedSerializer::CarbonsReceivedSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<CarbonsReceived>(), serializers_(serializers) { @@ -15,10 +15,10 @@ namespace Swift { CarbonsReceivedSerializer::~CarbonsReceivedSerializer() { } - std::string CarbonsReceivedSerializer::serializePayload(boost::shared_ptr<CarbonsReceived> received) const { + std::string CarbonsReceivedSerializer::serializePayload(std::shared_ptr<CarbonsReceived> received) const { XMLElement element("received", "urn:xmpp:carbons:2"); if (received->getForwarded()) { - element.addNode(boost::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(received->getForwarded()))); + element.addNode(std::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(received->getForwarded()))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h index 719e84a..017b187 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h @@ -20,7 +20,7 @@ namespace Swift { CarbonsReceivedSerializer(PayloadSerializerCollection* serializers); virtual ~CarbonsReceivedSerializer(); - virtual std::string serializePayload(boost::shared_ptr<CarbonsReceived> received) const; + virtual std::string serializePayload(std::shared_ptr<CarbonsReceived> received) const; private: PayloadSerializerCollection* serializers_; diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp index f71208f..986edcb 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,10 +13,10 @@ namespace Swift { CarbonsSentSerializer::~CarbonsSentSerializer() { } - std::string CarbonsSentSerializer::serializePayload(boost::shared_ptr<CarbonsSent> sent) const { + std::string CarbonsSentSerializer::serializePayload(std::shared_ptr<CarbonsSent> sent) const { XMLElement element("sent", "urn:xmpp:carbons:2"); if (sent->getForwarded()) { - element.addNode(boost::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(sent->getForwarded()))); + element.addNode(std::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(sent->getForwarded()))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h index cecb3b8..16db398 100644 --- a/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/CarbonsSent.h> @@ -22,7 +22,7 @@ namespace Swift { CarbonsSentSerializer(PayloadSerializerCollection* serializers); virtual ~CarbonsSentSerializer(); - virtual std::string serializePayload(boost::shared_ptr<CarbonsSent> sent) const; + virtual std::string serializePayload(std::shared_ptr<CarbonsSent> sent) const; private: PayloadSerializerCollection* serializers_; diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp index 325215a..17f8be0 100644 --- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -11,7 +11,7 @@ namespace Swift { ChatStateSerializer::ChatStateSerializer() : GenericPayloadSerializer<ChatState>() { } -std::string ChatStateSerializer::serializePayload(boost::shared_ptr<ChatState> chatState) const { +std::string ChatStateSerializer::serializePayload(std::shared_ptr<ChatState> chatState) const { std::string result("<"); switch (chatState->getChatState()) { case ChatState::Active: result += "active"; break; diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h index cfdaf83..3b9f315 100644 --- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: ChatStateSerializer(); - virtual std::string serializePayload(boost::shared_ptr<ChatState> error) const; + virtual std::string serializePayload(std::shared_ptr<ChatState> error) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp index 9ed17dc..e1dd6ed 100644 --- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -20,7 +19,7 @@ namespace Swift { CommandSerializer::CommandSerializer() { } -std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> command) const { +std::string CommandSerializer::serializePayload(std::shared_ptr<Command> command) const { XMLElement commandElement("command", "http://jabber.org/protocol/commands"); commandElement.setAttribute("node", command->getNode()); @@ -55,11 +54,11 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma actions += "<" + actionToString(action) + "/>"; } actions += "</actions>"; - commandElement.addNode(boost::make_shared<XMLRawTextNode>(actions)); + commandElement.addNode(std::make_shared<XMLRawTextNode>(actions)); } foreach (Command::Note note, command->getNotes()) { - boost::shared_ptr<XMLElement> noteElement(new XMLElement("note")); + std::shared_ptr<XMLElement> noteElement(new XMLElement("note")); std::string type; switch (note.type) { case Command::Note::Info: type = "info"; break; @@ -69,13 +68,13 @@ std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> comma if (!type.empty()) { noteElement->setAttribute("type", type); } - noteElement->addNode(boost::make_shared<XMLTextNode>(note.note)); + noteElement->addNode(std::make_shared<XMLTextNode>(note.note)); commandElement.addNode(noteElement); } Form::ref form = command->getForm(); if (form) { - commandElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); + commandElement.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); } return commandElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.h b/Swiften/Serializer/PayloadSerializers/CommandSerializer.h index bc3642d..e1f0b24 100644 --- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: CommandSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Command>) const; + virtual std::string serializePayload(std::shared_ptr<Command>) const; private: std::string actionToString(Command::Action action) const; diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp index 428b565..b168fdc 100644 --- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h> +#include <memory> + #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/DateTime.h> #include <Swiften/Base/String.h> @@ -18,7 +19,7 @@ namespace Swift { DelaySerializer::DelaySerializer() : GenericPayloadSerializer<Delay>() { } -std::string DelaySerializer::serializePayload(boost::shared_ptr<Delay> delay) const { +std::string DelaySerializer::serializePayload(std::shared_ptr<Delay> delay) const { XMLElement delayElement("delay", "urn:xmpp:delay"); if (delay->getFrom() && delay->getFrom()->isValid()) { delayElement.setAttribute("from", delay->getFrom()->toString()); diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h index 71039f2..86fde42 100644 --- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: DelaySerializer(); - virtual std::string serializePayload(boost::shared_ptr<Delay>) const; + virtual std::string serializePayload(std::shared_ptr<Delay>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.cpp index 887502a..8183b7f 100644 --- a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.cpp @@ -20,7 +20,7 @@ namespace Swift { DeliveryReceiptRequestSerializer::DeliveryReceiptRequestSerializer() : GenericPayloadSerializer<DeliveryReceiptRequest>() { } -std::string DeliveryReceiptRequestSerializer::serializePayload(boost::shared_ptr<DeliveryReceiptRequest> /* request*/) const { +std::string DeliveryReceiptRequestSerializer::serializePayload(std::shared_ptr<DeliveryReceiptRequest> /* request*/) const { XMLElement requestXML("request", "urn:xmpp:receipts"); return requestXML.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h index 97377d6..a3e76eb 100644 --- a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h @@ -21,6 +21,6 @@ namespace Swift { public: DeliveryReceiptRequestSerializer(); - virtual std::string serializePayload(boost::shared_ptr<DeliveryReceiptRequest> request) const; + virtual std::string serializePayload(std::shared_ptr<DeliveryReceiptRequest> request) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.cpp index d3e1480..d392d17 100644 --- a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.cpp @@ -19,7 +19,7 @@ namespace Swift { DeliveryReceiptSerializer::DeliveryReceiptSerializer() : GenericPayloadSerializer<DeliveryReceipt>() { } -std::string DeliveryReceiptSerializer::serializePayload(boost::shared_ptr<DeliveryReceipt> receipt) const { +std::string DeliveryReceiptSerializer::serializePayload(std::shared_ptr<DeliveryReceipt> receipt) const { XMLElement received("received", "urn:xmpp:receipts"); received.setAttribute("id", receipt->getReceivedID()); return received.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h index 943f4b9..6153de1 100644 --- a/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h @@ -21,6 +21,6 @@ namespace Swift { public: DeliveryReceiptSerializer(); - virtual std::string serializePayload(boost::shared_ptr<DeliveryReceipt> receipt) const; + virtual std::string serializePayload(std::shared_ptr<DeliveryReceipt> receipt) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp index e57fd12..73e2585 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -19,13 +18,13 @@ namespace Swift { DiscoInfoSerializer::DiscoInfoSerializer() : GenericPayloadSerializer<DiscoInfo>() { } -std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> discoInfo) const { +std::string DiscoInfoSerializer::serializePayload(std::shared_ptr<DiscoInfo> discoInfo) const { XMLElement queryElement("query", "http://jabber.org/protocol/disco#info"); if (!discoInfo->getNode().empty()) { queryElement.setAttribute("node", discoInfo->getNode()); } foreach(const DiscoInfo::Identity& identity, discoInfo->getIdentities()) { - boost::shared_ptr<XMLElement> identityElement(new XMLElement("identity")); + std::shared_ptr<XMLElement> identityElement(new XMLElement("identity")); if (!identity.getLanguage().empty()) { identityElement->setAttribute("xml:lang", identity.getLanguage()); } @@ -35,12 +34,12 @@ std::string DiscoInfoSerializer::serializePayload(boost::shared_ptr<DiscoInfo> d queryElement.addNode(identityElement); } foreach(const std::string& feature, discoInfo->getFeatures()) { - boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature")); + std::shared_ptr<XMLElement> featureElement(new XMLElement("feature")); featureElement->setAttribute("var", feature); queryElement.addNode(featureElement); } foreach(const Form::ref extension, discoInfo->getExtensions()) { - queryElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(extension))); + queryElement.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(extension))); } return queryElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h index 9850714..21648d6 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: DiscoInfoSerializer(); - virtual std::string serializePayload(boost::shared_ptr<DiscoInfo>) const; + virtual std::string serializePayload(std::shared_ptr<DiscoInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp index f537f40..1b734dc 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -16,13 +16,13 @@ namespace Swift { DiscoItemsSerializer::DiscoItemsSerializer() : GenericPayloadSerializer<DiscoItems>() { } -std::string DiscoItemsSerializer::serializePayload(boost::shared_ptr<DiscoItems> discoItems) const { +std::string DiscoItemsSerializer::serializePayload(std::shared_ptr<DiscoItems> discoItems) const { XMLElement queryElement("query", "http://jabber.org/protocol/disco#items"); if (!discoItems->getNode().empty()) { queryElement.setAttribute("node", discoItems->getNode()); } foreach(const DiscoItems::Item& item, discoItems->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + std::shared_ptr<XMLElement> itemElement(new XMLElement("item")); itemElement->setAttribute("name", item.getName()); itemElement->setAttribute("jid", item.getJID()); if (!item.getNode().empty()) { diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h index acc5a7b..ca88cb0 100644 --- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: DiscoItemsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<DiscoItems>) const; + virtual std::string serializePayload(std::shared_ptr<DiscoItems>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp index 1ed60d1..26686f0 100644 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp @@ -14,7 +14,7 @@ namespace Swift { ErrorSerializer::ErrorSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<ErrorPayload>(), serializers(serializers) { } -std::string ErrorSerializer::serializePayload(boost::shared_ptr<ErrorPayload> error) const { +std::string ErrorSerializer::serializePayload(std::shared_ptr<ErrorPayload> error) const { std::string result("<error type=\""); switch (error->getType()) { case ErrorPayload::Continue: result += "continue"; break; diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h index 2ccd5df..df7791e 100644 --- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: ErrorSerializer(PayloadSerializerCollection* serializers); - virtual std::string serializePayload(boost::shared_ptr<ErrorPayload> error) const; + virtual std::string serializePayload(std::shared_ptr<ErrorPayload> error) const; private: PayloadSerializerCollection* serializers; diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp index cc6339c..9a05431 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp @@ -7,11 +7,9 @@ #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> #include <iostream> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/Algorithm.h> #include <Swiften/Base/String.h> #include <Swiften/Base/foreach.h> @@ -21,10 +19,10 @@ using namespace Swift; namespace { - template<typename T> void serializeValueAsString(boost::shared_ptr<FormField> field, boost::shared_ptr<XMLElement> parent) { - std::string value = boost::dynamic_pointer_cast<T>(field)->getValue(); + template<typename T> void serializeValueAsString(std::shared_ptr<FormField> field, std::shared_ptr<XMLElement> parent) { + std::string value = std::dynamic_pointer_cast<T>(field)->getValue(); if (!value.empty()) { - boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); + std::shared_ptr<XMLElement> valueElement(new XMLElement("value")); valueElement->addNode(XMLTextNode::create(value)); parent->addNode(valueElement); } @@ -35,12 +33,12 @@ namespace Swift { FormSerializer::FormSerializer() : GenericPayloadSerializer<Form>() {} -std::string FormSerializer::serializePayload(boost::shared_ptr<Form> form) const { +std::string FormSerializer::serializePayload(std::shared_ptr<Form> form) const { if (!form) { return ""; } - boost::shared_ptr<XMLElement> formElement(new XMLElement("x", "jabber:x:data")); + std::shared_ptr<XMLElement> formElement(new XMLElement("x", "jabber:x:data")); std::string type; switch (form->getType()) { case Form::FormType: type = "form"; break; @@ -55,14 +53,14 @@ std::string FormSerializer::serializePayload(boost::shared_ptr<Form> form) cons if (!form->getInstructions().empty()) { multiLineify(form->getInstructions(), "instructions", formElement); } - foreach(boost::shared_ptr<FormPage> page, form->getPages()) { + foreach(std::shared_ptr<FormPage> page, form->getPages()) { formElement->addNode(pageToXML(page)); } - foreach(boost::shared_ptr<FormField> field, form->getFields()) { + foreach(std::shared_ptr<FormField> field, form->getFields()) { formElement->addNode(fieldToXML(field, true)); } if (!form->getReportedFields().empty()) { - boost::shared_ptr<XMLElement> reportedElement(new XMLElement("reported")); + std::shared_ptr<XMLElement> reportedElement(new XMLElement("reported")); foreach(FormField::ref field, form->getReportedFields()) { reportedElement->addNode(fieldToXML(field, true)); } @@ -70,7 +68,7 @@ std::string FormSerializer::serializePayload(boost::shared_ptr<Form> form) cons } foreach(Form::FormItem item, form->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + std::shared_ptr<XMLElement> itemElement(new XMLElement("item")); foreach(FormField::ref field, item) { itemElement->addNode(fieldToXML(field, false)); } @@ -81,27 +79,27 @@ std::string FormSerializer::serializePayload(boost::shared_ptr<Form> form) cons formElement->addNode(textToXML(text)); } - foreach (boost::shared_ptr<FormField> field, fields_) { + foreach (std::shared_ptr<FormField> field, fields_) { formElement->addNode(fieldToXML(field,true)); } return formElement->serialize(); } -boost::shared_ptr<XMLElement> FormSerializer::textToXML(boost::shared_ptr<FormText> text) const { - boost::shared_ptr<XMLElement> textElement (new XMLElement("text")); - textElement->addNode(boost::make_shared<XMLTextNode>(text->getTextString())); +std::shared_ptr<XMLElement> FormSerializer::textToXML(std::shared_ptr<FormText> text) const { + std::shared_ptr<XMLElement> textElement (new XMLElement("text")); + textElement->addNode(std::make_shared<XMLTextNode>(text->getTextString())); return textElement; } -boost::shared_ptr<XMLElement> FormSerializer::fieldRefToXML(const std::string& ref) const { - boost::shared_ptr<XMLElement> fieldRefElement(new XMLElement("fieldref")); +std::shared_ptr<XMLElement> FormSerializer::fieldRefToXML(const std::string& ref) const { + std::shared_ptr<XMLElement> fieldRefElement(new XMLElement("fieldref")); fieldRefElement->setAttribute("var", ref); return fieldRefElement; } -boost::shared_ptr<XMLElement> FormSerializer::pageToXML(boost::shared_ptr<FormPage> page) const { - boost::shared_ptr<XMLElement> pageElement(new XMLElement("page")); +std::shared_ptr<XMLElement> FormSerializer::pageToXML(std::shared_ptr<FormPage> page) const { + std::shared_ptr<XMLElement> pageElement(new XMLElement("page")); pageElement->setAttribute("xmlns", "http://jabber.org/protocol/xdata-layout"); if (!page->getLabel().empty()) { pageElement->setAttribute("label", page->getLabel()); @@ -109,12 +107,12 @@ boost::shared_ptr<XMLElement> FormSerializer::pageToXML(boost::shared_ptr<FormPa foreach(const FormText::text text, page->getTextElements()) { pageElement->addNode(textToXML(text)); } - foreach (const boost::shared_ptr<FormField> field, page->getFields()) { + foreach (const std::shared_ptr<FormField> field, page->getFields()) { pageElement->addNode(fieldRefToXML(field->getName())); fields_.push_back(field); } foreach(const FormReportedRef::ref reportedRef, page->getReportedRefs()) { - pageElement->addNode(boost::make_shared<XMLElement>("reportedref")); + pageElement->addNode(std::make_shared<XMLElement>("reportedref")); } foreach(const FormSection::section section, page->getChildSections()) { pageElement->addNode(sectionToXML(section)); @@ -122,20 +120,20 @@ boost::shared_ptr<XMLElement> FormSerializer::pageToXML(boost::shared_ptr<FormPa return pageElement; } -boost::shared_ptr<XMLElement> FormSerializer::sectionToXML(boost::shared_ptr<FormSection> section) const { - boost::shared_ptr<XMLElement> sectionElement(new XMLElement("section")); +std::shared_ptr<XMLElement> FormSerializer::sectionToXML(std::shared_ptr<FormSection> section) const { + std::shared_ptr<XMLElement> sectionElement(new XMLElement("section")); if (!section->getLabel().empty()) { sectionElement->setAttribute("label", section->getLabel()); } foreach(const FormText::text text, section->getTextElements()) { sectionElement->addNode(textToXML(text)); } - foreach(const boost::shared_ptr<FormField> field, section->getFields()) { + foreach(const std::shared_ptr<FormField> field, section->getFields()) { sectionElement->addNode(fieldRefToXML(field->getName())); fields_.push_back(field); } foreach(const FormReportedRef::ref reportedRef, section->getReportedRefs()) { - sectionElement->addNode(boost::make_shared<XMLElement>("reportedref")); + sectionElement->addNode(std::make_shared<XMLElement>("reportedref")); } foreach(const FormSection::section childSection, section->getChildSections()) { sectionElement->addNode(sectionToXML(childSection)); @@ -143,8 +141,8 @@ boost::shared_ptr<XMLElement> FormSerializer::sectionToXML(boost::shared_ptr<For return sectionElement; } -boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormField> field, bool withTypeAttribute) const { - boost::shared_ptr<XMLElement> fieldElement(new XMLElement("field")); +std::shared_ptr<XMLElement> FormSerializer::fieldToXML(std::shared_ptr<FormField> field, bool withTypeAttribute) const { + std::shared_ptr<XMLElement> fieldElement(new XMLElement("field")); if (!field->getName().empty()) { fieldElement->setAttribute("var", field->getName()); } @@ -152,11 +150,11 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF fieldElement->setAttribute("label", field->getLabel()); } if (field->getRequired()) { - fieldElement->addNode(boost::make_shared<XMLElement>("required")); + fieldElement->addNode(std::make_shared<XMLElement>("required")); } if (!field->getDescription().empty()) { - boost::shared_ptr<XMLElement> descriptionElement(new XMLElement("desc")); - descriptionElement->addNode(boost::make_shared<XMLTextNode>(field->getDescription())); + std::shared_ptr<XMLElement> descriptionElement(new XMLElement("desc")); + descriptionElement->addNode(std::make_shared<XMLTextNode>(field->getDescription())); fieldElement->addNode(descriptionElement); } @@ -179,18 +177,18 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF fieldElement->setAttribute("type", fieldType); } foreach (const std::string& value, field->getValues()) { - boost::shared_ptr<XMLElement> valueElement = boost::make_shared<XMLElement>("value"); - valueElement->addNode(boost::make_shared<XMLTextNode>(value)); + std::shared_ptr<XMLElement> valueElement = std::make_shared<XMLElement>("value"); + valueElement->addNode(std::make_shared<XMLTextNode>(value)); fieldElement->addNode(valueElement); } foreach (const FormField::Option& option, field->getOptions()) { - boost::shared_ptr<XMLElement> optionElement(new XMLElement("option")); + std::shared_ptr<XMLElement> optionElement(new XMLElement("option")); if (!option.label.empty()) { optionElement->setAttribute("label", option.label); } - boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); + std::shared_ptr<XMLElement> valueElement(new XMLElement("value")); valueElement->addNode(XMLTextNode::create(option.value)); optionElement->addNode(valueElement); fieldElement->addNode(optionElement); @@ -198,13 +196,13 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF return fieldElement; } -void FormSerializer::multiLineify(const std::string& text, const std::string& elementName, boost::shared_ptr<XMLElement> element) const { +void FormSerializer::multiLineify(const std::string& text, const std::string& elementName, std::shared_ptr<XMLElement> element) const { std::string unRdText(text); erase(unRdText, '\r'); std::vector<std::string> lines = String::split(unRdText, '\n'); foreach (std::string line, lines) { - boost::shared_ptr<XMLElement> lineElement(new XMLElement(elementName)); - lineElement->addNode(boost::make_shared<XMLTextNode>(line)); + std::shared_ptr<XMLElement> lineElement(new XMLElement(elementName)); + lineElement->addNode(std::make_shared<XMLTextNode>(line)); element->addNode(lineElement); } } diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.h b/Swiften/Serializer/PayloadSerializers/FormSerializer.h index 62f6484..590fce4 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.h @@ -18,16 +18,16 @@ namespace Swift { class SWIFTEN_API FormSerializer : public GenericPayloadSerializer<Form> { public: FormSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Form>) const; + virtual std::string serializePayload(std::shared_ptr<Form>) const; private: - boost::shared_ptr<XMLElement> textToXML(boost::shared_ptr<FormText> textElement) const; - boost::shared_ptr<XMLElement> fieldRefToXML(const std::string& ref) const; - boost::shared_ptr<XMLElement> reportedRefToXML(boost::shared_ptr<FormReportedRef> reportedRef) const; - boost::shared_ptr<XMLElement> pageToXML(boost::shared_ptr<FormPage> page) const; - boost::shared_ptr<XMLElement> sectionToXML(boost::shared_ptr<FormSection> section) const; - boost::shared_ptr<XMLElement> fieldToXML(boost::shared_ptr<FormField> field, bool withTypeAttribute) const; - void multiLineify(const std::string& text, const std::string& elementName, boost::shared_ptr<XMLElement> parent) const; - mutable std::vector<boost::shared_ptr<FormField> > fields_; + std::shared_ptr<XMLElement> textToXML(std::shared_ptr<FormText> textElement) const; + std::shared_ptr<XMLElement> fieldRefToXML(const std::string& ref) const; + std::shared_ptr<XMLElement> reportedRefToXML(std::shared_ptr<FormReportedRef> reportedRef) const; + std::shared_ptr<XMLElement> pageToXML(std::shared_ptr<FormPage> page) const; + std::shared_ptr<XMLElement> sectionToXML(std::shared_ptr<FormSection> section) const; + std::shared_ptr<XMLElement> fieldToXML(std::shared_ptr<FormField> field, bool withTypeAttribute) const; + void multiLineify(const std::string& text, const std::string& elementName, std::shared_ptr<XMLElement> parent) const; + mutable std::vector<std::shared_ptr<FormField> > fields_; }; } diff --git a/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.cpp index 8df5793..58660d7 100644 --- a/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Delay.h> #include <Swiften/Elements/IQ.h> @@ -30,7 +31,7 @@ ForwardedSerializer::ForwardedSerializer(PayloadSerializerCollection* serializer ForwardedSerializer::~ForwardedSerializer() { } -std::string ForwardedSerializer::serializePayload(boost::shared_ptr<Forwarded> payload) const { +std::string ForwardedSerializer::serializePayload(std::shared_ptr<Forwarded> payload) const { if (!payload) { return ""; } @@ -38,20 +39,20 @@ std::string ForwardedSerializer::serializePayload(boost::shared_ptr<Forwarded> p XMLElement element("forwarded", "urn:xmpp:forward:0"); if (payload->getDelay()) { - element.addNode(boost::make_shared<XMLRawTextNode>(DelaySerializer().serialize(payload->getDelay()))); + element.addNode(std::make_shared<XMLRawTextNode>(DelaySerializer().serialize(payload->getDelay()))); } if (payload->getStanza()) { /* find out what type of stanza we are dealing with and branch into the correct serializer*/ - boost::shared_ptr<IQ> iq; - boost::shared_ptr<Message> message; - boost::shared_ptr<Presence> presence; + std::shared_ptr<IQ> iq; + std::shared_ptr<Message> message; + std::shared_ptr<Presence> presence; const std::string ns = "jabber:client"; - if ((iq = boost::dynamic_pointer_cast<IQ>(payload->getStanza()))) { - element.addNode(boost::make_shared<XMLRawTextNode>(safeByteArrayToString(IQSerializer(serializers_).serialize(iq, ns)))); - } else if ((message = boost::dynamic_pointer_cast<Message>(payload->getStanza()))) { - element.addNode(boost::make_shared<XMLRawTextNode>(safeByteArrayToString(MessageSerializer(serializers_).serialize(message, ns)))); - } else if ((presence = boost::dynamic_pointer_cast<Presence>(payload->getStanza()))) { - element.addNode(boost::make_shared<XMLRawTextNode>(safeByteArrayToString(PresenceSerializer(serializers_).serialize(presence, ns)))); + if ((iq = std::dynamic_pointer_cast<IQ>(payload->getStanza()))) { + element.addNode(std::make_shared<XMLRawTextNode>(safeByteArrayToString(IQSerializer(serializers_).serialize(iq, ns)))); + } else if ((message = std::dynamic_pointer_cast<Message>(payload->getStanza()))) { + element.addNode(std::make_shared<XMLRawTextNode>(safeByteArrayToString(MessageSerializer(serializers_).serialize(message, ns)))); + } else if ((presence = std::dynamic_pointer_cast<Presence>(payload->getStanza()))) { + element.addNode(std::make_shared<XMLRawTextNode>(safeByteArrayToString(PresenceSerializer(serializers_).serialize(presence, ns)))); } } diff --git a/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h b/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h index 08b82b9..f3eb6fb 100644 --- a/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { ForwardedSerializer(PayloadSerializerCollection* serializers); virtual ~ForwardedSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Forwarded>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<Forwarded>) const SWIFTEN_OVERRIDE; private: PayloadSerializerCollection* serializers_; diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp index 53ae0d2..36d82a2 100644 --- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp @@ -7,10 +7,9 @@ #include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h> #include <cassert> +#include <memory> #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -22,7 +21,7 @@ namespace Swift { IBBSerializer::IBBSerializer() { } -std::string IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const { +std::string IBBSerializer::serializePayload(std::shared_ptr<IBB> ibb) const { switch(ibb->getAction()) { case IBB::Data: { XMLElement ibbElement("data", "http://jabber.org/protocol/ibb"); @@ -30,7 +29,7 @@ std::string IBBSerializer::serializePayload(boost::shared_ptr<IBB> ibb) const { if (ibb->getSequenceNumber() >= 0) { ibbElement.setAttribute("seq", boost::lexical_cast<std::string>(ibb->getSequenceNumber())); } - ibbElement.addNode(boost::make_shared<XMLTextNode>(Base64::encode(ibb->getData()))); + ibbElement.addNode(std::make_shared<XMLTextNode>(Base64::encode(ibb->getData()))); return ibbElement.serialize(); } case IBB::Open: { diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.h b/Swiften/Serializer/PayloadSerializers/IBBSerializer.h index fe45eac..0ef1680 100644 --- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: IBBSerializer(); - virtual std::string serializePayload(boost::shared_ptr<IBB>) const; + virtual std::string serializePayload(std::shared_ptr<IBB>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/IdleSerializer.h b/Swiften/Serializer/PayloadSerializers/IdleSerializer.h index 1a832a1..4e1a953 100644 --- a/Swiften/Serializer/PayloadSerializers/IdleSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/IdleSerializer.h @@ -22,7 +22,7 @@ namespace Swift { public: IdleSerializer() : GenericPayloadSerializer<Idle>() {} - virtual std::string serializePayload(boost::shared_ptr<Idle> idle) const { + virtual std::string serializePayload(std::shared_ptr<Idle> idle) const { return "<idle xmlns='urn:xmpp:idle:1' since='" + dateTimeToString(idle->getSince()) + "'/>"; } }; diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp index 5f275f1..31b023f 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -19,7 +18,7 @@ namespace Swift { InBandRegistrationPayloadSerializer::InBandRegistrationPayloadSerializer() { } -std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ptr<InBandRegistrationPayload> registration) const { +std::string InBandRegistrationPayloadSerializer::serializePayload(std::shared_ptr<InBandRegistrationPayload> registration) const { XMLElement registerElement("query", "jabber:iq:register"); if (registration->isRegistered()) { @@ -104,7 +103,7 @@ std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ } if (Form::ref form = registration->getForm()) { - registerElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); + registerElement.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); } return registerElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h index 45eb2f5..d5f6cce 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h @@ -16,6 +16,6 @@ namespace Swift { public: InBandRegistrationPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<InBandRegistrationPayload>) const; + virtual std::string serializePayload(std::shared_ptr<InBandRegistrationPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp index 243ebc0..000c1bf 100644 --- a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/XML/XMLRawTextNode.h> @@ -21,12 +21,12 @@ IsodeIQDelegationSerializer::IsodeIQDelegationSerializer(PayloadSerializerCollec IsodeIQDelegationSerializer::~IsodeIQDelegationSerializer() { } -std::string IsodeIQDelegationSerializer::serializePayload(boost::shared_ptr<IsodeIQDelegation> payload) const { +std::string IsodeIQDelegationSerializer::serializePayload(std::shared_ptr<IsodeIQDelegation> payload) const { if (!payload) { return ""; } XMLElement element("delegate", "http://isode.com/iq_delegation"); - element.addNode(boost::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(payload->getForward())->serialize(payload->getForward()))); + element.addNode(std::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(payload->getForward())->serialize(payload->getForward()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h index 47a9ddc..e7cfef9 100644 --- a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { IsodeIQDelegationSerializer(PayloadSerializerCollection* serializers); virtual ~IsodeIQDelegationSerializer(); - virtual std::string serializePayload(boost::shared_ptr<IsodeIQDelegation>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<IsodeIQDelegation>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp index c006a93..02e0f2a 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp @@ -12,9 +12,7 @@ #include <Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/intrusive_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -30,7 +28,7 @@ namespace Swift { JingleContentPayloadSerializer::JingleContentPayloadSerializer() { } -std::string JingleContentPayloadSerializer::serializePayload(boost::shared_ptr<JingleContentPayload> payload) const { +std::string JingleContentPayloadSerializer::serializePayload(std::shared_ptr<JingleContentPayload> payload) const { XMLElement payloadXML("content"); payloadXML.setAttribute("creator", creatorToString(payload->getCreator())); payloadXML.setAttribute("name", payload->getName()); @@ -41,8 +39,8 @@ std::string JingleContentPayloadSerializer::serializePayload(boost::shared_ptr<J JingleFileTransferDescription::ref filetransfer; foreach(JingleDescription::ref desc, payload->getDescriptions()) { - if ((filetransfer = boost::dynamic_pointer_cast<JingleFileTransferDescription>(desc))) { - payloadXML.addNode(boost::make_shared<XMLRawTextNode>(ftSerializer.serializePayload(filetransfer))); + if ((filetransfer = std::dynamic_pointer_cast<JingleFileTransferDescription>(desc))) { + payloadXML.addNode(std::make_shared<XMLRawTextNode>(ftSerializer.serializePayload(filetransfer))); } } } @@ -57,10 +55,10 @@ std::string JingleContentPayloadSerializer::serializePayload(boost::shared_ptr<J JingleS5BTransportPayload::ref s5b; foreach(JingleTransportPayload::ref transport, payload->getTransports()) { - if ((ibb = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) { - payloadXML.addNode(boost::make_shared<XMLRawTextNode>(ibbSerializer.serializePayload(ibb))); - } else if ((s5b = boost::dynamic_pointer_cast<JingleS5BTransportPayload>(transport))) { - payloadXML.addNode(boost::make_shared<XMLRawTextNode>(s5bSerializer.serializePayload(s5b))); + if ((ibb = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) { + payloadXML.addNode(std::make_shared<XMLRawTextNode>(ibbSerializer.serializePayload(ibb))); + } else if ((s5b = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transport))) { + payloadXML.addNode(std::make_shared<XMLRawTextNode>(s5bSerializer.serializePayload(s5b))); } } } diff --git a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h index ff0185e..825a67c 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h @@ -24,7 +24,7 @@ namespace Swift { public: JingleContentPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<JingleContentPayload>) const; + virtual std::string serializePayload(std::shared_ptr<JingleContentPayload>) const; private: std::string creatorToString(JingleContentPayload::Creator creator) const; diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp index b0bb78d..b002482 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp @@ -12,9 +12,9 @@ #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/DateTime.h> #include <Swiften/Base/foreach.h> @@ -29,11 +29,11 @@ namespace Swift { JingleFileTransferDescriptionSerializer::JingleFileTransferDescriptionSerializer() { } -std::string JingleFileTransferDescriptionSerializer::serializePayload(boost::shared_ptr<JingleFileTransferDescription> payload) const { +std::string JingleFileTransferDescriptionSerializer::serializePayload(std::shared_ptr<JingleFileTransferDescription> payload) const { XMLElement description("description", "urn:xmpp:jingle:apps:file-transfer:4"); JingleFileTransferFileInfoSerializer fileInfoSerializer; - boost::shared_ptr<XMLRawTextNode> fileInfoXML = boost::make_shared<XMLRawTextNode>(fileInfoSerializer.serialize(boost::make_shared<JingleFileTransferFileInfo>(payload->getFileInfo()))); + std::shared_ptr<XMLRawTextNode> fileInfoXML = std::make_shared<XMLRawTextNode>(fileInfoSerializer.serialize(std::make_shared<JingleFileTransferFileInfo>(payload->getFileInfo()))); description.addNode(fileInfoXML); return description.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h index 53199f6..65e757b 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h @@ -25,6 +25,6 @@ namespace Swift { public: JingleFileTransferDescriptionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<JingleFileTransferDescription>) const; + virtual std::string serializePayload(std::shared_ptr<JingleFileTransferDescription>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp index 7fcf452..d78d7df 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp @@ -6,9 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/DateTime.h> #include <Swiften/Base/foreach.h> @@ -22,28 +22,28 @@ namespace Swift { JingleFileTransferFileInfoSerializer::JingleFileTransferFileInfoSerializer() { } -std::string JingleFileTransferFileInfoSerializer::serializePayload(boost::shared_ptr<JingleFileTransferFileInfo> fileInfo) const { +std::string JingleFileTransferFileInfoSerializer::serializePayload(std::shared_ptr<JingleFileTransferFileInfo> fileInfo) const { XMLElement fileElement("file", ""); if (fileInfo->getDate() != stringToDateTime("")) { - fileElement.addNode(boost::make_shared<XMLElement>("date", "", dateTimeToString(fileInfo->getDate()))); + fileElement.addNode(std::make_shared<XMLElement>("date", "", dateTimeToString(fileInfo->getDate()))); } if (!fileInfo->getDescription().empty()) { - fileElement.addNode(boost::make_shared<XMLElement>("desc", "", fileInfo->getDescription())); + fileElement.addNode(std::make_shared<XMLElement>("desc", "", fileInfo->getDescription())); } if (!fileInfo->getMediaType().empty()) { - fileElement.addNode(boost::make_shared<XMLElement>("media-type", "", fileInfo->getMediaType())); + fileElement.addNode(std::make_shared<XMLElement>("media-type", "", fileInfo->getMediaType())); } if (!fileInfo->getName().empty()) { - fileElement.addNode(boost::make_shared<XMLElement>("name", "", fileInfo->getName())); + fileElement.addNode(std::make_shared<XMLElement>("name", "", fileInfo->getName())); } if (fileInfo->getSupportsRangeRequests()) { - boost::shared_ptr<XMLElement> range = boost::make_shared<XMLElement>("range"); + std::shared_ptr<XMLElement> range = std::make_shared<XMLElement>("range"); if (fileInfo->getRangeOffset() != 0) { range->setAttribute("offset", boost::lexical_cast<std::string>(fileInfo->getRangeOffset())); } @@ -51,11 +51,11 @@ std::string JingleFileTransferFileInfoSerializer::serializePayload(boost::shared } if (fileInfo->getSize() > 0) { - fileElement.addNode(boost::make_shared<XMLElement>("size", "", boost::lexical_cast<std::string>(fileInfo->getSize()))); + fileElement.addNode(std::make_shared<XMLElement>("size", "", boost::lexical_cast<std::string>(fileInfo->getSize()))); } foreach (JingleFileTransferFileInfo::HashElementMap::value_type hashElement, fileInfo->getHashes()) { - boost::shared_ptr<XMLElement> hash = boost::make_shared<XMLElement>("hash", "urn:xmpp:hashes:1", Base64::encode(hashElement.second)); + std::shared_ptr<XMLElement> hash = std::make_shared<XMLElement>("hash", "urn:xmpp:hashes:1", Base64::encode(hashElement.second)); hash->setAttribute("algo", hashElement.first); fileElement.addNode(hash); } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h index bd4d8cd..6b80235 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h @@ -18,6 +18,6 @@ namespace Swift { public: JingleFileTransferFileInfoSerializer(); - virtual std::string serializePayload(boost::shared_ptr<JingleFileTransferFileInfo>) const; + virtual std::string serializePayload(std::shared_ptr<JingleFileTransferFileInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp index 4db5f0c..1f6ead7 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp @@ -13,11 +13,9 @@ #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h> #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -29,7 +27,7 @@ namespace Swift { JingleFileTransferHashSerializer::JingleFileTransferHashSerializer() { } -std::string JingleFileTransferHashSerializer::serializePayload(boost::shared_ptr<JingleFileTransferHash> payload) const { +std::string JingleFileTransferHashSerializer::serializePayload(std::shared_ptr<JingleFileTransferHash> payload) const { // code for version urn:xmpp:jingle:apps:file-transfer:2 //XMLElement hash("hash", "urn:xmpp:jingle:apps:file-transfer:info:2", payload->getHash()); @@ -38,7 +36,7 @@ std::string JingleFileTransferHashSerializer::serializePayload(boost::shared_ptr JingleFileTransferFileInfoSerializer fileSerializer; - boost::shared_ptr<XMLRawTextNode> file = boost::make_shared<XMLRawTextNode>(fileSerializer.serialize(boost::make_shared<JingleFileTransferFileInfo>(payload->getFileInfo()))); + std::shared_ptr<XMLRawTextNode> file = std::make_shared<XMLRawTextNode>(fileSerializer.serialize(std::make_shared<JingleFileTransferFileInfo>(payload->getFileInfo()))); checksum.addNode(file); diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h index 5434c17..bb6eabc 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h @@ -25,6 +25,6 @@ namespace Swift { public: JingleFileTransferHashSerializer(); - virtual std::string serializePayload(boost::shared_ptr<JingleFileTransferHash>) const; + virtual std::string serializePayload(std::shared_ptr<JingleFileTransferHash>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp index 0574ea7..52e6c16 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp @@ -12,9 +12,9 @@ #include <Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -26,7 +26,7 @@ namespace Swift { JingleIBBTransportPayloadSerializer::JingleIBBTransportPayloadSerializer() { } -std::string JingleIBBTransportPayloadSerializer::serializePayload(boost::shared_ptr<JingleIBBTransportPayload> payload) const { +std::string JingleIBBTransportPayloadSerializer::serializePayload(std::shared_ptr<JingleIBBTransportPayload> payload) const { XMLElement payloadXML("transport", "urn:xmpp:jingle:transports:ibb:1"); if (payload->getBlockSize()) { payloadXML.setAttribute("block-size", boost::lexical_cast<std::string>(*payload->getBlockSize())); diff --git a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h index 1b77666..e94fb52 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h @@ -25,6 +25,6 @@ namespace Swift { public: JingleIBBTransportPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<JingleIBBTransportPayload>) const; + virtual std::string serializePayload(std::shared_ptr<JingleIBBTransportPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp index a5bd60a..8b37929 100644 --- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp @@ -12,9 +12,7 @@ #include <Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/intrusive_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -35,27 +33,27 @@ namespace Swift { JinglePayloadSerializer::JinglePayloadSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { } -std::string JinglePayloadSerializer::serializePayload(boost::shared_ptr<JinglePayload> payload) const { +std::string JinglePayloadSerializer::serializePayload(std::shared_ptr<JinglePayload> payload) const { XMLElement jinglePayload("jingle", "urn:xmpp:jingle:1"); jinglePayload.setAttribute("action", actionToString(payload->getAction())); jinglePayload.setAttribute("initiator", payload->getInitiator()); jinglePayload.setAttribute("sid", payload->getSessionID()); - std::vector<boost::shared_ptr<Payload> > payloads = payload->getPayloads(); + std::vector<std::shared_ptr<Payload> > payloads = payload->getPayloads(); if (!payloads.empty()) { - foreach(boost::shared_ptr<Payload> subPayload, payloads) { + foreach(std::shared_ptr<Payload> subPayload, payloads) { PayloadSerializer* serializer = serializers->getPayloadSerializer(subPayload); if (serializer) { - jinglePayload.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(subPayload))); + jinglePayload.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(subPayload))); } } } if (payload->getReason().is_initialized()) { - boost::shared_ptr<XMLElement> reason = boost::make_shared<XMLElement>("reason"); - reason->addNode(boost::make_shared<XMLElement>(reasonTypeToString(payload->getReason()->type))); + std::shared_ptr<XMLElement> reason = std::make_shared<XMLElement>("reason"); + reason->addNode(std::make_shared<XMLElement>(reasonTypeToString(payload->getReason()->type))); if (!payload->getReason()->text.empty()) { - reason->addNode(boost::make_shared<XMLElement>("desc", "", payload->getReason()->text)); + reason->addNode(std::make_shared<XMLElement>("desc", "", payload->getReason()->text)); } jinglePayload.addNode(reason); } diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h index 9b36626..a846ebe 100644 --- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h @@ -25,7 +25,7 @@ namespace Swift { public: JinglePayloadSerializer(PayloadSerializerCollection*); - virtual std::string serializePayload(boost::shared_ptr<JinglePayload>) const; + virtual std::string serializePayload(std::shared_ptr<JinglePayload>) const; private: std::string actionToString(JinglePayload::Action action) const; diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp index 66e6515..61447cd 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp @@ -12,9 +12,9 @@ #include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> @@ -27,7 +27,7 @@ namespace Swift { JingleS5BTransportPayloadSerializer::JingleS5BTransportPayloadSerializer() { } -std::string JingleS5BTransportPayloadSerializer::serializePayload(boost::shared_ptr<JingleS5BTransportPayload> payload) const { +std::string JingleS5BTransportPayloadSerializer::serializePayload(std::shared_ptr<JingleS5BTransportPayload> payload) const { XMLElement payloadXML("transport", "urn:xmpp:jingle:transports:s5b:1"); payloadXML.setAttribute("sid", payload->getSessionID()); payloadXML.setAttribute("mode", modeToString(payload->getMode())); @@ -36,7 +36,7 @@ std::string JingleS5BTransportPayloadSerializer::serializePayload(boost::shared_ } foreach(JingleS5BTransportPayload::Candidate candidate, payload->getCandidates()) { - boost::shared_ptr<XMLElement> candidateXML = boost::make_shared<XMLElement>("candidate"); + std::shared_ptr<XMLElement> candidateXML = std::make_shared<XMLElement>("candidate"); candidateXML->setAttribute("cid", candidate.cid); candidateXML->setAttribute("host", candidate.hostPort.getAddress().toString()); candidateXML->setAttribute("jid", candidate.jid.toString()); @@ -47,19 +47,19 @@ std::string JingleS5BTransportPayloadSerializer::serializePayload(boost::shared_ } if (payload->hasCandidateError()) { - payloadXML.addNode(boost::make_shared<XMLElement>("candidate-error")); + payloadXML.addNode(std::make_shared<XMLElement>("candidate-error")); } if (payload->hasProxyError()) { - payloadXML.addNode(boost::make_shared<XMLElement>("proxy-error")); + payloadXML.addNode(std::make_shared<XMLElement>("proxy-error")); } if (!payload->getActivated().empty()) { - boost::shared_ptr<XMLElement> activatedXML = boost::make_shared<XMLElement>("activated"); + std::shared_ptr<XMLElement> activatedXML = std::make_shared<XMLElement>("activated"); activatedXML->setAttribute("cid", payload->getActivated()); payloadXML.addNode(activatedXML); } if (!payload->getCandidateUsed().empty()) { - boost::shared_ptr<XMLElement> candusedXML = boost::make_shared<XMLElement>("candidate-used"); + std::shared_ptr<XMLElement> candusedXML = std::make_shared<XMLElement>("candidate-used"); candusedXML->setAttribute("cid", payload->getCandidateUsed()); payloadXML.addNode(candusedXML); } diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h index 684423e..cca2f4e 100644 --- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h @@ -25,7 +25,7 @@ namespace Swift { public: JingleS5BTransportPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<JingleS5BTransportPayload>) const; + virtual std::string serializePayload(std::shared_ptr<JingleS5BTransportPayload>) const; private: std::string modeToString(JingleS5BTransportPayload::Mode) const; diff --git a/Swiften/Serializer/PayloadSerializers/LastSerializer.h b/Swiften/Serializer/PayloadSerializers/LastSerializer.h index 6c831eb..1710bc0 100644 --- a/Swiften/Serializer/PayloadSerializers/LastSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/LastSerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: LastSerializer() : GenericPayloadSerializer<Last>() {} - virtual std::string serializePayload(boost::shared_ptr<Last> last) const { + virtual std::string serializePayload(std::shared_ptr<Last> last) const { return "<query xmlns='jabber:iq:last' seconds='" + boost::lexical_cast<std::string>(last->getSeconds()) + "'/>"; } }; diff --git a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.cpp index d15038c..6f40277 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h> @@ -22,7 +23,7 @@ MAMFinSerializer::MAMFinSerializer() { MAMFinSerializer::~MAMFinSerializer() { } -std::string MAMFinSerializer::serializePayload(boost::shared_ptr<MAMFin> payload) const { +std::string MAMFinSerializer::serializePayload(std::shared_ptr<MAMFin> payload) const { if (!payload) { return ""; } @@ -42,7 +43,7 @@ std::string MAMFinSerializer::serializePayload(boost::shared_ptr<MAMFin> payload } if (payload->getResultSet()) { - element.addNode(boost::make_shared<XMLRawTextNode>(ResultSetSerializer().serialize(payload->getResultSet()))); + element.addNode(std::make_shared<XMLRawTextNode>(ResultSetSerializer().serialize(payload->getResultSet()))); } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h index 2be6981..7e2a7c7 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,6 +21,6 @@ namespace Swift { MAMFinSerializer(); virtual ~MAMFinSerializer(); - virtual std::string serializePayload(boost::shared_ptr<MAMFin>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<MAMFin>) const SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.cpp b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.cpp index d503d0b..0b61c04 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -24,7 +25,7 @@ MAMQuerySerializer::MAMQuerySerializer() { MAMQuerySerializer::~MAMQuerySerializer() { } -std::string MAMQuerySerializer::serializePayload(boost::shared_ptr<MAMQuery> payload) const { +std::string MAMQuerySerializer::serializePayload(std::shared_ptr<MAMQuery> payload) const { if (!payload) { return ""; } @@ -40,11 +41,11 @@ std::string MAMQuerySerializer::serializePayload(boost::shared_ptr<MAMQuery> pay } if (payload->getForm()) { - element.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getForm()))); + element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getForm()))); } if (payload->getResultSet()) { - element.addNode(boost::make_shared<XMLRawTextNode>(ResultSetSerializer().serialize(payload->getResultSet()))); + element.addNode(std::make_shared<XMLRawTextNode>(ResultSetSerializer().serialize(payload->getResultSet()))); } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h index 8b5e270..6af979b 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,6 +21,6 @@ namespace Swift { MAMQuerySerializer(); virtual ~MAMQuerySerializer(); - virtual std::string serializePayload(boost::shared_ptr<MAMQuery>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<MAMQuery>) const SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.cpp index 4bf25c6..7ef2102 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h> @@ -22,7 +23,7 @@ MAMResultSerializer::MAMResultSerializer(PayloadSerializerCollection* serializer MAMResultSerializer::~MAMResultSerializer() { } -std::string MAMResultSerializer::serializePayload(boost::shared_ptr<MAMResult> payload) const { +std::string MAMResultSerializer::serializePayload(std::shared_ptr<MAMResult> payload) const { if (!payload) { return ""; } @@ -35,7 +36,7 @@ std::string MAMResultSerializer::serializePayload(boost::shared_ptr<MAMResult> p element.setAttribute("queryid", *payload->getQueryID()); } - element.addNode(boost::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(payload->getPayload()))); + element.addNode(std::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(payload->getPayload()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h b/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h index 4d8168c..f4fc054 100644 --- a/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { MAMResultSerializer(PayloadSerializerCollection* serializers); virtual ~MAMResultSerializer(); - virtual std::string serializePayload(boost::shared_ptr<MAMResult>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<MAMResult>) const SWIFTEN_OVERRIDE; private: PayloadSerializerCollection* serializers_; diff --git a/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp index 5bd4b01..385c181 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp @@ -6,11 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h> +#include <memory> #include <sstream> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -21,7 +19,7 @@ namespace Swift { MUCAdminPayloadSerializer::MUCAdminPayloadSerializer() : GenericPayloadSerializer<MUCAdminPayload>() { } -std::string MUCAdminPayloadSerializer::serializePayload(boost::shared_ptr<MUCAdminPayload> payload) const { +std::string MUCAdminPayloadSerializer::serializePayload(std::shared_ptr<MUCAdminPayload> payload) const { XMLElement mucElement("query", "http://jabber.org/protocol/muc#admin"); foreach (const MUCItem& item, payload->getItems()) { mucElement.addNode(MUCItemSerializer::itemToElement(item)); diff --git a/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h index b1e1ed1..c077d2e 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h @@ -17,7 +17,7 @@ namespace Swift { std::string affiliationToString(MUCOccupant::Affiliation affiliation) const; std::string roleToString(MUCOccupant::Role role) const; - virtual std::string serializePayload(boost::shared_ptr<MUCAdminPayload> version) const; + virtual std::string serializePayload(std::shared_ptr<MUCAdminPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp index 86d684e..3d807be 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -18,11 +17,11 @@ namespace Swift { MUCDestroyPayloadSerializer::MUCDestroyPayloadSerializer() : GenericPayloadSerializer<MUCDestroyPayload>() { } -std::string MUCDestroyPayloadSerializer::serializePayload(boost::shared_ptr<MUCDestroyPayload> payload) const { +std::string MUCDestroyPayloadSerializer::serializePayload(std::shared_ptr<MUCDestroyPayload> payload) const { XMLElement mucElement("destroy", ""); if (!payload->getReason().empty()) { - XMLElement::ref reason = boost::make_shared<XMLElement>("reason", ""); - reason->addNode(boost::make_shared<XMLTextNode>(payload->getReason())); + XMLElement::ref reason = std::make_shared<XMLElement>("reason", ""); + reason->addNode(std::make_shared<XMLTextNode>(payload->getReason())); mucElement.addNode(reason); } if (payload->getNewVenue().isValid()) { diff --git a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h index c6175fb..2ce8ccc 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API MUCDestroyPayloadSerializer : public GenericPayloadSerializer<MUCDestroyPayload> { public: MUCDestroyPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<MUCDestroyPayload> version) const; + virtual std::string serializePayload(std::shared_ptr<MUCDestroyPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp index 4695f63..4b978af 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h> @@ -19,7 +18,7 @@ namespace Swift { MUCInvitationPayloadSerializer::MUCInvitationPayloadSerializer() : GenericPayloadSerializer<MUCInvitationPayload>() { } -std::string MUCInvitationPayloadSerializer::serializePayload(boost::shared_ptr<MUCInvitationPayload> payload) const { +std::string MUCInvitationPayloadSerializer::serializePayload(std::shared_ptr<MUCInvitationPayload> payload) const { XMLElement mucElement("x", "jabber:x:conference"); if (payload->getIsContinuation()) { mucElement.setAttribute("continue", "true"); @@ -37,7 +36,7 @@ std::string MUCInvitationPayloadSerializer::serializePayload(boost::shared_ptr<M mucElement.setAttribute("thread", payload->getThread()); } if (payload->getIsImpromptu()) { - mucElement.addNode(boost::make_shared<XMLElement>("impromptu", "http://swift.im/impromptu")); + mucElement.addNode(std::make_shared<XMLElement>("impromptu", "http://swift.im/impromptu")); } return mucElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h index a2d27b0..be21177 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: MUCInvitationPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<MUCInvitationPayload> version) const; + virtual std::string serializePayload(std::shared_ptr<MUCInvitationPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h index 016caf4..22f7859 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/MUCItem.h> #include <Swiften/Serializer/GenericPayloadSerializer.h> @@ -40,8 +40,8 @@ namespace Swift { } - static boost::shared_ptr<XMLElement> itemToElement(const MUCItem& item) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + static std::shared_ptr<XMLElement> itemToElement(const MUCItem& item) { + std::shared_ptr<XMLElement> itemElement(new XMLElement("item")); if (item.affiliation) { itemElement->setAttribute("affiliation", affiliationToString(item.affiliation.get())); } @@ -55,13 +55,13 @@ namespace Swift { itemElement->setAttribute("nick", item.nick.get()); } if (item.actor) { - boost::shared_ptr<XMLElement> actorElement(new XMLElement("actor")); + std::shared_ptr<XMLElement> actorElement(new XMLElement("actor")); actorElement->setAttribute("jid", item.actor->toString()); itemElement->addNode(actorElement); } if (item.reason) { - boost::shared_ptr<XMLElement> reasonElement(new XMLElement("reason")); - reasonElement->addNode(boost::make_shared<XMLTextNode>(*item.reason)); + std::shared_ptr<XMLElement> reasonElement(new XMLElement("reason")); + reasonElement->addNode(std::make_shared<XMLTextNode>(*item.reason)); itemElement->addNode(reasonElement); } return itemElement; diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp index 348f9f5..f385e91 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -17,13 +17,13 @@ namespace Swift { MUCOwnerPayloadSerializer::MUCOwnerPayloadSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<MUCOwnerPayload>(), serializers(serializers) { } -std::string MUCOwnerPayloadSerializer::serializePayload(boost::shared_ptr<MUCOwnerPayload> mucOwner) const { +std::string MUCOwnerPayloadSerializer::serializePayload(std::shared_ptr<MUCOwnerPayload> mucOwner) const { XMLElement mucElement("query", "http://jabber.org/protocol/muc#owner"); - boost::shared_ptr<Payload> payload = mucOwner->getPayload(); + std::shared_ptr<Payload> payload = mucOwner->getPayload(); if (payload) { PayloadSerializer* serializer = serializers->getPayloadSerializer(payload); if (serializer) { - mucElement.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(payload))); + mucElement.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(payload))); } } return mucElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h index bbe919a..8e2e856 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API MUCOwnerPayloadSerializer : public GenericPayloadSerializer<MUCOwnerPayload> { public: MUCOwnerPayloadSerializer(PayloadSerializerCollection* serializers); - virtual std::string serializePayload(boost::shared_ptr<MUCOwnerPayload> version) const; + virtual std::string serializePayload(std::shared_ptr<MUCOwnerPayload> version) const; private: PayloadSerializerCollection* serializers; }; diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp index 9af2f15..4f0f637 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp @@ -6,9 +6,10 @@ #include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h> +#include <memory> + #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/String.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -19,9 +20,9 @@ namespace Swift { MUCPayloadSerializer::MUCPayloadSerializer() : GenericPayloadSerializer<MUCPayload>() { } -std::string MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload> muc) const { +std::string MUCPayloadSerializer::serializePayload(std::shared_ptr<MUCPayload> muc) const { XMLElement mucElement("x", "http://jabber.org/protocol/muc"); - boost::shared_ptr<XMLElement> historyElement(new XMLElement("history")); + std::shared_ptr<XMLElement> historyElement(new XMLElement("history")); bool history = false; if (muc->getMaxChars() >= 0) { historyElement->setAttribute("maxchars", boost::lexical_cast<std::string>(muc->getMaxChars())); @@ -44,8 +45,8 @@ std::string MUCPayloadSerializer::serializePayload(boost::shared_ptr<MUCPayload> } if (muc->getPassword()) { std::string password = *muc->getPassword(); - boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); - passwordElement->addNode(boost::make_shared<XMLTextNode>(password)); + std::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); + passwordElement->addNode(std::make_shared<XMLTextNode>(password)); mucElement.addNode(passwordElement); } if (history) { diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h index fa3a11c..6b0247d 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API MUCPayloadSerializer : public GenericPayloadSerializer<MUCPayload> { public: MUCPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<MUCPayload> version) const; + virtual std::string serializePayload(std::shared_ptr<MUCPayload> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp index d0c3b2b..52ab489 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp @@ -6,11 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h> +#include <memory> #include <sstream> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> - #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h> @@ -23,10 +21,10 @@ namespace Swift { MUCUserPayloadSerializer::MUCUserPayloadSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<MUCUserPayload>(), serializers(serializers) { } -std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUserPayload> payload) const { +std::string MUCUserPayloadSerializer::serializePayload(std::shared_ptr<MUCUserPayload> payload) const { XMLElement mucElement("x", "http://jabber.org/protocol/muc#user"); foreach (const MUCUserPayload::StatusCode statusCode, payload->getStatusCodes()) { - boost::shared_ptr<XMLElement> statusElement(new XMLElement("status")); + std::shared_ptr<XMLElement> statusElement(new XMLElement("status")); std::ostringstream code; code << statusCode.code; statusElement->setAttribute("code", code.str()); @@ -37,13 +35,13 @@ std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUser } if (payload->getPassword()) { - boost::shared_ptr<XMLElement> passwordElement = boost::make_shared<XMLElement>("password"); - passwordElement->addNode(boost::make_shared<XMLTextNode>(*payload->getPassword())); + std::shared_ptr<XMLElement> passwordElement = std::make_shared<XMLElement>("password"); + passwordElement->addNode(std::make_shared<XMLTextNode>(*payload->getPassword())); } if (payload->getInvite()) { MUCUserPayload::Invite invite = *payload->getInvite(); - boost::shared_ptr<XMLElement> inviteElement = boost::make_shared<XMLElement>("invite"); + std::shared_ptr<XMLElement> inviteElement = std::make_shared<XMLElement>("invite"); if (invite.to.isValid()) { inviteElement->setAttribute("to", invite.to.toString()); } @@ -51,17 +49,17 @@ std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUser inviteElement->setAttribute("from", invite.from.toString()); } if (!invite.reason.empty()) { - boost::shared_ptr<XMLElement> reasonElement = boost::make_shared<XMLElement>("reason"); - reasonElement->addNode(boost::make_shared<XMLTextNode>(invite.reason)); + std::shared_ptr<XMLElement> reasonElement = std::make_shared<XMLElement>("reason"); + reasonElement->addNode(std::make_shared<XMLTextNode>(invite.reason)); } mucElement.addNode(inviteElement); } - boost::shared_ptr<Payload> childPayload = payload->getPayload(); + std::shared_ptr<Payload> childPayload = payload->getPayload(); if (childPayload) { PayloadSerializer* serializer = serializers->getPayloadSerializer(childPayload); if (serializer) { - mucElement.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(childPayload))); + mucElement.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(childPayload))); } } return mucElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h index 91b2ae6..ea4b74b 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h @@ -16,7 +16,7 @@ namespace Swift { public: MUCUserPayloadSerializer(PayloadSerializerCollection* serializers); - virtual std::string serializePayload(boost::shared_ptr<MUCUserPayload> version) const; + virtual std::string serializePayload(std::shared_ptr<MUCUserPayload> version) const; private: PayloadSerializerCollection* serializers; }; diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp index 3b927f4..7bd8931 100644 --- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -17,9 +16,9 @@ namespace Swift { NicknameSerializer::NicknameSerializer() : GenericPayloadSerializer<Nickname>() { } -std::string NicknameSerializer::serializePayload(boost::shared_ptr<Nickname> nick) const { +std::string NicknameSerializer::serializePayload(std::shared_ptr<Nickname> nick) const { XMLElement nickElement("nick", "http://jabber.org/protocol/nick"); - nickElement.addNode(boost::make_shared<XMLTextNode>(nick->getNickname())); + nickElement.addNode(std::make_shared<XMLTextNode>(nick->getNickname())); return nickElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h index d1b6e81..efea9c2 100644 --- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: NicknameSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Nickname>) const; + virtual std::string serializePayload(std::shared_ptr<Nickname>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h index d7f0957..687d07f 100644 --- a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: PrioritySerializer() : GenericPayloadSerializer<Priority>() {} - virtual std::string serializePayload(boost::shared_ptr<Priority> priority) const { + virtual std::string serializePayload(std::shared_ptr<Priority> priority) const { return "<priority>" + boost::lexical_cast<std::string>(priority->getPriority()) + "</priority>"; } }; diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp index 2d03e1b..87a2eeb 100644 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializerCollection.h> @@ -20,13 +19,13 @@ namespace Swift { PrivateStorageSerializer::PrivateStorageSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { } -std::string PrivateStorageSerializer::serializePayload(boost::shared_ptr<PrivateStorage> storage) const { +std::string PrivateStorageSerializer::serializePayload(std::shared_ptr<PrivateStorage> storage) const { XMLElement storageElement("query", "jabber:iq:private"); - boost::shared_ptr<Payload> payload = storage->getPayload(); + std::shared_ptr<Payload> payload = storage->getPayload(); if (payload) { PayloadSerializer* serializer = serializers->getPayloadSerializer(payload); if (serializer) { - storageElement.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(payload))); + storageElement.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(payload))); } } return storageElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h index a014e52..f2f9d90 100644 --- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h @@ -17,7 +17,7 @@ namespace Swift { public: PrivateStorageSerializer(PayloadSerializerCollection* serializers); - virtual std::string serializePayload(boost::shared_ptr<PrivateStorage>) const; + virtual std::string serializePayload(std::shared_ptr<PrivateStorage>) const; private: PayloadSerializerCollection* serializers; diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.cpp index 8e58ff5..4814c59 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubAffiliationSerializer::PubSubAffiliationSerializer(PayloadSerializerCollec PubSubAffiliationSerializer::~PubSubAffiliationSerializer() { } -std::string PubSubAffiliationSerializer::serializePayload(boost::shared_ptr<PubSubAffiliation> payload) const { +std::string PubSubAffiliationSerializer::serializePayload(std::shared_ptr<PubSubAffiliation> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h index d451745..622db09 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubAffiliationSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubAffiliationSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubAffiliation>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubAffiliation>) const SWIFTEN_OVERRIDE; private: static std::string serializeType(PubSubAffiliation::Type); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp index eba96aa..9673710 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #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> @@ -23,7 +23,7 @@ PubSubAffiliationsSerializer::PubSubAffiliationsSerializer(PayloadSerializerColl PubSubAffiliationsSerializer::~PubSubAffiliationsSerializer() { } -std::string PubSubAffiliationsSerializer::serializePayload(boost::shared_ptr<PubSubAffiliations> payload) const { +std::string PubSubAffiliationsSerializer::serializePayload(std::shared_ptr<PubSubAffiliations> payload) const { if (!payload) { return ""; } @@ -31,8 +31,8 @@ std::string PubSubAffiliationsSerializer::serializePayload(boost::shared_ptr<Pub 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))); + foreach(std::shared_ptr<PubSubAffiliation> item, payload->getAffiliations()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubAffiliationSerializer(serializers).serialize(item))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h index 211d957..c51d70e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubAffiliationsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubAffiliationsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubAffiliations>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubAffiliations>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.cpp index 1853c1c..6ae4711 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -22,12 +22,12 @@ PubSubConfigureSerializer::PubSubConfigureSerializer(PayloadSerializerCollection PubSubConfigureSerializer::~PubSubConfigureSerializer() { } -std::string PubSubConfigureSerializer::serializePayload(boost::shared_ptr<PubSubConfigure> payload) const { +std::string PubSubConfigureSerializer::serializePayload(std::shared_ptr<PubSubConfigure> payload) const { if (!payload) { return ""; } XMLElement element("configure", "http://jabber.org/protocol/pubsub"); - element.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); + element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h index 3d800d8..fa0aecf 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubConfigureSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubConfigureSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubConfigure>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubConfigure>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.cpp index 8b38fc1..e5c0e67 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubCreateSerializer::PubSubCreateSerializer(PayloadSerializerCollection* seri PubSubCreateSerializer::~PubSubCreateSerializer() { } -std::string PubSubCreateSerializer::serializePayload(boost::shared_ptr<PubSubCreate> payload) const { +std::string PubSubCreateSerializer::serializePayload(std::shared_ptr<PubSubCreate> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h index 67b19bf..92965f2 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubCreateSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubCreateSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubCreate>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubCreate>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.cpp index aba1cae..3681dd0 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubDefaultSerializer::PubSubDefaultSerializer(PayloadSerializerCollection* se PubSubDefaultSerializer::~PubSubDefaultSerializer() { } -std::string PubSubDefaultSerializer::serializePayload(boost::shared_ptr<PubSubDefault> payload) const { +std::string PubSubDefaultSerializer::serializePayload(std::shared_ptr<PubSubDefault> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h index 5dc774f..1ec20c7 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubDefaultSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubDefaultSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubDefault>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubDefault>) const SWIFTEN_OVERRIDE; private: static std::string serializeType(PubSubDefault::Type); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.cpp index d14db49..5f85fd5 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.cpp @@ -17,7 +17,7 @@ PubSubErrorSerializer::PubSubErrorSerializer() { PubSubErrorSerializer::~PubSubErrorSerializer() { } -std::string PubSubErrorSerializer::serializePayload(boost::shared_ptr<PubSubError> payload) const { +std::string PubSubErrorSerializer::serializePayload(std::shared_ptr<PubSubError> payload) const { if (payload->getType() == PubSubError::UnknownType) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h index b6750e9..6b0882e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h @@ -19,7 +19,7 @@ namespace Swift { PubSubErrorSerializer(); virtual ~PubSubErrorSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubError>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubError>) const SWIFTEN_OVERRIDE; private: static std::string serializeType(PubSubError::Type); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.cpp index c855977..25d57fe 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubEventAssociateSerializer::PubSubEventAssociateSerializer(PayloadSerializer PubSubEventAssociateSerializer::~PubSubEventAssociateSerializer() { } -std::string PubSubEventAssociateSerializer::serializePayload(boost::shared_ptr<PubSubEventAssociate> payload) const { +std::string PubSubEventAssociateSerializer::serializePayload(std::shared_ptr<PubSubEventAssociate> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h index 03025fb..5056c63 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventAssociateSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventAssociateSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventAssociate>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventAssociate>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.cpp index df255d2..da9feb8 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h> @@ -23,7 +23,7 @@ PubSubEventCollectionSerializer::PubSubEventCollectionSerializer(PayloadSerializ PubSubEventCollectionSerializer::~PubSubEventCollectionSerializer() { } -std::string PubSubEventCollectionSerializer::serializePayload(boost::shared_ptr<PubSubEventCollection> payload) const { +std::string PubSubEventCollectionSerializer::serializePayload(std::shared_ptr<PubSubEventCollection> payload) const { if (!payload) { return ""; } @@ -31,8 +31,8 @@ std::string PubSubEventCollectionSerializer::serializePayload(boost::shared_ptr< if (payload->getNode()) { element.setAttribute("node", *payload->getNode()); } - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubEventDisassociateSerializer(serializers).serialize(payload->getDisassociate()))); - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubEventAssociateSerializer(serializers).serialize(payload->getAssociate()))); + element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventDisassociateSerializer(serializers).serialize(payload->getDisassociate()))); + element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventAssociateSerializer(serializers).serialize(payload->getAssociate()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h index 6e6817d..33144e9 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventCollectionSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventCollectionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventCollection>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventCollection>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.cpp index 3e2d18b..a758ce6 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -22,13 +22,13 @@ PubSubEventConfigurationSerializer::PubSubEventConfigurationSerializer(PayloadSe PubSubEventConfigurationSerializer::~PubSubEventConfigurationSerializer() { } -std::string PubSubEventConfigurationSerializer::serializePayload(boost::shared_ptr<PubSubEventConfiguration> payload) const { +std::string PubSubEventConfigurationSerializer::serializePayload(std::shared_ptr<PubSubEventConfiguration> payload) const { if (!payload) { return ""; } XMLElement element("configuration", "http://jabber.org/protocol/pubsub#event"); element.setAttribute("node", payload->getNode()); - element.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); + element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h index 6309e04..9823292 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventConfigurationSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventConfigurationSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventConfiguration>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventConfiguration>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.cpp index 4dcd734..cd8fc53 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h> @@ -22,13 +22,13 @@ PubSubEventDeleteSerializer::PubSubEventDeleteSerializer(PayloadSerializerCollec PubSubEventDeleteSerializer::~PubSubEventDeleteSerializer() { } -std::string PubSubEventDeleteSerializer::serializePayload(boost::shared_ptr<PubSubEventDelete> payload) const { +std::string PubSubEventDeleteSerializer::serializePayload(std::shared_ptr<PubSubEventDelete> payload) const { if (!payload) { return ""; } XMLElement element("delete", "http://jabber.org/protocol/pubsub#event"); element.setAttribute("node", payload->getNode()); - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubEventRedirectSerializer(serializers).serialize(payload->getRedirects()))); + element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventRedirectSerializer(serializers).serialize(payload->getRedirects()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h index 6d937aa..e02d44c 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventDeleteSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventDeleteSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventDelete>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventDelete>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.cpp index 0818dee..8ef62bd 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubEventDisassociateSerializer::PubSubEventDisassociateSerializer(PayloadSeri PubSubEventDisassociateSerializer::~PubSubEventDisassociateSerializer() { } -std::string PubSubEventDisassociateSerializer::serializePayload(boost::shared_ptr<PubSubEventDisassociate> payload) const { +std::string PubSubEventDisassociateSerializer::serializePayload(std::shared_ptr<PubSubEventDisassociate> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h index 9313ab2..77ca55d 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventDisassociateSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventDisassociateSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventDisassociate>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventDisassociate>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp index 4bc8815..3d1a9cb 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.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> @@ -22,7 +22,7 @@ PubSubEventItemSerializer::PubSubEventItemSerializer(PayloadSerializerCollection PubSubEventItemSerializer::~PubSubEventItemSerializer() { } -std::string PubSubEventItemSerializer::serializePayload(boost::shared_ptr<PubSubEventItem> payload) const { +std::string PubSubEventItemSerializer::serializePayload(std::shared_ptr<PubSubEventItem> payload) const { if (!payload) { return ""; } @@ -33,8 +33,8 @@ std::string PubSubEventItemSerializer::serializePayload(boost::shared_ptr<PubSub if (payload->getPublisher()) { element.setAttribute("publisher", *payload->getPublisher()); } - foreach(boost::shared_ptr<Payload> item, payload->getData()) { - element.addNode(boost::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(item)->serialize(item))); + foreach(std::shared_ptr<Payload> item, payload->getData()) { + element.addNode(std::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(item)->serialize(item))); } if (payload->getID()) { element.setAttribute("id", *payload->getID()); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h index 6666c6b..f292a53 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventItemSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventItemSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventItem>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventItem>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp index 7128314..2e0799b 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.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> @@ -24,17 +24,17 @@ PubSubEventItemsSerializer::PubSubEventItemsSerializer(PayloadSerializerCollecti PubSubEventItemsSerializer::~PubSubEventItemsSerializer() { } -std::string PubSubEventItemsSerializer::serializePayload(boost::shared_ptr<PubSubEventItems> payload) const { +std::string PubSubEventItemsSerializer::serializePayload(std::shared_ptr<PubSubEventItems> payload) const { if (!payload) { return ""; } XMLElement element("items", "http://jabber.org/protocol/pubsub#event"); element.setAttribute("node", payload->getNode()); - foreach(boost::shared_ptr<PubSubEventItem> item, payload->getItems()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubEventItemSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubEventItem> item, payload->getItems()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventItemSerializer(serializers).serialize(item))); } - foreach(boost::shared_ptr<PubSubEventRetract> item, payload->getRetracts()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubEventRetractSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubEventRetract> item, payload->getRetracts()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubEventRetractSerializer(serializers).serialize(item))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h index d174f30..7220fde 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventItemsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventItemsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventItems>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventItems>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.cpp index 86c7635..e0153ec 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubEventPurgeSerializer::PubSubEventPurgeSerializer(PayloadSerializerCollecti PubSubEventPurgeSerializer::~PubSubEventPurgeSerializer() { } -std::string PubSubEventPurgeSerializer::serializePayload(boost::shared_ptr<PubSubEventPurge> payload) const { +std::string PubSubEventPurgeSerializer::serializePayload(std::shared_ptr<PubSubEventPurge> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h index c80c703..991f2c6 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventPurgeSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventPurgeSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventPurge>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventPurge>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.cpp index a7fcd20..8169205 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubEventRedirectSerializer::PubSubEventRedirectSerializer(PayloadSerializerCo PubSubEventRedirectSerializer::~PubSubEventRedirectSerializer() { } -std::string PubSubEventRedirectSerializer::serializePayload(boost::shared_ptr<PubSubEventRedirect> payload) const { +std::string PubSubEventRedirectSerializer::serializePayload(std::shared_ptr<PubSubEventRedirect> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h index fe0f16e..26b6246 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventRedirectSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventRedirectSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventRedirect>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventRedirect>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.cpp index 6a132cc..0147648 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubEventRetractSerializer::PubSubEventRetractSerializer(PayloadSerializerColl PubSubEventRetractSerializer::~PubSubEventRetractSerializer() { } -std::string PubSubEventRetractSerializer::serializePayload(boost::shared_ptr<PubSubEventRetract> payload) const { +std::string PubSubEventRetractSerializer::serializePayload(std::shared_ptr<PubSubEventRetract> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h index 2c393c2..088c263 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventRetractSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventRetractSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventRetract>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventRetract>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp index 7305d29..c084a36 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h> @@ -23,26 +23,26 @@ using namespace Swift; PubSubEventSerializer::PubSubEventSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { - pubsubSerializers.push_back(boost::make_shared<PubSubEventSubscriptionSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubEventPurgeSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubEventCollectionSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubEventDeleteSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubEventItemsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubEventConfigurationSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubEventSubscriptionSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubEventPurgeSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubEventCollectionSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubEventDeleteSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubEventItemsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubEventConfigurationSerializer>(serializers)); } PubSubEventSerializer::~PubSubEventSerializer() { } -std::string PubSubEventSerializer::serializePayload(boost::shared_ptr<PubSubEvent> payload) const { +std::string PubSubEventSerializer::serializePayload(std::shared_ptr<PubSubEvent> payload) const { if (!payload) { return ""; } XMLElement element("event", "http://jabber.org/protocol/pubsub#event"); - boost::shared_ptr<PubSubEventPayload> p = payload->getPayload(); - foreach(boost::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) { + std::shared_ptr<PubSubEventPayload> p = payload->getPayload(); + foreach(std::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) { if (serializer->canSerialize(p)) { - element.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(p))); + element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(p))); } } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h index 2b50e95..5d2d5d7 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/PubSubEvent.h> @@ -23,13 +22,13 @@ namespace Swift { PubSubEventSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEvent>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEvent>) const SWIFTEN_OVERRIDE; private: private: PayloadSerializerCollection* serializers; - std::vector< boost::shared_ptr<PayloadSerializer> > pubsubSerializers; + std::vector< std::shared_ptr<PayloadSerializer> > pubsubSerializers; }; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.cpp index 322b482..212d9ca 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubEventSubscriptionSerializer::PubSubEventSubscriptionSerializer(PayloadSeri PubSubEventSubscriptionSerializer::~PubSubEventSubscriptionSerializer() { } -std::string PubSubEventSubscriptionSerializer::serializePayload(boost::shared_ptr<PubSubEventSubscription> payload) const { +std::string PubSubEventSubscriptionSerializer::serializePayload(std::shared_ptr<PubSubEventSubscription> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h index 74e3062..2b13ee2 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubEventSubscriptionSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubEventSubscriptionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubEventSubscription>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubEventSubscription>) const SWIFTEN_OVERRIDE; private: static std::string serializeSubscriptionType(PubSubEventSubscription::SubscriptionType); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp index e32f17a..4b9176e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.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> @@ -22,13 +22,13 @@ PubSubItemSerializer::PubSubItemSerializer(PayloadSerializerCollection* serializ PubSubItemSerializer::~PubSubItemSerializer() { } -std::string PubSubItemSerializer::serializePayload(boost::shared_ptr<PubSubItem> payload) const { +std::string PubSubItemSerializer::serializePayload(std::shared_ptr<PubSubItem> payload) const { if (!payload) { return ""; } XMLElement element("item", "http://jabber.org/protocol/pubsub"); - foreach(boost::shared_ptr<Payload> item, payload->getData()) { - element.addNode(boost::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(item)->serialize(item))); + foreach(std::shared_ptr<Payload> item, payload->getData()) { + element.addNode(std::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(item)->serialize(item))); } if (!payload->getID().empty()) { element.setAttribute("id", payload->getID()); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h index e6dbb83..866d09b 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubItemSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubItemSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubItem>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubItem>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp index 75d32f5..bde7315 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,7 +9,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Base/foreach.h> @@ -25,7 +25,7 @@ PubSubItemsSerializer::PubSubItemsSerializer(PayloadSerializerCollection* serial PubSubItemsSerializer::~PubSubItemsSerializer() { } -std::string PubSubItemsSerializer::serializePayload(boost::shared_ptr<PubSubItems> payload) const { +std::string PubSubItemsSerializer::serializePayload(std::shared_ptr<PubSubItems> payload) const { if (!payload) { return ""; } @@ -34,8 +34,8 @@ std::string PubSubItemsSerializer::serializePayload(boost::shared_ptr<PubSubItem SWIFT_LOG(warning) << "Serializing PubSubItems with empty node attribute"; } element.setAttribute("node", payload->getNode()); - foreach(boost::shared_ptr<PubSubItem> item, payload->getItems()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); } if (payload->getMaximumItems()) { element.setAttribute("max_items", boost::lexical_cast<std::string>(*payload->getMaximumItems())); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h index 28b923f..51b0578 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubItemsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubItemsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubItems>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubItems>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.cpp index 09f72ef..c291866 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -22,14 +22,14 @@ PubSubOptionsSerializer::PubSubOptionsSerializer(PayloadSerializerCollection* se PubSubOptionsSerializer::~PubSubOptionsSerializer() { } -std::string PubSubOptionsSerializer::serializePayload(boost::shared_ptr<PubSubOptions> payload) const { +std::string PubSubOptionsSerializer::serializePayload(std::shared_ptr<PubSubOptions> payload) const { if (!payload) { return ""; } XMLElement element("options", "http://jabber.org/protocol/pubsub"); element.setAttribute("node", payload->getNode()); element.setAttribute("jid", payload->getJID()); - element.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); + element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); if (payload->getSubscriptionID()) { element.setAttribute("subid", *payload->getSubscriptionID()); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h index 91dabab..3e0fde0 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOptionsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOptionsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOptions>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOptions>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.cpp index 82980ff..602eb34 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubOwnerAffiliationSerializer::PubSubOwnerAffiliationSerializer(PayloadSerial PubSubOwnerAffiliationSerializer::~PubSubOwnerAffiliationSerializer() { } -std::string PubSubOwnerAffiliationSerializer::serializePayload(boost::shared_ptr<PubSubOwnerAffiliation> payload) const { +std::string PubSubOwnerAffiliationSerializer::serializePayload(std::shared_ptr<PubSubOwnerAffiliation> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h index ef0decf..ad1c963 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerAffiliationSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerAffiliationSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerAffiliation>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerAffiliation>) const SWIFTEN_OVERRIDE; private: static std::string serializeType(PubSubOwnerAffiliation::Type); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp index 12873e5..3df3686 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.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> @@ -23,14 +23,14 @@ PubSubOwnerAffiliationsSerializer::PubSubOwnerAffiliationsSerializer(PayloadSeri PubSubOwnerAffiliationsSerializer::~PubSubOwnerAffiliationsSerializer() { } -std::string PubSubOwnerAffiliationsSerializer::serializePayload(boost::shared_ptr<PubSubOwnerAffiliations> payload) const { +std::string PubSubOwnerAffiliationsSerializer::serializePayload(std::shared_ptr<PubSubOwnerAffiliations> payload) const { if (!payload) { return ""; } XMLElement element("affiliations", "http://jabber.org/protocol/pubsub#owner"); element.setAttribute("node", payload->getNode()); - foreach(boost::shared_ptr<PubSubOwnerAffiliation> item, payload->getAffiliations()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubOwnerAffiliationSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubOwnerAffiliation> item, payload->getAffiliations()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubOwnerAffiliationSerializer(serializers).serialize(item))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h index 70ba66f..6c53189 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerAffiliationsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerAffiliationsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerAffiliations>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerAffiliations>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.cpp index 94e6860..51e302e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -22,7 +22,7 @@ PubSubOwnerConfigureSerializer::PubSubOwnerConfigureSerializer(PayloadSerializer PubSubOwnerConfigureSerializer::~PubSubOwnerConfigureSerializer() { } -std::string PubSubOwnerConfigureSerializer::serializePayload(boost::shared_ptr<PubSubOwnerConfigure> payload) const { +std::string PubSubOwnerConfigureSerializer::serializePayload(std::shared_ptr<PubSubOwnerConfigure> payload) const { if (!payload) { return ""; } @@ -30,7 +30,7 @@ std::string PubSubOwnerConfigureSerializer::serializePayload(boost::shared_ptr<P if (payload->getNode()) { element.setAttribute("node", *payload->getNode()); } - element.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); + element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h index be75a00..c5cac8d 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerConfigureSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerConfigureSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerConfigure>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerConfigure>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.cpp index 4b91a81..01e370b 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -22,12 +22,12 @@ PubSubOwnerDefaultSerializer::PubSubOwnerDefaultSerializer(PayloadSerializerColl PubSubOwnerDefaultSerializer::~PubSubOwnerDefaultSerializer() { } -std::string PubSubOwnerDefaultSerializer::serializePayload(boost::shared_ptr<PubSubOwnerDefault> payload) const { +std::string PubSubOwnerDefaultSerializer::serializePayload(std::shared_ptr<PubSubOwnerDefault> payload) const { if (!payload) { return ""; } XMLElement element("default", "http://jabber.org/protocol/pubsub#owner"); - element.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); + element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h index 9d2916f..09703e1 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerDefaultSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerDefaultSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerDefault>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerDefault>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.cpp index fbf9a24..faf991c 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h> @@ -22,13 +22,13 @@ PubSubOwnerDeleteSerializer::PubSubOwnerDeleteSerializer(PayloadSerializerCollec PubSubOwnerDeleteSerializer::~PubSubOwnerDeleteSerializer() { } -std::string PubSubOwnerDeleteSerializer::serializePayload(boost::shared_ptr<PubSubOwnerDelete> payload) const { +std::string PubSubOwnerDeleteSerializer::serializePayload(std::shared_ptr<PubSubOwnerDelete> payload) const { if (!payload) { return ""; } XMLElement element("delete", "http://jabber.org/protocol/pubsub#owner"); element.setAttribute("node", payload->getNode()); - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubOwnerRedirectSerializer(serializers).serialize(payload->getRedirect()))); + element.addNode(std::make_shared<XMLRawTextNode>(PubSubOwnerRedirectSerializer(serializers).serialize(payload->getRedirect()))); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h index 3a96e80..c06a916 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerDeleteSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerDeleteSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerDelete>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerDelete>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp index 25b38d0..f1dc2ae 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h> @@ -23,26 +23,26 @@ using namespace Swift; PubSubOwnerPubSubSerializer::PubSubOwnerPubSubSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { - pubsubSerializers.push_back(boost::make_shared<PubSubOwnerConfigureSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubOwnerSubscriptionsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubOwnerDefaultSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubOwnerPurgeSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubOwnerAffiliationsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubOwnerDeleteSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOwnerConfigureSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOwnerSubscriptionsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOwnerDefaultSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOwnerPurgeSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOwnerAffiliationsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOwnerDeleteSerializer>(serializers)); } PubSubOwnerPubSubSerializer::~PubSubOwnerPubSubSerializer() { } -std::string PubSubOwnerPubSubSerializer::serializePayload(boost::shared_ptr<PubSubOwnerPubSub> payload) const { +std::string PubSubOwnerPubSubSerializer::serializePayload(std::shared_ptr<PubSubOwnerPubSub> payload) const { if (!payload) { return ""; } XMLElement element("pubsub", "http://jabber.org/protocol/pubsub#owner"); - boost::shared_ptr<PubSubOwnerPayload> p = payload->getPayload(); - foreach(boost::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) { + std::shared_ptr<PubSubOwnerPayload> p = payload->getPayload(); + foreach(std::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) { if (serializer->canSerialize(p)) { - element.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(p))); + element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(p))); } } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h index 2dd8400..c93eb04 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> #include <Swiften/Elements/PubSubOwnerPubSub.h> @@ -23,13 +22,13 @@ namespace Swift { PubSubOwnerPubSubSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerPubSubSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerPubSub>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerPubSub>) const SWIFTEN_OVERRIDE; private: private: PayloadSerializerCollection* serializers; - std::vector< boost::shared_ptr<PayloadSerializer> > pubsubSerializers; + std::vector< std::shared_ptr<PayloadSerializer> > pubsubSerializers; }; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.cpp index f934c4e..8bc19e9 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubOwnerPurgeSerializer::PubSubOwnerPurgeSerializer(PayloadSerializerCollecti PubSubOwnerPurgeSerializer::~PubSubOwnerPurgeSerializer() { } -std::string PubSubOwnerPurgeSerializer::serializePayload(boost::shared_ptr<PubSubOwnerPurge> payload) const { +std::string PubSubOwnerPurgeSerializer::serializePayload(std::shared_ptr<PubSubOwnerPurge> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h index 64be235..31f8c52 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerPurgeSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerPurgeSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerPurge>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerPurge>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.cpp index f933a06..cdd101f 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubOwnerRedirectSerializer::PubSubOwnerRedirectSerializer(PayloadSerializerCo PubSubOwnerRedirectSerializer::~PubSubOwnerRedirectSerializer() { } -std::string PubSubOwnerRedirectSerializer::serializePayload(boost::shared_ptr<PubSubOwnerRedirect> payload) const { +std::string PubSubOwnerRedirectSerializer::serializePayload(std::shared_ptr<PubSubOwnerRedirect> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h index b183f46..826ebbe 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerRedirectSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerRedirectSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerRedirect>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerRedirect>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.cpp index 923c160..5f6b505 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubOwnerSubscriptionSerializer::PubSubOwnerSubscriptionSerializer(PayloadSeri PubSubOwnerSubscriptionSerializer::~PubSubOwnerSubscriptionSerializer() { } -std::string PubSubOwnerSubscriptionSerializer::serializePayload(boost::shared_ptr<PubSubOwnerSubscription> payload) const { +std::string PubSubOwnerSubscriptionSerializer::serializePayload(std::shared_ptr<PubSubOwnerSubscription> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h index 1bba67f..df025e0 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerSubscriptionSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerSubscriptionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerSubscription>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerSubscription>) const SWIFTEN_OVERRIDE; private: static std::string serializeSubscriptionType(PubSubOwnerSubscription::SubscriptionType); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp index 088f6c2..106efaa 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.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> @@ -23,14 +23,14 @@ PubSubOwnerSubscriptionsSerializer::PubSubOwnerSubscriptionsSerializer(PayloadSe PubSubOwnerSubscriptionsSerializer::~PubSubOwnerSubscriptionsSerializer() { } -std::string PubSubOwnerSubscriptionsSerializer::serializePayload(boost::shared_ptr<PubSubOwnerSubscriptions> payload) const { +std::string PubSubOwnerSubscriptionsSerializer::serializePayload(std::shared_ptr<PubSubOwnerSubscriptions> payload) const { if (!payload) { return ""; } XMLElement element("subscriptions", "http://jabber.org/protocol/pubsub#owner"); element.setAttribute("node", payload->getNode()); - foreach(boost::shared_ptr<PubSubOwnerSubscription> item, payload->getSubscriptions()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubOwnerSubscriptionSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubOwnerSubscription> item, payload->getSubscriptions()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubOwnerSubscriptionSerializer(serializers).serialize(item))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h index 70ea7b2..0c282b4 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubOwnerSubscriptionsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubOwnerSubscriptionsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubOwnerSubscriptions>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubOwnerSubscriptions>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp index efae018..0b30849 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.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> @@ -23,14 +23,14 @@ PubSubPublishSerializer::PubSubPublishSerializer(PayloadSerializerCollection* se PubSubPublishSerializer::~PubSubPublishSerializer() { } -std::string PubSubPublishSerializer::serializePayload(boost::shared_ptr<PubSubPublish> payload) const { +std::string PubSubPublishSerializer::serializePayload(std::shared_ptr<PubSubPublish> payload) const { if (!payload) { return ""; } XMLElement element("publish", "http://jabber.org/protocol/pubsub"); element.setAttribute("node", payload->getNode()); - foreach(boost::shared_ptr<PubSubItem> item, payload->getItems()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h index c576225..fb1af2e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubPublishSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubPublishSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubPublish>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubPublish>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp index 9a84959..752c234 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.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> @@ -23,14 +23,14 @@ PubSubRetractSerializer::PubSubRetractSerializer(PayloadSerializerCollection* se PubSubRetractSerializer::~PubSubRetractSerializer() { } -std::string PubSubRetractSerializer::serializePayload(boost::shared_ptr<PubSubRetract> payload) const { +std::string PubSubRetractSerializer::serializePayload(std::shared_ptr<PubSubRetract> payload) const { if (!payload) { return ""; } XMLElement element("retract", "http://jabber.org/protocol/pubsub"); element.setAttribute("node", payload->getNode()); - foreach(boost::shared_ptr<PubSubItem> item, payload->getItems()) { - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); + foreach(std::shared_ptr<PubSubItem> item, payload->getItems()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item))); } element.setAttribute("notify", payload->isNotify() ? "true" : "false"); return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h index 60acb6e..0cb12e4 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubRetractSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubRetractSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubRetract>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubRetract>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp index 9562edb..6c110e2 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h> @@ -30,36 +30,36 @@ using namespace Swift; PubSubSerializer::PubSubSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { - pubsubSerializers.push_back(boost::make_shared<PubSubItemsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubCreateSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubPublishSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubOptionsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubAffiliationsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubRetractSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubDefaultSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubSubscriptionsSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubSubscribeSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubUnsubscribeSerializer>(serializers)); - pubsubSerializers.push_back(boost::make_shared<PubSubSubscriptionSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubItemsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubCreateSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubPublishSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubOptionsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubAffiliationsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubRetractSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubDefaultSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubSubscriptionsSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubSubscribeSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubUnsubscribeSerializer>(serializers)); + pubsubSerializers.push_back(std::make_shared<PubSubSubscriptionSerializer>(serializers)); } PubSubSerializer::~PubSubSerializer() { } -std::string PubSubSerializer::serializePayload(boost::shared_ptr<PubSub> payload) const { +std::string PubSubSerializer::serializePayload(std::shared_ptr<PubSub> payload) const { if (!payload) { return ""; } XMLElement element("pubsub", "http://jabber.org/protocol/pubsub"); - boost::shared_ptr<PubSubPayload> p = payload->getPayload(); - foreach(boost::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) { + std::shared_ptr<PubSubPayload> p = payload->getPayload(); + foreach(std::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) { if (serializer->canSerialize(p)) { - element.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(p))); - if (boost::shared_ptr<PubSubCreate> create = boost::dynamic_pointer_cast<PubSubCreate>(p)) { - element.addNode(boost::make_shared<XMLRawTextNode>(boost::make_shared<PubSubConfigureSerializer>(serializers)->serialize(create->getConfigure()))); + element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(p))); + if (std::shared_ptr<PubSubCreate> create = std::dynamic_pointer_cast<PubSubCreate>(p)) { + element.addNode(std::make_shared<XMLRawTextNode>(std::make_shared<PubSubConfigureSerializer>(serializers)->serialize(create->getConfigure()))); } - if (boost::shared_ptr<PubSubSubscribe> subscribe = boost::dynamic_pointer_cast<PubSubSubscribe>(p)) { - element.addNode(boost::make_shared<XMLRawTextNode>(boost::make_shared<PubSubConfigureSerializer>(serializers)->serialize(subscribe->getOptions()))); + if (std::shared_ptr<PubSubSubscribe> subscribe = std::dynamic_pointer_cast<PubSubSubscribe>(p)) { + element.addNode(std::make_shared<XMLRawTextNode>(std::make_shared<PubSubConfigureSerializer>(serializers)->serialize(subscribe->getOptions()))); } } } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h index 0721d13..829f827 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,10 +21,10 @@ namespace Swift { PubSubSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSub>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSub>) const SWIFTEN_OVERRIDE; private: - std::vector< boost::shared_ptr<PayloadSerializer> > pubsubSerializers; + std::vector< std::shared_ptr<PayloadSerializer> > pubsubSerializers; PayloadSerializerCollection* serializers; }; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.cpp index 2e3987e..3fba52e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -21,12 +21,12 @@ PubSubSubscribeOptionsSerializer::PubSubSubscribeOptionsSerializer(PayloadSerial PubSubSubscribeOptionsSerializer::~PubSubSubscribeOptionsSerializer() { } -std::string PubSubSubscribeOptionsSerializer::serializePayload(boost::shared_ptr<PubSubSubscribeOptions> payload) const { +std::string PubSubSubscribeOptionsSerializer::serializePayload(std::shared_ptr<PubSubSubscribeOptions> payload) const { if (!payload) { return ""; } XMLElement element("subscribe-options", "http://jabber.org/protocol/pubsub"); - element.addNode(payload->isRequired() ? boost::make_shared<XMLElement>("required", "") : boost::shared_ptr<XMLElement>()); + element.addNode(payload->isRequired() ? std::make_shared<XMLElement>("required", "") : std::shared_ptr<XMLElement>()); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h index 663d91b..dc9b55a 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubSubscribeOptionsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubSubscribeOptionsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubSubscribeOptions>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubSubscribeOptions>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp index dcc7ab1..81fc71d 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubSubscribeSerializer::PubSubSubscribeSerializer(PayloadSerializerCollection PubSubSubscribeSerializer::~PubSubSubscribeSerializer() { } -std::string PubSubSubscribeSerializer::serializePayload(boost::shared_ptr<PubSubSubscribe> payload) const { +std::string PubSubSubscribeSerializer::serializePayload(std::shared_ptr<PubSubSubscribe> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h index c655464..1c8bfaa 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubSubscribeSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubSubscribeSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubSubscribe>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubSubscribe>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.cpp index cadfce9..644ac07 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #include <Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h> @@ -22,7 +22,7 @@ PubSubSubscriptionSerializer::PubSubSubscriptionSerializer(PayloadSerializerColl PubSubSubscriptionSerializer::~PubSubSubscriptionSerializer() { } -std::string PubSubSubscriptionSerializer::serializePayload(boost::shared_ptr<PubSubSubscription> payload) const { +std::string PubSubSubscriptionSerializer::serializePayload(std::shared_ptr<PubSubSubscription> payload) const { if (!payload) { return ""; } @@ -34,7 +34,7 @@ std::string PubSubSubscriptionSerializer::serializePayload(boost::shared_ptr<Pub element.setAttribute("subid", *payload->getSubscriptionID()); } element.setAttribute("jid", payload->getJID()); - element.addNode(boost::make_shared<XMLRawTextNode>(PubSubSubscribeOptionsSerializer(serializers).serialize(payload->getOptions()))); + element.addNode(std::make_shared<XMLRawTextNode>(PubSubSubscribeOptionsSerializer(serializers).serialize(payload->getOptions()))); element.setAttribute("subscription", serializeSubscriptionType(payload->getSubscription())); return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h index 7d96a06..5a5f847 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubSubscriptionSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubSubscriptionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubSubscription>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubSubscription>) const SWIFTEN_OVERRIDE; private: static std::string serializeSubscriptionType(PubSubSubscription::SubscriptionType); diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp index 3347187..511c8e8 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,7 +8,7 @@ #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> @@ -23,7 +23,7 @@ PubSubSubscriptionsSerializer::PubSubSubscriptionsSerializer(PayloadSerializerCo PubSubSubscriptionsSerializer::~PubSubSubscriptionsSerializer() { } -std::string PubSubSubscriptionsSerializer::serializePayload(boost::shared_ptr<PubSubSubscriptions> payload) const { +std::string PubSubSubscriptionsSerializer::serializePayload(std::shared_ptr<PubSubSubscriptions> payload) const { if (!payload) { return ""; } @@ -31,8 +31,8 @@ std::string PubSubSubscriptionsSerializer::serializePayload(boost::shared_ptr<Pu 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))); + foreach(std::shared_ptr<PubSubSubscription> item, payload->getSubscriptions()) { + element.addNode(std::make_shared<XMLRawTextNode>(PubSubSubscriptionSerializer(serializers).serialize(item))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h index cc64483..caeb3ef 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubSubscriptionsSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubSubscriptionsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubSubscriptions>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubSubscriptions>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.cpp index e9a16d6..6296d9e 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,7 +21,7 @@ PubSubUnsubscribeSerializer::PubSubUnsubscribeSerializer(PayloadSerializerCollec PubSubUnsubscribeSerializer::~PubSubUnsubscribeSerializer() { } -std::string PubSubUnsubscribeSerializer::serializePayload(boost::shared_ptr<PubSubUnsubscribe> payload) const { +std::string PubSubUnsubscribeSerializer::serializePayload(std::shared_ptr<PubSubUnsubscribe> payload) const { if (!payload) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h index ab9a053..cc98cf5 100644 --- a/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { PubSubUnsubscribeSerializer(PayloadSerializerCollection* serializers); virtual ~PubSubUnsubscribeSerializer(); - virtual std::string serializePayload(boost::shared_ptr<PubSubUnsubscribe>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<PubSubUnsubscribe>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h index 21ca59f..1f07e37 100644 --- a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: RawXMLPayloadSerializer() : GenericPayloadSerializer<RawXMLPayload>() {} - virtual std::string serializePayload(boost::shared_ptr<RawXMLPayload> p) const { + virtual std::string serializePayload(std::shared_ptr<RawXMLPayload> p) const { return p->getRawXML(); } }; diff --git a/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h b/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h index a16f52b..3487b16 100644 --- a/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h @@ -22,7 +22,7 @@ namespace Swift { public: ReplaceSerializer() : GenericPayloadSerializer<Replace>() {} - virtual std::string serializePayload(boost::shared_ptr<Replace> replace) const { + virtual std::string serializePayload(std::shared_ptr<Replace> replace) const { return "<replace id = '" + replace->getID() + "' xmlns='urn:xmpp:message-correct:0'/>"; } }; diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp index c737102..95a0084 100644 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -17,16 +16,16 @@ namespace Swift { ResourceBindSerializer::ResourceBindSerializer() : GenericPayloadSerializer<ResourceBind>() { } -std::string ResourceBindSerializer::serializePayload(boost::shared_ptr<ResourceBind> resourceBind) const { +std::string ResourceBindSerializer::serializePayload(std::shared_ptr<ResourceBind> resourceBind) const { XMLElement bindElement("bind", "urn:ietf:params:xml:ns:xmpp-bind"); if (resourceBind->getJID().isValid()) { - boost::shared_ptr<XMLElement> jidNode(new XMLElement("jid")); - jidNode->addNode(boost::make_shared<XMLTextNode>(resourceBind->getJID().toString())); + std::shared_ptr<XMLElement> jidNode(new XMLElement("jid")); + jidNode->addNode(std::make_shared<XMLTextNode>(resourceBind->getJID().toString())); bindElement.addNode(jidNode); } else if (!resourceBind->getResource().empty()) { - boost::shared_ptr<XMLElement> resourceNode(new XMLElement("resource")); - resourceNode->addNode(boost::make_shared<XMLTextNode>(resourceBind->getResource())); + std::shared_ptr<XMLElement> resourceNode(new XMLElement("resource")); + resourceNode->addNode(std::make_shared<XMLTextNode>(resourceBind->getResource())); bindElement.addNode(resourceNode); } return bindElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h index 2878c34..bea3ff1 100644 --- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: ResourceBindSerializer(); - virtual std::string serializePayload(boost::shared_ptr<ResourceBind>) const; + virtual std::string serializePayload(std::shared_ptr<ResourceBind>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp index 205d9e0..3302863 100644 --- a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLRawTextNode.h> @@ -20,7 +21,7 @@ ResultSetSerializer::ResultSetSerializer() { ResultSetSerializer::~ResultSetSerializer() { } -std::string ResultSetSerializer::serializePayload(boost::shared_ptr<ResultSet> payload) const { +std::string ResultSetSerializer::serializePayload(std::shared_ptr<ResultSet> payload) const { if (!payload) { return ""; } @@ -28,19 +29,19 @@ std::string ResultSetSerializer::serializePayload(boost::shared_ptr<ResultSet> p XMLElement element("set", "http://jabber.org/protocol/rsm"); if (payload->getMaxItems()) { - element.addNode(boost::make_shared<XMLElement>("max", "", boost::lexical_cast<std::string>(*payload->getMaxItems()))); + element.addNode(std::make_shared<XMLElement>("max", "", boost::lexical_cast<std::string>(*payload->getMaxItems()))); } if (payload->getCount()) { - element.addNode(boost::make_shared<XMLElement>("count", "", boost::lexical_cast<std::string>(*payload->getCount()))); + element.addNode(std::make_shared<XMLElement>("count", "", boost::lexical_cast<std::string>(*payload->getCount()))); } if (payload->getIndex()) { - element.addNode(boost::make_shared<XMLElement>("index", "", boost::lexical_cast<std::string>(*payload->getIndex()))); + element.addNode(std::make_shared<XMLElement>("index", "", boost::lexical_cast<std::string>(*payload->getIndex()))); } if (payload->getFirstID()) { - boost::shared_ptr<XMLElement> firstElement = boost::make_shared<XMLElement>("first", "", *payload->getFirstID()); + std::shared_ptr<XMLElement> firstElement = std::make_shared<XMLElement>("first", "", *payload->getFirstID()); if (payload->getFirstIDIndex()) { firstElement->setAttribute("index", boost::lexical_cast<std::string>(*payload->getFirstIDIndex())); } @@ -48,15 +49,15 @@ std::string ResultSetSerializer::serializePayload(boost::shared_ptr<ResultSet> p } if (payload->getLastID()) { - element.addNode(boost::make_shared<XMLElement>("last", "", *payload->getLastID())); + element.addNode(std::make_shared<XMLElement>("last", "", *payload->getLastID())); } if (payload->getBefore()) { - element.addNode(boost::make_shared<XMLElement>("before", "", *payload->getBefore())); + element.addNode(std::make_shared<XMLElement>("before", "", *payload->getBefore())); } if (payload->getAfter()) { - element.addNode(boost::make_shared<XMLElement>("after", "", *payload->getAfter())); + element.addNode(std::make_shared<XMLElement>("after", "", *payload->getAfter())); } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h index 9d8e24d..e75b443 100644 --- a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,6 +21,6 @@ namespace Swift { ResultSetSerializer(); virtual ~ResultSetSerializer(); - virtual std::string serializePayload(boost::shared_ptr<ResultSet>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<ResultSet>) const SWIFTEN_OVERRIDE; }; } diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp index f0b19e1..24cc301 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp @@ -12,8 +12,7 @@ #include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -25,10 +24,10 @@ namespace Swift { RosterItemExchangeSerializer::RosterItemExchangeSerializer() : GenericPayloadSerializer<RosterItemExchangePayload>() { } -std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<RosterItemExchangePayload> roster) const { +std::string RosterItemExchangeSerializer::serializePayload(std::shared_ptr<RosterItemExchangePayload> roster) const { XMLElement queryElement("x", "http://jabber.org/protocol/rosterx"); foreach(const RosterItemExchangePayload::Item& item, roster->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + std::shared_ptr<XMLElement> itemElement(new XMLElement("item")); itemElement->setAttribute("jid", item.getJID()); itemElement->setAttribute("name", item.getName()); @@ -39,8 +38,8 @@ std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<Ros } foreach(const std::string& group, item.getGroups()) { - boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); - groupElement->addNode(boost::make_shared<XMLTextNode>(group)); + std::shared_ptr<XMLElement> groupElement(new XMLElement("group")); + groupElement->addNode(std::make_shared<XMLTextNode>(group)); itemElement->addNode(groupElement); } diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h index ec4e81e..6212998 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h @@ -21,6 +21,6 @@ namespace Swift { public: RosterItemExchangeSerializer(); - virtual std::string serializePayload(boost::shared_ptr<RosterItemExchangePayload>) const; + virtual std::string serializePayload(std::shared_ptr<RosterItemExchangePayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp index 1094f2d..8c857ab 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -19,13 +18,13 @@ namespace Swift { RosterSerializer::RosterSerializer() : GenericPayloadSerializer<RosterPayload>() { } -std::string RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> roster) const { +std::string RosterSerializer::serializePayload(std::shared_ptr<RosterPayload> roster) const { XMLElement queryElement("query", "jabber:iq:roster"); if (roster->getVersion()) { queryElement.setAttribute("ver", *roster->getVersion()); } foreach(const RosterItemPayload& item, roster->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + std::shared_ptr<XMLElement> itemElement(new XMLElement("item")); itemElement->setAttribute("jid", item.getJID()); itemElement->setAttribute("name", item.getName()); @@ -42,13 +41,13 @@ std::string RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> } foreach(const std::string& group, item.getGroups()) { - boost::shared_ptr<XMLElement> groupElement(new XMLElement("group")); - groupElement->addNode(boost::make_shared<XMLTextNode>(group)); + std::shared_ptr<XMLElement> groupElement(new XMLElement("group")); + groupElement->addNode(std::make_shared<XMLTextNode>(group)); itemElement->addNode(groupElement); } if (!item.getUnknownContent().empty()) { - itemElement->addNode(boost::make_shared<XMLRawTextNode>(item.getUnknownContent())); + itemElement->addNode(std::make_shared<XMLRawTextNode>(item.getUnknownContent())); } diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h index 799d88f..834f723 100644 --- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: RosterSerializer(); - virtual std::string serializePayload(boost::shared_ptr<RosterPayload>) const; + virtual std::string serializePayload(std::shared_ptr<RosterPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h index f10bcfc..7058ac1 100644 --- a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h @@ -5,15 +5,16 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/S5BProxyRequest.h> @@ -25,17 +26,17 @@ namespace Swift { class SWIFTEN_API S5BProxyRequestSerializer : public GenericPayloadSerializer<S5BProxyRequest> { public: - virtual std::string serializePayload(boost::shared_ptr<S5BProxyRequest> s5bProxyRequest) const { + virtual std::string serializePayload(std::shared_ptr<S5BProxyRequest> s5bProxyRequest) const { XMLElement queryElement("query", "http://jabber.org/protocol/bytestreams"); if (s5bProxyRequest && s5bProxyRequest->getStreamHost()) { - boost::shared_ptr<XMLElement> streamHost = boost::make_shared<XMLElement>("streamhost"); + std::shared_ptr<XMLElement> streamHost = std::make_shared<XMLElement>("streamhost"); streamHost->setAttribute("host", s5bProxyRequest->getStreamHost().get().host); streamHost->setAttribute("port", boost::lexical_cast<std::string>(s5bProxyRequest->getStreamHost().get().port)); streamHost->setAttribute("jid", s5bProxyRequest->getStreamHost().get().jid.toString()); queryElement.addNode(streamHost); } else if (s5bProxyRequest && s5bProxyRequest->getActivate()) { queryElement.setAttribute("sid", s5bProxyRequest->getSID()); - boost::shared_ptr<XMLElement> activate = boost::make_shared<XMLElement>("activate", "", s5bProxyRequest->getActivate().get().toString()); + std::shared_ptr<XMLElement> activate = std::make_shared<XMLElement>("activate", "", s5bProxyRequest->getActivate().get().toString()); queryElement.addNode(activate); } return queryElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp index de036df..6e55f46 100644 --- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> @@ -19,7 +18,7 @@ namespace Swift { SearchPayloadSerializer::SearchPayloadSerializer() { } -std::string SearchPayloadSerializer::serializePayload(boost::shared_ptr<SearchPayload> searchPayload) const { +std::string SearchPayloadSerializer::serializePayload(std::shared_ptr<SearchPayload> searchPayload) const { XMLElement searchElement("query", "jabber:iq:search"); if (searchPayload->getInstructions()) { @@ -54,7 +53,7 @@ std::string SearchPayloadSerializer::serializePayload(boost::shared_ptr<SearchPa } if (Form::ref form = searchPayload->getForm()) { - searchElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); + searchElement.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); } return searchElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h index 594e5d7..51f4227 100644 --- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h @@ -18,6 +18,6 @@ namespace Swift { public: SearchPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<SearchPayload>) const; + virtual std::string serializePayload(std::shared_ptr<SearchPayload>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp index 9b35952..97c5411 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp @@ -6,7 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -18,27 +18,27 @@ namespace Swift { SecurityLabelSerializer::SecurityLabelSerializer() : GenericPayloadSerializer<SecurityLabel>() { } -std::string SecurityLabelSerializer::serializePayload(boost::shared_ptr<SecurityLabel> label) const { +std::string SecurityLabelSerializer::serializePayload(std::shared_ptr<SecurityLabel> label) const { XMLElement element("securitylabel", "urn:xmpp:sec-label:0"); if (!label->getDisplayMarking().empty()) { - boost::shared_ptr<XMLElement> displayMarking(new XMLElement("displaymarking")); + std::shared_ptr<XMLElement> displayMarking(new XMLElement("displaymarking")); if (!label->getForegroundColor().empty()) { displayMarking->setAttribute("fgcolor", label->getForegroundColor()); } if (!label->getBackgroundColor().empty()) { displayMarking->setAttribute("bgcolor", label->getBackgroundColor()); } - displayMarking->addNode(boost::make_shared<XMLTextNode>(label->getDisplayMarking())); + displayMarking->addNode(std::make_shared<XMLTextNode>(label->getDisplayMarking())); element.addNode(displayMarking); } - boost::shared_ptr<XMLElement> labelElement(new XMLElement("label")); - labelElement->addNode(boost::make_shared<XMLRawTextNode>(label->getLabel())); + std::shared_ptr<XMLElement> labelElement(new XMLElement("label")); + labelElement->addNode(std::make_shared<XMLRawTextNode>(label->getLabel())); element.addNode(labelElement); foreach(const std::string& equivalentLabel, label->getEquivalentLabels()) { - boost::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel")); - equivalentLabelElement->addNode(boost::make_shared<XMLRawTextNode>(equivalentLabel)); + std::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel")); + equivalentLabelElement->addNode(std::make_shared<XMLRawTextNode>(equivalentLabel)); element.addNode(equivalentLabelElement); } return element.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h index 23f50f4..b1eaaed 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: SecurityLabelSerializer(); - virtual std::string serializePayload(boost::shared_ptr<SecurityLabel> version) const; + virtual std::string serializePayload(std::shared_ptr<SecurityLabel> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp index 2bf6bbb..e8d2a1b 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp @@ -6,7 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h> @@ -18,7 +18,7 @@ namespace Swift { SecurityLabelsCatalogSerializer::SecurityLabelsCatalogSerializer() : GenericPayloadSerializer<SecurityLabelsCatalog>() { } -std::string SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr<SecurityLabelsCatalog> catalog) const { +std::string SecurityLabelsCatalogSerializer::serializePayload(std::shared_ptr<SecurityLabelsCatalog> catalog) const { XMLElement element("catalog", "urn:xmpp:sec-label:catalog:2"); if (!catalog->getName().empty()) { element.setAttribute("name", catalog->getName()); @@ -30,14 +30,14 @@ std::string SecurityLabelsCatalogSerializer::serializePayload(boost::shared_ptr< element.setAttribute("desc", catalog->getDescription()); } foreach (const SecurityLabelsCatalog::Item& item, catalog->getItems()) { - boost::shared_ptr<XMLElement> itemElement(new XMLElement("item")); + std::shared_ptr<XMLElement> itemElement(new XMLElement("item")); itemElement->setAttribute("selector", item.getSelector()); if (item.getIsDefault()) { itemElement->setAttribute("default", "true"); } if (item.getLabel()) { std::string serializedLabel = SecurityLabelSerializer().serialize(item.getLabel()); - itemElement->addNode(boost::make_shared<XMLRawTextNode>(serializedLabel)); + itemElement->addNode(std::make_shared<XMLRawTextNode>(serializedLabel)); } element.addNode(itemElement); } diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h index da3b7f3..c3efc1e 100644 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: SecurityLabelsCatalogSerializer(); - virtual std::string serializePayload(boost::shared_ptr<SecurityLabelsCatalog> version) const; + virtual std::string serializePayload(std::shared_ptr<SecurityLabelsCatalog> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp index 05beaae..2245030 100644 --- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -11,7 +11,7 @@ namespace Swift { SoftwareVersionSerializer::SoftwareVersionSerializer() : GenericPayloadSerializer<SoftwareVersion>() { } -std::string SoftwareVersionSerializer::serializePayload(boost::shared_ptr<SoftwareVersion> version) const { +std::string SoftwareVersionSerializer::serializePayload(std::shared_ptr<SoftwareVersion> version) const { std::string result("<query xmlns=\"jabber:iq:version\">"); if (!version->getName().empty()) { result += "<name>" + version->getName() + "</name>"; diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h index 6c03c84..7f0875b 100644 --- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: SoftwareVersionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<SoftwareVersion> version) const; + virtual std::string serializePayload(std::shared_ptr<SoftwareVersion> version) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h index 086652f..12e6994 100644 --- a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,7 +18,7 @@ namespace Swift { public: StartSessionSerializer() : GenericPayloadSerializer<StartSession>() {} - virtual std::string serializePayload(boost::shared_ptr<StartSession>) const { + virtual std::string serializePayload(std::shared_ptr<StartSession>) const { return XMLElement("session", "urn:ietf:params:xml:ns:xmpp-session").serialize(); } }; diff --git a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h index 8247e28..0e81a26 100644 --- a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/Status.h> @@ -19,9 +19,9 @@ namespace Swift { public: StatusSerializer() : GenericPayloadSerializer<Status>() {} - virtual std::string serializePayload(boost::shared_ptr<Status> status) const { + virtual std::string serializePayload(std::shared_ptr<Status> status) const { XMLElement element("status"); - element.addNode(boost::make_shared<XMLTextNode>(status->getText())); + element.addNode(std::make_shared<XMLTextNode>(status->getText())); return element.serialize(); } }; diff --git a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h index 24fbe1b..155b645 100644 --- a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h @@ -15,7 +15,7 @@ namespace Swift { public: StatusShowSerializer() : GenericPayloadSerializer<StatusShow>() {} - virtual std::string serializePayload(boost::shared_ptr<StatusShow> statusShow) const { + virtual std::string serializePayload(std::shared_ptr<StatusShow> statusShow) const { if (statusShow->getType () == StatusShow::Online || statusShow->getType() == StatusShow::None) { return ""; } diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp index 64ea62c..31720f7 100644 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -18,29 +17,29 @@ namespace Swift { StorageSerializer::StorageSerializer() : GenericPayloadSerializer<Storage>() { } -std::string StorageSerializer::serializePayload(boost::shared_ptr<Storage> storage) const { +std::string StorageSerializer::serializePayload(std::shared_ptr<Storage> storage) const { XMLElement storageElement("storage", "storage:bookmarks"); foreach(const Storage::Room& room, storage->getRooms()) { - boost::shared_ptr<XMLElement> conferenceElement(new XMLElement("conference")); + std::shared_ptr<XMLElement> conferenceElement(new XMLElement("conference")); conferenceElement->setAttribute("name", room.name); conferenceElement->setAttribute("jid", room.jid); conferenceElement->setAttribute("autojoin", room.autoJoin ? "1" : "0"); if (!room.nick.empty()) { - boost::shared_ptr<XMLElement> nickElement(new XMLElement("nick")); - nickElement->addNode(boost::make_shared<XMLTextNode>(room.nick)); + std::shared_ptr<XMLElement> nickElement(new XMLElement("nick")); + nickElement->addNode(std::make_shared<XMLTextNode>(room.nick)); conferenceElement->addNode(nickElement); } if (room.password) { - boost::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); - passwordElement->addNode(boost::make_shared<XMLTextNode>(*room.password)); + std::shared_ptr<XMLElement> passwordElement(new XMLElement("password")); + passwordElement->addNode(std::make_shared<XMLTextNode>(*room.password)); conferenceElement->addNode(passwordElement); } storageElement.addNode(conferenceElement); } foreach(const Storage::URL& url, storage->getURLs()) { - boost::shared_ptr<XMLElement> urlElement(new XMLElement("url")); + std::shared_ptr<XMLElement> urlElement(new XMLElement("url")); urlElement->setAttribute("name", url.name); urlElement->setAttribute("url", url.url); storageElement.addNode(urlElement); diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h index a3a55f4..9f88fa1 100644 --- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: StorageSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Storage>) const; + virtual std::string serializePayload(std::shared_ptr<Storage>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp index a64d7ae..e15ab77 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp @@ -12,9 +12,9 @@ #include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/DateTime.h> #include <Swiften/Base/foreach.h> @@ -27,7 +27,7 @@ namespace Swift { StreamInitiationFileInfoSerializer::StreamInitiationFileInfoSerializer() { } -std::string StreamInitiationFileInfoSerializer::serializePayload(boost::shared_ptr<StreamInitiationFileInfo> fileInfo) const { +std::string StreamInitiationFileInfoSerializer::serializePayload(std::shared_ptr<StreamInitiationFileInfo> fileInfo) const { XMLElement fileElement("file", "http://jabber.org/protocol/si/profile/file-transfer"); if (fileInfo->getDate() != stringToDateTime("")) { @@ -44,11 +44,11 @@ std::string StreamInitiationFileInfoSerializer::serializePayload(boost::shared_p fileElement.setAttribute("size", boost::lexical_cast<std::string>(fileInfo->getSize())); } if (!fileInfo->getDescription().empty()) { - boost::shared_ptr<XMLElement> desc = boost::make_shared<XMLElement>("desc", "", fileInfo->getDescription()); + std::shared_ptr<XMLElement> desc = std::make_shared<XMLElement>("desc", "", fileInfo->getDescription()); fileElement.addNode(desc); } if (fileInfo->getSupportsRangeRequests()) { - boost::shared_ptr<XMLElement> range = boost::make_shared<XMLElement>("range"); + std::shared_ptr<XMLElement> range = std::make_shared<XMLElement>("range"); if (fileInfo->getRangeOffset() != 0) { range->setAttribute("offset", boost::lexical_cast<std::string>(fileInfo->getRangeOffset())); } diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h index e7714f0..de54313 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h @@ -25,6 +25,6 @@ namespace Swift { public: StreamInitiationFileInfoSerializer(); - virtual std::string serializePayload(boost::shared_ptr<StreamInitiationFileInfo>) const; + virtual std::string serializePayload(std::shared_ptr<StreamInitiationFileInfo>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp index 824569a..fcfb063 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp @@ -1,13 +1,13 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> +#include <memory> #include <boost/lexical_cast.hpp> #include <Swiften/Base/foreach.h> @@ -25,7 +25,7 @@ namespace Swift { StreamInitiationSerializer::StreamInitiationSerializer() { } -std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<StreamInitiation> streamInitiation) const { +std::string StreamInitiationSerializer::serializePayload(std::shared_ptr<StreamInitiation> streamInitiation) const { assert(streamInitiation->getIsFileTransfer()); XMLElement siElement("si", "http://jabber.org/protocol/si"); @@ -36,37 +36,37 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<Strea if (streamInitiation->getFileInfo()) { StreamInitiationFileInfo file = *streamInitiation->getFileInfo(); - boost::shared_ptr<XMLElement> fileElement(new XMLElement("file", "http://jabber.org/protocol/si/profile/file-transfer")); + std::shared_ptr<XMLElement> fileElement(new XMLElement("file", "http://jabber.org/protocol/si/profile/file-transfer")); fileElement->setAttribute("name", file.getName()); if (file.getSize() != 0) { fileElement->setAttribute("size", boost::lexical_cast<std::string>(file.getSize())); } if (!file.getDescription().empty()) { - boost::shared_ptr<XMLElement> descElement(new XMLElement("desc")); - descElement->addNode(boost::make_shared<XMLTextNode>(file.getDescription())); + std::shared_ptr<XMLElement> descElement(new XMLElement("desc")); + descElement->addNode(std::make_shared<XMLTextNode>(file.getDescription())); fileElement->addNode(descElement); } siElement.addNode(fileElement); } - boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature", FEATURE_NEG_NS)); + std::shared_ptr<XMLElement> featureElement(new XMLElement("feature", FEATURE_NEG_NS)); if (streamInitiation->getProvidedMethods().size() > 0) { Form::ref form(new Form(Form::FormType)); - FormField::ref field = boost::make_shared<FormField>(FormField::ListSingleType); + FormField::ref field = std::make_shared<FormField>(FormField::ListSingleType); field->setName("stream-method"); foreach(const std::string& method, streamInitiation->getProvidedMethods()) { field->addOption(FormField::Option("", method)); } form->addField(field); - featureElement->addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); + featureElement->addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); } else if (!streamInitiation->getRequestedMethod().empty()) { Form::ref form(new Form(Form::SubmitType)); - FormField::ref field = boost::make_shared<FormField>(FormField::ListSingleType); + FormField::ref field = std::make_shared<FormField>(FormField::ListSingleType); field->addValue(streamInitiation->getRequestedMethod()); field->setName("stream-method"); form->addField(field); - featureElement->addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); + featureElement->addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); } siElement.addNode(featureElement); return siElement.serialize(); diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h index 056806e..73dbc39 100644 --- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: StreamInitiationSerializer(); - virtual std::string serializePayload(boost::shared_ptr<StreamInitiation>) const; + virtual std::string serializePayload(std::shared_ptr<StreamInitiation>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h b/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h index 9f90ce0..20f95fd 100644 --- a/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h @@ -16,7 +16,7 @@ namespace Swift { public: SubjectSerializer() : GenericPayloadSerializer<Subject>() {} - virtual std::string serializePayload(boost::shared_ptr<Subject> subject) const { + virtual std::string serializePayload(std::shared_ptr<Subject> subject) const { XMLTextNode textNode(subject->getText()); return "<subject>" + textNode.serialize() + "</subject>"; } diff --git a/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp index 61b91ae..5914cf2 100644 --- a/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,7 +15,7 @@ namespace Swift { ThreadSerializer::~ThreadSerializer() { } - std::string ThreadSerializer::serializePayload(boost::shared_ptr<Thread> thread) const { + std::string ThreadSerializer::serializePayload(std::shared_ptr<Thread> thread) const { XMLElement threadNode("thread", "", thread->getText()); if (!thread->getParent().empty()) { threadNode.setAttribute("parent", thread->getParent()); diff --git a/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h index 264faba..07ecb82 100644 --- a/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/ThreadSerializer.h @@ -17,6 +17,6 @@ namespace Swift { ThreadSerializer(); virtual ~ThreadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<Thread> thread) const; + virtual std::string serializePayload(std::shared_ptr<Thread> thread) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/BlockSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/BlockSerializerTest.cpp index 1dc97f8..9b9e00d 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/BlockSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/BlockSerializerTest.cpp @@ -34,7 +34,7 @@ class BlockSerializerTest : public CppUnit::TestFixture void testExample4() { BlockSerializer<BlockListPayload> testling("blocklist"); - boost::shared_ptr<BlockListPayload> blocklist = boost::make_shared<BlockListPayload>(); + std::shared_ptr<BlockListPayload> blocklist = std::make_shared<BlockListPayload>(); blocklist->addItem(JID("romeo@montague.net")); blocklist->addItem(JID("iago@shakespeare.lit")); @@ -43,7 +43,7 @@ class BlockSerializerTest : public CppUnit::TestFixture void testExample6() { BlockSerializer<BlockPayload> testling("block"); - boost::shared_ptr<BlockPayload> block = boost::make_shared<BlockPayload>(); + std::shared_ptr<BlockPayload> block = std::make_shared<BlockPayload>(); block->addItem(JID("romeo@montague.net")); CPPUNIT_ASSERT_EQUAL(std::string("<block xmlns=\"urn:xmpp:blocking\"><item jid=\"romeo@montague.net\"/></block>"), testling.serialize(block)); @@ -51,7 +51,7 @@ class BlockSerializerTest : public CppUnit::TestFixture void testExample10() { BlockSerializer<UnblockPayload> testling("unblock"); - boost::shared_ptr<UnblockPayload> unblock = boost::make_shared<UnblockPayload>(); + std::shared_ptr<UnblockPayload> unblock = std::make_shared<UnblockPayload>(); unblock->addItem(JID("romeo@montague.net")); CPPUNIT_ASSERT_EQUAL(std::string("<unblock xmlns=\"urn:xmpp:blocking\"><item jid=\"romeo@montague.net\"/></unblock>"), testling.serialize(unblock)); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp index 517e98b..c4e3ad8 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class CapsInfoSerializerTest : public CppUnit::TestFixture void testSerialize() { CapsInfoSerializer testling; - boost::shared_ptr<CapsInfo> priority(new CapsInfo("http://swift.im", "myversion", "sha-1")); + std::shared_ptr<CapsInfo> priority(new CapsInfo("http://swift.im", "myversion", "sha-1")); CPPUNIT_ASSERT_EQUAL(std::string("<c hash=\"sha-1\" node=\"http://swift.im\" ver=\"myversion\" xmlns=\"http://jabber.org/protocol/caps\"/>"), testling.serialize(priority)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp index a0c49a6..9ac8416 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp @@ -43,7 +43,7 @@ class CarbonsSerializerTest : public CppUnit::TestFixture { void testSerializeExample3() { CarbonsEnableSerializer testling; - CPPUNIT_ASSERT_EQUAL(std::string("<enable xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(boost::make_shared<CarbonsEnable>())); + CPPUNIT_ASSERT_EQUAL(std::string("<enable xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(std::make_shared<CarbonsEnable>())); } /* @@ -52,7 +52,7 @@ class CarbonsSerializerTest : public CppUnit::TestFixture { void testSerializeExample6() { CarbonsDisableSerializer testling; - CPPUNIT_ASSERT_EQUAL(std::string("<disable xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(boost::make_shared<CarbonsDisable>())); + CPPUNIT_ASSERT_EQUAL(std::string("<disable xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(std::make_shared<CarbonsDisable>())); } /* @@ -61,15 +61,15 @@ class CarbonsSerializerTest : public CppUnit::TestFixture { void testSerializeExample12() { CarbonsReceivedSerializer testling(&serializers); - CarbonsReceived::ref received = boost::make_shared<CarbonsReceived>(); + CarbonsReceived::ref received = std::make_shared<CarbonsReceived>(); - boost::shared_ptr<Forwarded> forwarded = boost::make_shared<Forwarded>(); + std::shared_ptr<Forwarded> forwarded = std::make_shared<Forwarded>(); - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setFrom(JID("juliet@capulet.example/balcony")); message->setTo(JID("romeo@montague.example/garden")); message->setBody("What man art thou that, thus bescreen'd in night, so stumblest on my counsel?"); - message->addPayload(boost::make_shared<Thread>("0e3141cd80894871a68e6fe6b1ec56fa")); + message->addPayload(std::make_shared<Thread>("0e3141cd80894871a68e6fe6b1ec56fa")); forwarded->setStanza(message); received->setForwarded(forwarded); @@ -94,15 +94,15 @@ class CarbonsSerializerTest : public CppUnit::TestFixture { void testSerializeExample14() { CarbonsSentSerializer testling(&serializers); - CarbonsSent::ref sent = boost::make_shared<CarbonsSent>(); + CarbonsSent::ref sent = std::make_shared<CarbonsSent>(); - boost::shared_ptr<Forwarded> forwarded = boost::make_shared<Forwarded>(); + std::shared_ptr<Forwarded> forwarded = std::make_shared<Forwarded>(); - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setTo(JID("juliet@capulet.example/balcony")); message->setFrom(JID("romeo@montague.example/home")); message->setBody("Neither, fair saint, if either thee dislike."); - message->addPayload(boost::make_shared<Thread>("0e3141cd80894871a68e6fe6b1ec56fa")); + message->addPayload(std::make_shared<Thread>("0e3141cd80894871a68e6fe6b1ec56fa")); forwarded->setStanza(message); sent->setForwarded(forwarded); @@ -127,7 +127,7 @@ class CarbonsSerializerTest : public CppUnit::TestFixture { void testSerializeExample15() { CarbonsPrivateSerializer testling; - CPPUNIT_ASSERT_EQUAL(std::string("<private xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(boost::make_shared<CarbonsPrivate>())); + CPPUNIT_ASSERT_EQUAL(std::string("<private xmlns=\"urn:xmpp:carbons:2\"/>"), testling.serialize(std::make_shared<CarbonsPrivate>())); } private: FullPayloadSerializerCollection serializers; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ChatStateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ChatStateSerializerTest.cpp index 85b067f..018d2cc 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ChatStateSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ChatStateSerializerTest.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -26,27 +32,27 @@ class ChatStateSerializerTest : public CppUnit::TestFixture ChatStateSerializer testling; void testSerialize_ActiveState() { - boost::shared_ptr<ChatState> priority(new ChatState(ChatState::Active)); + std::shared_ptr<ChatState> priority(new ChatState(ChatState::Active)); CPPUNIT_ASSERT_EQUAL(std::string("<active xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority)); } void testSerialize_GoneState() { - boost::shared_ptr<ChatState> priority(new ChatState(ChatState::Gone)); + std::shared_ptr<ChatState> priority(new ChatState(ChatState::Gone)); CPPUNIT_ASSERT_EQUAL(std::string("<gone xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority)); } void testSerialize_ComposingState() { - boost::shared_ptr<ChatState> priority(new ChatState(ChatState::Composing)); + std::shared_ptr<ChatState> priority(new ChatState(ChatState::Composing)); CPPUNIT_ASSERT_EQUAL(std::string("<composing xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority)); } void testSerialize_PausedState() { - boost::shared_ptr<ChatState> priority(new ChatState(ChatState::Paused)); + std::shared_ptr<ChatState> priority(new ChatState(ChatState::Paused)); CPPUNIT_ASSERT_EQUAL(std::string("<paused xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority)); } void testSerialize_InacativeState() { - boost::shared_ptr<ChatState> priority(new ChatState(ChatState::Inactive)); + std::shared_ptr<ChatState> priority(new ChatState(ChatState::Inactive)); CPPUNIT_ASSERT_EQUAL(std::string("<inactive xmlns=\"http://jabber.org/protocol/chatstates\"/>"), testling.serialize(priority)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/DeliveryReceiptSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/DeliveryReceiptSerializerTest.cpp index bda9ab7..7ed9421 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/DeliveryReceiptSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/DeliveryReceiptSerializerTest.cpp @@ -10,8 +10,7 @@ * See the COPYING file for more information. */ -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -31,18 +30,18 @@ class DeliveryReceiptSerializerTest : public CppUnit::TestFixture { void testSerialize_XEP0184Example3() { std::string expected = "<request xmlns=\"urn:xmpp:receipts\"/>"; - DeliveryReceiptRequest::ref receipt = boost::make_shared<DeliveryReceiptRequest>(); + DeliveryReceiptRequest::ref receipt = std::make_shared<DeliveryReceiptRequest>(); - boost::shared_ptr<DeliveryReceiptRequestSerializer> serializer = boost::make_shared<DeliveryReceiptRequestSerializer>(); + std::shared_ptr<DeliveryReceiptRequestSerializer> serializer = std::make_shared<DeliveryReceiptRequestSerializer>(); CPPUNIT_ASSERT_EQUAL(expected, serializer->serializePayload(receipt)); } void testSerialize_XEP0184Example4() { std::string expected = "<received id=\"richard2-4.1.247\" xmlns=\"urn:xmpp:receipts\"/>"; - DeliveryReceipt::ref receipt = boost::make_shared<DeliveryReceipt>("richard2-4.1.247"); + DeliveryReceipt::ref receipt = std::make_shared<DeliveryReceipt>("richard2-4.1.247"); - boost::shared_ptr<DeliveryReceiptSerializer> serializer = boost::make_shared<DeliveryReceiptSerializer>(); + std::shared_ptr<DeliveryReceiptSerializer> serializer = std::make_shared<DeliveryReceiptSerializer>(); CPPUNIT_ASSERT_EQUAL(expected, serializer->serializePayload(receipt)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp index 14b1a34..318c3d7 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ class DiscoInfoSerializerTest : public CppUnit::TestFixture void testSerialize() { DiscoInfoSerializer testling; - boost::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo()); + std::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo()); discoInfo->addIdentity(DiscoInfo::Identity("Swift", "client", "pc")); discoInfo->addIdentity(DiscoInfo::Identity("Vlug", "client", "pc", "nl")); discoInfo->addFeature("http://jabber.org/protocol/caps"); @@ -43,10 +43,10 @@ class DiscoInfoSerializerTest : public CppUnit::TestFixture void testSerialize_Form() { DiscoInfoSerializer testling; - boost::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo()); + std::shared_ptr<DiscoInfo> discoInfo(new DiscoInfo()); discoInfo->addFeature("http://jabber.org/protocol/caps"); discoInfo->addFeature("http://jabber.org/protocol/disco#info"); - boost::shared_ptr<Form> form(new Form(Form::FormType)); + std::shared_ptr<Form> form(new Form(Form::FormType)); form->setTitle("Bot Configuration"); discoInfo->addExtension(form); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp index 13d9e3c..68a72b8 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -24,15 +24,15 @@ class ErrorSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { ErrorSerializer testling(&serializers); - boost::shared_ptr<ErrorPayload> error(new ErrorPayload(ErrorPayload::BadRequest, ErrorPayload::Cancel, "My Error")); + std::shared_ptr<ErrorPayload> error(new ErrorPayload(ErrorPayload::BadRequest, ErrorPayload::Cancel, "My Error")); CPPUNIT_ASSERT_EQUAL(std::string("<error type=\"cancel\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">My Error</text></error>"), testling.serialize(error)); } void testSerialize_Payload() { ErrorSerializer testling(&serializers); - boost::shared_ptr<ErrorPayload> error = boost::make_shared<ErrorPayload>(); - error->setPayload(boost::make_shared<Delay>()); + std::shared_ptr<ErrorPayload> error = std::make_shared<ErrorPayload>(); + error->setPayload(std::make_shared<Delay>()); CPPUNIT_ASSERT_EQUAL(std::string( "<error type=\"cancel\"><undefined-condition xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><delay stamp=\"not-a-date-timeZ\" xmlns=\"urn:xmpp:delay\"/></error>" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp index 8bd16cd..6534dce 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -22,7 +22,7 @@ class FormSerializerTest : public CppUnit::TestFixture { public: void testSerializeFormInformation() { FormSerializer testling; - boost::shared_ptr<Form> form(new Form(Form::FormType)); + std::shared_ptr<Form> form(new Form(Form::FormType)); form->setTitle("Bot Configuration"); form->setInstructions("Hello!\nFill out this form to configure your new bot!"); @@ -36,39 +36,39 @@ class FormSerializerTest : public CppUnit::TestFixture { void testSerializeLayout() { FormSerializer testling; - boost::shared_ptr<Form> form(new Form(Form::FormType)); + std::shared_ptr<Form> form(new Form(Form::FormType)); - FormPage::page page = boost::make_shared<FormPage>(); + FormPage::page page = std::make_shared<FormPage>(); page->setLabel("P1"); - FormReportedRef::ref reportedRef = boost::make_shared<FormReportedRef>(); + FormReportedRef::ref reportedRef = std::make_shared<FormReportedRef>(); page->addReportedRef(reportedRef); - FormText::text formText = boost::make_shared<FormText>(); + FormText::text formText = std::make_shared<FormText>(); formText->setTextString("P1T1"); page->addTextElement(formText); - FormField::ref field = boost::make_shared<FormField>(FormField::TextSingleType); + FormField::ref field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("P1F1"); field->setLabel("field one"); page->addField(field); - FormSection::section section = boost::make_shared<FormSection>(); + FormSection::section section = std::make_shared<FormSection>(); section->setLabel("P1S1"); - formText = boost::make_shared<FormText>(); + formText = std::make_shared<FormText>(); formText->setTextString("P1S1T1"); section->addTextElement(formText); - field = boost::make_shared<FormField>(FormField::TextSingleType); + field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("P1S1F1"); field->setLabel("field two"); section->addField(field); page->addChildSection(section); form->addPage(page); - page = boost::make_shared<FormPage>(); + page = std::make_shared<FormPage>(); page->setLabel("P2"); - section = boost::make_shared<FormSection>(); + section = std::make_shared<FormSection>(); section->setLabel("P2S1"); - FormSection::section subSection = boost::make_shared<FormSection>(); + FormSection::section subSection = std::make_shared<FormSection>(); subSection->setLabel("P2S2"); - FormSection::section subSection2 = boost::make_shared<FormSection>(); + FormSection::section subSection2 = std::make_shared<FormSection>(); subSection2->setLabel("P2S3"); subSection->addChildSection(subSection2); section->addChildSection(subSection); @@ -101,37 +101,37 @@ class FormSerializerTest : public CppUnit::TestFixture { void testSerializeFields() { FormSerializer testling; - boost::shared_ptr<Form> form(new Form(Form::FormType)); + std::shared_ptr<Form> form(new Form(Form::FormType)); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); field->setName("FORM_TYPE"); form->addField(field); - form->addField(boost::make_shared<FormField>(FormField::FixedType, "Section 1: Bot Info")); + form->addField(std::make_shared<FormField>(FormField::FixedType, "Section 1: Bot Info")); - field = boost::make_shared<FormField>(FormField::TextSingleType); + field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("botname"); field->setLabel("The name of your bot"); form->addField(field); - field = boost::make_shared<FormField>(FormField::TextMultiType); + field = std::make_shared<FormField>(FormField::TextMultiType); field->setTextMultiValue("This is a bot.\nA quite good one actually"); field->setName("description"); field->setLabel("Helpful description of your bot"); form->addField(field); - field = boost::make_shared<FormField>(FormField::BooleanType, "1"); + field = std::make_shared<FormField>(FormField::BooleanType, "1"); field->setName("public"); field->setLabel("Public bot?"); field->setRequired(true); form->addField(field); - field = boost::make_shared<FormField>(FormField::TextPrivateType); + field = std::make_shared<FormField>(FormField::TextPrivateType); field->setName("password"); field->setLabel("Password for special access"); form->addField(field); - field = boost::make_shared<FormField>(FormField::ListMultiType); + field = std::make_shared<FormField>(FormField::ListMultiType); field->addValue("news"); field->addValue("search"); field->setName("features"); @@ -143,7 +143,7 @@ class FormSerializerTest : public CppUnit::TestFixture { field->addOption(FormField::Option("Search", "search")); form->addField(field); - field = boost::make_shared<FormField>(FormField::ListSingleType, "20"); + field = std::make_shared<FormField>(FormField::ListSingleType, "20"); field->setName("maxsubs"); field->setLabel("Maximum number of subscribers"); field->addOption(FormField::Option("10", "10")); @@ -155,7 +155,7 @@ class FormSerializerTest : public CppUnit::TestFixture { form->addField(field); std::vector<JID> jids; - field = boost::make_shared<FormField>(FormField::JIDMultiType); + field = std::make_shared<FormField>(FormField::JIDMultiType); field->addValue("foo@bar.com"); field->addValue("baz@fum.org"); field->setName("invitelist"); @@ -204,64 +204,64 @@ class FormSerializerTest : public CppUnit::TestFixture { void testSerializeFormItems() { FormSerializer testling; - boost::shared_ptr<Form> form(new Form(Form::ResultType)); + std::shared_ptr<Form> form(new Form(Form::ResultType)); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:iq:search"); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "jabber:iq:search"); field->setName("FORM_TYPE"); form->addField(field); // reported fields - field = boost::make_shared<FormField>(FormField::TextSingleType); + field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("first"); field->setLabel("Given Name"); form->addReportedField(field); - field = boost::make_shared<FormField>(FormField::TextSingleType); + field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("last"); field->setLabel("Family Name"); form->addReportedField(field); - field = boost::make_shared<FormField>(FormField::JIDSingleType); + field = std::make_shared<FormField>(FormField::JIDSingleType); field->setName("jid"); field->setLabel("Jabber ID"); form->addReportedField(field); - field = boost::make_shared<FormField>(FormField::ListSingleType); + field = std::make_shared<FormField>(FormField::ListSingleType); field->setName("x-gender"); field->setLabel("Gender"); form->addReportedField(field); Form::FormItem firstItem; - field = boost::make_shared<FormField>(FormField::TextSingleType, "Benvolio"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Benvolio"); field->setName("first"); firstItem.push_back(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "Montague"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Montague"); field->setName("last"); firstItem.push_back(field); - field = boost::make_shared<FormField>(FormField::JIDSingleType, JID("benvolio@montague.net")); + field = std::make_shared<FormField>(FormField::JIDSingleType, JID("benvolio@montague.net")); field->setName("jid"); firstItem.push_back(field); - field = boost::make_shared<FormField>(FormField::ListSingleType, "male"); + field = std::make_shared<FormField>(FormField::ListSingleType, "male"); field->setName("x-gender"); firstItem.push_back(field); Form::FormItem secondItem; - field = boost::make_shared<FormField>(FormField::TextSingleType, "Romeo"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Romeo"); field->setName("first"); secondItem.push_back(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "Montague"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Montague"); field->setName("last"); secondItem.push_back(field); - field = boost::make_shared<FormField>(FormField::JIDSingleType, JID("romeo@montague.net")); + field = std::make_shared<FormField>(FormField::JIDSingleType, JID("romeo@montague.net")); field->setName("jid"); secondItem.push_back(field); - field = boost::make_shared<FormField>(FormField::ListSingleType, "male"); + field = std::make_shared<FormField>(FormField::ListSingleType, "male"); field->setName("x-gender"); secondItem.push_back(field); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ForwardedSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ForwardedSerializerTest.cpp index d7aed26..b0f41d4 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ForwardedSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ForwardedSerializerTest.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -32,11 +32,11 @@ class ForwardedSerializerTest : public CppUnit::TestFixture { void testSerializeIQ() { ForwardedSerializer serializer(&serializers); - boost::shared_ptr<IQ> iq = IQ::createResult(JID("juliet@capulet.lit/balcony"), JID("romeo@montague.lit/orchard"), "id0"); + std::shared_ptr<IQ> iq = IQ::createResult(JID("juliet@capulet.lit/balcony"), JID("romeo@montague.lit/orchard"), "id0"); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(iq); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); std::string expectedResult = "<forwarded xmlns=\"urn:xmpp:forward:0\">" @@ -50,15 +50,15 @@ class ForwardedSerializerTest : public CppUnit::TestFixture { void testSerializeMessage() { ForwardedSerializer serializer(&serializers); - boost::shared_ptr<Message> message(boost::make_shared<Message>()); + std::shared_ptr<Message> message(std::make_shared<Message>()); message->setType(Message::Chat); message->setTo(JID("juliet@capulet.lit/balcony")); message->setFrom(JID("romeo@montague.lit/orchard")); message->setBody("Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(message); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); std::string expectedResult = "<forwarded xmlns=\"urn:xmpp:forward:0\">" @@ -74,13 +74,13 @@ class ForwardedSerializerTest : public CppUnit::TestFixture { void testSerializeMessageNoDelay() { ForwardedSerializer serializer(&serializers); - boost::shared_ptr<Message> message(boost::make_shared<Message>()); + std::shared_ptr<Message> message(std::make_shared<Message>()); message->setType(Message::Chat); message->setTo(JID("juliet@capulet.lit/balcony")); message->setFrom(JID("romeo@montague.lit/orchard")); message->setBody("Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(message); std::string expectedResult = @@ -96,12 +96,12 @@ class ForwardedSerializerTest : public CppUnit::TestFixture { void testSerializePresence() { ForwardedSerializer serializer(&serializers); - boost::shared_ptr<Presence> presence(boost::make_shared<Presence>()); + std::shared_ptr<Presence> presence(std::make_shared<Presence>()); presence->setType(Presence::Subscribe); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(presence); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); std::string expectedResult = "<forwarded xmlns=\"urn:xmpp:forward:0\">" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/IBBSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/IBBSerializerTest.cpp index 45badea..84412c9 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/IBBSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/IBBSerializerTest.cpp @@ -30,7 +30,7 @@ class IBBSerializerTest : public CppUnit::TestFixture void testSerialize_data() { IBBSerializer testling; - boost::shared_ptr<IBB> ibb = boost::make_shared<IBB>(); + std::shared_ptr<IBB> ibb = std::make_shared<IBB>(); ibb->setAction(IBB::Data); ibb->setData(createByteArray("abcdefgihjklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\x0a")); ibb->setSequenceNumber(4); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/IdleSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/IdleSerializerTest.cpp index 147c7be..46598da 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/IdleSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/IdleSerializerTest.cpp @@ -10,7 +10,7 @@ * See the COPYING file for more information. */ -#include <boost/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -29,7 +29,7 @@ class IdleSerializerTest : public CppUnit::TestFixture { void testSerialize() { IdleSerializer testling; - Idle::ref idle = boost::make_shared<Idle>(stringToDateTime("1969-07-21T02:56:15Z")); + Idle::ref idle = std::make_shared<Idle>(stringToDateTime("1969-07-21T02:56:15Z")); CPPUNIT_ASSERT_EQUAL(std::string("<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15Z'/>"), testling.serialize(idle)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp index b1b0c45..44ac7a1 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -22,7 +22,7 @@ class InBandRegistrationPayloadSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { InBandRegistrationPayloadSerializer testling; - boost::shared_ptr<InBandRegistrationPayload> registration(new InBandRegistrationPayload()); + std::shared_ptr<InBandRegistrationPayload> registration(new InBandRegistrationPayload()); registration->setRegistered(true); std::string expectedResult = @@ -34,13 +34,13 @@ class InBandRegistrationPayloadSerializerTest : public CppUnit::TestFixture { } void testSerialize_Form() { InBandRegistrationPayloadSerializer testling; - boost::shared_ptr<InBandRegistrationPayload> registration(new InBandRegistrationPayload()); + std::shared_ptr<InBandRegistrationPayload> registration(new InBandRegistrationPayload()); registration->setInstructions("Use the enclosed form to register."); - boost::shared_ptr<Form> form(new Form(Form::FormType)); + std::shared_ptr<Form> form(new Form(Form::FormType)); form->setTitle("Contest Registration"); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:iq:register"); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "jabber:iq:register"); field->setName("FORM_TYPE"); form->addField(field); registration->setForm(form); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/IsodeIQDelegationSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/IsodeIQDelegationSerializerTest.cpp index 8f46ca8..4a466ba 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/IsodeIQDelegationSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/IsodeIQDelegationSerializerTest.cpp @@ -41,13 +41,13 @@ class IsodeIQDelegationSerializerTest : public CppUnit::TestFixture void testSerialize_Forwarded_IQ() { IsodeIQDelegationSerializer testling(&serializers); - boost::shared_ptr<IsodeIQDelegation> isodeIQDelegation = boost::make_shared<IsodeIQDelegation>(); + std::shared_ptr<IsodeIQDelegation> isodeIQDelegation = std::make_shared<IsodeIQDelegation>(); - boost::shared_ptr<IQ> iq = IQ::createResult(JID("juliet@capulet.lit/balcony"), JID("romeo@montague.lit/orchard"), "id0", boost::make_shared<Subject>("text")); + std::shared_ptr<IQ> iq = IQ::createResult(JID("juliet@capulet.lit/balcony"), JID("romeo@montague.lit/orchard"), "id0", std::make_shared<Subject>("text")); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(iq); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); isodeIQDelegation->setForward(forwarded); CPPUNIT_ASSERT_EQUAL(std::string("<delegate xmlns=\"http://isode.com/iq_delegation\">" @@ -60,17 +60,17 @@ class IsodeIQDelegationSerializerTest : public CppUnit::TestFixture void testSerialize_Forwarded_Message() { IsodeIQDelegationSerializer testling(&serializers); - boost::shared_ptr<IsodeIQDelegation> isodeIQDelegation = boost::make_shared<IsodeIQDelegation>(); + std::shared_ptr<IsodeIQDelegation> isodeIQDelegation = std::make_shared<IsodeIQDelegation>(); - boost::shared_ptr<Message> message(boost::make_shared<Message>()); + std::shared_ptr<Message> message(std::make_shared<Message>()); message->setType(Message::Chat); message->setTo(JID("juliet@capulet.lit/balcony")); message->setFrom(JID("romeo@montague.lit/orchard")); message->setBody("Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(message); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); isodeIQDelegation->setForward(forwarded); CPPUNIT_ASSERT_EQUAL(std::string("<delegate xmlns=\"http://isode.com/iq_delegation\">" @@ -85,15 +85,15 @@ class IsodeIQDelegationSerializerTest : public CppUnit::TestFixture void testSerialize_Forwarded_MessageNoDelay() { IsodeIQDelegationSerializer testling(&serializers); - boost::shared_ptr<IsodeIQDelegation> isodeIQDelegation = boost::make_shared<IsodeIQDelegation>(); + std::shared_ptr<IsodeIQDelegation> isodeIQDelegation = std::make_shared<IsodeIQDelegation>(); - boost::shared_ptr<Message> message(boost::make_shared<Message>()); + std::shared_ptr<Message> message(std::make_shared<Message>()); message->setType(Message::Chat); message->setTo(JID("juliet@capulet.lit/balcony")); message->setFrom(JID("romeo@montague.lit/orchard")); message->setBody("Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(message); isodeIQDelegation->setForward(forwarded); @@ -108,14 +108,14 @@ class IsodeIQDelegationSerializerTest : public CppUnit::TestFixture void testSerialize_Forwarded_Presence() { IsodeIQDelegationSerializer testling(&serializers); - boost::shared_ptr<IsodeIQDelegation> isodeIQDelegation = boost::make_shared<IsodeIQDelegation>(); + std::shared_ptr<IsodeIQDelegation> isodeIQDelegation = std::make_shared<IsodeIQDelegation>(); - boost::shared_ptr<Presence> presence(boost::make_shared<Presence>()); + std::shared_ptr<Presence> presence(std::make_shared<Presence>()); presence->setType(Presence::Subscribe); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(presence); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); isodeIQDelegation->setForward(forwarded); CPPUNIT_ASSERT_EQUAL(std::string("<delegate xmlns=\"http://isode.com/iq_delegation\">" diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp index ecb68cd..00d79b3 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp @@ -10,8 +10,7 @@ * See the COPYING file for more information. */ -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -49,8 +48,8 @@ class JingleSerializersTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); - boost::shared_ptr<JinglePayloadSerializer> createTestling() { - return boost::make_shared<JinglePayloadSerializer>(&collection); + std::shared_ptr<JinglePayloadSerializer> createTestling() { + return std::make_shared<JinglePayloadSerializer>(&collection); } @@ -66,7 +65,7 @@ class JingleSerializersTest : public CppUnit::TestFixture { "<range/>" "</file>"; - StreamInitiationFileInfo::ref fileInfo = boost::make_shared<StreamInitiationFileInfo>(); + StreamInitiationFileInfo::ref fileInfo = std::make_shared<StreamInitiationFileInfo>(); fileInfo->setDate(stringToDateTime("1969-07-21T02:56:15Z")); fileInfo->setHash("552da749930852c69ae5d2141d3766b1"); fileInfo->setSize(1022); @@ -74,7 +73,7 @@ class JingleSerializersTest : public CppUnit::TestFixture { fileInfo->setDescription("This is a test. If this were a real file..."); fileInfo->setSupportsRangeRequests(true); - boost::shared_ptr<StreamInitiationFileInfoSerializer> serializer = boost::make_shared<StreamInitiationFileInfoSerializer>(); + std::shared_ptr<StreamInitiationFileInfoSerializer> serializer = std::make_shared<StreamInitiationFileInfoSerializer>(); CPPUNIT_ASSERT_EQUAL(expected, serializer->serializePayload(fileInfo)); } @@ -84,12 +83,12 @@ class JingleSerializersTest : public CppUnit::TestFixture { "<range offset=\"270336\"/>" "</file>"; - StreamInitiationFileInfo::ref fileInfo = boost::make_shared<StreamInitiationFileInfo>(); + StreamInitiationFileInfo::ref fileInfo = std::make_shared<StreamInitiationFileInfo>(); fileInfo->setHash("552da749930852c69ae5d2141d3766b1"); fileInfo->setSupportsRangeRequests(true); fileInfo->setRangeOffset(270336); - boost::shared_ptr<StreamInitiationFileInfoSerializer> serializer = boost::make_shared<StreamInitiationFileInfoSerializer>(); + std::shared_ptr<StreamInitiationFileInfoSerializer> serializer = std::make_shared<StreamInitiationFileInfoSerializer>(); CPPUNIT_ASSERT_EQUAL(expected, serializer->serializePayload(fileInfo)); } @@ -110,16 +109,16 @@ class JingleSerializersTest : public CppUnit::TestFixture { "</content>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::SessionInitiate); payload->setSessionID("a73sjjvkla37jfea"); payload->setInitiator(JID("romeo@montague.lit/orchard")); - JingleIBBTransportPayload::ref transport = boost::make_shared<JingleIBBTransportPayload>(); + JingleIBBTransportPayload::ref transport = std::make_shared<JingleIBBTransportPayload>(); transport->setBlockSize(4096); transport->setSessionID("ch3d9s71"); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(JingleContentPayload::InitiatorCreator); content->setName("ex"); content->addTransport(transport); @@ -143,16 +142,16 @@ class JingleSerializersTest : public CppUnit::TestFixture { "</content>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::TransportInfo); payload->setInitiator(JID("romeo@montague.lit/orchard")); payload->setSessionID("a73sjjvkla37jfea"); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(JingleContentPayload::InitiatorCreator); content->setName("ex"); - JingleIBBTransportPayload::ref transport = boost::make_shared<JingleIBBTransportPayload>(); + JingleIBBTransportPayload::ref transport = std::make_shared<JingleIBBTransportPayload>(); transport->setBlockSize(2048); transport->setSessionID("bt8a71h6"); @@ -172,7 +171,7 @@ class JingleSerializersTest : public CppUnit::TestFixture { "<reason><success/></reason>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::SessionTerminate); payload->setInitiator(JID("romeo@montague.lit/orchard")); payload->setSessionID("a73sjjvkla37jfea"); @@ -193,7 +192,7 @@ class JingleSerializersTest : public CppUnit::TestFixture { "<hash algo=\"sha-1\" xmlns=\"urn:xmpp:hashes:1\">VS2nSZMIUsaa5dIUHTdmsQ==</hash>" "</file>" "</description>"; - JingleFileTransferDescription::ref desc = boost::make_shared<JingleFileTransferDescription>(); + JingleFileTransferDescription::ref desc = std::make_shared<JingleFileTransferDescription>(); JingleFileTransferFileInfo fileInfo; fileInfo.setDate(stringToDateTime("1969-07-21T02:56:15Z")); @@ -205,7 +204,7 @@ class JingleSerializersTest : public CppUnit::TestFixture { desc->setFileInfo(fileInfo); - CPPUNIT_ASSERT_EQUAL(expected, boost::make_shared<JingleFileTransferDescriptionSerializer>()->serialize(desc)); + CPPUNIT_ASSERT_EQUAL(expected, std::make_shared<JingleFileTransferDescriptionSerializer>()->serialize(desc)); } // http://xmpp.org/extensions/xep-0234.html#example-3 @@ -251,16 +250,16 @@ class JingleSerializersTest : public CppUnit::TestFixture { "</content>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::SessionAccept); payload->setInitiator(JID("romeo@montague.lit/orchard")); payload->setSessionID("851ba2"); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(JingleContentPayload::InitiatorCreator); content->setName("a-file-offer"); - JingleFileTransferDescription::ref description = boost::make_shared<JingleFileTransferDescription>(); + JingleFileTransferDescription::ref description = std::make_shared<JingleFileTransferDescription>(); JingleFileTransferFileInfo fileInfo; fileInfo.setName("test.txt"); fileInfo.setSize(1022); @@ -293,12 +292,12 @@ class JingleSerializersTest : public CppUnit::TestFixture { //"</content>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::TransportInfo); payload->setInitiator(JID("romeo@montague.lit/orchard")); payload->setSessionID("a73sjjvkla37jfea"); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(JingleContentPayload::InitiatorCreator); content->setName("ex"); payload->addPayload(content); @@ -321,12 +320,12 @@ class JingleSerializersTest : public CppUnit::TestFixture { "</checksum>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::SessionInfo); payload->setInitiator(JID("romeo@montague.lit/orchard")); payload->setSessionID("a73sjjvkla37jfea"); - JingleFileTransferHash::ref hash = boost::make_shared<JingleFileTransferHash>(); + JingleFileTransferHash::ref hash = std::make_shared<JingleFileTransferHash>(); hash->getFileInfo().addHash(HashElement("sha-1", Base64::decode("VS2nSZMIUsaa5dIUHTdmsQ=="))); payload->addPayload(hash); @@ -364,16 +363,16 @@ class JingleSerializersTest : public CppUnit::TestFixture { "</content>" "</jingle>"; - JinglePayload::ref payload = boost::make_shared<JinglePayload>(); + JinglePayload::ref payload = std::make_shared<JinglePayload>(); payload->setAction(JinglePayload::SessionInitiate); payload->setInitiator(JID("romeo@montague.lit/orchard")); payload->setSessionID("a73sjjvkla37jfea"); - JingleContentPayload::ref content = boost::make_shared<JingleContentPayload>(); + JingleContentPayload::ref content = std::make_shared<JingleContentPayload>(); content->setCreator(JingleContentPayload::InitiatorCreator); content->setName("ex"); - JingleS5BTransportPayload::ref transport = boost::make_shared<JingleS5BTransportPayload>(); + JingleS5BTransportPayload::ref transport = std::make_shared<JingleS5BTransportPayload>(); transport->setMode(JingleS5BTransportPayload::TCPMode); transport->setDstAddr("1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba"); transport->setSessionID("vj3hs98y"); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MAMFinSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MAMFinSerializerTest.cpp index 0eda01c..198f73c 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/MAMFinSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MAMFinSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -24,7 +24,7 @@ class MAMFinSerializerTest : public CppUnit::TestFixture { void testSerialize_XEP0313_Exmaple1() { MAMFinSerializer serializer; - boost::shared_ptr<MAMFin> fin = boost::make_shared<MAMFin>(); + std::shared_ptr<MAMFin> fin = std::make_shared<MAMFin>(); fin->setQueryID("f27"); std::string expectedResult = @@ -35,10 +35,10 @@ class MAMFinSerializerTest : public CppUnit::TestFixture { void testSerialize_XEP0313_Exmaple9() { MAMFinSerializer serializer; - boost::shared_ptr<MAMFin> fin = boost::make_shared<MAMFin>(); + std::shared_ptr<MAMFin> fin = std::make_shared<MAMFin>(); fin->setComplete(true); - boost::shared_ptr<ResultSet> set = boost::make_shared<ResultSet>(); + std::shared_ptr<ResultSet> set = std::make_shared<ResultSet>(); set->setFirstID(std::string("23452-4534-1")); set->setFirstIDIndex(0); set->setLastID(std::string("390-2342-22")); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MAMQuerySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MAMQuerySerializerTest.cpp index faf788d..cc46ef9 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/MAMQuerySerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MAMQuerySerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -27,22 +27,22 @@ class MAMQuerySerializerTest : public CppUnit::TestFixture { void testSerialize() { MAMQuerySerializer serializer; - boost::shared_ptr<Form> parameters(boost::make_shared<Form>()); + std::shared_ptr<Form> parameters(std::make_shared<Form>()); - boost::shared_ptr<FormField> fieldType = boost::make_shared<FormField>(FormField::TextSingleType); + std::shared_ptr<FormField> fieldType = std::make_shared<FormField>(FormField::TextSingleType); fieldType->setName("FORM_TYPE"); fieldType->addValue("urn:xmpp:mam:0"); parameters->addField(fieldType); - boost::shared_ptr<FormField> fieldStart = boost::make_shared<FormField>(FormField::TextSingleType); + std::shared_ptr<FormField> fieldStart = std::make_shared<FormField>(FormField::TextSingleType); fieldStart->setName("start"); fieldStart->addValue("2010-08-07T00:00:00Z"); parameters->addField(fieldStart); - boost::shared_ptr<ResultSet> set = boost::make_shared<ResultSet>(); + std::shared_ptr<ResultSet> set = std::make_shared<ResultSet>(); set->setMaxItems(10); - boost::shared_ptr<MAMQuery> query(boost::make_shared<MAMQuery>()); + std::shared_ptr<MAMQuery> query(std::make_shared<MAMQuery>()); query->setQueryID(std::string("id0")); query->setNode(std::string("node1")); query->setForm(parameters); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MAMResultSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MAMResultSerializerTest.cpp index 40ca27d..09bec39 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/MAMResultSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MAMResultSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -27,17 +27,17 @@ class MAMResultSerializerTest : public CppUnit::TestFixture { void testSerialize() { MAMResultSerializer serializer(&serializers); - boost::shared_ptr<Message> message(boost::make_shared<Message>()); + std::shared_ptr<Message> message(std::make_shared<Message>()); message->setType(Message::Chat); message->setTo(JID("juliet@capulet.lit/balcony")); message->setFrom(JID("romeo@montague.lit/orchard")); message->setBody("Call me but love, and I'll be new baptized; Henceforth I never will be Romeo."); - boost::shared_ptr<Forwarded> forwarded(boost::make_shared<Forwarded>()); + std::shared_ptr<Forwarded> forwarded(std::make_shared<Forwarded>()); forwarded->setStanza(message); - forwarded->setDelay(boost::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); + forwarded->setDelay(std::make_shared<Delay>(stringToDateTime(std::string("2010-07-10T23:08:25Z")))); - boost::shared_ptr<MAMResult> result(boost::make_shared<MAMResult>()); + std::shared_ptr<MAMResult> result(std::make_shared<MAMResult>()); result->setID("28482-98726-73623"); result->setQueryID(std::string("f27")); result->setPayload(forwarded); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MUCAdminPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MUCAdminPayloadSerializerTest.cpp index fc6b346..5aeb9dd 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/MUCAdminPayloadSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MUCAdminPayloadSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -24,7 +24,7 @@ class MUCAdminPayloadSerializerTest : public CppUnit::TestFixture void testSerialize() { MUCAdminPayloadSerializer testling; - boost::shared_ptr<MUCAdminPayload> admin = boost::make_shared<MUCAdminPayload>(); + std::shared_ptr<MUCAdminPayload> admin = std::make_shared<MUCAdminPayload>(); MUCItem item; item.affiliation = MUCOccupant::Owner; item.role = MUCOccupant::Visitor; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp index 223e7d9..d34ea38 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -12,7 +12,7 @@ namespace Swift { -std::string PayloadsSerializer::serialize(boost::shared_ptr<Payload> payload) { +std::string PayloadsSerializer::serialize(std::shared_ptr<Payload> payload) { PayloadSerializer* serializer = serializers.getPayloadSerializer(payload); if (serializer) { return serializer->serialize(payload); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h index 827e9da..5e0f0c5 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h @@ -6,17 +6,16 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Elements/Payload.h> #include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h> namespace Swift { class PayloadsSerializer { public: - std::string serialize(boost::shared_ptr<Payload> payload); + std::string serialize(std::shared_ptr<Payload> payload); private: FullPayloadSerializerCollection serializers; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp index 19971c2..87d7d0f 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class PrioritySerializerTest : public CppUnit::TestFixture void testSerialize() { PrioritySerializer testling; - boost::shared_ptr<Priority> priority(new Priority(-113)); + std::shared_ptr<Priority> priority(new Priority(-113)); CPPUNIT_ASSERT_EQUAL(std::string("<priority>-113</priority>"), testling.serialize(priority)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp index 3b115b3..4e77e7d 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp @@ -24,8 +24,8 @@ class PrivateStorageSerializerTest : public CppUnit::TestFixture { void testSerialize() { PayloadsSerializer serializer; - boost::shared_ptr<PrivateStorage> privateStorage(new PrivateStorage()); - boost::shared_ptr<Storage> storage(new Storage()); + std::shared_ptr<PrivateStorage> privateStorage(new PrivateStorage()); + std::shared_ptr<Storage> storage(new Storage()); Storage::Room room; room.name = "Swift"; room.jid = JID("swift@rooms.swift.im"); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemSerializerTest.cpp index b835421..e8673b9 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -26,10 +26,10 @@ class PubSubItemSerializerTest : public CppUnit::TestFixture { void testSerialize() { PubSubItemSerializer serializer(&serializers); - boost::shared_ptr<RawXMLPayload> payload(boost::make_shared<RawXMLPayload>()); + std::shared_ptr<RawXMLPayload> payload(std::make_shared<RawXMLPayload>()); payload->setRawXML("<payload xmlns=\"tmp\"/>"); - boost::shared_ptr<PubSubItem> item(boost::make_shared<PubSubItem>()); + std::shared_ptr<PubSubItem> item(std::make_shared<PubSubItem>()); item->addData(payload); item->setID("pubsub-item-1"); @@ -44,7 +44,7 @@ class PubSubItemSerializerTest : public CppUnit::TestFixture { void testSerializeEmptyID() { PubSubItemSerializer serializer(&serializers); - boost::shared_ptr<PubSubItem> item(boost::make_shared<PubSubItem>()); + std::shared_ptr<PubSubItem> item(std::make_shared<PubSubItem>()); std::string expectedResult = "<item xmlns=\"http://jabber.org/protocol/pubsub\"/>"; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemsSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemsSerializerTest.cpp index fa99202..0194553 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemsSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemsSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -26,21 +26,21 @@ class PubSubItemsSerializerTest : public CppUnit::TestFixture { void testSerialize() { PubSubItemsSerializer serializer(&serializers); - boost::shared_ptr<RawXMLPayload> payload1(boost::make_shared<RawXMLPayload>()); + std::shared_ptr<RawXMLPayload> payload1(std::make_shared<RawXMLPayload>()); payload1->setRawXML("<payload xmlns=\"tmp\"/>"); - boost::shared_ptr<PubSubItem> item1(boost::make_shared<PubSubItem>()); + std::shared_ptr<PubSubItem> item1(std::make_shared<PubSubItem>()); item1->addData(payload1); item1->setID("pubsub-item-1"); - boost::shared_ptr<RawXMLPayload> payload2(boost::make_shared<RawXMLPayload>()); + std::shared_ptr<RawXMLPayload> payload2(std::make_shared<RawXMLPayload>()); payload2->setRawXML("<payload xmlns=\"other-tmp\"/>"); - boost::shared_ptr<PubSubItem> item2(boost::make_shared<PubSubItem>()); + std::shared_ptr<PubSubItem> item2(std::make_shared<PubSubItem>()); item2->addData(payload2); item2->setID("pubsub-item-2"); - boost::shared_ptr<PubSubItems> items(boost::make_shared<PubSubItems>()); + std::shared_ptr<PubSubItems> items(std::make_shared<PubSubItems>()); items->setNode("test-node"); items->setSubscriptionID(std::string("sub-id")); items->addItem(item1); @@ -62,7 +62,7 @@ class PubSubItemsSerializerTest : public CppUnit::TestFixture { void testSerializeEmptyItems() { PubSubItemsSerializer serializer(&serializers); - boost::shared_ptr<PubSubItems> items(boost::make_shared<PubSubItems>()); + std::shared_ptr<PubSubItems> items(std::make_shared<PubSubItems>()); std::string expectedResult = "<items node=\"\" xmlns=\"http://jabber.org/protocol/pubsub\"/>"; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp index 1f40b26..4aab334 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2012 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -27,7 +27,7 @@ class ReplaceSerializerTest: public CppUnit::TestFixture { void testSerialize() { ReplaceSerializer testling; - boost::shared_ptr<Replace> replace(new Replace()); + std::shared_ptr<Replace> replace(new Replace()); replace->setID("bad1"); CPPUNIT_ASSERT_EQUAL(std::string("<replace id = 'bad1' xmlns='urn:xmpp:message-correct:0'/>"), testling.serialize(replace)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp index 9bc637f..30cd6e7 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -24,7 +24,7 @@ class ResourceBindSerializerTest : public CppUnit::TestFixture void testSerialize_JID() { ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); + std::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); resourceBind->setJID(JID("somenode@example.com/someresource")); CPPUNIT_ASSERT_EQUAL(std::string( @@ -35,7 +35,7 @@ class ResourceBindSerializerTest : public CppUnit::TestFixture void testSerialize_Resource() { ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); + std::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); resourceBind->setResource("someresource"); CPPUNIT_ASSERT_EQUAL(std::string( @@ -46,7 +46,7 @@ class ResourceBindSerializerTest : public CppUnit::TestFixture void testSerialize_Empty() { ResourceBindSerializer testling; - boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); + std::shared_ptr<ResourceBind> resourceBind(new ResourceBind()); CPPUNIT_ASSERT_EQUAL(std::string("<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"), testling.serialize(resourceBind)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ResultSetSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ResultSetSerializerTest.cpp index 0b0163e..fecd3c5 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/ResultSetSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ResultSetSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -28,7 +28,7 @@ class ResultSetSerializerTest : public CppUnit::TestFixture { void testSerializeFull() { ResultSetSerializer serializer; - boost::shared_ptr<ResultSet> resultSet(boost::make_shared<ResultSet>()); + std::shared_ptr<ResultSet> resultSet(std::make_shared<ResultSet>()); resultSet->setMaxItems(100); resultSet->setCount(800); @@ -56,7 +56,7 @@ class ResultSetSerializerTest : public CppUnit::TestFixture { void testSerializeMaxItems() { ResultSetSerializer serializer; - boost::shared_ptr<ResultSet> resultSet(boost::make_shared<ResultSet>()); + std::shared_ptr<ResultSet> resultSet(std::make_shared<ResultSet>()); resultSet->setMaxItems(100); @@ -71,7 +71,7 @@ class ResultSetSerializerTest : public CppUnit::TestFixture { void testSerializeEmptyBefore() { ResultSetSerializer serializer; - boost::shared_ptr<ResultSet> resultSet(boost::make_shared<ResultSet>()); + std::shared_ptr<ResultSet> resultSet(std::make_shared<ResultSet>()); resultSet->setBefore(std::string()); @@ -86,7 +86,7 @@ class ResultSetSerializerTest : public CppUnit::TestFixture { void testSerializeFirst() { ResultSetSerializer serializer; - boost::shared_ptr<ResultSet> resultSet(boost::make_shared<ResultSet>()); + std::shared_ptr<ResultSet> resultSet(std::make_shared<ResultSet>()); resultSet->setFirstID(std::string("stpeter@jabber.org")); @@ -101,7 +101,7 @@ class ResultSetSerializerTest : public CppUnit::TestFixture { void testSerializeFirstWithIndex() { ResultSetSerializer serializer; - boost::shared_ptr<ResultSet> resultSet(boost::make_shared<ResultSet>()); + std::shared_ptr<ResultSet> resultSet(std::make_shared<ResultSet>()); resultSet->setFirstID(std::string("stpeter@jabber.org")); resultSet->setFirstIDIndex(123); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp index 65922f7..652becb 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -22,7 +28,7 @@ class RosterItemExchangeSerializerTest : public CppUnit::TestFixture void testSerialize() { RosterItemExchangeSerializer testling; - boost::shared_ptr<RosterItemExchangePayload> roster(new RosterItemExchangePayload()); + std::shared_ptr<RosterItemExchangePayload> roster(new RosterItemExchangePayload()); RosterItemExchangePayload::Item item1; item1.setJID("foo@bar.com"); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp index 6670bb8..0c576d2 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class RosterSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { RosterSerializer testling; - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); RosterItemPayload item1; item1.setJID(JID("foo@bar.com")); @@ -52,7 +52,7 @@ class RosterSerializerTest : public CppUnit::TestFixture { void testSerialize_ItemWithUnknownContent() { RosterSerializer testling; - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); RosterItemPayload item; item.setJID(JID("baz@blo.com")); @@ -79,7 +79,7 @@ class RosterSerializerTest : public CppUnit::TestFixture { void testSerialize_WithVersion() { RosterSerializer testling; - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->setVersion("ver20"); std::string expectedResult = "<query ver=\"ver20\" xmlns=\"jabber:iq:roster\"/>"; @@ -89,7 +89,7 @@ class RosterSerializerTest : public CppUnit::TestFixture { void testSerialize_WithEmptyVersion() { RosterSerializer testling; - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->setVersion(""); std::string expectedResult = "<query ver=\"\" xmlns=\"jabber:iq:roster\"/>"; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp index 0dfe0b0..3deca11 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -78,64 +78,64 @@ class SearchPayloadSerializerTest : public CppUnit::TestFixture { SearchPayloadSerializer testling; SearchPayload::ref payload(new SearchPayload()); - boost::shared_ptr<Form> form(new Form(Form::ResultType)); + std::shared_ptr<Form> form(new Form(Form::ResultType)); - FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:iq:search"); + FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "jabber:iq:search"); field->setName("FORM_TYPE"); form->addField(field); // reported fields - field = boost::make_shared<FormField>(FormField::TextSingleType); + field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("first"); field->setLabel("Given Name"); form->addReportedField(field); - field = boost::make_shared<FormField>(FormField::TextSingleType); + field = std::make_shared<FormField>(FormField::TextSingleType); field->setName("last"); field->setLabel("Family Name"); form->addReportedField(field); - field = boost::make_shared<FormField>(FormField::JIDSingleType); + field = std::make_shared<FormField>(FormField::JIDSingleType); field->setName("jid"); field->setLabel("Jabber ID"); form->addReportedField(field); - field = boost::make_shared<FormField>(FormField::ListSingleType); + field = std::make_shared<FormField>(FormField::ListSingleType); field->setName("x-gender"); field->setLabel("Gender"); form->addReportedField(field); Form::FormItem firstItem; - field = boost::make_shared<FormField>(FormField::TextSingleType, "Benvolio"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Benvolio"); field->setName("first"); firstItem.push_back(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "Montague"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Montague"); field->setName("last"); firstItem.push_back(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "benvolio@montague.net"); + field = std::make_shared<FormField>(FormField::TextSingleType, "benvolio@montague.net"); field->setName("jid"); firstItem.push_back(field); - field = boost::make_shared<FormField>(FormField::ListSingleType, "male"); + field = std::make_shared<FormField>(FormField::ListSingleType, "male"); field->setName("x-gender"); firstItem.push_back(field); Form::FormItem secondItem; - field = boost::make_shared<FormField>(FormField::TextSingleType, "Romeo"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Romeo"); field->setName("first"); secondItem.push_back(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "Montague"); + field = std::make_shared<FormField>(FormField::TextSingleType, "Montague"); field->setName("last"); secondItem.push_back(field); - field = boost::make_shared<FormField>(FormField::TextSingleType, "romeo@montague.net"); + field = std::make_shared<FormField>(FormField::TextSingleType, "romeo@montague.net"); field->setName("jid"); secondItem.push_back(field); - field = boost::make_shared<FormField>(FormField::ListSingleType, "male"); + field = std::make_shared<FormField>(FormField::ListSingleType, "male"); field->setName("x-gender"); secondItem.push_back(field); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp index db482ff..6b65fd4 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ class SecurityLabelSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { SecurityLabelSerializer testling; - boost::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); + std::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); securityLabel->setDisplayMarking("SECRET"); securityLabel->setForegroundColor("black"); securityLabel->setBackgroundColor("red"); @@ -45,7 +45,7 @@ class SecurityLabelSerializerTest : public CppUnit::TestFixture { void testSerialize_EmptyLabel() { SecurityLabelSerializer testling; - boost::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); + std::shared_ptr<SecurityLabel> securityLabel(new SecurityLabel()); securityLabel->setDisplayMarking("SECRET"); securityLabel->setLabel(""); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp index 51c98c1..c3a72a5 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,13 +22,13 @@ class SecurityLabelsCatalogSerializerTest : public CppUnit::TestFixture void testSerialize() { SecurityLabelsCatalogSerializer testling; - boost::shared_ptr<SecurityLabelsCatalog> catalog(new SecurityLabelsCatalog()); + std::shared_ptr<SecurityLabelsCatalog> catalog(new SecurityLabelsCatalog()); catalog->setTo(JID("example.com")); catalog->setName("Default"); catalog->setDescription("an example set of labels"); SecurityLabelsCatalog::Item item1; - boost::shared_ptr<SecurityLabel> securityLabel1(new SecurityLabel()); + std::shared_ptr<SecurityLabel> securityLabel1(new SecurityLabel()); item1.setLabel(securityLabel1); securityLabel1->setDisplayMarking("SECRET"); securityLabel1->setForegroundColor("black"); @@ -39,7 +39,7 @@ class SecurityLabelsCatalogSerializerTest : public CppUnit::TestFixture catalog->addItem(item1); SecurityLabelsCatalog::Item item2; - boost::shared_ptr<SecurityLabel> securityLabel2(new SecurityLabel()); + std::shared_ptr<SecurityLabel> securityLabel2(new SecurityLabel()); item2.setLabel(securityLabel2); securityLabel2->setDisplayMarking("CONFIDENTIAL"); securityLabel2->setForegroundColor("black"); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp index 5643e1e..a20efb7 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class SoftwareVersionSerializerTest : public CppUnit::TestFixture void testSerialize() { SoftwareVersionSerializer testling; - boost::shared_ptr<SoftwareVersion> softwareVersion(new SoftwareVersion("Swift", "0.1", "Mac OS X")); + std::shared_ptr<SoftwareVersion> softwareVersion(new SoftwareVersion("Swift", "0.1", "Mac OS X")); CPPUNIT_ASSERT_EQUAL(std::string("<query xmlns=\"jabber:iq:version\"><name>Swift</name><version>0.1</version><os>Mac OS X</os></query>"), testling.serialize(softwareVersion)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp index c8c2156..03a3ef5 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class StatusSerializerTest : public CppUnit::TestFixture void testSerialize() { StatusSerializer testling; - boost::shared_ptr<Status> status(new Status("I am away")); + std::shared_ptr<Status> status(new Status("I am away")); CPPUNIT_ASSERT_EQUAL(std::string("<status>I am away</status>"), testling.serialize(status)); } diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp index 9fda49e..eb3b221 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,37 +26,37 @@ class StatusShowSerializerTest : public CppUnit::TestFixture void testSerialize_Online() { StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Online)); + std::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Online)); CPPUNIT_ASSERT_EQUAL(std::string(""), testling.serialize(statusShow)); } void testSerialize_Away() { StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Away)); + std::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Away)); CPPUNIT_ASSERT_EQUAL(std::string("<show>away</show>"), testling.serialize(statusShow)); } void testSerialize_FFC() { StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::FFC)); + std::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::FFC)); CPPUNIT_ASSERT_EQUAL(std::string("<show>chat</show>"), testling.serialize(statusShow)); } void testSerialize_XA() { StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::XA)); + std::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::XA)); CPPUNIT_ASSERT_EQUAL(std::string("<show>xa</show>"), testling.serialize(statusShow)); } void testSerialize_DND() { StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::DND)); + std::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::DND)); CPPUNIT_ASSERT_EQUAL(std::string("<show>dnd</show>"), testling.serialize(statusShow)); } void testSerialize_None() { StatusShowSerializer testling; - boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::None)); + std::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::None)); CPPUNIT_ASSERT_EQUAL(std::string(""), testling.serialize(statusShow)); } }; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp index e98ee3a..33c63cb 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp @@ -23,7 +23,7 @@ class StorageSerializerTest : public CppUnit::TestFixture { void testSerialize() { PayloadsSerializer serializer; - boost::shared_ptr<Storage> storage(new Storage()); + std::shared_ptr<Storage> storage(new Storage()); Storage::Room room; room.name = "Council of Oberon"; room.autoJoin = true; @@ -51,7 +51,7 @@ class StorageSerializerTest : public CppUnit::TestFixture { void testSerialize_NoNickOrPassword() { PayloadsSerializer serializer; - boost::shared_ptr<Storage> storage(new Storage()); + std::shared_ptr<Storage> storage(new Storage()); Storage::Room room; room.name = "Council of Oberon"; room.autoJoin = true; diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp index ada65a9..a38295c 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ class StreamInitiationSerializerTest : public CppUnit::TestFixture{ public: void testSerialize_Request() { StreamInitiationSerializer testling; - boost::shared_ptr<StreamInitiation> streamInitiation(new StreamInitiation()); + std::shared_ptr<StreamInitiation> streamInitiation(new StreamInitiation()); StreamInitiationFileInfo fileInfo("test.txt", "This is info about the file.", 1022); streamInitiation->setID("a0"); streamInitiation->setFileInfo(fileInfo); @@ -48,7 +48,7 @@ class StreamInitiationSerializerTest : public CppUnit::TestFixture{ void testSerialize_Response() { StreamInitiationSerializer testling; - boost::shared_ptr<StreamInitiation> streamInitiation(new StreamInitiation()); + std::shared_ptr<StreamInitiation> streamInitiation(new StreamInitiation()); streamInitiation->setRequestedMethod("http://jabber.org/protocol/bytestreams"); CPPUNIT_ASSERT_EQUAL(std::string( diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/UserLocationSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/UserLocationSerializerTest.cpp index 3aed450..4c2121f 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/UserLocationSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/UserLocationSerializerTest.cpp @@ -10,7 +10,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -31,7 +31,7 @@ class UserLocationSerializerTest : public CppUnit::TestFixture { public: void testSerialize_withAllVariablesSet() { UserLocationSerializer testling(&serializers); - boost::shared_ptr<UserLocation> userLocation(new UserLocation()); + std::shared_ptr<UserLocation> userLocation(new UserLocation()); userLocation->setArea(boost::optional<std::string>("Barbaric")); userLocation->setAltitude(5.75F); userLocation->setLocality(boost::optional<std::string>("Near")); @@ -70,7 +70,7 @@ class UserLocationSerializerTest : public CppUnit::TestFixture { void testSerialize_withSomeVariablesSet() { UserLocationSerializer testling(&serializers); - boost::shared_ptr<UserLocation> userLocation(new UserLocation()); + std::shared_ptr<UserLocation> userLocation(new UserLocation()); userLocation->setArea(boost::optional<std::string>("Barbaric")); userLocation->setAltitude(5.75F); userLocation->setLocality(boost::optional<std::string>("Near")); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/UserTuneSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/UserTuneSerializerTest.cpp index 50f2a54..df79f0d 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/UserTuneSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/UserTuneSerializerTest.cpp @@ -10,7 +10,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -31,7 +31,7 @@ class UserTuneSerializerTest : public CppUnit::TestFixture { public: void testSerialize_withAllVariablesSet() { UserTuneSerializer testling(&serializers); - boost::shared_ptr<UserTune> userTune(new UserTune()); + std::shared_ptr<UserTune> userTune(new UserTune()); userTune->setRating(5); userTune->setTitle(boost::optional<std::string>("Minion")); userTune->setTrack(boost::optional<std::string>("Yellow")); @@ -49,7 +49,7 @@ class UserTuneSerializerTest : public CppUnit::TestFixture { void testSerialize_withSomeVariablesSet() { UserTuneSerializer testling(&serializers); - boost::shared_ptr<UserTune> userTune(new UserTune()); + std::shared_ptr<UserTune> userTune(new UserTune()); userTune->setTitle(boost::optional<std::string>("Minion")); userTune->setTrack(boost::optional<std::string>("Yellow")); userTune->setArtist(boost::optional<std::string>("Ice")); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp index c4a8156..49402ec 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ class VCardSerializerTest : public CppUnit::TestFixture public: void testSerialize() { VCardSerializer testling; - boost::shared_ptr<VCard> vcard(new VCard()); + std::shared_ptr<VCard> vcard(new VCard()); vcard->setVersion("2.0"); vcard->setFullName("Alice In Wonderland"); vcard->setPrefix("Mrs"); diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp index ed0500a..e3fc5ff 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class VCardUpdateSerializerTest : public CppUnit::TestFixture void testSerialize() { VCardUpdateSerializer testling; - boost::shared_ptr<VCardUpdate> update(new VCardUpdate()); + std::shared_ptr<VCardUpdate> update(new VCardUpdate()); update->setPhotoHash("sha1-hash-of-image"); std::string expectedResult = diff --git a/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.cpp index 2383cc8..c53342c 100644 --- a/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -10,7 +10,7 @@ #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Base/DateTime.h> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -23,76 +23,76 @@ UserLocationSerializer::UserLocationSerializer(PayloadSerializerCollection* seri UserLocationSerializer::~UserLocationSerializer() { } -std::string UserLocationSerializer::serializePayload(boost::shared_ptr<UserLocation> payload) const { +std::string UserLocationSerializer::serializePayload(std::shared_ptr<UserLocation> payload) const { if (!payload) { return ""; } XMLElement element("geoloc", "http://jabber.org/protocol/geoloc"); if (payload->getArea()) { - element.addNode(boost::make_shared<XMLElement>("area", "", *payload->getArea())); + element.addNode(std::make_shared<XMLElement>("area", "", *payload->getArea())); } if (payload->getAltitude()) { - element.addNode(boost::make_shared<XMLElement>("alt", "", boost::lexical_cast<std::string>(*payload->getAltitude()))); + element.addNode(std::make_shared<XMLElement>("alt", "", boost::lexical_cast<std::string>(*payload->getAltitude()))); } if (payload->getLocality()) { - element.addNode(boost::make_shared<XMLElement>("locality", "", *payload->getLocality())); + element.addNode(std::make_shared<XMLElement>("locality", "", *payload->getLocality())); } if (payload->getLatitude()) { - element.addNode(boost::make_shared<XMLElement>("lat", "", boost::lexical_cast<std::string>(*payload->getLatitude()))); + element.addNode(std::make_shared<XMLElement>("lat", "", boost::lexical_cast<std::string>(*payload->getLatitude()))); } if (payload->getAccuracy()) { - element.addNode(boost::make_shared<XMLElement>("accuracy", "", boost::lexical_cast<std::string>(*payload->getAccuracy()))); + element.addNode(std::make_shared<XMLElement>("accuracy", "", boost::lexical_cast<std::string>(*payload->getAccuracy()))); } if (payload->getDescription()) { - element.addNode(boost::make_shared<XMLElement>("description", "", *payload->getDescription())); + element.addNode(std::make_shared<XMLElement>("description", "", *payload->getDescription())); } if (payload->getCountryCode()) { - element.addNode(boost::make_shared<XMLElement>("countrycode", "", *payload->getCountryCode())); + element.addNode(std::make_shared<XMLElement>("countrycode", "", *payload->getCountryCode())); } if (payload->getTimestamp()) { - element.addNode(boost::make_shared<XMLElement>("timestamp", "", dateTimeToString(*payload->getTimestamp()))); + element.addNode(std::make_shared<XMLElement>("timestamp", "", dateTimeToString(*payload->getTimestamp()))); } if (payload->getFloor()) { - element.addNode(boost::make_shared<XMLElement>("floor", "", *payload->getFloor())); + element.addNode(std::make_shared<XMLElement>("floor", "", *payload->getFloor())); } if (payload->getBuilding()) { - element.addNode(boost::make_shared<XMLElement>("building", "", *payload->getBuilding())); + element.addNode(std::make_shared<XMLElement>("building", "", *payload->getBuilding())); } if (payload->getRoom()) { - element.addNode(boost::make_shared<XMLElement>("room", "", *payload->getRoom())); + element.addNode(std::make_shared<XMLElement>("room", "", *payload->getRoom())); } if (payload->getCountry()) { - element.addNode(boost::make_shared<XMLElement>("country", "", *payload->getCountry())); + element.addNode(std::make_shared<XMLElement>("country", "", *payload->getCountry())); } if (payload->getRegion()) { - element.addNode(boost::make_shared<XMLElement>("region", "", *payload->getRegion())); + element.addNode(std::make_shared<XMLElement>("region", "", *payload->getRegion())); } if (payload->getURI()) { - element.addNode(boost::make_shared<XMLElement>("uri", "", *payload->getURI())); + element.addNode(std::make_shared<XMLElement>("uri", "", *payload->getURI())); } if (payload->getLongitude()) { - element.addNode(boost::make_shared<XMLElement>("lon", "", boost::lexical_cast<std::string>(*payload->getLongitude()))); + element.addNode(std::make_shared<XMLElement>("lon", "", boost::lexical_cast<std::string>(*payload->getLongitude()))); } if (payload->getError()) { - element.addNode(boost::make_shared<XMLElement>("error", "", boost::lexical_cast<std::string>(*payload->getError()))); + element.addNode(std::make_shared<XMLElement>("error", "", boost::lexical_cast<std::string>(*payload->getError()))); } if (payload->getPostalCode()) { - element.addNode(boost::make_shared<XMLElement>("postalcode", "", *payload->getPostalCode())); + element.addNode(std::make_shared<XMLElement>("postalcode", "", *payload->getPostalCode())); } if (payload->getBearing()) { - element.addNode(boost::make_shared<XMLElement>("bearing", "", boost::lexical_cast<std::string>(*payload->getBearing()))); + element.addNode(std::make_shared<XMLElement>("bearing", "", boost::lexical_cast<std::string>(*payload->getBearing()))); } if (payload->getText()) { - element.addNode(boost::make_shared<XMLElement>("text", "", *payload->getText())); + element.addNode(std::make_shared<XMLElement>("text", "", *payload->getText())); } if (payload->getDatum()) { - element.addNode(boost::make_shared<XMLElement>("datum", "", *payload->getDatum())); + element.addNode(std::make_shared<XMLElement>("datum", "", *payload->getDatum())); } if (payload->getStreet()) { - element.addNode(boost::make_shared<XMLElement>("street", "", *payload->getStreet())); + element.addNode(std::make_shared<XMLElement>("street", "", *payload->getStreet())); } if (payload->getSpeed()) { - element.addNode(boost::make_shared<XMLElement>("speed", "", boost::lexical_cast<std::string>(*payload->getSpeed()))); + element.addNode(std::make_shared<XMLElement>("speed", "", boost::lexical_cast<std::string>(*payload->getSpeed()))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h b/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h index 4b17628..a7ed772 100644 --- a/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { UserLocationSerializer(PayloadSerializerCollection* serializers); virtual ~UserLocationSerializer(); - virtual std::string serializePayload(boost::shared_ptr<UserLocation>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<UserLocation>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp index eeab2b7..bbae0a3 100644 --- a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -9,7 +9,7 @@ #include <Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/PayloadSerializerCollection.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -22,31 +22,31 @@ UserTuneSerializer::UserTuneSerializer(PayloadSerializerCollection* serializers) UserTuneSerializer::~UserTuneSerializer() { } -std::string UserTuneSerializer::serializePayload(boost::shared_ptr<UserTune> payload) const { +std::string UserTuneSerializer::serializePayload(std::shared_ptr<UserTune> payload) const { if (!payload) { return ""; } XMLElement element("tune", "http://jabber.org/protocol/tune"); if (payload->getRating()) { - element.addNode(boost::make_shared<XMLElement>("rating", "", boost::lexical_cast<std::string>(*payload->getRating()))); + element.addNode(std::make_shared<XMLElement>("rating", "", boost::lexical_cast<std::string>(*payload->getRating()))); } if (payload->getTitle()) { - element.addNode(boost::make_shared<XMLElement>("title", "", *payload->getTitle())); + element.addNode(std::make_shared<XMLElement>("title", "", *payload->getTitle())); } if (payload->getTrack()) { - element.addNode(boost::make_shared<XMLElement>("track", "", *payload->getTrack())); + element.addNode(std::make_shared<XMLElement>("track", "", *payload->getTrack())); } if (payload->getArtist()) { - element.addNode(boost::make_shared<XMLElement>("artist", "", *payload->getArtist())); + element.addNode(std::make_shared<XMLElement>("artist", "", *payload->getArtist())); } if (payload->getURI()) { - element.addNode(boost::make_shared<XMLElement>("uri", "", *payload->getURI())); + element.addNode(std::make_shared<XMLElement>("uri", "", *payload->getURI())); } if (payload->getSource()) { - element.addNode(boost::make_shared<XMLElement>("source", "", *payload->getSource())); + element.addNode(std::make_shared<XMLElement>("source", "", *payload->getSource())); } if (payload->getLength()) { - element.addNode(boost::make_shared<XMLElement>("length", "", boost::lexical_cast<std::string>(*payload->getLength()))); + element.addNode(std::make_shared<XMLElement>("length", "", boost::lexical_cast<std::string>(*payload->getLength()))); } return element.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h index 1d3c76b..565bd71 100644 --- a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Override.h> @@ -21,7 +21,7 @@ namespace Swift { UserTuneSerializer(PayloadSerializerCollection* serializers); virtual ~UserTuneSerializer(); - virtual std::string serializePayload(boost::shared_ptr<UserTune>) const SWIFTEN_OVERRIDE; + virtual std::string serializePayload(std::shared_ptr<UserTune>) const SWIFTEN_OVERRIDE; private: diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp index 98597e4..a1393cb 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp @@ -6,8 +6,7 @@ #include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/DateTime.h> #include <Swiften/Base/foreach.h> @@ -21,229 +20,229 @@ namespace Swift { VCardSerializer::VCardSerializer() : GenericPayloadSerializer<VCard>() { } -std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const { +std::string VCardSerializer::serializePayload(std::shared_ptr<VCard> vcard) const { XMLElement queryElement("vCard", "vcard-temp"); if (!vcard->getVersion().empty()) { - queryElement.addNode(boost::make_shared<XMLElement>("VERSION", "", vcard->getVersion())); + queryElement.addNode(std::make_shared<XMLElement>("VERSION", "", vcard->getVersion())); } if (!vcard->getFullName().empty()) { - queryElement.addNode(boost::make_shared<XMLElement>("FN", "", vcard->getFullName())); + queryElement.addNode(std::make_shared<XMLElement>("FN", "", vcard->getFullName())); } if (!vcard->getGivenName().empty() || !vcard->getFamilyName().empty() || !vcard->getMiddleName().empty() || !vcard->getPrefix().empty() || !vcard->getSuffix().empty()) { - boost::shared_ptr<XMLElement> nameElement(new XMLElement("N")); + std::shared_ptr<XMLElement> nameElement(new XMLElement("N")); if (!vcard->getFamilyName().empty()) { - nameElement->addNode(boost::make_shared<XMLElement>("FAMILY", "", vcard->getFamilyName())); + nameElement->addNode(std::make_shared<XMLElement>("FAMILY", "", vcard->getFamilyName())); } if (!vcard->getGivenName().empty()) { - nameElement->addNode(boost::make_shared<XMLElement>("GIVEN", "", vcard->getGivenName())); + nameElement->addNode(std::make_shared<XMLElement>("GIVEN", "", vcard->getGivenName())); } if (!vcard->getMiddleName().empty()) { - nameElement->addNode(boost::make_shared<XMLElement>("MIDDLE", "", vcard->getMiddleName())); + nameElement->addNode(std::make_shared<XMLElement>("MIDDLE", "", vcard->getMiddleName())); } if (!vcard->getPrefix().empty()) { - nameElement->addNode(boost::make_shared<XMLElement>("PREFIX", "", vcard->getPrefix())); + nameElement->addNode(std::make_shared<XMLElement>("PREFIX", "", vcard->getPrefix())); } if (!vcard->getSuffix().empty()) { - nameElement->addNode(boost::make_shared<XMLElement>("SUFFIX", "", vcard->getSuffix())); + nameElement->addNode(std::make_shared<XMLElement>("SUFFIX", "", vcard->getSuffix())); } queryElement.addNode(nameElement); } foreach(const VCard::EMailAddress& emailAddress, vcard->getEMailAddresses()) { - boost::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL")); - emailElement->addNode(boost::make_shared<XMLElement>("USERID", "", emailAddress.address)); + std::shared_ptr<XMLElement> emailElement(new XMLElement("EMAIL")); + emailElement->addNode(std::make_shared<XMLElement>("USERID", "", emailAddress.address)); if (emailAddress.isHome) { - emailElement->addNode(boost::make_shared<XMLElement>("HOME")); + emailElement->addNode(std::make_shared<XMLElement>("HOME")); } if (emailAddress.isWork) { - emailElement->addNode(boost::make_shared<XMLElement>("WORK")); + emailElement->addNode(std::make_shared<XMLElement>("WORK")); } if (emailAddress.isInternet) { - emailElement->addNode(boost::make_shared<XMLElement>("INTERNET")); + emailElement->addNode(std::make_shared<XMLElement>("INTERNET")); } if (emailAddress.isPreferred) { - emailElement->addNode(boost::make_shared<XMLElement>("PREF")); + emailElement->addNode(std::make_shared<XMLElement>("PREF")); } if (emailAddress.isX400) { - emailElement->addNode(boost::make_shared<XMLElement>("X400")); + emailElement->addNode(std::make_shared<XMLElement>("X400")); } queryElement.addNode(emailElement); } if (!vcard->getNickname().empty()) { - queryElement.addNode(boost::make_shared<XMLElement>("NICKNAME", "", vcard->getNickname())); + queryElement.addNode(std::make_shared<XMLElement>("NICKNAME", "", vcard->getNickname())); } if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) { XMLElement::ref photoElement(new XMLElement("PHOTO")); if (!vcard->getPhotoType().empty()) { - photoElement->addNode(boost::make_shared<XMLElement>("TYPE", "", vcard->getPhotoType())); + photoElement->addNode(std::make_shared<XMLElement>("TYPE", "", vcard->getPhotoType())); } if (!vcard->getPhoto().empty()) { - photoElement->addNode(boost::make_shared<XMLElement>("BINVAL", "", Base64::encode(vcard->getPhoto()))); + photoElement->addNode(std::make_shared<XMLElement>("BINVAL", "", Base64::encode(vcard->getPhoto()))); } queryElement.addNode(photoElement); } if (!vcard->getBirthday().is_not_a_date_time()) { - queryElement.addNode(boost::make_shared<XMLElement>("BDAY", "", dateTimeToString(vcard->getBirthday()))); + queryElement.addNode(std::make_shared<XMLElement>("BDAY", "", dateTimeToString(vcard->getBirthday()))); } foreach(const VCard::Telephone& telephone, vcard->getTelephones()) { - boost::shared_ptr<XMLElement> telElement(new XMLElement("TEL")); - telElement->addNode(boost::make_shared<XMLElement>("NUMBER", "", telephone.number)); + std::shared_ptr<XMLElement> telElement(new XMLElement("TEL")); + telElement->addNode(std::make_shared<XMLElement>("NUMBER", "", telephone.number)); if (telephone.isHome) { - telElement->addNode(boost::make_shared<XMLElement>("HOME")); + telElement->addNode(std::make_shared<XMLElement>("HOME")); } if (telephone.isWork) { - telElement->addNode(boost::make_shared<XMLElement>("WORK")); + telElement->addNode(std::make_shared<XMLElement>("WORK")); } if (telephone.isVoice) { - telElement->addNode(boost::make_shared<XMLElement>("VOICE")); + telElement->addNode(std::make_shared<XMLElement>("VOICE")); } if (telephone.isFax) { - telElement->addNode(boost::make_shared<XMLElement>("FAX")); + telElement->addNode(std::make_shared<XMLElement>("FAX")); } if (telephone.isPager) { - telElement->addNode(boost::make_shared<XMLElement>("PAGER")); + telElement->addNode(std::make_shared<XMLElement>("PAGER")); } if (telephone.isMSG) { - telElement->addNode(boost::make_shared<XMLElement>("MSG")); + telElement->addNode(std::make_shared<XMLElement>("MSG")); } if (telephone.isCell) { - telElement->addNode(boost::make_shared<XMLElement>("CELL")); + telElement->addNode(std::make_shared<XMLElement>("CELL")); } if (telephone.isVideo) { - telElement->addNode(boost::make_shared<XMLElement>("VIDEO")); + telElement->addNode(std::make_shared<XMLElement>("VIDEO")); } if (telephone.isBBS) { - telElement->addNode(boost::make_shared<XMLElement>("BBS")); + telElement->addNode(std::make_shared<XMLElement>("BBS")); } if (telephone.isModem) { - telElement->addNode(boost::make_shared<XMLElement>("MODEM")); + telElement->addNode(std::make_shared<XMLElement>("MODEM")); } if (telephone.isISDN) { - telElement->addNode(boost::make_shared<XMLElement>("ISDN")); + telElement->addNode(std::make_shared<XMLElement>("ISDN")); } if (telephone.isPCS) { - telElement->addNode(boost::make_shared<XMLElement>("PCS")); + telElement->addNode(std::make_shared<XMLElement>("PCS")); } if (telephone.isPreferred) { - telElement->addNode(boost::make_shared<XMLElement>("PREF")); + telElement->addNode(std::make_shared<XMLElement>("PREF")); } queryElement.addNode(telElement); } foreach(const VCard::Address& address, vcard->getAddresses()) { - boost::shared_ptr<XMLElement> adrElement = boost::make_shared<XMLElement>("ADR"); + std::shared_ptr<XMLElement> adrElement = std::make_shared<XMLElement>("ADR"); if (!address.poBox.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("POBOX", "", address.poBox)); + adrElement->addNode(std::make_shared<XMLElement>("POBOX", "", address.poBox)); } if (!address.addressExtension.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("EXTADD", "", address.addressExtension)); + adrElement->addNode(std::make_shared<XMLElement>("EXTADD", "", address.addressExtension)); } if (!address.street.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("STREET", "", address.street)); + adrElement->addNode(std::make_shared<XMLElement>("STREET", "", address.street)); } if (!address.locality.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("LOCALITY", "", address.locality)); + adrElement->addNode(std::make_shared<XMLElement>("LOCALITY", "", address.locality)); } if (!address.region.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("REGION", "", address.region)); + adrElement->addNode(std::make_shared<XMLElement>("REGION", "", address.region)); } if (!address.postalCode.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("PCODE", "", address.postalCode)); + adrElement->addNode(std::make_shared<XMLElement>("PCODE", "", address.postalCode)); } if (!address.country.empty()) { - adrElement->addNode(boost::make_shared<XMLElement>("CTRY", "", address.country)); + adrElement->addNode(std::make_shared<XMLElement>("CTRY", "", address.country)); } if (address.isHome) { - adrElement->addNode(boost::make_shared<XMLElement>("HOME")); + adrElement->addNode(std::make_shared<XMLElement>("HOME")); } if (address.isWork) { - adrElement->addNode(boost::make_shared<XMLElement>("WORK")); + adrElement->addNode(std::make_shared<XMLElement>("WORK")); } if (address.isPostal) { - adrElement->addNode(boost::make_shared<XMLElement>("POSTAL")); + adrElement->addNode(std::make_shared<XMLElement>("POSTAL")); } if (address.isParcel) { - adrElement->addNode(boost::make_shared<XMLElement>("PARCEL")); + adrElement->addNode(std::make_shared<XMLElement>("PARCEL")); } if (address.deliveryType == VCard::DomesticDelivery) { - adrElement->addNode(boost::make_shared<XMLElement>("DOM")); + adrElement->addNode(std::make_shared<XMLElement>("DOM")); } if (address.deliveryType == VCard::InternationalDelivery) { - adrElement->addNode(boost::make_shared<XMLElement>("INTL")); + adrElement->addNode(std::make_shared<XMLElement>("INTL")); } if (address.isPreferred) { - adrElement->addNode(boost::make_shared<XMLElement>("PREF")); + adrElement->addNode(std::make_shared<XMLElement>("PREF")); } queryElement.addNode(adrElement); } foreach(const VCard::AddressLabel& addressLabel, vcard->getAddressLabels()) { - boost::shared_ptr<XMLElement> labelElement = boost::make_shared<XMLElement>("LABEL"); + std::shared_ptr<XMLElement> labelElement = std::make_shared<XMLElement>("LABEL"); foreach(const std::string& line, addressLabel.lines) { - labelElement->addNode(boost::make_shared<XMLElement>("LINE", "", line)); + labelElement->addNode(std::make_shared<XMLElement>("LINE", "", line)); } if (addressLabel.isHome) { - labelElement->addNode(boost::make_shared<XMLElement>("HOME")); + labelElement->addNode(std::make_shared<XMLElement>("HOME")); } if (addressLabel.isWork) { - labelElement->addNode(boost::make_shared<XMLElement>("WORK")); + labelElement->addNode(std::make_shared<XMLElement>("WORK")); } if (addressLabel.isPostal) { - labelElement->addNode(boost::make_shared<XMLElement>("POSTAL")); + labelElement->addNode(std::make_shared<XMLElement>("POSTAL")); } if (addressLabel.isParcel) { - labelElement->addNode(boost::make_shared<XMLElement>("PARCEL")); + labelElement->addNode(std::make_shared<XMLElement>("PARCEL")); } if (addressLabel.deliveryType == VCard::DomesticDelivery) { - labelElement->addNode(boost::make_shared<XMLElement>("DOM")); + labelElement->addNode(std::make_shared<XMLElement>("DOM")); } if (addressLabel.deliveryType == VCard::InternationalDelivery) { - labelElement->addNode(boost::make_shared<XMLElement>("INTL")); + labelElement->addNode(std::make_shared<XMLElement>("INTL")); } if (addressLabel.isPreferred) { - labelElement->addNode(boost::make_shared<XMLElement>("PREF")); + labelElement->addNode(std::make_shared<XMLElement>("PREF")); } queryElement.addNode(labelElement); } foreach(const JID& jid, vcard->getJIDs()) { - queryElement.addNode(boost::make_shared<XMLElement>("JID", "", jid.toString())); + queryElement.addNode(std::make_shared<XMLElement>("JID", "", jid.toString())); } if (!vcard->getDescription().empty()) { - queryElement.addNode(boost::make_shared<XMLElement>("DESC", "", vcard->getDescription())); + queryElement.addNode(std::make_shared<XMLElement>("DESC", "", vcard->getDescription())); } foreach(const VCard::Organization& org, vcard->getOrganizations()) { - boost::shared_ptr<XMLElement> orgElement = boost::make_shared<XMLElement>("ORG"); + std::shared_ptr<XMLElement> orgElement = std::make_shared<XMLElement>("ORG"); if (!org.name.empty()) { - orgElement->addNode(boost::make_shared<XMLElement>("ORGNAME", "", org.name)); + orgElement->addNode(std::make_shared<XMLElement>("ORGNAME", "", org.name)); } if (!org.units.empty()) { foreach(const std::string& unit, org.units) { - orgElement->addNode(boost::make_shared<XMLElement>("ORGUNIT", "", unit)); + orgElement->addNode(std::make_shared<XMLElement>("ORGUNIT", "", unit)); } } queryElement.addNode(orgElement); } foreach(const std::string& title, vcard->getTitles()) { - queryElement.addNode(boost::make_shared<XMLElement>("TITLE", "", title)); + queryElement.addNode(std::make_shared<XMLElement>("TITLE", "", title)); } foreach(const std::string& role, vcard->getRoles()) { - queryElement.addNode(boost::make_shared<XMLElement>("ROLE", "", role)); + queryElement.addNode(std::make_shared<XMLElement>("ROLE", "", role)); } foreach(const std::string& url, vcard->getURLs()) { - queryElement.addNode(boost::make_shared<XMLElement>("URL", "", url)); + queryElement.addNode(std::make_shared<XMLElement>("URL", "", url)); } if (!vcard->getUnknownContent().empty()) { - queryElement.addNode(boost::make_shared<XMLRawTextNode>(vcard->getUnknownContent())); + queryElement.addNode(std::make_shared<XMLRawTextNode>(vcard->getUnknownContent())); } return queryElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h index e84252d..ad83f9a 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: VCardSerializer(); - virtual std::string serializePayload(boost::shared_ptr<VCard>) const; + virtual std::string serializePayload(std::shared_ptr<VCard>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp index 8fb1e3f..607cf72 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp @@ -1,13 +1,12 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLTextNode.h> @@ -17,10 +16,10 @@ namespace Swift { VCardUpdateSerializer::VCardUpdateSerializer() : GenericPayloadSerializer<VCardUpdate>() { } -std::string VCardUpdateSerializer::serializePayload(boost::shared_ptr<VCardUpdate> vcardUpdate) const { +std::string VCardUpdateSerializer::serializePayload(std::shared_ptr<VCardUpdate> vcardUpdate) const { XMLElement updateElement("x", "vcard-temp:x:update"); - boost::shared_ptr<XMLElement> photoElement(new XMLElement("photo")); - photoElement->addNode(boost::make_shared<XMLTextNode>(vcardUpdate->getPhotoHash())); + std::shared_ptr<XMLElement> photoElement(new XMLElement("photo")); + photoElement->addNode(std::make_shared<XMLTextNode>(vcardUpdate->getPhotoHash())); updateElement.addNode(photoElement); return updateElement.serialize(); } diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h index 777da3e..cea8ebd 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: VCardUpdateSerializer(); - virtual std::string serializePayload(boost::shared_ptr<VCardUpdate>) const; + virtual std::string serializePayload(std::shared_ptr<VCardUpdate>) const; }; } diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp index 27d3f57..5aebca3 100644 --- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp @@ -13,9 +13,9 @@ #include <Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h> #include <iostream> +#include <memory> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h> @@ -24,7 +24,7 @@ namespace Swift { void WhiteboardElementSerializingVisitor::visit(WhiteboardLineElement& line) { - element = boost::make_shared<XMLElement>("line"); + element = std::make_shared<XMLElement>("line"); try { element->setAttribute("x1", boost::lexical_cast<std::string>(line.x1())); element->setAttribute("y1", boost::lexical_cast<std::string>(line.y1())); @@ -39,7 +39,7 @@ namespace Swift { } void WhiteboardElementSerializingVisitor::visit(WhiteboardFreehandPathElement& path) { - element = boost::make_shared<XMLElement>("path"); + element = std::make_shared<XMLElement>("path"); element->setAttribute("id", path.getID()); element->setAttribute("stroke", path.getColor().toHex()); try { @@ -59,7 +59,7 @@ namespace Swift { } void WhiteboardElementSerializingVisitor::visit(WhiteboardRectElement& rect) { - element = boost::make_shared<XMLElement>("rect"); + element = std::make_shared<XMLElement>("rect"); try { element->setAttribute("x", boost::lexical_cast<std::string>(rect.getX())); element->setAttribute("y", boost::lexical_cast<std::string>(rect.getY())); @@ -76,7 +76,7 @@ namespace Swift { } void WhiteboardElementSerializingVisitor::visit(WhiteboardPolygonElement& polygon) { - element = boost::make_shared<XMLElement>("polygon"); + element = std::make_shared<XMLElement>("polygon"); try { element->setAttribute("id", polygon.getID()); element->setAttribute("stroke", polygon.getPenColor().toHex()); @@ -95,7 +95,7 @@ namespace Swift { } void WhiteboardElementSerializingVisitor::visit(WhiteboardTextElement& text) { - element = boost::make_shared<XMLElement>("text"); + element = std::make_shared<XMLElement>("text"); try { element->setAttribute("x", boost::lexical_cast<std::string>(text.getX())); element->setAttribute("y", boost::lexical_cast<std::string>(text.getY())); @@ -103,13 +103,13 @@ namespace Swift { element->setAttribute("id", text.getID()); element->setAttribute("fill", text.getColor().toHex()); element->setAttribute("opacity", alphaToOpacity(text.getColor().getAlpha())); - element->addNode(boost::make_shared<XMLTextNode>(text.getText())); + element->addNode(std::make_shared<XMLTextNode>(text.getText())); } catch (boost::bad_lexical_cast&) { } } void WhiteboardElementSerializingVisitor::visit(WhiteboardEllipseElement& ellipse) { - element = boost::make_shared<XMLElement>("ellipse"); + element = std::make_shared<XMLElement>("ellipse"); try { element->setAttribute("cx", boost::lexical_cast<std::string>(ellipse.getCX())); element->setAttribute("cy", boost::lexical_cast<std::string>(ellipse.getCY())); @@ -138,13 +138,13 @@ namespace Swift { } } - std::string WhiteboardSerializer::serializePayload(boost::shared_ptr<WhiteboardPayload> payload) const { + std::string WhiteboardSerializer::serializePayload(std::shared_ptr<WhiteboardPayload> payload) const { XMLElement element("wb", "http://swift.im/whiteboard"); if (payload->getType() == WhiteboardPayload::Data) { - XMLElement::ref operationNode = boost::make_shared<XMLElement>("operation"); + XMLElement::ref operationNode = std::make_shared<XMLElement>("operation"); WhiteboardElementSerializingVisitor visitor; // payload->getElement()->accept(visitor); - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(payload->getOperation()); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(payload->getOperation()); if (insertOp) { try { operationNode->setAttribute("type", "insert"); @@ -156,7 +156,7 @@ namespace Swift { insertOp->getElement()->accept(visitor); operationNode->addNode(visitor.getResult()); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(payload->getOperation()); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(payload->getOperation()); if (updateOp) { try { operationNode->setAttribute("type", "update"); @@ -171,7 +171,7 @@ namespace Swift { } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(payload->getOperation()); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(payload->getOperation()); if (deleteOp) { try { operationNode->setAttribute("type", "delete"); diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h index 70aef1e..1fde636 100644 --- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h +++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h @@ -43,7 +43,7 @@ namespace Swift { class SWIFTEN_API WhiteboardSerializer : public GenericPayloadSerializer<WhiteboardPayload> { public: - std::string serializePayload(boost::shared_ptr<WhiteboardPayload> payload) const; + std::string serializePayload(std::shared_ptr<WhiteboardPayload> payload) const; private: std::string typeToString(WhiteboardPayload::Type type) const; diff --git a/Swiften/Serializer/PresenceSerializer.cpp b/Swiften/Serializer/PresenceSerializer.cpp index 24c4365..fc398a4 100644 --- a/Swiften/Serializer/PresenceSerializer.cpp +++ b/Swiften/Serializer/PresenceSerializer.cpp @@ -6,7 +6,7 @@ #include <Swiften/Serializer/PresenceSerializer.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/Log.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -19,7 +19,7 @@ PresenceSerializer::PresenceSerializer(PayloadSerializerCollection* payloadSeria } void PresenceSerializer::setStanzaSpecificAttributesGeneric( - boost::shared_ptr<Presence> presence, + std::shared_ptr<Presence> presence, XMLElement& element) const { switch (presence->getType()) { case Presence::Unavailable: element.setAttribute("type","unavailable"); break; diff --git a/Swiften/Serializer/PresenceSerializer.h b/Swiften/Serializer/PresenceSerializer.h index e40b9c2..b0e1a4f 100644 --- a/Swiften/Serializer/PresenceSerializer.h +++ b/Swiften/Serializer/PresenceSerializer.h @@ -20,7 +20,7 @@ namespace Swift { private: virtual void setStanzaSpecificAttributesGeneric( - boost::shared_ptr<Presence> presence, + std::shared_ptr<Presence> presence, XMLElement& element) const; }; } diff --git a/Swiften/Serializer/StanzaAckRequestSerializer.h b/Swiften/Serializer/StanzaAckRequestSerializer.h index b178db1..f738231 100644 --- a/Swiften/Serializer/StanzaAckRequestSerializer.h +++ b/Swiften/Serializer/StanzaAckRequestSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StanzaAckRequest.h> @@ -19,7 +19,7 @@ namespace Swift { StanzaAckRequestSerializer() : GenericElementSerializer<StanzaAckRequest>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("r", "urn:xmpp:sm:2").serialize()); } }; diff --git a/Swiften/Serializer/StanzaAckSerializer.h b/Swiften/Serializer/StanzaAckSerializer.h index 7ca6ab8..f5a27dc 100644 --- a/Swiften/Serializer/StanzaAckSerializer.h +++ b/Swiften/Serializer/StanzaAckSerializer.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/StanzaAck.h> @@ -20,8 +21,8 @@ namespace Swift { StanzaAckSerializer() : GenericElementSerializer<StanzaAck>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const { - StanzaAck::ref stanzaAck(boost::dynamic_pointer_cast<StanzaAck>(element)); + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const { + StanzaAck::ref stanzaAck(std::dynamic_pointer_cast<StanzaAck>(element)); assert(stanzaAck->isValid()); XMLElement result("a", "urn:xmpp:sm:2"); result.setAttribute("h", std::string(boost::lexical_cast<std::string>(stanzaAck->getHandledStanzasCount()))); diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp index 002f2c3..de1e8f1 100644 --- a/Swiften/Serializer/StanzaSerializer.cpp +++ b/Swiften/Serializer/StanzaSerializer.cpp @@ -22,7 +22,7 @@ namespace Swift { StanzaSerializer::StanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers, const boost::optional<std::string>& explicitNS) : tag_(tag), payloadSerializers_(payloadSerializers), explicitDefaultNS_(explicitNS) { } -SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { +SafeByteArray StanzaSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { if (explicitDefaultNS_) { return serialize(element, explicitDefaultNS_.get()); } @@ -31,8 +31,8 @@ SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> ele } } -SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> element, const std::string& xmlns) const { - boost::shared_ptr<Stanza> stanza(boost::dynamic_pointer_cast<Stanza>(element)); +SafeByteArray StanzaSerializer::serialize(std::shared_ptr<ToplevelElement> element, const std::string& xmlns) const { + std::shared_ptr<Stanza> stanza(std::dynamic_pointer_cast<Stanza>(element)); XMLElement stanzaElement(tag_, explicitDefaultNS_ ? explicitDefaultNS_.get() : xmlns); if (stanza->getFrom().isValid()) { @@ -47,7 +47,7 @@ SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> ele setStanzaSpecificAttributes(stanza, stanzaElement); std::string serializedPayloads; - foreach (const boost::shared_ptr<Payload>& payload, stanza->getPayloads()) { + foreach (const std::shared_ptr<Payload>& payload, stanza->getPayloads()) { PayloadSerializer* serializer = payloadSerializers_->getPayloadSerializer(payload); if (serializer) { serializedPayloads += serializer->serialize(payload); @@ -57,7 +57,7 @@ SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> ele } } if (!serializedPayloads.empty()) { - stanzaElement.addNode(boost::shared_ptr<XMLNode>(new XMLRawTextNode(serializedPayloads))); + stanzaElement.addNode(std::make_shared<XMLRawTextNode>(serializedPayloads)); } return createSafeByteArray(stanzaElement.serialize()); diff --git a/Swiften/Serializer/StanzaSerializer.h b/Swiften/Serializer/StanzaSerializer.h index 34aab9e..b2e051c 100644 --- a/Swiften/Serializer/StanzaSerializer.h +++ b/Swiften/Serializer/StanzaSerializer.h @@ -22,9 +22,9 @@ namespace Swift { public: StanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers, const boost::optional<std::string>& explicitNS = boost::optional<std::string>()); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element, const std::string& xmlns) const; - virtual void setStanzaSpecificAttributes(boost::shared_ptr<ToplevelElement>, XMLElement&) const = 0; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element, const std::string& xmlns) const; + virtual void setStanzaSpecificAttributes(std::shared_ptr<ToplevelElement>, XMLElement&) const = 0; private: std::string tag_; diff --git a/Swiften/Serializer/StartTLSFailureSerializer.h b/Swiften/Serializer/StartTLSFailureSerializer.h index f7f7296..77f904c 100644 --- a/Swiften/Serializer/StartTLSFailureSerializer.h +++ b/Swiften/Serializer/StartTLSFailureSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StartTLSFailure.h> @@ -19,7 +19,7 @@ namespace Swift { StartTLSFailureSerializer() : GenericElementSerializer<StartTLSFailure>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failure", "urn:ietf:params:xml:ns:xmpp-tls").serialize()); } }; diff --git a/Swiften/Serializer/StartTLSRequestSerializer.h b/Swiften/Serializer/StartTLSRequestSerializer.h index cc8e3d5..ee2a76f 100644 --- a/Swiften/Serializer/StartTLSRequestSerializer.h +++ b/Swiften/Serializer/StartTLSRequestSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StartTLSRequest.h> @@ -19,7 +19,7 @@ namespace Swift { StartTLSRequestSerializer() : GenericElementSerializer<StartTLSRequest>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("starttls", "urn:ietf:params:xml:ns:xmpp-tls").serialize()); } }; diff --git a/Swiften/Serializer/StreamErrorSerializer.cpp b/Swiften/Serializer/StreamErrorSerializer.cpp index 3cad478..66a71ca 100644 --- a/Swiften/Serializer/StreamErrorSerializer.cpp +++ b/Swiften/Serializer/StreamErrorSerializer.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/StreamErrorSerializer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Serializer/XML/XMLElement.h> @@ -15,8 +15,8 @@ namespace Swift { StreamErrorSerializer::StreamErrorSerializer() : GenericElementSerializer<StreamError>() { } -SafeByteArray StreamErrorSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - StreamError::ref error = boost::dynamic_pointer_cast<StreamError>(element); +SafeByteArray StreamErrorSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + StreamError::ref error = std::dynamic_pointer_cast<StreamError>(element); XMLElement errorElement("error", "http://etherx.jabber.org/streams"); std::string typeTag; @@ -47,10 +47,10 @@ SafeByteArray StreamErrorSerializer::serialize(boost::shared_ptr<ToplevelElement case StreamError::UnsupportedStanzaType: typeTag = "unsupported-stanza-type"; break; case StreamError::UnsupportedVersion: typeTag = "unsupported-version"; break; } - errorElement.addNode(boost::make_shared<XMLElement>(typeTag, "urn:ietf:params:xml:ns:xmpp-streams")); + errorElement.addNode(std::make_shared<XMLElement>(typeTag, "urn:ietf:params:xml:ns:xmpp-streams")); if (!error->getText().empty()) { - errorElement.addNode(boost::make_shared<XMLElement>("text", "urn:ietf:params:xml:ns:xmpp-streams", error->getText())); + errorElement.addNode(std::make_shared<XMLElement>("text", "urn:ietf:params:xml:ns:xmpp-streams", error->getText())); } return createSafeByteArray(errorElement.serialize()); diff --git a/Swiften/Serializer/StreamErrorSerializer.h b/Swiften/Serializer/StreamErrorSerializer.h index f578005..7277903 100644 --- a/Swiften/Serializer/StreamErrorSerializer.h +++ b/Swiften/Serializer/StreamErrorSerializer.h @@ -15,6 +15,6 @@ namespace Swift { public: StreamErrorSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> error) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> error) const; }; } diff --git a/Swiften/Serializer/StreamFeaturesSerializer.cpp b/Swiften/Serializer/StreamFeaturesSerializer.cpp index ed042ec..820b96c 100644 --- a/Swiften/Serializer/StreamFeaturesSerializer.cpp +++ b/Swiften/Serializer/StreamFeaturesSerializer.cpp @@ -6,7 +6,7 @@ #include <Swiften/Serializer/StreamFeaturesSerializer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Base/foreach.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -17,42 +17,42 @@ namespace Swift { StreamFeaturesSerializer::StreamFeaturesSerializer() { } -SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { - boost::shared_ptr<StreamFeatures> streamFeatures(boost::dynamic_pointer_cast<StreamFeatures>(element)); +SafeByteArray StreamFeaturesSerializer::serialize(std::shared_ptr<ToplevelElement> element) const { + std::shared_ptr<StreamFeatures> streamFeatures(std::dynamic_pointer_cast<StreamFeatures>(element)); XMLElement streamFeaturesElement("stream:features"); if (streamFeatures->hasStartTLS()) { - streamFeaturesElement.addNode(boost::make_shared<XMLElement>("starttls", "urn:ietf:params:xml:ns:xmpp-tls")); + streamFeaturesElement.addNode(std::make_shared<XMLElement>("starttls", "urn:ietf:params:xml:ns:xmpp-tls")); } if (!streamFeatures->getCompressionMethods().empty()) { - boost::shared_ptr<XMLElement> compressionElement(new XMLElement("compression", "http://jabber.org/features/compress")); + std::shared_ptr<XMLElement> compressionElement(new XMLElement("compression", "http://jabber.org/features/compress")); foreach(const std::string& method, streamFeatures->getCompressionMethods()) { - boost::shared_ptr<XMLElement> methodElement(new XMLElement("method")); - methodElement->addNode(boost::make_shared<XMLTextNode>(method)); + std::shared_ptr<XMLElement> methodElement(new XMLElement("method")); + methodElement->addNode(std::make_shared<XMLTextNode>(method)); compressionElement->addNode(methodElement); } streamFeaturesElement.addNode(compressionElement); } if (!streamFeatures->getAuthenticationMechanisms().empty()) { - boost::shared_ptr<XMLElement> mechanismsElement(new XMLElement("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl")); + std::shared_ptr<XMLElement> mechanismsElement(new XMLElement("mechanisms", "urn:ietf:params:xml:ns:xmpp-sasl")); foreach(const std::string& mechanism, streamFeatures->getAuthenticationMechanisms()) { - boost::shared_ptr<XMLElement> mechanismElement(new XMLElement("mechanism")); - mechanismElement->addNode(boost::make_shared<XMLTextNode>(mechanism)); + std::shared_ptr<XMLElement> mechanismElement(new XMLElement("mechanism")); + mechanismElement->addNode(std::make_shared<XMLTextNode>(mechanism)); mechanismsElement->addNode(mechanismElement); } streamFeaturesElement.addNode(mechanismsElement); } if (streamFeatures->hasResourceBind()) { - streamFeaturesElement.addNode(boost::make_shared<XMLElement>("bind", "urn:ietf:params:xml:ns:xmpp-bind")); + streamFeaturesElement.addNode(std::make_shared<XMLElement>("bind", "urn:ietf:params:xml:ns:xmpp-bind")); } if (streamFeatures->hasSession()) { - streamFeaturesElement.addNode(boost::make_shared<XMLElement>("session", "urn:ietf:params:xml:ns:xmpp-session")); + streamFeaturesElement.addNode(std::make_shared<XMLElement>("session", "urn:ietf:params:xml:ns:xmpp-session")); } if (streamFeatures->hasStreamManagement()) { - streamFeaturesElement.addNode(boost::make_shared<XMLElement>("sm", "urn:xmpp:sm:2")); + streamFeaturesElement.addNode(std::make_shared<XMLElement>("sm", "urn:xmpp:sm:2")); } if (streamFeatures->hasRosterVersioning()) { - streamFeaturesElement.addNode(boost::make_shared<XMLElement>("ver", "urn:xmpp:features:rosterver")); + streamFeaturesElement.addNode(std::make_shared<XMLElement>("ver", "urn:xmpp:features:rosterver")); } return createSafeByteArray(streamFeaturesElement.serialize()); } diff --git a/Swiften/Serializer/StreamFeaturesSerializer.h b/Swiften/Serializer/StreamFeaturesSerializer.h index f2328a5..b1cc2f7 100644 --- a/Swiften/Serializer/StreamFeaturesSerializer.h +++ b/Swiften/Serializer/StreamFeaturesSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamFeatures.h> @@ -17,6 +17,6 @@ namespace Swift { public: StreamFeaturesSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/StreamManagementEnabledSerializer.cpp b/Swiften/Serializer/StreamManagementEnabledSerializer.cpp index b03196c..4f4ca2e 100644 --- a/Swiften/Serializer/StreamManagementEnabledSerializer.cpp +++ b/Swiften/Serializer/StreamManagementEnabledSerializer.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/StreamManagementEnabledSerializer.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Elements/StreamManagementEnabled.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -16,8 +16,8 @@ using namespace Swift; StreamManagementEnabledSerializer::StreamManagementEnabledSerializer() : GenericElementSerializer<StreamManagementEnabled>() { } -SafeByteArray StreamManagementEnabledSerializer::serialize(boost::shared_ptr<ToplevelElement> el) const { - boost::shared_ptr<StreamManagementEnabled> e(boost::dynamic_pointer_cast<StreamManagementEnabled>(el)); +SafeByteArray StreamManagementEnabledSerializer::serialize(std::shared_ptr<ToplevelElement> el) const { + std::shared_ptr<StreamManagementEnabled> e(std::dynamic_pointer_cast<StreamManagementEnabled>(el)); XMLElement element("enabled", "urn:xmpp:sm:2"); if (!e->getResumeID().empty()) { element.setAttribute("id", e->getResumeID()); diff --git a/Swiften/Serializer/StreamManagementEnabledSerializer.h b/Swiften/Serializer/StreamManagementEnabledSerializer.h index 9ffe233..f139dc8 100644 --- a/Swiften/Serializer/StreamManagementEnabledSerializer.h +++ b/Swiften/Serializer/StreamManagementEnabledSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamManagementEnabled.h> @@ -17,6 +17,6 @@ namespace Swift { public: StreamManagementEnabledSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const; }; } diff --git a/Swiften/Serializer/StreamManagementFailedSerializer.h b/Swiften/Serializer/StreamManagementFailedSerializer.h index b189bd8..29dd0ab 100644 --- a/Swiften/Serializer/StreamManagementFailedSerializer.h +++ b/Swiften/Serializer/StreamManagementFailedSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamManagementFailed.h> @@ -19,7 +19,7 @@ namespace Swift { StreamManagementFailedSerializer() : GenericElementSerializer<StreamManagementFailed>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failed", "urn:xmpp:sm:2").serialize()); } }; diff --git a/Swiften/Serializer/StreamResumeSerializer.cpp b/Swiften/Serializer/StreamResumeSerializer.cpp index c660083..619ac9c 100644 --- a/Swiften/Serializer/StreamResumeSerializer.cpp +++ b/Swiften/Serializer/StreamResumeSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/StreamResumeSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Elements/StreamResume.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -17,8 +18,8 @@ using namespace Swift; StreamResumeSerializer::StreamResumeSerializer() : GenericElementSerializer<StreamResume>() { } -SafeByteArray StreamResumeSerializer::serialize(boost::shared_ptr<ToplevelElement> el) const { - boost::shared_ptr<StreamResume> e(boost::dynamic_pointer_cast<StreamResume>(el)); +SafeByteArray StreamResumeSerializer::serialize(std::shared_ptr<ToplevelElement> el) const { + std::shared_ptr<StreamResume> e(std::dynamic_pointer_cast<StreamResume>(el)); XMLElement element("resume", "urn:xmpp:sm:2"); element.setAttribute("previd", e->getResumeID()); if (e->getHandledStanzasCount()) { diff --git a/Swiften/Serializer/StreamResumeSerializer.h b/Swiften/Serializer/StreamResumeSerializer.h index 5e7c58d..ad13b2b 100644 --- a/Swiften/Serializer/StreamResumeSerializer.h +++ b/Swiften/Serializer/StreamResumeSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamResume.h> @@ -17,6 +17,6 @@ namespace Swift { public: StreamResumeSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const; }; } diff --git a/Swiften/Serializer/StreamResumedSerializer.cpp b/Swiften/Serializer/StreamResumedSerializer.cpp index 9778338..5b88ded 100644 --- a/Swiften/Serializer/StreamResumedSerializer.cpp +++ b/Swiften/Serializer/StreamResumedSerializer.cpp @@ -6,8 +6,9 @@ #include <Swiften/Serializer/StreamResumedSerializer.h> +#include <memory> + #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Elements/StreamResumed.h> #include <Swiften/Serializer/XML/XMLElement.h> @@ -17,8 +18,8 @@ using namespace Swift; StreamResumedSerializer::StreamResumedSerializer() : GenericElementSerializer<StreamResumed>() { } -SafeByteArray StreamResumedSerializer::serialize(boost::shared_ptr<ToplevelElement> el) const { - boost::shared_ptr<StreamResumed> e(boost::dynamic_pointer_cast<StreamResumed>(el)); +SafeByteArray StreamResumedSerializer::serialize(std::shared_ptr<ToplevelElement> el) const { + std::shared_ptr<StreamResumed> e(std::dynamic_pointer_cast<StreamResumed>(el)); XMLElement element("resumed", "urn:xmpp:sm:2"); element.setAttribute("previd", e->getResumeID()); if (e->getHandledStanzasCount()) { diff --git a/Swiften/Serializer/StreamResumedSerializer.h b/Swiften/Serializer/StreamResumedSerializer.h index 82a66d7..324282b 100644 --- a/Swiften/Serializer/StreamResumedSerializer.h +++ b/Swiften/Serializer/StreamResumedSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamResumed.h> @@ -17,6 +17,6 @@ namespace Swift { public: StreamResumedSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const; + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const; }; } diff --git a/Swiften/Serializer/TLSProceedSerializer.h b/Swiften/Serializer/TLSProceedSerializer.h index e9af0a2..f99aefd 100644 --- a/Swiften/Serializer/TLSProceedSerializer.h +++ b/Swiften/Serializer/TLSProceedSerializer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Elements/TLSProceed.h> @@ -19,7 +19,7 @@ namespace Swift { TLSProceedSerializer() : GenericElementSerializer<TLSProceed>() { } - virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { + virtual SafeByteArray serialize(std::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("proceed", "urn:ietf:params:xml:ns:xmpp-tls").serialize()); } }; diff --git a/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp index 1d41e81..d313b42 100644 --- a/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp +++ b/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp @@ -24,7 +24,7 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { AuthChallengeSerializer testling; - boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge()); + std::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge()); authChallenge->setValue(createByteArray("foo")); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( @@ -35,7 +35,7 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture { void testSerialize_NoMessage() { AuthChallengeSerializer testling; - boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge()); + std::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( "<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" @@ -44,7 +44,7 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture { void testSerialize_EmptyMessage() { AuthChallengeSerializer testling; - boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge()); + std::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge()); authChallenge->setValue(std::vector<unsigned char>()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( diff --git a/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp index 95460b2..2dc71fb 100644 --- a/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp +++ b/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp @@ -24,7 +24,7 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { AuthRequestSerializer testling; - boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN")); + std::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN")); authRequest->setMessage(createSafeByteArray("foo")); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( @@ -35,7 +35,7 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture { void testSerialize_NoMessage() { AuthRequestSerializer testling; - boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN")); + std::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN")); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( "<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">" @@ -44,7 +44,7 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture { void testSerialize_EmptyMessage() { AuthRequestSerializer testling; - boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN")); + std::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN")); authRequest->setMessage(SafeByteArray()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( diff --git a/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp index 67c6f16..1ee4b62 100644 --- a/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp +++ b/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp @@ -24,7 +24,7 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { AuthResponseSerializer testling; - boost::shared_ptr<AuthResponse> authResponse(new AuthResponse()); + std::shared_ptr<AuthResponse> authResponse(new AuthResponse()); authResponse->setValue(createSafeByteArray("foo")); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( @@ -35,7 +35,7 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture { void testSerialize_NoMessage() { AuthResponseSerializer testling; - boost::shared_ptr<AuthResponse> authResponse(new AuthResponse()); + std::shared_ptr<AuthResponse> authResponse(new AuthResponse()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( "<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" @@ -44,7 +44,7 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture { void testSerialize_EmptyMessage() { AuthResponseSerializer testling; - boost::shared_ptr<AuthResponse> authResponse(new AuthResponse()); + std::shared_ptr<AuthResponse> authResponse(new AuthResponse()); authResponse->setValue(SafeByteArray()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( diff --git a/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp index 228bd9b..3c4bb1b 100644 --- a/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp +++ b/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp @@ -24,7 +24,7 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture { public: void testSerialize() { AuthSuccessSerializer testling; - boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess()); + std::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess()); authSuccess->setValue(createByteArray("foo")); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( @@ -35,7 +35,7 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture { void testSerialize_NoMessage() { AuthSuccessSerializer testling; - boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess()); + std::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( "<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" @@ -44,7 +44,7 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture { void testSerialize_EmptyMessage() { AuthSuccessSerializer testling; - boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess()); + std::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess()); authSuccess->setValue(std::vector<unsigned char>()); CPPUNIT_ASSERT_EQUAL(createSafeByteArray( diff --git a/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp b/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp index 5f4f821..dd3d6c3 100644 --- a/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp +++ b/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp @@ -24,7 +24,7 @@ class StreamFeaturesSerializerTest : public CppUnit::TestFixture void testSerialize() { StreamFeaturesSerializer testling; - boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); + std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures()); streamFeatures->setHasStartTLS(); streamFeatures->addCompressionMethod("zlib"); streamFeatures->addCompressionMethod("lzw"); diff --git a/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp b/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp index 3eaeef0..93205fc 100644 --- a/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp +++ b/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp @@ -31,7 +31,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture { } void testSerializeHeader_Client() { - boost::shared_ptr<XMPPSerializer> testling(createSerializer(ClientStreamType)); + std::shared_ptr<XMPPSerializer> testling(createSerializer(ClientStreamType)); ProtocolHeader protocolHeader; protocolHeader.setFrom("bla@foo.com"); protocolHeader.setTo("foo.com"); @@ -42,7 +42,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture { } void testSerializeHeader_Component() { - boost::shared_ptr<XMPPSerializer> testling(createSerializer(ComponentStreamType)); + std::shared_ptr<XMPPSerializer> testling(createSerializer(ComponentStreamType)); ProtocolHeader protocolHeader; protocolHeader.setFrom("bla@foo.com"); protocolHeader.setTo("foo.com"); @@ -53,7 +53,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture { } void testSerializeHeader_Server() { - boost::shared_ptr<XMPPSerializer> testling(createSerializer(ServerStreamType)); + std::shared_ptr<XMPPSerializer> testling(createSerializer(ServerStreamType)); ProtocolHeader protocolHeader; protocolHeader.setFrom("bla@foo.com"); protocolHeader.setTo("foo.com"); diff --git a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp index edd1b0e..ed3f8ab 100644 --- a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp +++ b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -29,11 +29,11 @@ class XMLElementTest : public CppUnit::TestFixture void testSerialize() { XMLElement testling("foo", "http://example.com"); testling.setAttribute("myatt", "myval"); - boost::shared_ptr<XMLElement> barElement(new XMLElement("bar")); - barElement->addNode(boost::make_shared<XMLTextNode>("Blo")); + std::shared_ptr<XMLElement> barElement(new XMLElement("bar")); + barElement->addNode(std::make_shared<XMLTextNode>("Blo")); testling.addNode(barElement); - boost::shared_ptr<XMLElement> bazElement(new XMLElement("baz")); - bazElement->addNode(boost::make_shared<XMLTextNode>("Bli&</stream>")); + std::shared_ptr<XMLElement> bazElement(new XMLElement("baz")); + bazElement->addNode(std::make_shared<XMLTextNode>("Bli&</stream>")); testling.addNode(bazElement); std::string result = testling.serialize(); diff --git a/Swiften/Serializer/XML/XMLElement.cpp b/Swiften/Serializer/XML/XMLElement.cpp index fc5e470..4a874ab 100644 --- a/Swiften/Serializer/XML/XMLElement.cpp +++ b/Swiften/Serializer/XML/XMLElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -30,7 +30,7 @@ std::string XMLElement::serialize() { if (!childNodes_.empty()) { result += ">"; - foreach (boost::shared_ptr<XMLNode> node, childNodes_) { + foreach (std::shared_ptr<XMLNode> node, childNodes_) { result += node->serialize(); } result += "</" + tag_ + ">"; @@ -51,7 +51,7 @@ void XMLElement::setAttribute(const std::string& attribute, const std::string& v attributes_[attribute] = escapedValue; } -void XMLElement::addNode(boost::shared_ptr<XMLNode> node) { +void XMLElement::addNode(std::shared_ptr<XMLNode> node) { if (node) { childNodes_.push_back(node); } diff --git a/Swiften/Serializer/XML/XMLElement.h b/Swiften/Serializer/XML/XMLElement.h index e7507f2..54de041 100644 --- a/Swiften/Serializer/XML/XMLElement.h +++ b/Swiften/Serializer/XML/XMLElement.h @@ -7,29 +7,28 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Serializer/XML/XMLNode.h> namespace Swift { class SWIFTEN_API XMLElement : public XMLNode { public: - typedef boost::shared_ptr<XMLElement> ref; + typedef std::shared_ptr<XMLElement> ref; XMLElement(const std::string& tag, const std::string& xmlns = "", const std::string& text = ""); void setAttribute(const std::string& attribute, const std::string& value); - void addNode(boost::shared_ptr<XMLNode> node); + void addNode(std::shared_ptr<XMLNode> node); virtual std::string serialize(); private: std::string tag_; std::map<std::string, std::string> attributes_; - std::vector< boost::shared_ptr<XMLNode> > childNodes_; + std::vector< std::shared_ptr<XMLNode> > childNodes_; }; } diff --git a/Swiften/Serializer/XML/XMLTextNode.h b/Swiften/Serializer/XML/XMLTextNode.h index b0f8d01..44970bf 100644 --- a/Swiften/Serializer/XML/XMLTextNode.h +++ b/Swiften/Serializer/XML/XMLTextNode.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/String.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API XMLTextNode : public XMLNode { public: - typedef boost::shared_ptr<XMLTextNode> ref; + typedef std::shared_ptr<XMLTextNode> ref; XMLTextNode(const std::string& text) : text_(text) { String::replaceAll(text_, '&', "&"); // Should come first diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp index b17e31b..8b2fd5c 100644 --- a/Swiften/Serializer/XMPPSerializer.cpp +++ b/Swiften/Serializer/XMPPSerializer.cpp @@ -8,9 +8,9 @@ #include <cassert> #include <iostream> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Elements/ProtocolHeader.h> @@ -41,29 +41,29 @@ namespace Swift { XMPPSerializer::XMPPSerializer(PayloadSerializerCollection* payloadSerializers, StreamType type, bool setExplictNSonTopLevelElements) : type_(type) { - serializers_.push_back(boost::make_shared<PresenceSerializer>(payloadSerializers, setExplictNSonTopLevelElements ? getDefaultNamespace() : boost::optional<std::string>())); - serializers_.push_back(boost::make_shared<IQSerializer>(payloadSerializers, setExplictNSonTopLevelElements ? getDefaultNamespace() : boost::optional<std::string>())); - serializers_.push_back(boost::make_shared<MessageSerializer>(payloadSerializers, setExplictNSonTopLevelElements ? getDefaultNamespace() : boost::optional<std::string>())); - serializers_.push_back(boost::make_shared<CompressRequestSerializer>()); - serializers_.push_back(boost::make_shared<CompressFailureSerializer>()); - serializers_.push_back(boost::make_shared<AuthRequestSerializer>()); - serializers_.push_back(boost::make_shared<AuthFailureSerializer>()); - serializers_.push_back(boost::make_shared<AuthSuccessSerializer>()); - serializers_.push_back(boost::make_shared<AuthChallengeSerializer>()); - serializers_.push_back(boost::make_shared<AuthResponseSerializer>()); - serializers_.push_back(boost::make_shared<StartTLSRequestSerializer>()); - serializers_.push_back(boost::make_shared<StartTLSFailureSerializer>()); - serializers_.push_back(boost::make_shared<TLSProceedSerializer>()); - serializers_.push_back(boost::make_shared<StreamFeaturesSerializer>()); - serializers_.push_back(boost::make_shared<StreamErrorSerializer>()); - serializers_.push_back(boost::make_shared<EnableStreamManagementSerializer>()); - serializers_.push_back(boost::make_shared<StreamManagementEnabledSerializer>()); - serializers_.push_back(boost::make_shared<StreamManagementFailedSerializer>()); - serializers_.push_back(boost::make_shared<StreamResumeSerializer>()); - serializers_.push_back(boost::make_shared<StreamResumedSerializer>()); - serializers_.push_back(boost::make_shared<StanzaAckSerializer>()); - serializers_.push_back(boost::make_shared<StanzaAckRequestSerializer>()); - serializers_.push_back(boost::make_shared<ComponentHandshakeSerializer>()); + serializers_.push_back(std::make_shared<PresenceSerializer>(payloadSerializers, setExplictNSonTopLevelElements ? getDefaultNamespace() : boost::optional<std::string>())); + serializers_.push_back(std::make_shared<IQSerializer>(payloadSerializers, setExplictNSonTopLevelElements ? getDefaultNamespace() : boost::optional<std::string>())); + serializers_.push_back(std::make_shared<MessageSerializer>(payloadSerializers, setExplictNSonTopLevelElements ? getDefaultNamespace() : boost::optional<std::string>())); + serializers_.push_back(std::make_shared<CompressRequestSerializer>()); + serializers_.push_back(std::make_shared<CompressFailureSerializer>()); + serializers_.push_back(std::make_shared<AuthRequestSerializer>()); + serializers_.push_back(std::make_shared<AuthFailureSerializer>()); + serializers_.push_back(std::make_shared<AuthSuccessSerializer>()); + serializers_.push_back(std::make_shared<AuthChallengeSerializer>()); + serializers_.push_back(std::make_shared<AuthResponseSerializer>()); + serializers_.push_back(std::make_shared<StartTLSRequestSerializer>()); + serializers_.push_back(std::make_shared<StartTLSFailureSerializer>()); + serializers_.push_back(std::make_shared<TLSProceedSerializer>()); + serializers_.push_back(std::make_shared<StreamFeaturesSerializer>()); + serializers_.push_back(std::make_shared<StreamErrorSerializer>()); + serializers_.push_back(std::make_shared<EnableStreamManagementSerializer>()); + serializers_.push_back(std::make_shared<StreamManagementEnabledSerializer>()); + serializers_.push_back(std::make_shared<StreamManagementFailedSerializer>()); + serializers_.push_back(std::make_shared<StreamResumeSerializer>()); + serializers_.push_back(std::make_shared<StreamResumedSerializer>()); + serializers_.push_back(std::make_shared<StanzaAckSerializer>()); + serializers_.push_back(std::make_shared<StanzaAckRequestSerializer>()); + serializers_.push_back(std::make_shared<ComponentHandshakeSerializer>()); } std::string XMPPSerializer::serializeHeader(const ProtocolHeader& header) const { @@ -84,8 +84,8 @@ std::string XMPPSerializer::serializeHeader(const ProtocolHeader& header) const return result; } -SafeByteArray XMPPSerializer::serializeElement(boost::shared_ptr<ToplevelElement> element) const { - std::vector< boost::shared_ptr<ElementSerializer> >::const_iterator i = std::find_if(serializers_.begin(), serializers_.end(), boost::bind(&ElementSerializer::canSerialize, _1, element)); +SafeByteArray XMPPSerializer::serializeElement(std::shared_ptr<ToplevelElement> element) const { + std::vector< std::shared_ptr<ElementSerializer> >::const_iterator i = std::find_if(serializers_.begin(), serializers_.end(), boost::bind(&ElementSerializer::canSerialize, _1, element)); if (i != serializers_.end()) { return (*i)->serialize(element); } diff --git a/Swiften/Serializer/XMPPSerializer.h b/Swiften/Serializer/XMPPSerializer.h index a771fdd..8c182e3 100644 --- a/Swiften/Serializer/XMPPSerializer.h +++ b/Swiften/Serializer/XMPPSerializer.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Elements/StreamType.h> #include <Swiften/Elements/ToplevelElement.h> @@ -26,7 +25,7 @@ namespace Swift { XMPPSerializer(PayloadSerializerCollection*, StreamType type, bool setExplictNSonTopLevelElements); std::string serializeHeader(const ProtocolHeader&) const; - SafeByteArray serializeElement(boost::shared_ptr<ToplevelElement> stanza) const; + SafeByteArray serializeElement(std::shared_ptr<ToplevelElement> stanza) const; std::string serializeFooter() const; private: @@ -34,6 +33,6 @@ namespace Swift { private: StreamType type_; - std::vector< boost::shared_ptr<ElementSerializer> > serializers_; + std::vector< std::shared_ptr<ElementSerializer> > serializers_; }; } diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp index dd6e83a..635fd69 100644 --- a/Swiften/Session/BOSHSessionStream.cpp +++ b/Swiften/Session/BOSHSessionStream.cpp @@ -40,7 +40,7 @@ BOSHSessionStream::BOSHSessionStream(const URL& boshURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, - boost::shared_ptr<HTTPTrafficFilter> trafficFilter) : + std::shared_ptr<HTTPTrafficFilter> trafficFilter) : available(false), eventLoop(eventLoop), firstHeader(true) { @@ -92,7 +92,7 @@ void BOSHSessionStream::handlePoolXMPPDataRead(const SafeByteArray& data) { xmppLayer->handleDataRead(data); } -void BOSHSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) { +void BOSHSessionStream::writeElement(std::shared_ptr<ToplevelElement> element) { assert(available); xmppLayer->writeElement(element); } @@ -134,7 +134,7 @@ std::vector<Certificate::ref> BOSHSessionStream::getPeerCertificateChain() const return connectionPool->getPeerCertificateChain(); } -boost::shared_ptr<CertificateVerificationError> BOSHSessionStream::getPeerCertificateVerificationError() const { +std::shared_ptr<CertificateVerificationError> BOSHSessionStream::getPeerCertificateVerificationError() const { return connectionPool->getPeerCertificateVerificationError(); } @@ -162,13 +162,13 @@ void BOSHSessionStream::handleStreamStartReceived(const ProtocolHeader& header) onStreamStartReceived(header); } -void BOSHSessionStream::handleElementReceived(boost::shared_ptr<ToplevelElement> element) { +void BOSHSessionStream::handleElementReceived(std::shared_ptr<ToplevelElement> element) { onElementReceived(element); } void BOSHSessionStream::handleXMPPError() { available = false; - onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ParseError)); + onClosed(std::make_shared<SessionStreamError>(SessionStreamError::ParseError)); } void BOSHSessionStream::handlePoolSessionStarted() { diff --git a/Swiften/Session/BOSHSessionStream.h b/Swiften/Session/BOSHSessionStream.h index 17292f4..0c26848 100644 --- a/Swiften/Session/BOSHSessionStream.h +++ b/Swiften/Session/BOSHSessionStream.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011-2015 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -30,7 +30,7 @@ namespace Swift { class XMLParserFactory; class XMPPLayer; - class SWIFTEN_API BOSHSessionStream : public SessionStream, public EventOwner, public boost::enable_shared_from_this<BOSHSessionStream> { + class SWIFTEN_API BOSHSessionStream : public SessionStream, public EventOwner, public std::enable_shared_from_this<BOSHSessionStream> { public: BOSHSessionStream( const URL& boshURL, @@ -47,7 +47,7 @@ namespace Swift { const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, - boost::shared_ptr<HTTPTrafficFilter> trafficFilter + std::shared_ptr<HTTPTrafficFilter> trafficFilter ); virtual ~BOSHSessionStream(); @@ -56,7 +56,7 @@ namespace Swift { virtual bool isOpen(); virtual void writeHeader(const ProtocolHeader& header); - virtual void writeElement(boost::shared_ptr<ToplevelElement>); + virtual void writeElement(std::shared_ptr<ToplevelElement>); virtual void writeFooter(); virtual void writeData(const std::string& data); @@ -68,7 +68,7 @@ namespace Swift { virtual bool isTLSEncrypted(); virtual Certificate::ref getPeerCertificate() const; virtual std::vector<Certificate::ref> getPeerCertificateChain() const; - virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; virtual ByteArray getTLSFinishMessage() const; virtual void setWhitespacePingEnabled(bool); @@ -78,7 +78,7 @@ namespace Swift { private: void handleXMPPError(); void handleStreamStartReceived(const ProtocolHeader&); - void handleElementReceived(boost::shared_ptr<ToplevelElement>); + void handleElementReceived(std::shared_ptr<ToplevelElement>); void handlePoolXMPPDataRead(const SafeByteArray& data); void handleXMPPLayerDataWritten(const SafeByteArray& data); void handlePoolSessionStarted(); diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index a6f1421..402f642 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -6,8 +6,9 @@ #include <Swiften/Session/BasicSessionStream.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/StreamStack/CompressionLayer.h> #include <Swiften/StreamStack/ConnectionLayer.h> @@ -22,7 +23,7 @@ namespace Swift { BasicSessionStream::BasicSessionStream( StreamType streamType, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, TLSContextFactory* tlsContextFactory, @@ -79,7 +80,7 @@ void BasicSessionStream::writeHeader(const ProtocolHeader& header) { xmppLayer->writeHeader(header); } -void BasicSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) { +void BasicSessionStream::writeElement(std::shared_ptr<ToplevelElement> element) { assert(available); xmppLayer->writeElement(element); } @@ -110,7 +111,7 @@ void BasicSessionStream::addTLSEncryption() { assert(available); tlsLayer = new TLSLayer(tlsContextFactory, tlsOptions_); if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) { - onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::InvalidTLSCertificateError)); + onClosed(std::make_shared<SessionStreamError>(SessionStreamError::InvalidTLSCertificateError)); } else { streamStack->addLayer(tlsLayer); @@ -132,7 +133,7 @@ std::vector<Certificate::ref> BasicSessionStream::getPeerCertificateChain() cons return tlsLayer->getPeerCertificateChain(); } -boost::shared_ptr<CertificateVerificationError> BasicSessionStream::getPeerCertificateVerificationError() const { +std::shared_ptr<CertificateVerificationError> BasicSessionStream::getPeerCertificateVerificationError() const { return tlsLayer->getPeerCertificateVerificationError(); } @@ -170,20 +171,20 @@ void BasicSessionStream::handleStreamStartReceived(const ProtocolHeader& header) onStreamStartReceived(header); } -void BasicSessionStream::handleElementReceived(boost::shared_ptr<ToplevelElement> element) { +void BasicSessionStream::handleElementReceived(std::shared_ptr<ToplevelElement> element) { onElementReceived(element); } void BasicSessionStream::handleXMPPError() { available = false; - onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ParseError)); + onClosed(std::make_shared<SessionStreamError>(SessionStreamError::ParseError)); } void BasicSessionStream::handleTLSConnected() { onTLSEncrypted(); } -void BasicSessionStream::handleTLSError(boost::shared_ptr<TLSError> error) { +void BasicSessionStream::handleTLSError(std::shared_ptr<TLSError> error) { available = false; onClosed(error); } @@ -191,13 +192,13 @@ void BasicSessionStream::handleTLSError(boost::shared_ptr<TLSError> error) { void BasicSessionStream::handleConnectionFinished(const boost::optional<Connection::Error>& error) { available = false; if (error == Connection::ReadError) { - onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ConnectionReadError)); + onClosed(std::make_shared<SessionStreamError>(SessionStreamError::ConnectionReadError)); } else if (error) { - onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ConnectionWriteError)); + onClosed(std::make_shared<SessionStreamError>(SessionStreamError::ConnectionWriteError)); } else { - onClosed(boost::shared_ptr<SessionStreamError>()); + onClosed(std::shared_ptr<SessionStreamError>()); } } diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h index db4a7e0..1806cef 100644 --- a/Swiften/Session/BasicSessionStream.h +++ b/Swiften/Session/BasicSessionStream.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -33,7 +33,7 @@ namespace Swift { public: BasicSessionStream( StreamType streamType, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, TLSContextFactory* tlsContextFactory, @@ -47,7 +47,7 @@ namespace Swift { virtual bool isOpen(); virtual void writeHeader(const ProtocolHeader& header); - virtual void writeElement(boost::shared_ptr<ToplevelElement>); + virtual void writeElement(std::shared_ptr<ToplevelElement>); virtual void writeFooter(); virtual void writeData(const std::string& data); @@ -60,7 +60,7 @@ namespace Swift { virtual Certificate::ref getPeerCertificate() const; virtual std::vector<Certificate::ref> getPeerCertificateChain() const; - virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; virtual ByteArray getTLSFinishMessage() const; virtual void setWhitespacePingEnabled(bool); @@ -71,15 +71,15 @@ namespace Swift { void handleConnectionFinished(const boost::optional<Connection::Error>& error); void handleXMPPError(); void handleTLSConnected(); - void handleTLSError(boost::shared_ptr<TLSError>); + void handleTLSError(std::shared_ptr<TLSError>); void handleStreamStartReceived(const ProtocolHeader&); - void handleElementReceived(boost::shared_ptr<ToplevelElement>); + void handleElementReceived(std::shared_ptr<ToplevelElement>); void handleDataRead(const SafeByteArray& data); void handleDataWritten(const SafeByteArray& data); private: bool available; - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; TLSContextFactory* tlsContextFactory; TimerFactory* timerFactory; XMPPLayer* xmppLayer; diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp index 82514c1..ebdb5d1 100644 --- a/Swiften/Session/Session.cpp +++ b/Swiften/Session/Session.cpp @@ -14,7 +14,7 @@ namespace Swift { Session::Session( - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory) : @@ -76,7 +76,7 @@ void Session::initializeStreamStack() { streamStack = new StreamStack(xmppLayer, connectionLayer); } -void Session::sendElement(boost::shared_ptr<ToplevelElement> stanza) { +void Session::sendElement(std::shared_ptr<ToplevelElement> stanza) { xmppLayer->writeElement(stanza); } diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h index d01833d..911bd34 100644 --- a/Swiften/Session/Session.h +++ b/Swiften/Session/Session.h @@ -6,9 +6,9 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> +#include <memory> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -28,7 +28,7 @@ namespace Swift { class XMPPLayer; class XMLParserFactory; - class SWIFTEN_API Session : public boost::enable_shared_from_this<Session> { + class SWIFTEN_API Session : public std::enable_shared_from_this<Session> { public: enum SessionError { ConnectionReadError, @@ -45,7 +45,7 @@ namespace Swift { }; Session( - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); @@ -54,7 +54,7 @@ namespace Swift { void startSession(); void finishSession(); - void sendElement(boost::shared_ptr<ToplevelElement>); + void sendElement(std::shared_ptr<ToplevelElement>); const JID& getLocalJID() const { return localJID; @@ -64,7 +64,7 @@ namespace Swift { return remoteJID; } - boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElementReceived; + boost::signal<void (std::shared_ptr<ToplevelElement>)> onElementReceived; boost::signal<void (const boost::optional<SessionError>&)> onSessionFinished; boost::signal<void (const SafeByteArray&)> onDataWritten; boost::signal<void (const SafeByteArray&)> onDataRead; @@ -82,7 +82,7 @@ namespace Swift { virtual void handleSessionStarted() {} virtual void handleSessionFinished(const boost::optional<SessionError>&) {} - virtual void handleElement(boost::shared_ptr<ToplevelElement>) = 0; + virtual void handleElement(std::shared_ptr<ToplevelElement>) = 0; virtual void handleStreamStart(const ProtocolHeader&) = 0; void initializeStreamStack(); @@ -103,7 +103,7 @@ namespace Swift { private: JID localJID; JID remoteJID; - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; PayloadParserFactoryCollection* payloadParserFactories; PayloadSerializerCollection* payloadSerializers; XMLParserFactory* xmlParserFactory; diff --git a/Swiften/Session/SessionStream.h b/Swiften/Session/SessionStream.h index 18404c6..4b86cee 100644 --- a/Swiften/Session/SessionStream.h +++ b/Swiften/Session/SessionStream.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> @@ -46,7 +47,7 @@ namespace Swift { virtual void writeHeader(const ProtocolHeader& header) = 0; virtual void writeFooter() = 0; - virtual void writeElement(boost::shared_ptr<ToplevelElement>) = 0; + virtual void writeElement(std::shared_ptr<ToplevelElement>) = 0; virtual void writeData(const std::string& data) = 0; virtual bool supportsZLibCompression() = 0; @@ -69,13 +70,13 @@ namespace Swift { virtual Certificate::ref getPeerCertificate() const = 0; virtual std::vector<Certificate::ref> getPeerCertificateChain() const = 0; - virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const = 0; + virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const = 0; virtual ByteArray getTLSFinishMessage() const = 0; boost::signal<void (const ProtocolHeader&)> onStreamStartReceived; - boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElementReceived; - boost::signal<void (boost::shared_ptr<Error>)> onClosed; + boost::signal<void (std::shared_ptr<ToplevelElement>)> onElementReceived; + boost::signal<void (std::shared_ptr<Error>)> onClosed; boost::signal<void ()> onTLSEncrypted; boost::signal<void (const SafeByteArray&)> onDataRead; boost::signal<void (const SafeByteArray&)> onDataWritten; diff --git a/Swiften/Session/SessionTracer.cpp b/Swiften/Session/SessionTracer.cpp index aa44b9c..49b369d 100644 --- a/Swiften/Session/SessionTracer.cpp +++ b/Swiften/Session/SessionTracer.cpp @@ -12,7 +12,7 @@ namespace Swift { -SessionTracer::SessionTracer(boost::shared_ptr<Session> session) : session(session) { +SessionTracer::SessionTracer(std::shared_ptr<Session> session) : session(session) { session->onDataRead.connect(boost::bind(&SessionTracer::printData, this, '<', _1)); session->onDataWritten.connect(boost::bind(&SessionTracer::printData, this, '>', _1)); } diff --git a/Swiften/Session/SessionTracer.h b/Swiften/Session/SessionTracer.h index 3993a87..8e73c16 100644 --- a/Swiften/Session/SessionTracer.h +++ b/Swiften/Session/SessionTracer.h @@ -15,11 +15,11 @@ namespace Swift { class SWIFTEN_API SessionTracer { public: - SessionTracer(boost::shared_ptr<Session> session); + SessionTracer(std::shared_ptr<Session> session); private: void printData(char direction, const SafeByteArray& data); - boost::shared_ptr<Session> session; + std::shared_ptr<Session> session; }; } diff --git a/Swiften/StreamManagement/StanzaAckRequester.cpp b/Swiften/StreamManagement/StanzaAckRequester.cpp index ceafe28..8e9e7f3 100644 --- a/Swiften/StreamManagement/StanzaAckRequester.cpp +++ b/Swiften/StreamManagement/StanzaAckRequester.cpp @@ -20,9 +20,9 @@ StanzaAckRequester::StanzaAckRequester() : lastHandledStanzasCount(0) { } -void StanzaAckRequester::handleStanzaSent(boost::shared_ptr<Stanza> stanza) { +void StanzaAckRequester::handleStanzaSent(std::shared_ptr<Stanza> stanza) { unackedStanzas.push_back(stanza); - if (boost::dynamic_pointer_cast<Message>(stanza)) { + if (std::dynamic_pointer_cast<Message>(stanza)) { onRequestAck(); } } @@ -34,7 +34,7 @@ void StanzaAckRequester::handleAckReceived(unsigned int handledStanzasCount) { std::cerr << "Warning: Server acked more stanzas than we sent" << std::endl; break; } - boost::shared_ptr<Stanza> ackedStanza = unackedStanzas.front(); + std::shared_ptr<Stanza> ackedStanza = unackedStanzas.front(); unackedStanzas.pop_front(); onStanzaAcked(ackedStanza); i = (i == MAX_HANDLED_STANZA_COUNT ? 0 : i + 1); diff --git a/Swiften/StreamManagement/StanzaAckRequester.h b/Swiften/StreamManagement/StanzaAckRequester.h index 4d913bb..dda1395 100644 --- a/Swiften/StreamManagement/StanzaAckRequester.h +++ b/Swiften/StreamManagement/StanzaAckRequester.h @@ -7,8 +7,7 @@ #pragma once #include <deque> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -19,17 +18,17 @@ namespace Swift { public: StanzaAckRequester(); - void handleStanzaSent(boost::shared_ptr<Stanza> stanza); + void handleStanzaSent(std::shared_ptr<Stanza> stanza); void handleAckReceived(unsigned int handledStanzasCount); public: boost::signal<void ()> onRequestAck; - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked; + boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked; private: friend class StanzaAckRequesterTest; unsigned int lastHandledStanzasCount; - std::deque<boost::shared_ptr<Stanza> > unackedStanzas; + std::deque<std::shared_ptr<Stanza> > unackedStanzas; }; } diff --git a/Swiften/StreamManagement/StanzaAckResponder.h b/Swiften/StreamManagement/StanzaAckResponder.h index 16c8825..389606e 100644 --- a/Swiften/StreamManagement/StanzaAckResponder.h +++ b/Swiften/StreamManagement/StanzaAckResponder.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> diff --git a/Swiften/StreamManagement/UnitTest/StanzaAckRequesterTest.cpp b/Swiften/StreamManagement/UnitTest/StanzaAckRequesterTest.cpp index 55e6012..b1bc7c2 100644 --- a/Swiften/StreamManagement/UnitTest/StanzaAckRequesterTest.cpp +++ b/Swiften/StreamManagement/UnitTest/StanzaAckRequesterTest.cpp @@ -37,28 +37,28 @@ class StanzaAckRequesterTest : public CppUnit::TestFixture { } void testHandleStanzaSent_MessageRequestsAck() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createMessage("m1")); CPPUNIT_ASSERT_EQUAL(1, acksRequested); } void testHandleStanzaSent_IQDoesNotRequestAck() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createIQ("iq1")); CPPUNIT_ASSERT_EQUAL(0, acksRequested); } void testHandleStanzaSent_PresenceDoesNotRequestAck() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createPresence("p1")); CPPUNIT_ASSERT_EQUAL(0, acksRequested); } void testHandleAckReceived_AcksStanza() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createMessage("m1")); testling->handleAckReceived(1); @@ -68,7 +68,7 @@ class StanzaAckRequesterTest : public CppUnit::TestFixture { } void testHandleAckReceived_AcksMultipleMessages() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createMessage("m1")); testling->handleStanzaSent(createMessage("m2")); @@ -80,7 +80,7 @@ class StanzaAckRequesterTest : public CppUnit::TestFixture { } void testHandleAckReceived_AcksMultipleStanzas() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createIQ("iq1")); testling->handleStanzaSent(createPresence("p1")); testling->handleStanzaSent(createMessage("m1")); @@ -94,7 +94,7 @@ class StanzaAckRequesterTest : public CppUnit::TestFixture { } void testHandleAckReceived_MultipleAcks() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createMessage("m1")); testling->handleAckReceived(1); @@ -110,7 +110,7 @@ class StanzaAckRequesterTest : public CppUnit::TestFixture { // Handle stanza ack count wrapping, as per the XEP void testHandleAckReceived_WrapAround() { - boost::shared_ptr<StanzaAckRequester> testling(createRequester()); + std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->lastHandledStanzasCount = boost::numeric_cast<unsigned int>((1ULL<<32) - 1); testling->handleStanzaSent(createMessage("m1")); testling->handleStanzaSent(createMessage("m2")); @@ -152,13 +152,13 @@ class StanzaAckRequesterTest : public CppUnit::TestFixture { acksRequested++; } - void handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { + void handleStanzaAcked(std::shared_ptr<Stanza> stanza) { ackedStanzas.push_back(stanza); } private: int acksRequested; - std::vector< boost::shared_ptr<Stanza> > ackedStanzas; + std::vector< std::shared_ptr<Stanza> > ackedStanzas; }; } diff --git a/Swiften/StreamManagement/UnitTest/StanzaAckResponderTest.cpp b/Swiften/StreamManagement/UnitTest/StanzaAckResponderTest.cpp index 70cd8fc..ffdabe9 100644 --- a/Swiften/StreamManagement/UnitTest/StanzaAckResponderTest.cpp +++ b/Swiften/StreamManagement/UnitTest/StanzaAckResponderTest.cpp @@ -27,7 +27,7 @@ class StanzaAckResponderTest : public CppUnit::TestFixture { public: void testHandleAckRequestReceived_AcksStanza() { - boost::shared_ptr<StanzaAckResponder> testling(createResponder()); + std::shared_ptr<StanzaAckResponder> testling(createResponder()); testling->handleStanzaReceived(); testling->handleAckRequestReceived(); @@ -37,7 +37,7 @@ class StanzaAckResponderTest : public CppUnit::TestFixture { } void testHandleAckRequestReceived_AcksMultipleStanzas() { - boost::shared_ptr<StanzaAckResponder> testling(createResponder()); + std::shared_ptr<StanzaAckResponder> testling(createResponder()); testling->handleStanzaReceived(); testling->handleStanzaReceived(); @@ -48,7 +48,7 @@ class StanzaAckResponderTest : public CppUnit::TestFixture { } void testHandleAckRequestReceived_MultipleAcks() { - boost::shared_ptr<StanzaAckResponder> testling(createResponder()); + std::shared_ptr<StanzaAckResponder> testling(createResponder()); testling->handleStanzaReceived(); testling->handleAckRequestReceived(); @@ -62,7 +62,7 @@ class StanzaAckResponderTest : public CppUnit::TestFixture { // Handle stanza ack count wrapping, as per the XEP void testHandleAckRequestReceived_WrapAround() { - boost::shared_ptr<StanzaAckResponder> testling(createResponder()); + std::shared_ptr<StanzaAckResponder> testling(createResponder()); testling->handledStanzasCount = boost::numeric_cast<unsigned int>((1ULL<<32) - 1); testling->handleStanzaReceived(); testling->handleStanzaReceived(); diff --git a/Swiften/StreamStack/ConnectionLayer.cpp b/Swiften/StreamStack/ConnectionLayer.cpp index 09b6f87..b0c4deb 100644 --- a/Swiften/StreamStack/ConnectionLayer.cpp +++ b/Swiften/StreamStack/ConnectionLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -10,7 +10,7 @@ namespace Swift { -ConnectionLayer::ConnectionLayer(boost::shared_ptr<Connection> connection) : connection(connection) { +ConnectionLayer::ConnectionLayer(std::shared_ptr<Connection> connection) : connection(connection) { connection->onDataRead.connect(boost::bind(&ConnectionLayer::handleDataRead, this, _1)); } @@ -18,7 +18,7 @@ ConnectionLayer::~ConnectionLayer() { connection->onDataRead.disconnect(boost::bind(&ConnectionLayer::handleDataRead, this, _1)); } -void ConnectionLayer::handleDataRead(boost::shared_ptr<SafeByteArray> data) { +void ConnectionLayer::handleDataRead(std::shared_ptr<SafeByteArray> data) { writeDataToParentLayer(*data); } diff --git a/Swiften/StreamStack/ConnectionLayer.h b/Swiften/StreamStack/ConnectionLayer.h index c2d0fde..d1775ee 100644 --- a/Swiften/StreamStack/ConnectionLayer.h +++ b/Swiften/StreamStack/ConnectionLayer.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Network/Connection.h> @@ -15,7 +15,7 @@ namespace Swift { class SWIFTEN_API ConnectionLayer : public LowLayer { public: - ConnectionLayer(boost::shared_ptr<Connection> connection); + ConnectionLayer(std::shared_ptr<Connection> connection); virtual ~ConnectionLayer(); void writeData(const SafeByteArray& data) { @@ -23,9 +23,9 @@ namespace Swift { } private: - void handleDataRead(boost::shared_ptr<SafeByteArray>); + void handleDataRead(std::shared_ptr<SafeByteArray>); private: - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; }; } diff --git a/Swiften/StreamStack/StreamStack.h b/Swiften/StreamStack/StreamStack.h index 74b92d7..718aa32 100644 --- a/Swiften/StreamStack/StreamStack.h +++ b/Swiften/StreamStack/StreamStack.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/Stanza.h> diff --git a/Swiften/StreamStack/TLSLayer.cpp b/Swiften/StreamStack/TLSLayer.cpp index 3ab885a..ced879e 100644 --- a/Swiften/StreamStack/TLSLayer.cpp +++ b/Swiften/StreamStack/TLSLayer.cpp @@ -49,7 +49,7 @@ std::vector<Certificate::ref> TLSLayer::getPeerCertificateChain() const { return context->getPeerCertificateChain(); } -boost::shared_ptr<CertificateVerificationError> TLSLayer::getPeerCertificateVerificationError() const { +std::shared_ptr<CertificateVerificationError> TLSLayer::getPeerCertificateVerificationError() const { return context->getPeerCertificateVerificationError(); } diff --git a/Swiften/StreamStack/TLSLayer.h b/Swiften/StreamStack/TLSLayer.h index b9072f3..8782753 100644 --- a/Swiften/StreamStack/TLSLayer.h +++ b/Swiften/StreamStack/TLSLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -30,7 +30,7 @@ namespace Swift { Certificate::ref getPeerCertificate() const; std::vector<Certificate::ref> getPeerCertificateChain() const; - boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; void writeData(const SafeByteArray& data); void handleDataRead(const SafeByteArray& data); @@ -40,7 +40,7 @@ namespace Swift { } public: - boost::signal<void (boost::shared_ptr<TLSError>)> onError; + boost::signal<void (std::shared_ptr<TLSError>)> onError; boost::signal<void ()> onConnected; private: diff --git a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp index 7044ad9..6d50b77 100644 --- a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp +++ b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp @@ -61,7 +61,7 @@ class StreamStackTest : public CppUnit::TestFixture { void testWriteData_OneIntermediateStream() { StreamStack testling(xmppStream_, physicalStream_); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); testling.addLayer(xStream.get()); xmppStream_->writeData("foo"); @@ -72,8 +72,8 @@ class StreamStackTest : public CppUnit::TestFixture { void testWriteData_TwoIntermediateStreamStack() { StreamStack testling(xmppStream_, physicalStream_); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); - boost::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("Y")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); + std::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("Y")); testling.addLayer(xStream.get()); testling.addLayer(yStream.get()); @@ -95,7 +95,7 @@ class StreamStackTest : public CppUnit::TestFixture { void testReadData_OneIntermediateStream() { StreamStack testling(xmppStream_, physicalStream_); xmppStream_->onElement.connect(boost::bind(&StreamStackTest::handleElement, this, _1)); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("<")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("<")); testling.addLayer(xStream.get()); physicalStream_->onDataRead(createSafeByteArray("stream:stream xmlns:stream='http://etherx.jabber.org/streams'><presence/>")); @@ -106,8 +106,8 @@ class StreamStackTest : public CppUnit::TestFixture { void testReadData_TwoIntermediateStreamStack() { StreamStack testling(xmppStream_, physicalStream_); xmppStream_->onElement.connect(boost::bind(&StreamStackTest::handleElement, this, _1)); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("s")); - boost::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("<")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("s")); + std::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("<")); testling.addLayer(xStream.get()); testling.addLayer(yStream.get()); @@ -119,7 +119,7 @@ class StreamStackTest : public CppUnit::TestFixture { void testAddLayer_ExistingOnWriteDataSlot() { StreamStack testling(xmppStream_, physicalStream_); xmppStream_->onWriteData.connect(boost::bind(&StreamStackTest::handleWriteData, this, _1)); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); testling.addLayer(xStream.get()); xmppStream_->writeData("foo"); @@ -127,7 +127,7 @@ class StreamStackTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, dataWriteReceived_); } - void handleElement(boost::shared_ptr<ToplevelElement>) { + void handleElement(std::shared_ptr<ToplevelElement>) { ++elementsReceived_; } diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp index 86e02ba..6d1d537 100644 --- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp +++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp @@ -85,7 +85,7 @@ class XMPPLayerTest : public CppUnit::TestFixture { } void testWriteElement() { - testling_->writeElement(boost::make_shared<Presence>()); + testling_->writeElement(std::make_shared<Presence>()); CPPUNIT_ASSERT_EQUAL(std::string("<presence/>"), lowLayer_->writtenData); } @@ -96,11 +96,11 @@ class XMPPLayerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("</stream:stream>"), lowLayer_->writtenData); } - void handleElement(boost::shared_ptr<ToplevelElement>) { + void handleElement(std::shared_ptr<ToplevelElement>) { ++elementsReceived_; } - void handleElementAndReset(boost::shared_ptr<ToplevelElement>) { + void handleElementAndReset(std::shared_ptr<ToplevelElement>) { ++elementsReceived_; testling_->resetParser(); } diff --git a/Swiften/StreamStack/WhitespacePingLayer.h b/Swiften/StreamStack/WhitespacePingLayer.h index 41189ba..c9ffe92 100644 --- a/Swiften/StreamStack/WhitespacePingLayer.h +++ b/Swiften/StreamStack/WhitespacePingLayer.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/StreamStack/StreamLayer.h> @@ -35,6 +36,6 @@ namespace Swift { private: bool isActive; - boost::shared_ptr<Timer> timer; + std::shared_ptr<Timer> timer; }; } diff --git a/Swiften/StreamStack/XMPPLayer.cpp b/Swiften/StreamStack/XMPPLayer.cpp index e0d683c..2eed906 100644 --- a/Swiften/StreamStack/XMPPLayer.cpp +++ b/Swiften/StreamStack/XMPPLayer.cpp @@ -41,7 +41,7 @@ void XMPPLayer::writeFooter() { writeDataInternal(createSafeByteArray(xmppSerializer_->serializeFooter())); } -void XMPPLayer::writeElement(boost::shared_ptr<ToplevelElement> element) { +void XMPPLayer::writeElement(std::shared_ptr<ToplevelElement> element) { writeDataInternal(xmppSerializer_->serializeElement(element)); } @@ -81,7 +81,7 @@ void XMPPLayer::handleStreamStart(const ProtocolHeader& header) { onStreamStart(header); } -void XMPPLayer::handleElement(boost::shared_ptr<ToplevelElement> stanza) { +void XMPPLayer::handleElement(std::shared_ptr<ToplevelElement> stanza) { onElement(stanza); } diff --git a/Swiften/StreamStack/XMPPLayer.h b/Swiften/StreamStack/XMPPLayer.h index 25d48bf..74ea519 100644 --- a/Swiften/StreamStack/XMPPLayer.h +++ b/Swiften/StreamStack/XMPPLayer.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -39,7 +40,7 @@ namespace Swift { void writeHeader(const ProtocolHeader& header); void writeFooter(); - void writeElement(boost::shared_ptr<ToplevelElement>); + void writeElement(std::shared_ptr<ToplevelElement>); void writeData(const std::string& data); void resetParser(); @@ -50,14 +51,14 @@ namespace Swift { public: boost::signal<void (const ProtocolHeader&)> onStreamStart; - boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElement; + boost::signal<void (std::shared_ptr<ToplevelElement>)> onElement; boost::signal<void (const SafeByteArray&)> onWriteData; boost::signal<void (const SafeByteArray&)> onDataRead; boost::signal<void ()> onError; private: void handleStreamStart(const ProtocolHeader&); - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamEnd(); void doResetParser(); diff --git a/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp b/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp index 343c170..43866cb 100644 --- a/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp +++ b/Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp @@ -25,7 +25,7 @@ class PBKDF2Test : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); } void testGetResult_I1() { @@ -47,7 +47,7 @@ class PBKDF2Test : public CppUnit::TestFixture { } private: - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(PBKDF2Test); diff --git a/Swiften/TLS/CAPICertificate.cpp b/Swiften/TLS/CAPICertificate.cpp index 29bb338..a46b9f6 100644 --- a/Swiften/TLS/CAPICertificate.cpp +++ b/Swiften/TLS/CAPICertificate.cpp @@ -20,7 +20,7 @@ #define DEBUG_SCARD_STATUS(function, status) \ { \ - boost::shared_ptr<boost::system::error_code> errorCode = boost::make_shared<boost::system::error_code>(status, boost::system::system_category()); \ + std::shared_ptr<boost::system::error_code> errorCode = std::make_shared<boost::system::error_code>(status, boost::system::system_category()); \ SWIFT_LOG(debug) << std::hex << function << ": status: 0x" << status << ": " << errorCode->message() << std::endl; \ } diff --git a/Swiften/TLS/CAPICertificate.h b/Swiften/TLS/CAPICertificate.h index e0b5488..5322a03 100644 --- a/Swiften/TLS/CAPICertificate.h +++ b/Swiften/TLS/CAPICertificate.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <Swiften/Base/API.h> @@ -58,7 +64,7 @@ namespace Swift { std::string certStore_; std::string certName_; std::string smartCardReaderName_; - boost::shared_ptr<Timer> smartCardTimer_; + std::shared_ptr<Timer> smartCardTimer_; TimerFactory* timerFactory_; bool lastPollingResult_; diff --git a/Swiften/TLS/Certificate.h b/Swiften/TLS/Certificate.h index 0b45479..dbc61ad 100644 --- a/Swiften/TLS/Certificate.h +++ b/Swiften/TLS/Certificate.h @@ -1,16 +1,15 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> @@ -19,7 +18,7 @@ namespace Swift { class SWIFTEN_API Certificate { public: - typedef boost::shared_ptr<Certificate> ref; + typedef std::shared_ptr<Certificate> ref; virtual ~Certificate(); diff --git a/Swiften/TLS/CertificateTrustChecker.h b/Swiften/TLS/CertificateTrustChecker.h index bf2b891..dd2b3ec 100644 --- a/Swiften/TLS/CertificateTrustChecker.h +++ b/Swiften/TLS/CertificateTrustChecker.h @@ -6,11 +6,10 @@ #pragma once +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/TLS/Certificate.h> diff --git a/Swiften/TLS/CertificateVerificationError.h b/Swiften/TLS/CertificateVerificationError.h index 0079e4f..02b4cca 100644 --- a/Swiften/TLS/CertificateVerificationError.h +++ b/Swiften/TLS/CertificateVerificationError.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API CertificateVerificationError : public Error { public: - typedef boost::shared_ptr<CertificateVerificationError> ref; + typedef std::shared_ptr<CertificateVerificationError> ref; enum Type { UnknownError, diff --git a/Swiften/TLS/CertificateWithKey.h b/Swiften/TLS/CertificateWithKey.h index 3d95e5b..8414938 100644 --- a/Swiften/TLS/CertificateWithKey.h +++ b/Swiften/TLS/CertificateWithKey.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -12,7 +12,7 @@ namespace Swift { class SWIFTEN_API CertificateWithKey { public: - typedef boost::shared_ptr<CertificateWithKey> ref; + typedef std::shared_ptr<CertificateWithKey> ref; CertificateWithKey() {} virtual ~CertificateWithKey() {} diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp index 3110813..17ac8cc 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -19,7 +19,7 @@ namespace Swift { -OpenSSLCertificate::OpenSSLCertificate(boost::shared_ptr<X509> cert) : cert(cert) { +OpenSSLCertificate::OpenSSLCertificate(std::shared_ptr<X509> cert) : cert(cert) { parse(); } @@ -30,7 +30,7 @@ OpenSSLCertificate::OpenSSLCertificate(const ByteArray& der) { #else const unsigned char* p = vecptr(der); #endif - cert = boost::shared_ptr<X509>(d2i_X509(NULL, &p, der.size()), X509_free); + cert = std::shared_ptr<X509>(d2i_X509(NULL, &p, der.size()), X509_free); if (!cert) { SWIFT_LOG(warning) << "Error creating certificate from DER data" << std::endl; } @@ -75,9 +75,9 @@ void OpenSSLCertificate::parse() { int subjectAltNameLoc = X509_get_ext_by_NID(cert.get(), NID_subject_alt_name, -1); if(subjectAltNameLoc != -1) { X509_EXTENSION* extension = X509_get_ext(cert.get(), subjectAltNameLoc); - boost::shared_ptr<GENERAL_NAMES> generalNames(reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(extension)), GENERAL_NAMES_free); - boost::shared_ptr<ASN1_OBJECT> xmppAddrObject(OBJ_txt2obj(ID_ON_XMPPADDR_OID, 1), ASN1_OBJECT_free); - boost::shared_ptr<ASN1_OBJECT> dnsSRVObject(OBJ_txt2obj(ID_ON_DNSSRV_OID, 1), ASN1_OBJECT_free); + std::shared_ptr<GENERAL_NAMES> generalNames(reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(extension)), GENERAL_NAMES_free); + std::shared_ptr<ASN1_OBJECT> xmppAddrObject(OBJ_txt2obj(ID_ON_XMPPADDR_OID, 1), ASN1_OBJECT_free); + std::shared_ptr<ASN1_OBJECT> dnsSRVObject(OBJ_txt2obj(ID_ON_DNSSRV_OID, 1), ASN1_OBJECT_free); for (int i = 0; i < sk_GENERAL_NAME_num(generalNames.get()); ++i) { GENERAL_NAME* generalName = sk_GENERAL_NAME_value(generalNames.get(), i); if (generalName->type == GEN_OTHERNAME) { diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.h b/Swiften/TLS/OpenSSL/OpenSSLCertificate.h index 4b8b32c..186caea 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.h +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <openssl/ssl.h> #include <Swiften/TLS/Certificate.h> @@ -17,7 +16,7 @@ namespace Swift { class OpenSSLCertificate : public Certificate { public: - OpenSSLCertificate(boost::shared_ptr<X509>); + OpenSSLCertificate(std::shared_ptr<X509>); OpenSSLCertificate(const ByteArray& der); std::string getSubjectName() const { @@ -42,7 +41,7 @@ namespace Swift { ByteArray toDER() const; - boost::shared_ptr<X509> getInternalX509() const { + std::shared_ptr<X509> getInternalX509() const { return cert; } @@ -62,7 +61,7 @@ namespace Swift { } private: - boost::shared_ptr<X509> cert; + std::shared_ptr<X509> cert; std::string subjectName; std::vector<std::string> commonNames; std::vector<std::string> dnsNames; diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp index cc420e6..b7496a0 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,7 +13,7 @@ #include <vector> #include <openssl/err.h> #include <openssl/pkcs12.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #if defined(SWIFTEN_PLATFORM_MACOSX) #include <Security/Security.h> @@ -147,7 +147,7 @@ void OpenSSLContext::doConnect() { break; default: state_ = Error; - onError(boost::make_shared<TLSError>()); + onError(std::make_shared<TLSError>()); } } @@ -181,7 +181,7 @@ void OpenSSLContext::handleDataFromApplication(const SafeByteArray& data) { } else { state_ = Error; - onError(boost::make_shared<TLSError>()); + onError(std::make_shared<TLSError>()); } } @@ -197,12 +197,12 @@ void OpenSSLContext::sendPendingDataToApplication() { } if (ret < 0 && SSL_get_error(handle_, ret) != SSL_ERROR_WANT_READ) { state_ = Error; - onError(boost::make_shared<TLSError>()); + onError(std::make_shared<TLSError>()); } } bool OpenSSLContext::setClientCertificate(CertificateWithKey::ref certificate) { - boost::shared_ptr<PKCS12Certificate> pkcs12Certificate = boost::dynamic_pointer_cast<PKCS12Certificate>(certificate); + std::shared_ptr<PKCS12Certificate> pkcs12Certificate = std::dynamic_pointer_cast<PKCS12Certificate>(certificate); if (!pkcs12Certificate || pkcs12Certificate->isNull()) { return false; } @@ -210,7 +210,7 @@ bool OpenSSLContext::setClientCertificate(CertificateWithKey::ref certificate) { // Create a PKCS12 structure BIO* bio = BIO_new(BIO_s_mem()); BIO_write(bio, vecptr(pkcs12Certificate->getData()), pkcs12Certificate->getData().size()); - boost::shared_ptr<PKCS12> pkcs12(d2i_PKCS12_bio(bio, NULL), PKCS12_free); + std::shared_ptr<PKCS12> pkcs12(d2i_PKCS12_bio(bio, NULL), PKCS12_free); BIO_free(bio); if (!pkcs12) { return false; @@ -226,9 +226,9 @@ bool OpenSSLContext::setClientCertificate(CertificateWithKey::ref certificate) { if (result != 1) { return false; } - boost::shared_ptr<X509> cert(certPtr, X509_free); - boost::shared_ptr<EVP_PKEY> privateKey(privateKeyPtr, EVP_PKEY_free); - boost::shared_ptr<STACK_OF(X509)> caCerts(caCertsPtr, freeX509Stack); + std::shared_ptr<X509> cert(certPtr, X509_free); + std::shared_ptr<EVP_PKEY> privateKey(privateKeyPtr, EVP_PKEY_free); + std::shared_ptr<STACK_OF(X509)> caCerts(caCertsPtr, freeX509Stack); // Use the key & certificates if (SSL_CTX_use_certificate(context_, cert.get()) != 1) { @@ -247,21 +247,21 @@ std::vector<Certificate::ref> OpenSSLContext::getPeerCertificateChain() const { std::vector<Certificate::ref> result; STACK_OF(X509)* chain = SSL_get_peer_cert_chain(handle_); for (int i = 0; i < sk_X509_num(chain); ++i) { - boost::shared_ptr<X509> x509Cert(X509_dup(sk_X509_value(chain, i)), X509_free); + std::shared_ptr<X509> x509Cert(X509_dup(sk_X509_value(chain, i)), X509_free); - Certificate::ref cert = boost::make_shared<OpenSSLCertificate>(x509Cert); + Certificate::ref cert = std::make_shared<OpenSSLCertificate>(x509Cert); result.push_back(cert); } return result; } -boost::shared_ptr<CertificateVerificationError> OpenSSLContext::getPeerCertificateVerificationError() const { +std::shared_ptr<CertificateVerificationError> OpenSSLContext::getPeerCertificateVerificationError() const { int verifyResult = SSL_get_verify_result(handle_); if (verifyResult != X509_V_OK) { - return boost::make_shared<CertificateVerificationError>(getVerificationErrorTypeForResult(verifyResult)); + return std::make_shared<CertificateVerificationError>(getVerificationErrorTypeForResult(verifyResult)); } else { - return boost::shared_ptr<CertificateVerificationError>(); + return std::shared_ptr<CertificateVerificationError>(); } } diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.h b/Swiften/TLS/OpenSSL/OpenSSLContext.h index 7fd5af7..54a8dcb 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.h +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -29,7 +29,7 @@ namespace Swift { void handleDataFromApplication(const SafeByteArray&); std::vector<Certificate::ref> getPeerCertificateChain() const; - boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; virtual ByteArray getFinishMessage() const; diff --git a/Swiften/TLS/Schannel/SchannelCertificate.cpp b/Swiften/TLS/Schannel/SchannelCertificate.cpp index 68dd0cf..23c2479 100644 --- a/Swiften/TLS/Schannel/SchannelCertificate.cpp +++ b/Swiften/TLS/Schannel/SchannelCertificate.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include "Swiften/TLS/Schannel/SchannelCertificate.h" #include "Swiften/Base/ByteArray.h" @@ -160,9 +166,9 @@ void SchannelCertificate::parse() // int subjectAltNameLoc = X509_get_ext_by_NID(cert.get(), NID_subject_alt_name, -1); // if(subjectAltNameLoc != -1) { // X509_EXTENSION* extension = X509_get_ext(cert.get(), subjectAltNameLoc); - // boost::shared_ptr<GENERAL_NAMES> generalNames(reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(extension)), GENERAL_NAMES_free); - // boost::shared_ptr<ASN1_OBJECT> xmppAddrObject(OBJ_txt2obj(ID_ON_XMPPADDR_OID, 1), ASN1_OBJECT_free); - // boost::shared_ptr<ASN1_OBJECT> dnsSRVObject(OBJ_txt2obj(ID_ON_DNSSRV_OID, 1), ASN1_OBJECT_free); + // std::shared_ptr<GENERAL_NAMES> generalNames(reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(extension)), GENERAL_NAMES_free); + // std::shared_ptr<ASN1_OBJECT> xmppAddrObject(OBJ_txt2obj(ID_ON_XMPPADDR_OID, 1), ASN1_OBJECT_free); + // std::shared_ptr<ASN1_OBJECT> dnsSRVObject(OBJ_txt2obj(ID_ON_DNSSRV_OID, 1), ASN1_OBJECT_free); // for (int i = 0; i < sk_GENERAL_NAME_num(generalNames.get()); ++i) { // GENERAL_NAME* generalName = sk_GENERAL_NAME_value(generalNames.get(), i); // if (generalName->type == GEN_OTHERNAME) { diff --git a/Swiften/TLS/Schannel/SchannelCertificate.h b/Swiften/TLS/Schannel/SchannelCertificate.h index 814f344..d3bd66c 100644 --- a/Swiften/TLS/Schannel/SchannelCertificate.h +++ b/Swiften/TLS/Schannel/SchannelCertificate.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/String.h> #include <Swiften/TLS/Certificate.h> @@ -23,7 +23,7 @@ namespace Swift class SchannelCertificate : public Certificate { public: - typedef boost::shared_ptr<SchannelCertificate> ref; + typedef std::shared_ptr<SchannelCertificate> ref; public: SchannelCertificate(const ScopedCertContext& certCtxt); diff --git a/Swiften/TLS/Schannel/SchannelContext.cpp b/Swiften/TLS/Schannel/SchannelContext.cpp index 7b67f4c..5799157 100644 --- a/Swiften/TLS/Schannel/SchannelContext.cpp +++ b/Swiften/TLS/Schannel/SchannelContext.cpp @@ -61,14 +61,14 @@ void SchannelContext::connect() { if (myCertStore_ == NULL) { myCertStore_ = CertOpenSystemStore(0, certStoreName_.c_str()); if (!myCertStore_) { - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); return; } } pCertContext = findCertificateInStore( myCertStore_, certName_ ); if (pCertContext == NULL) { - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); return; } } @@ -115,7 +115,7 @@ void SchannelContext::connect() { if (status != SEC_E_OK) { // We failed to obtain the credentials handle - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); return; } @@ -158,7 +158,7 @@ void SchannelContext::connect() { if (status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) { // We failed to initialize the security context handleCertError(status); - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); return; } @@ -181,7 +181,7 @@ void SchannelContext::connect() { //------------------------------------------------------------------------ SECURITY_STATUS SchannelContext::validateServerCertificate() { - SchannelCertificate::ref pServerCert = boost::dynamic_pointer_cast<SchannelCertificate>( getPeerCertificate() ); + SchannelCertificate::ref pServerCert = std::dynamic_pointer_cast<SchannelCertificate>( getPeerCertificate() ); if (!pServerCert) { return SEC_E_WRONG_PRINCIPAL; } @@ -359,7 +359,7 @@ void SchannelContext::continueHandshake(const SafeByteArray& data) { else { // We failed to initialize the security context handleCertError(status); - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); return; } } @@ -459,7 +459,7 @@ void SchannelContext::handleDataFromNetwork(const SafeByteArray& data) { //------------------------------------------------------------------------ -void SchannelContext::indicateError(boost::shared_ptr<TLSError> error) { +void SchannelContext::indicateError(std::shared_ptr<TLSError> error) { state_ = Error; receivedData_.clear(); onError(error); @@ -505,15 +505,15 @@ void SchannelContext::decryptAndProcessData(const SafeByteArray& data) { } else if (status == SEC_I_RENEGOTIATE) { // TODO: Handle renegotiation scenarios - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); break; } else if (status == SEC_I_CONTEXT_EXPIRED) { - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); break; } else if (status != SEC_E_OK) { - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); break; } @@ -596,7 +596,7 @@ void SchannelContext::encryptAndSendData(const SafeByteArray& data) { SECURITY_STATUS status = EncryptMessage(contextHandle_, 0, &outBufferDesc, 0); if (status != SEC_E_OK) { - indicateError(boost::make_shared<TLSError>(TLSError::UnknownError)); + indicateError(std::make_shared<TLSError>(TLSError::UnknownError)); return; } @@ -609,7 +609,7 @@ void SchannelContext::encryptAndSendData(const SafeByteArray& data) { //------------------------------------------------------------------------ bool SchannelContext::setClientCertificate(CertificateWithKey::ref certificate) { - boost::shared_ptr<CAPICertificate> capiCertificate = boost::dynamic_pointer_cast<CAPICertificate>(certificate); + std::shared_ptr<CAPICertificate> capiCertificate = std::dynamic_pointer_cast<CAPICertificate>(certificate); if (!capiCertificate || capiCertificate->isNull()) { return false; } @@ -631,7 +631,7 @@ bool SchannelContext::setClientCertificate(CertificateWithKey::ref certificate) //------------------------------------------------------------------------ void SchannelContext::handleCertificateCardRemoved() { if (disconnectOnCardRemoval_) { - indicateError(boost::make_shared<TLSError>(TLSError::CertificateCardRemoved)); + indicateError(std::make_shared<TLSError>(TLSError::CertificateCardRemoved)); } } @@ -647,7 +647,7 @@ std::vector<Certificate::ref> SchannelContext::getPeerCertificateChain() const { if (status != SEC_E_OK) { return certificateChain; } - certificateChain.push_back(boost::make_shared<SchannelCertificate>(pServerCert)); + certificateChain.push_back(std::make_shared<SchannelCertificate>(pServerCert)); pCurrentCert = pServerCert; while(pCurrentCert.GetPointer()) { @@ -656,7 +656,7 @@ std::vector<Certificate::ref> SchannelContext::getPeerCertificateChain() const { if (!(*pIssuerCert.GetPointer())) { break; } - certificateChain.push_back(boost::make_shared<SchannelCertificate>(pIssuerCert)); + certificateChain.push_back(std::make_shared<SchannelCertificate>(pIssuerCert)); pCurrentCert = pIssuerCert; pIssuerCert = NULL; @@ -667,7 +667,7 @@ std::vector<Certificate::ref> SchannelContext::getPeerCertificateChain() const { //------------------------------------------------------------------------ CertificateVerificationError::ref SchannelContext::getPeerCertificateVerificationError() const { - return verificationError_ ? boost::make_shared<CertificateVerificationError>(*verificationError_) : CertificateVerificationError::ref(); + return verificationError_ ? std::make_shared<CertificateVerificationError>(*verificationError_) : CertificateVerificationError::ref(); } //------------------------------------------------------------------------ diff --git a/Swiften/TLS/Schannel/SchannelContext.h b/Swiften/TLS/Schannel/SchannelContext.h index 2c6a3ff..4cb086e 100644 --- a/Swiften/TLS/Schannel/SchannelContext.h +++ b/Swiften/TLS/Schannel/SchannelContext.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2012-2015 Isode Limited. + * Copyright (c) 2012-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -34,7 +34,7 @@ namespace Swift class SchannelContext : public TLSContext, boost::noncopyable { public: - typedef boost::shared_ptr<SchannelContext> sp_t; + typedef std::shared_ptr<SchannelContext> sp_t; public: SchannelContext(bool tls1_0Workaround); @@ -62,9 +62,9 @@ namespace Swift private: void determineStreamSizes(); void continueHandshake(const SafeByteArray& data); - void indicateError(boost::shared_ptr<TLSError> error); + void indicateError(std::shared_ptr<TLSError> error); //FIXME: Remove - void indicateError() {indicateError(boost::make_shared<TLSError>());} + void indicateError() {indicateError(std::make_shared<TLSError>());} void handleCertError(SECURITY_STATUS status) ; void sendDataOnNetwork(const void* pData, size_t dataSize); @@ -104,7 +104,7 @@ namespace Swift std::string certName_; ////Not needed, most likely std::string smartCardReader_; //Can be empty string for non SmartCard certificates - boost::shared_ptr<CAPICertificate> userCertificate_; + std::shared_ptr<CAPICertificate> userCertificate_; bool checkCertificateRevocation_; bool tls1_0Workaround_; bool disconnectOnCardRemoval_; diff --git a/Swiften/TLS/Schannel/SchannelUtil.h b/Swiften/TLS/Schannel/SchannelUtil.h index 194ec35..ec71d9d 100644 --- a/Swiften/TLS/Schannel/SchannelUtil.h +++ b/Swiften/TLS/Schannel/SchannelUtil.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #define SECURITY_WIN32 @@ -92,7 +98,7 @@ namespace Swift } private: - boost::shared_ptr<HandleContext> m_pHandle; + std::shared_ptr<HandleContext> m_pHandle; }; //------------------------------------------------------------------------ @@ -168,7 +174,7 @@ namespace Swift } private: - boost::shared_ptr<HandleContext> m_pHandle; + std::shared_ptr<HandleContext> m_pHandle; }; //------------------------------------------------------------------------ @@ -303,7 +309,7 @@ namespace Swift } private: - boost::shared_ptr<HandleContext> m_pHandle; + std::shared_ptr<HandleContext> m_pHandle; }; //------------------------------------------------------------------------ @@ -420,6 +426,6 @@ namespace Swift } private: - boost::shared_ptr<HandleContext> m_pHandle; + std::shared_ptr<HandleContext> m_pHandle; }; } diff --git a/Swiften/TLS/SecureTransport/SecureTransportCertificate.h b/Swiften/TLS/SecureTransport/SecureTransportCertificate.h index 625c2ae..7faf3be 100644 --- a/Swiften/TLS/SecureTransport/SecureTransportCertificate.h +++ b/Swiften/TLS/SecureTransport/SecureTransportCertificate.h @@ -1,12 +1,13 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> + #include <boost/type_traits.hpp> #include <Security/SecCertificate.h> @@ -34,7 +35,7 @@ private: typedef boost::remove_pointer<SecCertificateRef>::type SecCertificate; private: - boost::shared_ptr<SecCertificate> certificateHandle_; + std::shared_ptr<SecCertificate> certificateHandle_; std::string subjectName_; std::vector<std::string> commonNames_; std::vector<std::string> srvNames_; diff --git a/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm b/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm index ed47f56..db0af89 100644 --- a/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm +++ b/Swiften/TLS/SecureTransport/SecureTransportCertificate.mm @@ -43,7 +43,7 @@ namespace Swift { SecureTransportCertificate::SecureTransportCertificate(SecCertificateRef certificate) { assert(certificate); CFRetain(certificate); - certificateHandle_ = boost::shared_ptr<SecCertificate>(certificate, CFRelease); + certificateHandle_ = std::shared_ptr<SecCertificate>(certificate, CFRelease); parse(); } @@ -53,7 +53,7 @@ SecureTransportCertificate::SecureTransportCertificate(const ByteArray& der) { // certificate will take ownership of derData and free it on its release. SecCertificateRef certificate = SecCertificateCreateWithData(nullptr, derData); if (certificate) { - certificateHandle_ = boost::shared_ptr<SecCertificate>(certificate, CFRelease); + certificateHandle_ = std::shared_ptr<SecCertificate>(certificate, CFRelease); parse(); } } diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.h b/Swiften/TLS/SecureTransport/SecureTransportContext.h index 4d45f52..3942904 100644 --- a/Swiften/TLS/SecureTransport/SecureTransportContext.h +++ b/Swiften/TLS/SecureTransport/SecureTransportContext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -38,16 +38,16 @@ class SecureTransportContext : public TLSContext { static std::string stateToString(State state); void setState(State newState); - static boost::shared_ptr<TLSError> nativeToTLSError(OSStatus error); - boost::shared_ptr<CertificateVerificationError> CSSMErrorToVerificationError(OSStatus resultCode); + static std::shared_ptr<TLSError> nativeToTLSError(OSStatus error); + std::shared_ptr<CertificateVerificationError> CSSMErrorToVerificationError(OSStatus resultCode); void processHandshake(); void verifyServerCertificate(); - void fatalError(boost::shared_ptr<TLSError> error, boost::shared_ptr<CertificateVerificationError> certificateError); + void fatalError(std::shared_ptr<TLSError> error, std::shared_ptr<CertificateVerificationError> certificateError); private: - boost::shared_ptr<SSLContext> sslContext_; + std::shared_ptr<SSLContext> sslContext_; SafeByteArray readingBuffer_; State state_; CertificateVerificationError::ref verificationError_; diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.mm b/Swiften/TLS/SecureTransport/SecureTransportContext.mm index 1c5e3ab..970d270 100644 --- a/Swiften/TLS/SecureTransport/SecureTransportContext.mm +++ b/Swiften/TLS/SecureTransport/SecureTransportContext.mm @@ -39,7 +39,7 @@ namespace { CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) { - boost::shared_ptr<PKCS12Certificate> pkcs12 = boost::dynamic_pointer_cast<PKCS12Certificate>(key); + std::shared_ptr<PKCS12Certificate> pkcs12 = std::dynamic_pointer_cast<PKCS12Certificate>(key); if (!key) { return nullptr; } @@ -104,7 +104,7 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) } SecureTransportContext::SecureTransportContext(bool checkCertificateRevocation) : state_(None), checkCertificateRevocation_(checkCertificateRevocation) { - sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(nullptr, kSSLClientSide, kSSLStreamType), CFRelease); + sslContext_ = std::shared_ptr<SSLContext>(SSLCreateContext(nullptr, kSSLClientSide, kSSLStreamType), CFRelease); OSStatus error = noErr; // set IO callbacks @@ -163,7 +163,7 @@ void SecureTransportContext::connect() { if (clientCertificate_) { CFArrayRef certs = CreateClientCertificateChainAsCFArrayRef(clientCertificate_); if (certs) { - boost::shared_ptr<CFArray> certRefs(certs, CFRelease); + std::shared_ptr<CFArray> certRefs(certs, CFRelease); OSStatus result = SSLSetCertificate(sslContext_.get(), certRefs.get()); if (result != noErr) { SWIFT_LOG(error) << "SSLSetCertificate failed with error " << result << "." << std::endl; @@ -191,7 +191,7 @@ void SecureTransportContext::processHandshake() { } else { SWIFT_LOG(debug) << "Error returned from SSLHandshake call is " << error << "." << std::endl; - fatalError(nativeToTLSError(error), boost::make_shared<CertificateVerificationError>()); + fatalError(nativeToTLSError(error), std::make_shared<CertificateVerificationError>()); } } @@ -203,15 +203,15 @@ void SecureTransportContext::verifyServerCertificate() { SecTrustRef trust = nullptr; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &trust); if (error != noErr) { - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(std::make_shared<TLSError>(), std::make_shared<CertificateVerificationError>()); return; } - boost::shared_ptr<SecTrust> trustRef = boost::shared_ptr<SecTrust>(trust, CFRelease); + std::shared_ptr<SecTrust> trustRef = std::shared_ptr<SecTrust>(trust, CFRelease); if (checkCertificateRevocation_) { error = SecTrustSetOptions(trust, kSecTrustOptionRequireRevPerCert | kSecTrustOptionFetchIssuerFromNet); if (error != noErr) { - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(std::make_shared<TLSError>(), std::make_shared<CertificateVerificationError>()); return; } } @@ -219,7 +219,7 @@ void SecureTransportContext::verifyServerCertificate() { SecTrustResultType trustResult; error = SecTrustEvaluate(trust, &trustResult); if (error != errSecSuccess) { - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(std::make_shared<TLSError>(), std::make_shared<CertificateVerificationError>()); return; } @@ -242,7 +242,7 @@ void SecureTransportContext::verifyServerCertificate() { CSSM_TP_APPLE_EVIDENCE_INFO* statusChain; error = SecTrustGetResult(trustRef.get(), &trustResult, &certChain, &statusChain); if (error == errSecSuccess) { - boost::shared_ptr<CFArray> certChainRef = boost::shared_ptr<CFArray>(certChain, CFRelease); + std::shared_ptr<CFArray> certChainRef = std::shared_ptr<CFArray>(certChain, CFRelease); for (CFIndex index = 0; index < CFArrayGetCount(certChainRef.get()); index++) { for (CFIndex n = 0; n < statusChain[index].NumStatusCodes; n++) { // Even though Secure Transport reported CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK on the whole certificate @@ -259,11 +259,11 @@ void SecureTransportContext::verifyServerCertificate() { } } else { - verificationError_ = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); + verificationError_ = std::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); } break; case kSecTrustResultOtherError: - verificationError_ = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); + verificationError_ = std::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); break; default: SWIFT_LOG(warning) << "Unhandled trust result " << trustResult << "." << std::endl; @@ -321,7 +321,7 @@ void SecureTransportContext::handleDataFromNetwork(const SafeByteArray& data) { } else { SWIFT_LOG(error) << "SSLRead failed with error " << error << ", read bytes: " << bytesRead << "." << std::endl; - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(std::make_shared<TLSError>(), std::make_shared<CertificateVerificationError>()); return; } @@ -353,7 +353,7 @@ void SecureTransportContext::handleDataFromApplication(const SafeByteArray& data return; default: SWIFT_LOG(warning) << "SSLWrite returned error code: " << error << ", processed bytes: " << processedBytes << std::endl; - fatalError(boost::make_shared<TLSError>(), boost::shared_ptr<CertificateVerificationError>()); + fatalError(std::make_shared<TLSError>(), std::shared_ptr<CertificateVerificationError>()); } } @@ -362,18 +362,18 @@ std::vector<Certificate::ref> SecureTransportContext::getPeerCertificateChain() if (sslContext_) { typedef boost::remove_pointer<SecTrustRef>::type SecTrust; - boost::shared_ptr<SecTrust> securityTrust; + std::shared_ptr<SecTrust> securityTrust; SecTrustRef secTrust = nullptr;; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &secTrust); if (error == noErr) { - securityTrust = boost::shared_ptr<SecTrust>(secTrust, CFRelease); + securityTrust = std::shared_ptr<SecTrust>(secTrust, CFRelease); CFIndex chainSize = SecTrustGetCertificateCount(securityTrust.get()); for (CFIndex n = 0; n < chainSize; n++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(securityTrust.get(), n); if (certificate) { - peerCertificateChain.push_back(boost::make_shared<SecureTransportCertificate>(certificate)); + peerCertificateChain.push_back(std::make_shared<SecureTransportCertificate>(certificate)); } } } @@ -431,30 +431,30 @@ OSStatus SecureTransportContext::SSLSocketWriteCallback(SSLConnectionRef connect return retValue; } -boost::shared_ptr<TLSError> SecureTransportContext::nativeToTLSError(OSStatus /* error */) { - boost::shared_ptr<TLSError> swiftenError; - swiftenError = boost::make_shared<TLSError>(); +std::shared_ptr<TLSError> SecureTransportContext::nativeToTLSError(OSStatus /* error */) { + std::shared_ptr<TLSError> swiftenError; + swiftenError = std::make_shared<TLSError>(); return swiftenError; } -boost::shared_ptr<CertificateVerificationError> SecureTransportContext::CSSMErrorToVerificationError(OSStatus resultCode) { - boost::shared_ptr<CertificateVerificationError> error; +std::shared_ptr<CertificateVerificationError> SecureTransportContext::CSSMErrorToVerificationError(OSStatus resultCode) { + std::shared_ptr<CertificateVerificationError> error; switch(resultCode) { case CSSMERR_TP_NOT_TRUSTED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_NOT_TRUSTED" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::Untrusted); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Untrusted); break; case CSSMERR_TP_CERT_NOT_VALID_YET: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_NOT_VALID_YET" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::NotYetValid); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::NotYetValid); break; case CSSMERR_TP_CERT_EXPIRED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_EXPIRED" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::Expired); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Expired); break; case CSSMERR_TP_CERT_REVOKED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_REVOKED" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::Revoked); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Revoked); break; case CSSMERR_TP_VERIFY_ACTION_FAILED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_VERIFY_ACTION_FAILED" << std::endl; @@ -462,28 +462,28 @@ boost::shared_ptr<CertificateVerificationError> SecureTransportContext::CSSMErro case CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK" << std::endl; if (checkCertificateRevocation_) { - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); } break; case CSSMERR_APPLETP_OCSP_UNAVAILABLE: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_OCSP_UNAVAILABLE" << std::endl; if (checkCertificateRevocation_) { - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); } break; case CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidPurpose); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidPurpose); break; default: SWIFT_LOG(warning) << "unhandled CSSM error: " << resultCode << ", CSSM_TP_BASE_TP_ERROR: " << CSSM_TP_BASE_TP_ERROR << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); + error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); break; } return error; } -void SecureTransportContext::fatalError(boost::shared_ptr<TLSError> error, boost::shared_ptr<CertificateVerificationError> certificateError) { +void SecureTransportContext::fatalError(std::shared_ptr<TLSError> error, std::shared_ptr<CertificateVerificationError> certificateError) { setState(Error); if (sslContext_) { SSLClose(sslContext_.get()); diff --git a/Swiften/TLS/ServerIdentityVerifier.h b/Swiften/TLS/ServerIdentityVerifier.h index ca92180..f40c683 100644 --- a/Swiften/TLS/ServerIdentityVerifier.h +++ b/Swiften/TLS/ServerIdentityVerifier.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> #include <Swiften/TLS/Certificate.h> diff --git a/Swiften/TLS/SimpleCertificate.h b/Swiften/TLS/SimpleCertificate.h index 4dbf847..08cf1e3 100644 --- a/Swiften/TLS/SimpleCertificate.h +++ b/Swiften/TLS/SimpleCertificate.h @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API SimpleCertificate : public Certificate { public: - typedef boost::shared_ptr<SimpleCertificate> ref; + typedef std::shared_ptr<SimpleCertificate> ref; void setSubjectName(const std::string& name) { subjectName = name; diff --git a/Swiften/TLS/TLSContext.h b/Swiften/TLS/TLSContext.h index d7b33d4..b0d9296 100644 --- a/Swiften/TLS/TLSContext.h +++ b/Swiften/TLS/TLSContext.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/SafeByteArray.h> @@ -38,7 +38,7 @@ namespace Swift { public: boost::signal<void (const SafeByteArray&)> onDataForNetwork; boost::signal<void (const SafeByteArray&)> onDataForApplication; - boost::signal<void (boost::shared_ptr<TLSError>)> onError; + boost::signal<void (std::shared_ptr<TLSError>)> onError; boost::signal<void ()> onConnected; }; } diff --git a/Swiften/TLS/TLSError.h b/Swiften/TLS/TLSError.h index bed5be9..ae775e6 100644 --- a/Swiften/TLS/TLSError.h +++ b/Swiften/TLS/TLSError.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> @@ -14,7 +14,7 @@ namespace Swift { class SWIFTEN_API TLSError : public Error { public: - typedef boost::shared_ptr<TLSError> ref; + typedef std::shared_ptr<TLSError> ref; enum Type { UnknownError, diff --git a/Swiften/TLS/UnitTest/CertificateTest.cpp b/Swiften/TLS/UnitTest/CertificateTest.cpp index f7bb93e..2483dae 100644 --- a/Swiften/TLS/UnitTest/CertificateTest.cpp +++ b/Swiften/TLS/UnitTest/CertificateTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -24,10 +24,10 @@ class CertificateTest : public CppUnit::TestFixture { public: void testGetSHA1Fingerprint() { - SimpleCertificate::ref testling = boost::make_shared<SimpleCertificate>(); + SimpleCertificate::ref testling = std::make_shared<SimpleCertificate>(); testling->setDER(createByteArray("abcdefg")); - CPPUNIT_ASSERT_EQUAL(std::string("2f:b5:e1:34:19:fc:89:24:68:65:e7:a3:24:f4:76:ec:62:4e:87:40"), Certificate::getSHA1Fingerprint(testling, boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()).get())); + CPPUNIT_ASSERT_EQUAL(std::string("2f:b5:e1:34:19:fc:89:24:68:65:e7:a3:24:f4:76:ec:62:4e:87:40"), Certificate::getSHA1Fingerprint(testling, std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()).get())); } }; diff --git a/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp b/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp index 1fe936d..30fe423 100644 --- a/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp +++ b/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp @@ -39,7 +39,7 @@ class ServerIdentityVerifierTest : public CppUnit::TestFixture { public: void setUp() { - idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + idnConverter = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); } void testCertificateVerifies_WithoutMatchingDNSName() { @@ -172,7 +172,7 @@ class ServerIdentityVerifierTest : public CppUnit::TestFixture { CPPUNIT_ASSERT(!testling.certificateVerifies(certificate)); } - boost::shared_ptr<IDNConverter> idnConverter; + std::shared_ptr<IDNConverter> idnConverter; }; CPPUNIT_TEST_SUITE_REGISTRATION(ServerIdentityVerifierTest); diff --git a/Swiften/VCards/GetVCardRequest.h b/Swiften/VCards/GetVCardRequest.h index 5d6fc17..1b575c0 100644 --- a/Swiften/VCards/GetVCardRequest.h +++ b/Swiften/VCards/GetVCardRequest.h @@ -13,14 +13,14 @@ namespace Swift { class SWIFTEN_API GetVCardRequest : public GenericRequest<VCard> { public: - typedef boost::shared_ptr<GetVCardRequest> ref; + typedef std::shared_ptr<GetVCardRequest> ref; static ref create(const JID& jid, IQRouter* router) { return ref(new GetVCardRequest(jid, router)); } private: - GetVCardRequest(const JID& jid, IQRouter* router) : GenericRequest<VCard>(IQ::Get, jid, boost::shared_ptr<Payload>(new VCard()), router) { + GetVCardRequest(const JID& jid, IQRouter* router) : GenericRequest<VCard>(IQ::Get, jid, std::make_shared<VCard>(), router) { } }; } diff --git a/Swiften/VCards/SetVCardRequest.h b/Swiften/VCards/SetVCardRequest.h index b9621ab..15cc78b 100644 --- a/Swiften/VCards/SetVCardRequest.h +++ b/Swiften/VCards/SetVCardRequest.h @@ -13,7 +13,7 @@ namespace Swift { class SWIFTEN_API SetVCardRequest : public GenericRequest<VCard> { public: - typedef boost::shared_ptr<SetVCardRequest> ref; + typedef std::shared_ptr<SetVCardRequest> ref; static ref create(VCard::ref vcard, IQRouter* router) { return ref(new SetVCardRequest(vcard, router)); diff --git a/Swiften/VCards/UnitTest/VCardManagerTest.cpp b/Swiften/VCards/UnitTest/VCardManagerTest.cpp index 3784c6c..3d5338d 100644 --- a/Swiften/VCards/UnitTest/VCardManagerTest.cpp +++ b/Swiften/VCards/UnitTest/VCardManagerTest.cpp @@ -1,13 +1,13 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <memory> #include <vector> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -41,7 +41,7 @@ class VCardManagerTest : public CppUnit::TestFixture { changes.clear(); ownChanges.clear(); ownJID = JID("baz@fum.com/dum"); - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); vcardStorage = new VCardMemoryStorage(crypto.get()); @@ -54,7 +54,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testGet_NewVCardRequestsVCard() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); VCard::ref result = testling->getVCardAndRequestWhenNeeded(JID("foo@bar.com/baz")); CPPUNIT_ASSERT(!result); @@ -63,7 +63,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testGet_ExistingVCard() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); VCard::ref vcard(new VCard()); vcard->setFullName("Foo Bar"); vcardStorage->setVCard(JID("foo@bar.com/baz"), vcard); @@ -75,7 +75,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testRequest_RequestsVCard() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); testling->requestVCard(JID("foo@bar.com/baz")); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel->sentStanzas.size())); @@ -83,7 +83,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testRequest_ReceiveEmitsNotification() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); testling->requestVCard(JID("foo@bar.com/baz")); stanzaChannel->onIQReceived(createVCardResult()); @@ -96,7 +96,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testRequest_Error() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); testling->requestVCard(JID("foo@bar.com/baz")); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); @@ -105,7 +105,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testRequest_VCardAlreadyRequested() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); testling->requestVCard(JID("foo@bar.com/baz")); VCard::ref result = testling->getVCardAndRequestWhenNeeded(JID("foo@bar.com/baz")); @@ -114,7 +114,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testRequest_AfterPreviousRequest() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); testling->requestVCard(JID("foo@bar.com/baz")); stanzaChannel->onIQReceived(createVCardResult()); testling->requestVCard(JID("foo@bar.com/baz")); @@ -124,7 +124,7 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testRequestOwnVCard() { - boost::shared_ptr<VCardManager> testling = createManager(); + std::shared_ptr<VCardManager> testling = createManager(); testling->requestVCard(ownJID); stanzaChannel->onIQReceived(createOwnVCardResult()); @@ -140,8 +140,8 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testCreateSetVCardRequest() { - boost::shared_ptr<VCardManager> testling = createManager(); - VCard::ref vcard = boost::make_shared<VCard>(); + std::shared_ptr<VCardManager> testling = createManager(); + VCard::ref vcard = std::make_shared<VCard>(); vcard->setFullName("New Name"); SetVCardRequest::ref request = testling->createSetVCardRequest(vcard); request->send(); @@ -154,8 +154,8 @@ class VCardManagerTest : public CppUnit::TestFixture { } void testCreateSetVCardRequest_Error() { - boost::shared_ptr<VCardManager> testling = createManager(); - VCard::ref vcard = boost::make_shared<VCard>(); + std::shared_ptr<VCardManager> testling = createManager(); + VCard::ref vcard = std::make_shared<VCard>(); vcard->setFullName("New Name"); SetVCardRequest::ref request = testling->createSetVCardRequest(vcard); request->send(); @@ -166,8 +166,8 @@ class VCardManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<VCardManager> createManager() { - boost::shared_ptr<VCardManager> manager(new VCardManager(ownJID, iqRouter, vcardStorage)); + std::shared_ptr<VCardManager> createManager() { + std::shared_ptr<VCardManager> manager(new VCardManager(ownJID, iqRouter, vcardStorage)); manager->onVCardChanged.connect(boost::bind(&VCardManagerTest::handleVCardChanged, this, _1, _2)); manager->onOwnVCardChanged.connect(boost::bind(&VCardManagerTest::handleOwnVCardChanged, this, _1)); return manager; @@ -205,7 +205,7 @@ class VCardManagerTest : public CppUnit::TestFixture { VCardMemoryStorage* vcardStorage; std::vector< std::pair<JID, VCard::ref> > changes; std::vector<VCard::ref> ownChanges; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(VCardManagerTest); diff --git a/Swiften/VCards/VCardMemoryStorage.h b/Swiften/VCards/VCardMemoryStorage.h index d4df639..9a79edc 100644 --- a/Swiften/VCards/VCardMemoryStorage.h +++ b/Swiften/VCards/VCardMemoryStorage.h @@ -7,8 +7,7 @@ #pragma once #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> diff --git a/Swiften/VCards/VCardStorage.h b/Swiften/VCards/VCardStorage.h index 7314559..632e9e3 100644 --- a/Swiften/VCards/VCardStorage.h +++ b/Swiften/VCards/VCardStorage.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Elements/VCard.h> diff --git a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp index 206e10b..462bf21 100644 --- a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp @@ -12,7 +12,7 @@ #include <Swiften/Whiteboard/IncomingWhiteboardSession.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h> @@ -27,8 +27,8 @@ namespace Swift { } void IncomingWhiteboardSession::accept() { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionAccept); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionAccept); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); onRequestAccepted(toJID_); } @@ -43,7 +43,7 @@ namespace Swift { } if (pairResult.server) { - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(pairResult.server); sendPayload(payload); } @@ -57,7 +57,7 @@ namespace Swift { WhiteboardOperation::ref result = client.handleLocalOperationReceived(operation); if (result) { - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(result); sendPayload(payload); } diff --git a/Swiften/Whiteboard/IncomingWhiteboardSession.h b/Swiften/Whiteboard/IncomingWhiteboardSession.h index f6c1f49..0f43cea 100644 --- a/Swiften/Whiteboard/IncomingWhiteboardSession.h +++ b/Swiften/Whiteboard/IncomingWhiteboardSession.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Whiteboard/WhiteboardClient.h> @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API IncomingWhiteboardSession : public WhiteboardSession { public: - typedef boost::shared_ptr<IncomingWhiteboardSession> ref; + typedef std::shared_ptr<IncomingWhiteboardSession> ref; public: IncomingWhiteboardSession(const JID& jid, IQRouter* router); diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp index 2bfc434..49f48aa 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp @@ -12,8 +12,9 @@ #include <Swiften/Whiteboard/OutgoingWhiteboardSession.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h> @@ -28,13 +29,13 @@ namespace Swift { } void OutgoingWhiteboardSession::startSession() { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionRequest); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionRequest); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->onResponse.connect(boost::bind(&OutgoingWhiteboardSession::handleRequestResponse, this, _1, _2)); request->send(); } - void OutgoingWhiteboardSession::handleRequestResponse(boost::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error) { + void OutgoingWhiteboardSession::handleRequestResponse(std::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error) { if (error) { onRequestRejected(toJID_); } @@ -47,7 +48,7 @@ namespace Swift { } lastOpID = op->getID(); - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(op); sendPayload(payload); } @@ -58,7 +59,7 @@ namespace Swift { lastOpID = operation->getID(); server.handleLocalOperationReceived(operation); - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(operation); sendPayload(payload); } diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.h b/Swiften/Whiteboard/OutgoingWhiteboardSession.h index dd8623a..52fb1db 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.h +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Queries/GenericRequest.h> @@ -22,7 +22,7 @@ namespace Swift { class SWIFTEN_API OutgoingWhiteboardSession : public WhiteboardSession { public: - typedef boost::shared_ptr<OutgoingWhiteboardSession> ref; + typedef std::shared_ptr<OutgoingWhiteboardSession> ref; public: OutgoingWhiteboardSession(const JID& jid, IQRouter* router); @@ -30,7 +30,7 @@ namespace Swift { void startSession(); private: - void handleRequestResponse(boost::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error); + void handleRequestResponse(std::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error); void handleIncomingOperation(WhiteboardOperation::ref operation); void sendOperation(WhiteboardOperation::ref operation); diff --git a/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp b/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp index 9534c60..fd26825 100644 --- a/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp +++ b/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp @@ -11,7 +11,7 @@ */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -46,7 +46,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -54,7 +54,7 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); WhiteboardInsertOperation::ref result; checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); @@ -63,7 +63,7 @@ public: //so it have to be transformed against local operations and then transformed value can //be returned to draw serverOp = createInsertOperation("b", "0", 1); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(bElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "b", "a", 2, bElement); @@ -82,7 +82,7 @@ public: //but operation returned to send to the server should be parented off last server //operation, which is "b" clientOp = createInsertOperation("c", "b", 3); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(cElement); checkOperation(client.handleLocalOperationReceived(clientOp), "c", "a", 3, cElement); @@ -123,21 +123,21 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists //in server history and client doesn't wait for any operation ack from server, //so this operation could be send WhiteboardInsertOperation::ref clientOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(cElement); checkOperation(client.handleLocalOperationReceived(clientOp), "c", "0", 1, cElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("d", "c", 2); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(dElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -162,11 +162,11 @@ public: //the end of local history so it doesn't have to be transformed, so operation //to pass to window should be the same serverOp = createInsertOperation("e", "d", 3); - WhiteboardEllipseElement::ref eElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref eElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(eElement); pairResult = client.handleServerOperationReceived(serverOp); - WhiteboardInsertOperation::ref result = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + WhiteboardInsertOperation::ref result = std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); @@ -196,7 +196,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -204,14 +204,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("b", "a", 2); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -219,7 +219,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 3, cElement); @@ -230,7 +230,7 @@ public: //"c" existing in local history. //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("d", "c", 2); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "c", 4, dElement); @@ -282,7 +282,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -290,14 +290,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("b", "a", 2); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -305,7 +305,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 3, cElement); @@ -314,7 +314,7 @@ public: //Client receives new local operation, client is still waiting for ack so, it //should return nothing clientOp = createInsertOperation("e", "a", 4); - WhiteboardEllipseElement::ref eElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref eElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(eElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -322,7 +322,7 @@ public: //against result of previous transformations and operation "e", returned operation should //be parented off "e", which was last local operation serverOp = createInsertOperation("d", "c", 2); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "e", 5, dElement); @@ -383,7 +383,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -391,14 +391,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("b", "a", 2); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -406,7 +406,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 3, cElement); @@ -425,7 +425,7 @@ public: //against result of previous transformation(but only with transformation of "b"), returned //operation should be parented off "c", which was last local operation serverOp = createInsertOperation("d", "a", 3); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "c", 4, dElement); @@ -471,7 +471,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -479,14 +479,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. WhiteboardUpdateOperation::ref clientUpdateOp = createUpdateOperation("b", "a", 0); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientUpdateOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientUpdateOp)); @@ -494,7 +494,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server WhiteboardUpdateOperation::ref serverUpdateOp = createUpdateOperation("c", "0", 0); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverUpdateOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverUpdateOp); checkOperation(pairResult.client, "c", "b", 0, cElement); @@ -505,7 +505,7 @@ public: //"c" existing in local history. //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("d", "c", 1); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "c", 2, dElement); @@ -556,12 +556,12 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); serverOp = createInsertOperation("1", "0", 1); pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists //in server history and client doesn't wait for any operation ack from server, @@ -570,7 +570,7 @@ public: WhiteboardUpdateOperation::ref clientUpdateOp; WhiteboardDeleteOperation::ref clientDeleteOp; clientUpdateOp = createUpdateOperation("a", "1", 0); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientUpdateOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientUpdateOp), "a", "1", 0, aElement); @@ -583,7 +583,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "1", 2); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 1, cElement); @@ -594,7 +594,7 @@ public: //"c" existing in local history. //Because client is waiting for ack of "a", there is no operation to send to server WhiteboardUpdateOperation::ref serverUpdateOp = createUpdateOperation("d", "c", 0); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverUpdateOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverUpdateOp); checkOperation(pairResult.client, "d", "c", 0, dElement); @@ -636,7 +636,7 @@ public: WhiteboardInsertOperation::ref createInsertOperation(std::string id, std::string parent, int pos) { - WhiteboardInsertOperation::ref operation = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref operation = std::make_shared<WhiteboardInsertOperation>(); operation->setParentID(parent); operation->setID(id); operation->setPos(pos); @@ -644,7 +644,7 @@ public: } WhiteboardUpdateOperation::ref createUpdateOperation(std::string id, std::string parent, int pos) { - WhiteboardUpdateOperation::ref operation = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref operation = std::make_shared<WhiteboardUpdateOperation>(); operation->setParentID(parent); operation->setID(id); operation->setPos(pos); @@ -652,7 +652,7 @@ public: } WhiteboardDeleteOperation::ref createDeleteOperation(std::string id, std::string parent, int pos) { - WhiteboardDeleteOperation::ref operation = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref operation = std::make_shared<WhiteboardDeleteOperation>(); operation->setParentID(parent); operation->setID(id); operation->setPos(pos); @@ -667,12 +667,12 @@ public: } if (element) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { CPPUNIT_ASSERT_EQUAL(element, insertOp->getElement()); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { CPPUNIT_ASSERT_EQUAL(element, updateOp->getElement()); } diff --git a/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp b/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp index 58b8c19..e868968 100644 --- a/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp +++ b/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp @@ -11,7 +11,7 @@ */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -34,44 +34,44 @@ class WhiteboardServerTest : public CppUnit::TestFixture { public: void testSimpleOp() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardInsertOperation::ref serverOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("b"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - WhiteboardInsertOperation::ref clientOp = boost::make_shared<WhiteboardInsertOperation>(); - WhiteboardEllipseElement::ref clientElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardInsertOperation::ref clientOp = std::make_shared<WhiteboardInsertOperation>(); + WhiteboardEllipseElement::ref clientElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setID("a"); clientOp->setParentID("0"); clientOp->setPos(1); clientOp->setElement(clientElement); - WhiteboardInsertOperation::ref op = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardInsertOperation::ref op = std::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("b"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("a"), op->getID()); CPPUNIT_ASSERT_EQUAL(1, op->getPos()); - CPPUNIT_ASSERT_EQUAL(clientElement, boost::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); + CPPUNIT_ASSERT_EQUAL(clientElement, std::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); } void testSimpleOp1() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardDeleteOperation::ref serverOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref serverOp = std::make_shared<WhiteboardDeleteOperation>(); serverOp->setID("b"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - WhiteboardUpdateOperation::ref clientOp = boost::make_shared<WhiteboardUpdateOperation>(); - WhiteboardEllipseElement::ref clientElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardUpdateOperation::ref clientOp = std::make_shared<WhiteboardUpdateOperation>(); + WhiteboardEllipseElement::ref clientElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setID("a"); clientOp->setParentID("0"); clientOp->setPos(1); clientOp->setElement(clientElement); - WhiteboardDeleteOperation::ref op = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardDeleteOperation::ref op = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("b"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("a"), op->getID()); CPPUNIT_ASSERT_EQUAL(-1, op->getPos()); @@ -79,19 +79,19 @@ public: void testSimpleOp2() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardUpdateOperation::ref serverOp = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref serverOp = std::make_shared<WhiteboardUpdateOperation>(); serverOp->setID("b"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - WhiteboardDeleteOperation::ref clientOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref clientOp = std::make_shared<WhiteboardDeleteOperation>(); clientOp->setID("a"); clientOp->setParentID("0"); clientOp->setPos(1); - WhiteboardDeleteOperation::ref op = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardDeleteOperation::ref op = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("b"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("a"), op->getID()); CPPUNIT_ASSERT_EQUAL(1, op->getPos()); @@ -100,35 +100,35 @@ public: void testFewSimpleOps() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardInsertOperation::ref serverOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("a"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - serverOp = boost::make_shared<WhiteboardInsertOperation>(); + serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("b"); serverOp->setParentID("a"); serverOp->setPos(2); server.handleLocalOperationReceived(serverOp); - serverOp = boost::make_shared<WhiteboardInsertOperation>(); + serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("c"); serverOp->setParentID("b"); serverOp->setPos(3); server.handleLocalOperationReceived(serverOp); - WhiteboardInsertOperation::ref clientOp = boost::make_shared<WhiteboardInsertOperation>(); - WhiteboardEllipseElement::ref clientElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardInsertOperation::ref clientOp = std::make_shared<WhiteboardInsertOperation>(); + WhiteboardEllipseElement::ref clientElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setID("d"); clientOp->setParentID("0"); clientOp->setPos(1); clientOp->setElement(clientElement); - WhiteboardInsertOperation::ref op = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardInsertOperation::ref op = std::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("c"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("d"), op->getID()); CPPUNIT_ASSERT_EQUAL(1, op->getPos()); - CPPUNIT_ASSERT_EQUAL(clientElement, boost::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); + CPPUNIT_ASSERT_EQUAL(clientElement, std::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); } }; diff --git a/Swiften/Whiteboard/WhiteboardClient.cpp b/Swiften/Whiteboard/WhiteboardClient.cpp index f272a8c..d7ed3ad 100644 --- a/Swiften/Whiteboard/WhiteboardClient.cpp +++ b/Swiften/Whiteboard/WhiteboardClient.cpp @@ -13,8 +13,7 @@ #include <Swiften/Whiteboard/WhiteboardClient.h> #include <iostream> - -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Whiteboard/WhiteboardTransformer.h> @@ -23,17 +22,17 @@ namespace Swift { localOperations_.push_back(operation); WhiteboardOperation::ref op; - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { - op = boost::make_shared<WhiteboardInsertOperation>(*insertOp); + op = std::make_shared<WhiteboardInsertOperation>(*insertOp); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { - op = boost::make_shared<WhiteboardUpdateOperation>(*updateOp); + op = std::make_shared<WhiteboardUpdateOperation>(*updateOp); } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); if (deleteOp) { - op = boost::make_shared<WhiteboardDeleteOperation>(*deleteOp); + op = std::make_shared<WhiteboardDeleteOperation>(*deleteOp); } if (!bridge_.empty()) { @@ -43,17 +42,17 @@ namespace Swift { if (lastSentOperationID_.empty()) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { - op = boost::make_shared<WhiteboardInsertOperation>(*insertOp); + op = std::make_shared<WhiteboardInsertOperation>(*insertOp); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { - op = boost::make_shared<WhiteboardUpdateOperation>(*updateOp); + op = std::make_shared<WhiteboardUpdateOperation>(*updateOp); } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); if (deleteOp) { - op = boost::make_shared<WhiteboardDeleteOperation>(*deleteOp); + op = std::make_shared<WhiteboardDeleteOperation>(*deleteOp); } diff --git a/Swiften/Whiteboard/WhiteboardResponder.cpp b/Swiften/Whiteboard/WhiteboardResponder.cpp index b0b3e6c..f9df709 100644 --- a/Swiften/Whiteboard/WhiteboardResponder.cpp +++ b/Swiften/Whiteboard/WhiteboardResponder.cpp @@ -12,7 +12,7 @@ #include <Swiften/Whiteboard/WhiteboardResponder.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Whiteboard/IncomingWhiteboardSession.h> @@ -23,17 +23,17 @@ namespace Swift { WhiteboardResponder::WhiteboardResponder(WhiteboardSessionManager* sessionManager, IQRouter* router) : SetResponder<WhiteboardPayload>(router), sessionManager_(sessionManager), router_(router) { } - bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, boost::shared_ptr<WhiteboardPayload> payload) { + bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, std::shared_ptr<WhiteboardPayload> payload) { if (payload->getType() == WhiteboardPayload::SessionRequest) { if (sessionManager_->getSession(from)) { sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel); } else { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); - IncomingWhiteboardSession::ref session = boost::make_shared<IncomingWhiteboardSession>(from, router_); + sendResponse(from, id, std::shared_ptr<WhiteboardPayload>()); + IncomingWhiteboardSession::ref session = std::make_shared<IncomingWhiteboardSession>(from, router_); sessionManager_->handleIncomingSession(session); } } else { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); + sendResponse(from, id, std::shared_ptr<WhiteboardPayload>()); WhiteboardSession::ref session = sessionManager_->getSession(from); if (session != nullptr) { session->handleIncomingAction(payload); diff --git a/Swiften/Whiteboard/WhiteboardResponder.h b/Swiften/Whiteboard/WhiteboardResponder.h index 0821a9f..ac44664 100644 --- a/Swiften/Whiteboard/WhiteboardResponder.h +++ b/Swiften/Whiteboard/WhiteboardResponder.h @@ -23,7 +23,7 @@ namespace Swift { class SWIFTEN_API WhiteboardResponder : public SetResponder<WhiteboardPayload> { public: WhiteboardResponder(WhiteboardSessionManager* sessionManager, IQRouter* router); - bool handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, boost::shared_ptr<WhiteboardPayload> payload); + bool handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, std::shared_ptr<WhiteboardPayload> payload); private: WhiteboardSessionManager* sessionManager_; diff --git a/Swiften/Whiteboard/WhiteboardSession.cpp b/Swiften/Whiteboard/WhiteboardSession.cpp index 23ca312..befef4f 100644 --- a/Swiften/Whiteboard/WhiteboardSession.cpp +++ b/Swiften/Whiteboard/WhiteboardSession.cpp @@ -13,8 +13,7 @@ #include <Swiften/Whiteboard/WhiteboardSession.h> #include <iostream> - -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/ErrorPayload.h> #include <Swiften/Elements/WhiteboardPayload.h> @@ -27,7 +26,7 @@ namespace Swift { WhiteboardSession::~WhiteboardSession() { } - void WhiteboardSession::handleIncomingAction(boost::shared_ptr<WhiteboardPayload> payload) { + void WhiteboardSession::handleIncomingAction(std::shared_ptr<WhiteboardPayload> payload) { switch (payload->getType()) { case WhiteboardPayload::Data: handleIncomingOperation(payload->getOperation()); @@ -48,21 +47,21 @@ namespace Swift { } void WhiteboardSession::sendElement(const WhiteboardElement::ref element) { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(); payload->setElement(element); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } - void WhiteboardSession::sendPayload(boost::shared_ptr<WhiteboardPayload> payload) { - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + void WhiteboardSession::sendPayload(std::shared_ptr<WhiteboardPayload> payload) { + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } void WhiteboardSession::cancel() { if (router_->isAvailable()) { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionTerminate); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionTerminate); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } onSessionTerminated(toJID_); diff --git a/Swiften/Whiteboard/WhiteboardSession.h b/Swiften/Whiteboard/WhiteboardSession.h index da927b3..63d9670 100644 --- a/Swiften/Whiteboard/WhiteboardSession.h +++ b/Swiften/Whiteboard/WhiteboardSession.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/IDGenerator.h> @@ -29,12 +29,12 @@ namespace Swift { class SWIFTEN_API WhiteboardSession { public: - typedef boost::shared_ptr<WhiteboardSession> ref; + typedef std::shared_ptr<WhiteboardSession> ref; public: WhiteboardSession(const JID& jid, IQRouter* router); virtual ~WhiteboardSession(); - void handleIncomingAction(boost::shared_ptr<WhiteboardPayload> payload); + void handleIncomingAction(std::shared_ptr<WhiteboardPayload> payload); void sendElement(const WhiteboardElement::ref element); virtual void sendOperation(WhiteboardOperation::ref operation) = 0; void cancel(); @@ -51,7 +51,7 @@ namespace Swift { virtual void handleIncomingOperation(WhiteboardOperation::ref operation) = 0; protected: - void sendPayload(boost::shared_ptr<WhiteboardPayload> payload); + void sendPayload(std::shared_ptr<WhiteboardPayload> payload); JID toJID_; IQRouter* router_; diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.cpp b/Swiften/Whiteboard/WhiteboardSessionManager.cpp index 36f02cc..66b5ef8 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.cpp +++ b/Swiften/Whiteboard/WhiteboardSessionManager.cpp @@ -13,8 +13,9 @@ #include <Swiften/Whiteboard/WhiteboardSessionManager.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Disco/EntityCapsProvider.h> @@ -37,7 +38,7 @@ namespace Swift { WhiteboardSession::ref WhiteboardSessionManager::getSession(const JID& to) { if (sessions_.find(to) == sessions_.end()) { - return boost::shared_ptr<WhiteboardSession>(); + return std::shared_ptr<WhiteboardSession>(); } return sessions_[to]; } @@ -47,7 +48,7 @@ namespace Swift { if (fullJID.isBare()) { fullJID = getFullJID(fullJID); } - OutgoingWhiteboardSession::ref session = boost::make_shared<OutgoingWhiteboardSession>(fullJID, router_); + OutgoingWhiteboardSession::ref session = std::make_shared<OutgoingWhiteboardSession>(fullJID, router_); sessions_[fullJID] = session; session->onSessionTerminated.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); session->onRequestRejected.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.h b/Swiften/Whiteboard/WhiteboardSessionManager.h index 44ec087..44ce14a 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.h +++ b/Swiften/Whiteboard/WhiteboardSessionManager.h @@ -50,7 +50,7 @@ namespace Swift { void deleteSessionEntry(const JID& contact); private: - std::map<JID, boost::shared_ptr<WhiteboardSession> > sessions_; + std::map<JID, std::shared_ptr<WhiteboardSession> > sessions_; IQRouter* router_; StanzaChannel* stanzaChannel_; PresenceOracle* presenceOracle_; diff --git a/Swiften/Whiteboard/WhiteboardTransformer.cpp b/Swiften/Whiteboard/WhiteboardTransformer.cpp index 40e364b..1d519f4 100644 --- a/Swiften/Whiteboard/WhiteboardTransformer.cpp +++ b/Swiften/Whiteboard/WhiteboardTransformer.cpp @@ -12,16 +12,16 @@ #include <Swiften/Whiteboard/WhiteboardTransformer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardOperation::ref clientOp, WhiteboardOperation::ref serverOp) { - WhiteboardInsertOperation::ref clientInsert = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(clientOp); - WhiteboardInsertOperation::ref serverInsert = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(serverOp); - WhiteboardUpdateOperation::ref clientUpdate = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(clientOp); - WhiteboardUpdateOperation::ref serverUpdate = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(serverOp); - WhiteboardDeleteOperation::ref clientDelete = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(clientOp); - WhiteboardDeleteOperation::ref serverDelete = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(serverOp); + WhiteboardInsertOperation::ref clientInsert = std::dynamic_pointer_cast<WhiteboardInsertOperation>(clientOp); + WhiteboardInsertOperation::ref serverInsert = std::dynamic_pointer_cast<WhiteboardInsertOperation>(serverOp); + WhiteboardUpdateOperation::ref clientUpdate = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(clientOp); + WhiteboardUpdateOperation::ref serverUpdate = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(serverOp); + WhiteboardDeleteOperation::ref clientDelete = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(clientOp); + WhiteboardDeleteOperation::ref serverDelete = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(serverOp); if (clientInsert && serverInsert) { return transform(clientInsert, serverInsert); } else if (clientUpdate && serverUpdate) { @@ -47,9 +47,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardInsertOperation::ref clientOp, WhiteboardInsertOperation::ref serverOp) { std::pair<WhiteboardInsertOperation::ref, WhiteboardInsertOperation::ref> result; - result.first = boost::make_shared<WhiteboardInsertOperation>(*serverOp); + result.first = std::make_shared<WhiteboardInsertOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardInsertOperation>(*clientOp); + result.second = std::make_shared<WhiteboardInsertOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() <= serverOp->getPos()) { result.first->setPos(result.first->getPos()+1); @@ -61,15 +61,15 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardUpdateOperation::ref clientOp, WhiteboardUpdateOperation::ref serverOp) { std::pair<WhiteboardUpdateOperation::ref, WhiteboardUpdateOperation::ref> result; - result.first = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + result.first = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.first->setParentID(clientOp->getID()); if (clientOp->getPos() == serverOp->getPos()) { - result.second = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + result.second = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.second->setID(clientOp->getID()); result.second->setParentID(serverOp->getID()); } else { - result.second = boost::make_shared<WhiteboardUpdateOperation>(*clientOp); + result.second = std::make_shared<WhiteboardUpdateOperation>(*clientOp); result.second->setParentID(serverOp->getID()); } @@ -95,9 +95,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardUpdateOperation::ref clientOp, WhiteboardInsertOperation::ref serverOp) { std::pair<WhiteboardInsertOperation::ref, WhiteboardUpdateOperation::ref> result; - result.first = boost::make_shared<WhiteboardInsertOperation>(*serverOp); + result.first = std::make_shared<WhiteboardInsertOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardUpdateOperation>(*clientOp); + result.second = std::make_shared<WhiteboardUpdateOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (serverOp->getPos() <= clientOp->getPos()) { result.second->setPos(result.second->getPos()+1); @@ -107,9 +107,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardInsertOperation::ref clientOp, WhiteboardUpdateOperation::ref serverOp) { std::pair<WhiteboardUpdateOperation::ref, WhiteboardInsertOperation::ref> result; - result.first = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + result.first = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardInsertOperation>(*clientOp); + result.second = std::make_shared<WhiteboardInsertOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (serverOp->getPos() >= clientOp->getPos()) { result.first->setPos(result.first->getPos()+1); @@ -119,9 +119,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardDeleteOperation::ref clientOp, WhiteboardDeleteOperation::ref serverOp) { std::pair<WhiteboardDeleteOperation::ref, WhiteboardDeleteOperation::ref> result; - result.first = boost::make_shared<WhiteboardDeleteOperation>(*serverOp); + result.first = std::make_shared<WhiteboardDeleteOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardDeleteOperation>(*clientOp); + result.second = std::make_shared<WhiteboardDeleteOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() == -1) { result.second->setPos(-1); @@ -142,9 +142,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardInsertOperation::ref clientOp, WhiteboardDeleteOperation::ref serverOp) { std::pair<WhiteboardDeleteOperation::ref, WhiteboardInsertOperation::ref> result; - result.first = boost::make_shared<WhiteboardDeleteOperation>(*serverOp); + result.first = std::make_shared<WhiteboardDeleteOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardInsertOperation>(*clientOp); + result.second = std::make_shared<WhiteboardInsertOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() <= serverOp->getPos()) { result.first->setPos(result.first->getPos()+1); @@ -156,9 +156,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardDeleteOperation::ref clientOp, WhiteboardInsertOperation::ref serverOp) { std::pair<WhiteboardInsertOperation::ref, WhiteboardDeleteOperation::ref> result; - result.first = boost::make_shared<WhiteboardInsertOperation>(*serverOp); + result.first = std::make_shared<WhiteboardInsertOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardDeleteOperation>(*clientOp); + result.second = std::make_shared<WhiteboardDeleteOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (serverOp->getPos() <= clientOp->getPos()) { result.second->setPos(result.second->getPos()+1); @@ -170,13 +170,13 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardUpdateOperation::ref clientOp, WhiteboardDeleteOperation::ref serverOp) { std::pair<WhiteboardDeleteOperation::ref, WhiteboardOperation::ref> result; - result.first = boost::make_shared<WhiteboardDeleteOperation>(*serverOp); + result.first = std::make_shared<WhiteboardDeleteOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(*clientOp); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(*clientOp); result.second = updateOp; result.second->setParentID(serverOp->getID()); if (clientOp->getPos() == serverOp->getPos()) { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); result.second = deleteOp; result.second->setPos(-1); result.second->setID(clientOp->getID()); @@ -195,13 +195,13 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardDeleteOperation::ref clientOp, WhiteboardUpdateOperation::ref serverOp) { std::pair<WhiteboardOperation::ref, WhiteboardDeleteOperation::ref> result; - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.first = updateOp; result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardDeleteOperation>(*clientOp); + result.second = std::make_shared<WhiteboardDeleteOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() == serverOp->getPos()) { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); result.first = deleteOp; result.first->setPos(-1); result.first->setID(serverOp->getID()); |