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/Avatars/UnitTest/AvatarManagerImplTest.cpp | |
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/Avatars/UnitTest/AvatarManagerImplTest.cpp')
-rw-r--r-- | Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
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; }; |