summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 17:23:49 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-04 08:28:23 (GMT)
commit741c45b74d5f634622eb5f757c49323274fb8937 (patch)
treeb9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften/Whiteboard/UnitTest
parenteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff)
downloadswift-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/UnitTest')
-rw-r--r--Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp84
-rw-r--r--Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp48
2 files changed, 66 insertions, 66 deletions
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()));
}
};