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/MUC/UnitTest | |
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/MUC/UnitTest')
-rw-r--r-- | Swiften/MUC/UnitTest/MUCTest.cpp | 26 | ||||
-rw-r--r-- | Swiften/MUC/UnitTest/MockMUC.h | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp index 548617c..115787e 100644 --- a/Swiften/MUC/UnitTest/MUCTest.cpp +++ b/Swiften/MUC/UnitTest/MUCTest.cpp @@ -4,9 +4,9 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -102,7 +102,7 @@ class MUCTest : public CppUnit::TestFixture { void testCreateInstant() { MUC::ref testling = createMUC(JID("rabbithole@wonderland.lit")); testling->joinAs("Alice"); - Presence::ref serverRespondsLocked = boost::make_shared<Presence>(); + Presence::ref serverRespondsLocked = std::make_shared<Presence>(); serverRespondsLocked->setFrom(JID("rabbithole@wonderland.lit/Alice")); MUCUserPayload::ref mucPayload(new MUCUserPayload()); MUCItem myItem; @@ -122,12 +122,12 @@ class MUCTest : public CppUnit::TestFixture { } void testReplicateBug() { - Presence::ref initialPresence = boost::make_shared<Presence>(); + Presence::ref initialPresence = std::make_shared<Presence>(); initialPresence->setStatus(""); - VCard::ref vcard = boost::make_shared<VCard>(); + VCard::ref vcard = std::make_shared<VCard>(); vcard->setPhoto(createByteArray("15c30080ae98ec48be94bf0e191d43edd06e500a")); initialPresence->addPayload(vcard); - CapsInfo::ref caps = boost::make_shared<CapsInfo>(); + CapsInfo::ref caps = std::make_shared<CapsInfo>(); caps->setNode("http://swift.im"); caps->setVersion("p2UP0DrcVgKM6jJqYN/B92DKK0o="); initialPresence->addPayload(caps); @@ -135,7 +135,7 @@ class MUCTest : public CppUnit::TestFixture { MUC::ref testling = createMUC(JID("test@rooms.swift.im")); testling->joinAs("Test"); - Presence::ref serverRespondsLocked = boost::make_shared<Presence>(); + Presence::ref serverRespondsLocked = std::make_shared<Presence>(); serverRespondsLocked->setFrom(JID("test@rooms.swift.im/Test")); serverRespondsLocked->setTo(JID("test@swift.im/6913d576d55f0b67")); serverRespondsLocked->addPayload(vcard); @@ -163,14 +163,14 @@ class MUCTest : public CppUnit::TestFixture { testling->joinAs("Rabbit"); // Rabbit joins - Presence::ref rabbitJoins = boost::make_shared<Presence>(); + Presence::ref rabbitJoins = std::make_shared<Presence>(); rabbitJoins->setTo("test@swift.im/6913d576d55f0b67"); rabbitJoins->setFrom(testling->getJID().toString() + "/Rabbit"); channel->onPresenceReceived(rabbitJoins); CPPUNIT_ASSERT_EQUAL(true, testling->hasOccupant("Rabbit")); // Alice joins - Presence::ref aliceJoins = boost::make_shared<Presence>(); + Presence::ref aliceJoins = std::make_shared<Presence>(); aliceJoins->setTo("test@swift.im/6913d576d55f0b67"); aliceJoins->setFrom(testling->getJID().toString() + "/Alice"); channel->onPresenceReceived(aliceJoins); @@ -183,7 +183,7 @@ class MUCTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("Dodo"), stanza->getTo().getResource()); // Alice changes nick to Alice2 - stanza = boost::make_shared<Presence>(); + stanza = std::make_shared<Presence>(); stanza->setFrom(JID("foo@bar.com/Alice")); stanza->setTo(JID(router->getJID())); stanza->setType(Presence::Unavailable); @@ -201,7 +201,7 @@ class MUCTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(true, testling->hasOccupant("Alice2")); // We (Rabbit) change nick to Robot - stanza = boost::make_shared<Presence>(); + stanza = std::make_shared<Presence>(); stanza->setFrom(JID("foo@bar.com/Rabbit")); stanza->setTo(JID(router->getJID())); stanza->setType(Presence::Unavailable); @@ -235,7 +235,7 @@ class MUCTest : public CppUnit::TestFixture { private: MUC::ref createMUC(const JID& jid) { - MUC::ref muc = boost::make_shared<MUCImpl>(channel, router, presenceSender, jid, mucRegistry); + MUC::ref muc = std::make_shared<MUCImpl>(channel, router, presenceSender, jid, mucRegistry); muc->onOccupantNicknameChanged.connect(boost::bind(&MUCTest::handleOccupantNicknameChanged, this, _1, _2)); return muc; } @@ -250,7 +250,7 @@ class MUCTest : public CppUnit::TestFixture { void receivePresence(const JID& jid, const std::string& status) { Presence::ref p = Presence::create(status); p->setFrom(jid); - //MUCUserPayload::ref mucUserPayload = boost::make_shared<MUCUserPayload>(); + //MUCUserPayload::ref mucUserPayload = std::make_shared<MUCUserPayload>(); //mucUserPayload->addItem(item); //p->addPayload(mucUserPayload); channel->onPresenceReceived(p); diff --git a/Swiften/MUC/UnitTest/MockMUC.h b/Swiften/MUC/UnitTest/MockMUC.h index c61f8a9..575c8e7 100644 --- a/Swiften/MUC/UnitTest/MockMUC.h +++ b/Swiften/MUC/UnitTest/MockMUC.h @@ -7,9 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/signals/connection.hpp> #include <Swiften/Base/API.h> @@ -31,7 +31,7 @@ namespace Swift { class SWIFTEN_API MockMUC : public MUC{ public: - typedef boost::shared_ptr<MockMUC> ref; + typedef std::shared_ptr<MockMUC> ref; public: MockMUC(const JID &muc); |