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 @@ |