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/Whiteboard | |
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/Whiteboard')
-rw-r--r-- | Swiften/Whiteboard/IncomingWhiteboardSession.cpp | 10 | ||||
-rw-r--r-- | Swiften/Whiteboard/IncomingWhiteboardSession.h | 4 | ||||
-rw-r--r-- | Swiften/Whiteboard/OutgoingWhiteboardSession.cpp | 13 | ||||
-rw-r--r-- | Swiften/Whiteboard/OutgoingWhiteboardSession.h | 6 | ||||
-rw-r--r-- | Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp | 84 | ||||
-rw-r--r-- | Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp | 48 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardClient.cpp | 27 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardResponder.cpp | 10 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardResponder.h | 2 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSession.cpp | 17 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSession.h | 8 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSessionManager.cpp | 7 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSessionManager.h | 2 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardTransformer.cpp | 56 |
14 files changed, 147 insertions, 147 deletions
diff --git a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp index 206e10b..462bf21 100644 --- a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp @@ -12,7 +12,7 @@ #include <Swiften/Whiteboard/IncomingWhiteboardSession.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h> @@ -27,8 +27,8 @@ namespace Swift { } void IncomingWhiteboardSession::accept() { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionAccept); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionAccept); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); onRequestAccepted(toJID_); } @@ -43,7 +43,7 @@ namespace Swift { } if (pairResult.server) { - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(pairResult.server); sendPayload(payload); } @@ -57,7 +57,7 @@ namespace Swift { WhiteboardOperation::ref result = client.handleLocalOperationReceived(operation); if (result) { - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(result); sendPayload(payload); } diff --git a/Swiften/Whiteboard/IncomingWhiteboardSession.h b/Swiften/Whiteboard/IncomingWhiteboardSession.h index f6c1f49..0f43cea 100644 --- a/Swiften/Whiteboard/IncomingWhiteboardSession.h +++ b/Swiften/Whiteboard/IncomingWhiteboardSession.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Whiteboard/WhiteboardClient.h> @@ -21,7 +21,7 @@ namespace Swift { class SWIFTEN_API IncomingWhiteboardSession : public WhiteboardSession { public: - typedef boost::shared_ptr<IncomingWhiteboardSession> ref; + typedef std::shared_ptr<IncomingWhiteboardSession> ref; public: IncomingWhiteboardSession(const JID& jid, IQRouter* router); diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp index 2bfc434..49f48aa 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp @@ -12,8 +12,9 @@ #include <Swiften/Whiteboard/OutgoingWhiteboardSession.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h> #include <Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h> @@ -28,13 +29,13 @@ namespace Swift { } void OutgoingWhiteboardSession::startSession() { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionRequest); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionRequest); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->onResponse.connect(boost::bind(&OutgoingWhiteboardSession::handleRequestResponse, this, _1, _2)); request->send(); } - void OutgoingWhiteboardSession::handleRequestResponse(boost::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error) { + void OutgoingWhiteboardSession::handleRequestResponse(std::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error) { if (error) { onRequestRejected(toJID_); } @@ -47,7 +48,7 @@ namespace Swift { } lastOpID = op->getID(); - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(op); sendPayload(payload); } @@ -58,7 +59,7 @@ namespace Swift { lastOpID = operation->getID(); server.handleLocalOperationReceived(operation); - WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + WhiteboardPayload::ref payload = std::make_shared<WhiteboardPayload>(); payload->setOperation(operation); sendPayload(payload); } diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.h b/Swiften/Whiteboard/OutgoingWhiteboardSession.h index dd8623a..52fb1db 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.h +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Queries/GenericRequest.h> @@ -22,7 +22,7 @@ namespace Swift { class SWIFTEN_API OutgoingWhiteboardSession : public WhiteboardSession { public: - typedef boost::shared_ptr<OutgoingWhiteboardSession> ref; + typedef std::shared_ptr<OutgoingWhiteboardSession> ref; public: OutgoingWhiteboardSession(const JID& jid, IQRouter* router); @@ -30,7 +30,7 @@ namespace Swift { void startSession(); private: - void handleRequestResponse(boost::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error); + void handleRequestResponse(std::shared_ptr<WhiteboardPayload> /*payload*/, ErrorPayload::ref error); void handleIncomingOperation(WhiteboardOperation::ref operation); void sendOperation(WhiteboardOperation::ref operation); diff --git a/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp b/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp index 9534c60..fd26825 100644 --- a/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp +++ b/Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp @@ -11,7 +11,7 @@ */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -46,7 +46,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -54,7 +54,7 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); WhiteboardInsertOperation::ref result; checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); @@ -63,7 +63,7 @@ public: //so it have to be transformed against local operations and then transformed value can //be returned to draw serverOp = createInsertOperation("b", "0", 1); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(bElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "b", "a", 2, bElement); @@ -82,7 +82,7 @@ public: //but operation returned to send to the server should be parented off last server //operation, which is "b" clientOp = createInsertOperation("c", "b", 3); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(cElement); checkOperation(client.handleLocalOperationReceived(clientOp), "c", "a", 3, cElement); @@ -123,21 +123,21 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists //in server history and client doesn't wait for any operation ack from server, //so this operation could be send WhiteboardInsertOperation::ref clientOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(cElement); checkOperation(client.handleLocalOperationReceived(clientOp), "c", "0", 1, cElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("d", "c", 2); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(dElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -162,11 +162,11 @@ public: //the end of local history so it doesn't have to be transformed, so operation //to pass to window should be the same serverOp = createInsertOperation("e", "d", 3); - WhiteboardEllipseElement::ref eElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref eElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(eElement); pairResult = client.handleServerOperationReceived(serverOp); - WhiteboardInsertOperation::ref result = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + WhiteboardInsertOperation::ref result = std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); @@ -196,7 +196,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -204,14 +204,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("b", "a", 2); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -219,7 +219,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 3, cElement); @@ -230,7 +230,7 @@ public: //"c" existing in local history. //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("d", "c", 2); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "c", 4, dElement); @@ -282,7 +282,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -290,14 +290,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("b", "a", 2); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -305,7 +305,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 3, cElement); @@ -314,7 +314,7 @@ public: //Client receives new local operation, client is still waiting for ack so, it //should return nothing clientOp = createInsertOperation("e", "a", 4); - WhiteboardEllipseElement::ref eElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref eElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(eElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -322,7 +322,7 @@ public: //against result of previous transformations and operation "e", returned operation should //be parented off "e", which was last local operation serverOp = createInsertOperation("d", "c", 2); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "e", 5, dElement); @@ -383,7 +383,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -391,14 +391,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. clientOp = createInsertOperation("b", "a", 2); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientOp)); @@ -406,7 +406,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "0", 1); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 3, cElement); @@ -425,7 +425,7 @@ public: //against result of previous transformation(but only with transformation of "b"), returned //operation should be parented off "c", which was last local operation serverOp = createInsertOperation("d", "a", 3); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "c", 4, dElement); @@ -471,7 +471,7 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists @@ -479,14 +479,14 @@ public: //so this operation could be send WhiteboardInsertOperation::ref clientOp; clientOp = createInsertOperation("a", "0", 1); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientOp), "a", "0", 1, aElement); //Client receives second local operation, client didn't receive ack about previous //operation from the server so it can't be send. WhiteboardUpdateOperation::ref clientUpdateOp = createUpdateOperation("b", "a", 0); - WhiteboardEllipseElement::ref bElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref bElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientUpdateOp->setElement(bElement); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), client.handleLocalOperationReceived(clientUpdateOp)); @@ -494,7 +494,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server WhiteboardUpdateOperation::ref serverUpdateOp = createUpdateOperation("c", "0", 0); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverUpdateOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverUpdateOp); checkOperation(pairResult.client, "c", "b", 0, cElement); @@ -505,7 +505,7 @@ public: //"c" existing in local history. //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("d", "c", 1); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "d", "c", 2, dElement); @@ -556,12 +556,12 @@ public: WhiteboardInsertOperation::ref serverOp; serverOp = createInsertOperation("0", "", 0); WhiteboardClient::Result pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); serverOp = createInsertOperation("1", "0", 1); pairResult = client.handleServerOperationReceived(serverOp); - CPPUNIT_ASSERT_EQUAL(serverOp, boost::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); + CPPUNIT_ASSERT_EQUAL(serverOp, std::dynamic_pointer_cast<WhiteboardInsertOperation>(pairResult.client)); CPPUNIT_ASSERT_EQUAL(WhiteboardOperation::ref(), pairResult.server); //Client receives first local operation, because it's parented off "0" which exists //in server history and client doesn't wait for any operation ack from server, @@ -570,7 +570,7 @@ public: WhiteboardUpdateOperation::ref clientUpdateOp; WhiteboardDeleteOperation::ref clientDeleteOp; clientUpdateOp = createUpdateOperation("a", "1", 0); - WhiteboardEllipseElement::ref aElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref aElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientUpdateOp->setElement(aElement); checkOperation(client.handleLocalOperationReceived(clientUpdateOp), "a", "1", 0, aElement); @@ -583,7 +583,7 @@ public: //"a" and "b" before adding to local operations history because it's parented off "0". //Because client is waiting for ack of "a", there is no operation to send to server serverOp = createInsertOperation("c", "1", 2); - WhiteboardEllipseElement::ref cElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref cElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverOp->setElement(cElement); pairResult = client.handleServerOperationReceived(serverOp); checkOperation(pairResult.client, "c", "b", 1, cElement); @@ -594,7 +594,7 @@ public: //"c" existing in local history. //Because client is waiting for ack of "a", there is no operation to send to server WhiteboardUpdateOperation::ref serverUpdateOp = createUpdateOperation("d", "c", 0); - WhiteboardEllipseElement::ref dElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardEllipseElement::ref dElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); serverUpdateOp->setElement(dElement); pairResult = client.handleServerOperationReceived(serverUpdateOp); checkOperation(pairResult.client, "d", "c", 0, dElement); @@ -636,7 +636,7 @@ public: WhiteboardInsertOperation::ref createInsertOperation(std::string id, std::string parent, int pos) { - WhiteboardInsertOperation::ref operation = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref operation = std::make_shared<WhiteboardInsertOperation>(); operation->setParentID(parent); operation->setID(id); operation->setPos(pos); @@ -644,7 +644,7 @@ public: } WhiteboardUpdateOperation::ref createUpdateOperation(std::string id, std::string parent, int pos) { - WhiteboardUpdateOperation::ref operation = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref operation = std::make_shared<WhiteboardUpdateOperation>(); operation->setParentID(parent); operation->setID(id); operation->setPos(pos); @@ -652,7 +652,7 @@ public: } WhiteboardDeleteOperation::ref createDeleteOperation(std::string id, std::string parent, int pos) { - WhiteboardDeleteOperation::ref operation = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref operation = std::make_shared<WhiteboardDeleteOperation>(); operation->setParentID(parent); operation->setID(id); operation->setPos(pos); @@ -667,12 +667,12 @@ public: } if (element) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { CPPUNIT_ASSERT_EQUAL(element, insertOp->getElement()); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { CPPUNIT_ASSERT_EQUAL(element, updateOp->getElement()); } diff --git a/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp b/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp index 58b8c19..e868968 100644 --- a/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp +++ b/Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp @@ -11,7 +11,7 @@ */ -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -34,44 +34,44 @@ class WhiteboardServerTest : public CppUnit::TestFixture { public: void testSimpleOp() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardInsertOperation::ref serverOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("b"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - WhiteboardInsertOperation::ref clientOp = boost::make_shared<WhiteboardInsertOperation>(); - WhiteboardEllipseElement::ref clientElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardInsertOperation::ref clientOp = std::make_shared<WhiteboardInsertOperation>(); + WhiteboardEllipseElement::ref clientElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setID("a"); clientOp->setParentID("0"); clientOp->setPos(1); clientOp->setElement(clientElement); - WhiteboardInsertOperation::ref op = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardInsertOperation::ref op = std::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("b"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("a"), op->getID()); CPPUNIT_ASSERT_EQUAL(1, op->getPos()); - CPPUNIT_ASSERT_EQUAL(clientElement, boost::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); + CPPUNIT_ASSERT_EQUAL(clientElement, std::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); } void testSimpleOp1() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardDeleteOperation::ref serverOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref serverOp = std::make_shared<WhiteboardDeleteOperation>(); serverOp->setID("b"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - WhiteboardUpdateOperation::ref clientOp = boost::make_shared<WhiteboardUpdateOperation>(); - WhiteboardEllipseElement::ref clientElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardUpdateOperation::ref clientOp = std::make_shared<WhiteboardUpdateOperation>(); + WhiteboardEllipseElement::ref clientElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setID("a"); clientOp->setParentID("0"); clientOp->setPos(1); clientOp->setElement(clientElement); - WhiteboardDeleteOperation::ref op = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardDeleteOperation::ref op = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("b"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("a"), op->getID()); CPPUNIT_ASSERT_EQUAL(-1, op->getPos()); @@ -79,19 +79,19 @@ public: void testSimpleOp2() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardUpdateOperation::ref serverOp = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref serverOp = std::make_shared<WhiteboardUpdateOperation>(); serverOp->setID("b"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - WhiteboardDeleteOperation::ref clientOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref clientOp = std::make_shared<WhiteboardDeleteOperation>(); clientOp->setID("a"); clientOp->setParentID("0"); clientOp->setPos(1); - WhiteboardDeleteOperation::ref op = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardDeleteOperation::ref op = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("b"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("a"), op->getID()); CPPUNIT_ASSERT_EQUAL(1, op->getPos()); @@ -100,35 +100,35 @@ public: void testFewSimpleOps() { WhiteboardServer server; - WhiteboardInsertOperation::ref firstOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref firstOp = std::make_shared<WhiteboardInsertOperation>(); firstOp->setID("0"); server.handleLocalOperationReceived(firstOp); - WhiteboardInsertOperation::ref serverOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("a"); serverOp->setParentID("0"); serverOp->setPos(1); server.handleLocalOperationReceived(serverOp); - serverOp = boost::make_shared<WhiteboardInsertOperation>(); + serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("b"); serverOp->setParentID("a"); serverOp->setPos(2); server.handleLocalOperationReceived(serverOp); - serverOp = boost::make_shared<WhiteboardInsertOperation>(); + serverOp = std::make_shared<WhiteboardInsertOperation>(); serverOp->setID("c"); serverOp->setParentID("b"); serverOp->setPos(3); server.handleLocalOperationReceived(serverOp); - WhiteboardInsertOperation::ref clientOp = boost::make_shared<WhiteboardInsertOperation>(); - WhiteboardEllipseElement::ref clientElement = boost::make_shared<WhiteboardEllipseElement>(0,0,0,0); + WhiteboardInsertOperation::ref clientOp = std::make_shared<WhiteboardInsertOperation>(); + WhiteboardEllipseElement::ref clientElement = std::make_shared<WhiteboardEllipseElement>(0,0,0,0); clientOp->setID("d"); clientOp->setParentID("0"); clientOp->setPos(1); clientOp->setElement(clientElement); - WhiteboardInsertOperation::ref op = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); + WhiteboardInsertOperation::ref op = std::dynamic_pointer_cast<WhiteboardInsertOperation>(server.handleClientOperationReceived(clientOp)); CPPUNIT_ASSERT_EQUAL(std::string("c"), op->getParentID()); CPPUNIT_ASSERT_EQUAL(std::string("d"), op->getID()); CPPUNIT_ASSERT_EQUAL(1, op->getPos()); - CPPUNIT_ASSERT_EQUAL(clientElement, boost::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); + CPPUNIT_ASSERT_EQUAL(clientElement, std::dynamic_pointer_cast<WhiteboardEllipseElement>(op->getElement())); } }; diff --git a/Swiften/Whiteboard/WhiteboardClient.cpp b/Swiften/Whiteboard/WhiteboardClient.cpp index f272a8c..d7ed3ad 100644 --- a/Swiften/Whiteboard/WhiteboardClient.cpp +++ b/Swiften/Whiteboard/WhiteboardClient.cpp @@ -13,8 +13,7 @@ #include <Swiften/Whiteboard/WhiteboardClient.h> #include <iostream> - -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Whiteboard/WhiteboardTransformer.h> @@ -23,17 +22,17 @@ namespace Swift { localOperations_.push_back(operation); WhiteboardOperation::ref op; - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { - op = boost::make_shared<WhiteboardInsertOperation>(*insertOp); + op = std::make_shared<WhiteboardInsertOperation>(*insertOp); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { - op = boost::make_shared<WhiteboardUpdateOperation>(*updateOp); + op = std::make_shared<WhiteboardUpdateOperation>(*updateOp); } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); if (deleteOp) { - op = boost::make_shared<WhiteboardDeleteOperation>(*deleteOp); + op = std::make_shared<WhiteboardDeleteOperation>(*deleteOp); } if (!bridge_.empty()) { @@ -43,17 +42,17 @@ namespace Swift { if (lastSentOperationID_.empty()) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { - op = boost::make_shared<WhiteboardInsertOperation>(*insertOp); + op = std::make_shared<WhiteboardInsertOperation>(*insertOp); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { - op = boost::make_shared<WhiteboardUpdateOperation>(*updateOp); + op = std::make_shared<WhiteboardUpdateOperation>(*updateOp); } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); if (deleteOp) { - op = boost::make_shared<WhiteboardDeleteOperation>(*deleteOp); + op = std::make_shared<WhiteboardDeleteOperation>(*deleteOp); } diff --git a/Swiften/Whiteboard/WhiteboardResponder.cpp b/Swiften/Whiteboard/WhiteboardResponder.cpp index b0b3e6c..f9df709 100644 --- a/Swiften/Whiteboard/WhiteboardResponder.cpp +++ b/Swiften/Whiteboard/WhiteboardResponder.cpp @@ -12,7 +12,7 @@ #include <Swiften/Whiteboard/WhiteboardResponder.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Whiteboard/IncomingWhiteboardSession.h> @@ -23,17 +23,17 @@ namespace Swift { WhiteboardResponder::WhiteboardResponder(WhiteboardSessionManager* sessionManager, IQRouter* router) : SetResponder<WhiteboardPayload>(router), sessionManager_(sessionManager), router_(router) { } - bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, boost::shared_ptr<WhiteboardPayload> payload) { + bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, std::shared_ptr<WhiteboardPayload> payload) { if (payload->getType() == WhiteboardPayload::SessionRequest) { if (sessionManager_->getSession(from)) { sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel); } else { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); - IncomingWhiteboardSession::ref session = boost::make_shared<IncomingWhiteboardSession>(from, router_); + sendResponse(from, id, std::shared_ptr<WhiteboardPayload>()); + IncomingWhiteboardSession::ref session = std::make_shared<IncomingWhiteboardSession>(from, router_); sessionManager_->handleIncomingSession(session); } } else { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); + sendResponse(from, id, std::shared_ptr<WhiteboardPayload>()); WhiteboardSession::ref session = sessionManager_->getSession(from); if (session != nullptr) { session->handleIncomingAction(payload); diff --git a/Swiften/Whiteboard/WhiteboardResponder.h b/Swiften/Whiteboard/WhiteboardResponder.h index 0821a9f..ac44664 100644 --- a/Swiften/Whiteboard/WhiteboardResponder.h +++ b/Swiften/Whiteboard/WhiteboardResponder.h @@ -23,7 +23,7 @@ namespace Swift { class SWIFTEN_API WhiteboardResponder : public SetResponder<WhiteboardPayload> { public: WhiteboardResponder(WhiteboardSessionManager* sessionManager, IQRouter* router); - bool handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, boost::shared_ptr<WhiteboardPayload> payload); + bool handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, std::shared_ptr<WhiteboardPayload> payload); private: WhiteboardSessionManager* sessionManager_; diff --git a/Swiften/Whiteboard/WhiteboardSession.cpp b/Swiften/Whiteboard/WhiteboardSession.cpp index 23ca312..befef4f 100644 --- a/Swiften/Whiteboard/WhiteboardSession.cpp +++ b/Swiften/Whiteboard/WhiteboardSession.cpp @@ -13,8 +13,7 @@ #include <Swiften/Whiteboard/WhiteboardSession.h> #include <iostream> - -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/ErrorPayload.h> #include <Swiften/Elements/WhiteboardPayload.h> @@ -27,7 +26,7 @@ namespace Swift { WhiteboardSession::~WhiteboardSession() { } - void WhiteboardSession::handleIncomingAction(boost::shared_ptr<WhiteboardPayload> payload) { + void WhiteboardSession::handleIncomingAction(std::shared_ptr<WhiteboardPayload> payload) { switch (payload->getType()) { case WhiteboardPayload::Data: handleIncomingOperation(payload->getOperation()); @@ -48,21 +47,21 @@ namespace Swift { } void WhiteboardSession::sendElement(const WhiteboardElement::ref element) { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(); payload->setElement(element); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } - void WhiteboardSession::sendPayload(boost::shared_ptr<WhiteboardPayload> payload) { - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + void WhiteboardSession::sendPayload(std::shared_ptr<WhiteboardPayload> payload) { + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } void WhiteboardSession::cancel() { if (router_->isAvailable()) { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionTerminate); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + std::shared_ptr<WhiteboardPayload> payload = std::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionTerminate); + std::shared_ptr<GenericRequest<WhiteboardPayload> > request = std::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } onSessionTerminated(toJID_); diff --git a/Swiften/Whiteboard/WhiteboardSession.h b/Swiften/Whiteboard/WhiteboardSession.h index da927b3..63d9670 100644 --- a/Swiften/Whiteboard/WhiteboardSession.h +++ b/Swiften/Whiteboard/WhiteboardSession.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/API.h> #include <Swiften/Base/IDGenerator.h> @@ -29,12 +29,12 @@ namespace Swift { class SWIFTEN_API WhiteboardSession { public: - typedef boost::shared_ptr<WhiteboardSession> ref; + typedef std::shared_ptr<WhiteboardSession> ref; public: WhiteboardSession(const JID& jid, IQRouter* router); virtual ~WhiteboardSession(); - void handleIncomingAction(boost::shared_ptr<WhiteboardPayload> payload); + void handleIncomingAction(std::shared_ptr<WhiteboardPayload> payload); void sendElement(const WhiteboardElement::ref element); virtual void sendOperation(WhiteboardOperation::ref operation) = 0; void cancel(); @@ -51,7 +51,7 @@ namespace Swift { virtual void handleIncomingOperation(WhiteboardOperation::ref operation) = 0; protected: - void sendPayload(boost::shared_ptr<WhiteboardPayload> payload); + void sendPayload(std::shared_ptr<WhiteboardPayload> payload); JID toJID_; IQRouter* router_; diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.cpp b/Swiften/Whiteboard/WhiteboardSessionManager.cpp index 36f02cc..66b5ef8 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.cpp +++ b/Swiften/Whiteboard/WhiteboardSessionManager.cpp @@ -13,8 +13,9 @@ #include <Swiften/Whiteboard/WhiteboardSessionManager.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/foreach.h> #include <Swiften/Disco/EntityCapsProvider.h> @@ -37,7 +38,7 @@ namespace Swift { WhiteboardSession::ref WhiteboardSessionManager::getSession(const JID& to) { if (sessions_.find(to) == sessions_.end()) { - return boost::shared_ptr<WhiteboardSession>(); + return std::shared_ptr<WhiteboardSession>(); } return sessions_[to]; } @@ -47,7 +48,7 @@ namespace Swift { if (fullJID.isBare()) { fullJID = getFullJID(fullJID); } - OutgoingWhiteboardSession::ref session = boost::make_shared<OutgoingWhiteboardSession>(fullJID, router_); + OutgoingWhiteboardSession::ref session = std::make_shared<OutgoingWhiteboardSession>(fullJID, router_); sessions_[fullJID] = session; session->onSessionTerminated.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); session->onRequestRejected.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1)); diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.h b/Swiften/Whiteboard/WhiteboardSessionManager.h index 44ec087..44ce14a 100644 --- a/Swiften/Whiteboard/WhiteboardSessionManager.h +++ b/Swiften/Whiteboard/WhiteboardSessionManager.h @@ -50,7 +50,7 @@ namespace Swift { void deleteSessionEntry(const JID& contact); private: - std::map<JID, boost::shared_ptr<WhiteboardSession> > sessions_; + std::map<JID, std::shared_ptr<WhiteboardSession> > sessions_; IQRouter* router_; StanzaChannel* stanzaChannel_; PresenceOracle* presenceOracle_; diff --git a/Swiften/Whiteboard/WhiteboardTransformer.cpp b/Swiften/Whiteboard/WhiteboardTransformer.cpp index 40e364b..1d519f4 100644 --- a/Swiften/Whiteboard/WhiteboardTransformer.cpp +++ b/Swiften/Whiteboard/WhiteboardTransformer.cpp @@ -12,16 +12,16 @@ #include <Swiften/Whiteboard/WhiteboardTransformer.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardOperation::ref clientOp, WhiteboardOperation::ref serverOp) { - WhiteboardInsertOperation::ref clientInsert = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(clientOp); - WhiteboardInsertOperation::ref serverInsert = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(serverOp); - WhiteboardUpdateOperation::ref clientUpdate = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(clientOp); - WhiteboardUpdateOperation::ref serverUpdate = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(serverOp); - WhiteboardDeleteOperation::ref clientDelete = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(clientOp); - WhiteboardDeleteOperation::ref serverDelete = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(serverOp); + WhiteboardInsertOperation::ref clientInsert = std::dynamic_pointer_cast<WhiteboardInsertOperation>(clientOp); + WhiteboardInsertOperation::ref serverInsert = std::dynamic_pointer_cast<WhiteboardInsertOperation>(serverOp); + WhiteboardUpdateOperation::ref clientUpdate = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(clientOp); + WhiteboardUpdateOperation::ref serverUpdate = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(serverOp); + WhiteboardDeleteOperation::ref clientDelete = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(clientOp); + WhiteboardDeleteOperation::ref serverDelete = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(serverOp); if (clientInsert && serverInsert) { return transform(clientInsert, serverInsert); } else if (clientUpdate && serverUpdate) { @@ -47,9 +47,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardInsertOperation::ref clientOp, WhiteboardInsertOperation::ref serverOp) { std::pair<WhiteboardInsertOperation::ref, WhiteboardInsertOperation::ref> result; - result.first = boost::make_shared<WhiteboardInsertOperation>(*serverOp); + result.first = std::make_shared<WhiteboardInsertOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardInsertOperation>(*clientOp); + result.second = std::make_shared<WhiteboardInsertOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() <= serverOp->getPos()) { result.first->setPos(result.first->getPos()+1); @@ -61,15 +61,15 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardUpdateOperation::ref clientOp, WhiteboardUpdateOperation::ref serverOp) { std::pair<WhiteboardUpdateOperation::ref, WhiteboardUpdateOperation::ref> result; - result.first = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + result.first = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.first->setParentID(clientOp->getID()); if (clientOp->getPos() == serverOp->getPos()) { - result.second = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + result.second = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.second->setID(clientOp->getID()); result.second->setParentID(serverOp->getID()); } else { - result.second = boost::make_shared<WhiteboardUpdateOperation>(*clientOp); + result.second = std::make_shared<WhiteboardUpdateOperation>(*clientOp); result.second->setParentID(serverOp->getID()); } @@ -95,9 +95,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardUpdateOperation::ref clientOp, WhiteboardInsertOperation::ref serverOp) { std::pair<WhiteboardInsertOperation::ref, WhiteboardUpdateOperation::ref> result; - result.first = boost::make_shared<WhiteboardInsertOperation>(*serverOp); + result.first = std::make_shared<WhiteboardInsertOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardUpdateOperation>(*clientOp); + result.second = std::make_shared<WhiteboardUpdateOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (serverOp->getPos() <= clientOp->getPos()) { result.second->setPos(result.second->getPos()+1); @@ -107,9 +107,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardInsertOperation::ref clientOp, WhiteboardUpdateOperation::ref serverOp) { std::pair<WhiteboardUpdateOperation::ref, WhiteboardInsertOperation::ref> result; - result.first = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + result.first = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardInsertOperation>(*clientOp); + result.second = std::make_shared<WhiteboardInsertOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (serverOp->getPos() >= clientOp->getPos()) { result.first->setPos(result.first->getPos()+1); @@ -119,9 +119,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardDeleteOperation::ref clientOp, WhiteboardDeleteOperation::ref serverOp) { std::pair<WhiteboardDeleteOperation::ref, WhiteboardDeleteOperation::ref> result; - result.first = boost::make_shared<WhiteboardDeleteOperation>(*serverOp); + result.first = std::make_shared<WhiteboardDeleteOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardDeleteOperation>(*clientOp); + result.second = std::make_shared<WhiteboardDeleteOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() == -1) { result.second->setPos(-1); @@ -142,9 +142,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardInsertOperation::ref clientOp, WhiteboardDeleteOperation::ref serverOp) { std::pair<WhiteboardDeleteOperation::ref, WhiteboardInsertOperation::ref> result; - result.first = boost::make_shared<WhiteboardDeleteOperation>(*serverOp); + result.first = std::make_shared<WhiteboardDeleteOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardInsertOperation>(*clientOp); + result.second = std::make_shared<WhiteboardInsertOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() <= serverOp->getPos()) { result.first->setPos(result.first->getPos()+1); @@ -156,9 +156,9 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardDeleteOperation::ref clientOp, WhiteboardInsertOperation::ref serverOp) { std::pair<WhiteboardInsertOperation::ref, WhiteboardDeleteOperation::ref> result; - result.first = boost::make_shared<WhiteboardInsertOperation>(*serverOp); + result.first = std::make_shared<WhiteboardInsertOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardDeleteOperation>(*clientOp); + result.second = std::make_shared<WhiteboardDeleteOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (serverOp->getPos() <= clientOp->getPos()) { result.second->setPos(result.second->getPos()+1); @@ -170,13 +170,13 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardUpdateOperation::ref clientOp, WhiteboardDeleteOperation::ref serverOp) { std::pair<WhiteboardDeleteOperation::ref, WhiteboardOperation::ref> result; - result.first = boost::make_shared<WhiteboardDeleteOperation>(*serverOp); + result.first = std::make_shared<WhiteboardDeleteOperation>(*serverOp); result.first->setParentID(clientOp->getID()); - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(*clientOp); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(*clientOp); result.second = updateOp; result.second->setParentID(serverOp->getID()); if (clientOp->getPos() == serverOp->getPos()) { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); result.second = deleteOp; result.second->setPos(-1); result.second->setID(clientOp->getID()); @@ -195,13 +195,13 @@ namespace Swift { std::pair<WhiteboardOperation::ref, WhiteboardOperation::ref> WhiteboardTransformer::transform(WhiteboardDeleteOperation::ref clientOp, WhiteboardUpdateOperation::ref serverOp) { std::pair<WhiteboardOperation::ref, WhiteboardDeleteOperation::ref> result; - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(*serverOp); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(*serverOp); result.first = updateOp; result.first->setParentID(clientOp->getID()); - result.second = boost::make_shared<WhiteboardDeleteOperation>(*clientOp); + result.second = std::make_shared<WhiteboardDeleteOperation>(*clientOp); result.second->setParentID(serverOp->getID()); if (clientOp->getPos() == serverOp->getPos()) { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); result.first = deleteOp; result.first->setPos(-1); result.first->setID(serverOp->getID()); |