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/StreamStack/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/StreamStack/UnitTest')
-rw-r--r-- | Swiften/StreamStack/UnitTest/StreamStackTest.cpp | 16 | ||||
-rw-r--r-- | Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp index 7044ad9..6d50b77 100644 --- a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp +++ b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp @@ -61,7 +61,7 @@ class StreamStackTest : public CppUnit::TestFixture { void testWriteData_OneIntermediateStream() { StreamStack testling(xmppStream_, physicalStream_); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); testling.addLayer(xStream.get()); xmppStream_->writeData("foo"); @@ -72,8 +72,8 @@ class StreamStackTest : public CppUnit::TestFixture { void testWriteData_TwoIntermediateStreamStack() { StreamStack testling(xmppStream_, physicalStream_); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); - boost::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("Y")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); + std::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("Y")); testling.addLayer(xStream.get()); testling.addLayer(yStream.get()); @@ -95,7 +95,7 @@ class StreamStackTest : public CppUnit::TestFixture { void testReadData_OneIntermediateStream() { StreamStack testling(xmppStream_, physicalStream_); xmppStream_->onElement.connect(boost::bind(&StreamStackTest::handleElement, this, _1)); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("<")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("<")); testling.addLayer(xStream.get()); physicalStream_->onDataRead(createSafeByteArray("stream:stream xmlns:stream='http://etherx.jabber.org/streams'><presence/>")); @@ -106,8 +106,8 @@ class StreamStackTest : public CppUnit::TestFixture { void testReadData_TwoIntermediateStreamStack() { StreamStack testling(xmppStream_, physicalStream_); xmppStream_->onElement.connect(boost::bind(&StreamStackTest::handleElement, this, _1)); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("s")); - boost::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("<")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("s")); + std::shared_ptr<MyStreamLayer> yStream(new MyStreamLayer("<")); testling.addLayer(xStream.get()); testling.addLayer(yStream.get()); @@ -119,7 +119,7 @@ class StreamStackTest : public CppUnit::TestFixture { void testAddLayer_ExistingOnWriteDataSlot() { StreamStack testling(xmppStream_, physicalStream_); xmppStream_->onWriteData.connect(boost::bind(&StreamStackTest::handleWriteData, this, _1)); - boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); + std::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X")); testling.addLayer(xStream.get()); xmppStream_->writeData("foo"); @@ -127,7 +127,7 @@ class StreamStackTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, dataWriteReceived_); } - void handleElement(boost::shared_ptr<ToplevelElement>) { + void handleElement(std::shared_ptr<ToplevelElement>) { ++elementsReceived_; } diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp index 86e02ba..6d1d537 100644 --- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp +++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp @@ -85,7 +85,7 @@ class XMPPLayerTest : public CppUnit::TestFixture { } void testWriteElement() { - testling_->writeElement(boost::make_shared<Presence>()); + testling_->writeElement(std::make_shared<Presence>()); CPPUNIT_ASSERT_EQUAL(std::string("<presence/>"), lowLayer_->writtenData); } @@ -96,11 +96,11 @@ class XMPPLayerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("</stream:stream>"), lowLayer_->writtenData); } - void handleElement(boost::shared_ptr<ToplevelElement>) { + void handleElement(std::shared_ptr<ToplevelElement>) { ++elementsReceived_; } - void handleElementAndReset(boost::shared_ptr<ToplevelElement>) { + void handleElementAndReset(std::shared_ptr<ToplevelElement>) { ++elementsReceived_; testling_->resetParser(); } |