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/Parser/PayloadParsers/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/Parser/PayloadParsers/UnitTest')
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp10
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp10
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp8
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp8
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp16
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp8
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp16
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp10
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h8
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp10
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp6
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp2
18 files changed, 83 insertions, 65 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp
index f85efb2..b5b9995 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp
@@ -73,14 +73,14 @@ class CarbonsParserTest : public CppUnit::TestFixture {
CarbonsReceived::ref received = parser.getPayload<CarbonsReceived>();
CPPUNIT_ASSERT(received);
- boost::shared_ptr<Forwarded> forwarded = received->getForwarded();
+ std::shared_ptr<Forwarded> forwarded = received->getForwarded();
CPPUNIT_ASSERT(forwarded);
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(forwarded->getStanza());
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(forwarded->getStanza());
CPPUNIT_ASSERT(message);
CPPUNIT_ASSERT_EQUAL(JID("juliet@capulet.example/balcony"), message->getFrom());
- boost::shared_ptr<Thread> thread = message->getPayload<Thread>();
+ std::shared_ptr<Thread> thread = message->getPayload<Thread>();
CPPUNIT_ASSERT(thread);
CPPUNIT_ASSERT_EQUAL(std::string("0e3141cd80894871a68e6fe6b1ec56fa"), thread->getText());
}
@@ -105,10 +105,10 @@ class CarbonsParserTest : public CppUnit::TestFixture {
CarbonsSent::ref sent = parser.getPayload<CarbonsSent>();
CPPUNIT_ASSERT(sent);
- boost::shared_ptr<Forwarded> forwarded = sent->getForwarded();
+ std::shared_ptr<Forwarded> forwarded = sent->getForwarded();
CPPUNIT_ASSERT(forwarded);
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(forwarded->getStanza());
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(forwarded->getStanza());
CPPUNIT_ASSERT(message);
CPPUNIT_ASSERT_EQUAL(JID("juliet@capulet.example/balcony"), message->getTo());
}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp
index d18e1b4..d93fd1f 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp
@@ -4,6 +4,12 @@
* See http://www.opensource.org/licenses/bsd-license.php for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -25,7 +31,7 @@ class DeliveryReceiptParserTest : public CppUnit::TestFixture {
PayloadsParserTester parser;
CPPUNIT_ASSERT(parser.parse("<request xmlns='urn:xmpp:receipts'/>"));
- DeliveryReceiptRequest::ref request = boost::dynamic_pointer_cast<DeliveryReceiptRequest>(parser.getPayload());
+ DeliveryReceiptRequest::ref request = std::dynamic_pointer_cast<DeliveryReceiptRequest>(parser.getPayload());
CPPUNIT_ASSERT(request);
}
@@ -34,7 +40,7 @@ class DeliveryReceiptParserTest : public CppUnit::TestFixture {
PayloadsParserTester parser;
CPPUNIT_ASSERT(parser.parse("<received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>"));
- DeliveryReceipt::ref receipt = boost::dynamic_pointer_cast<DeliveryReceipt>(parser.getPayload());
+ DeliveryReceipt::ref receipt = std::dynamic_pointer_cast<DeliveryReceipt>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(std::string("richard2-4.1.247"), receipt->getReceivedID());
}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
index c23b1d0..6e866fc 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -32,7 +32,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture {
"<feature var=\"baz-feature\"/>"
"</query>"));
- DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
+ DiscoInfo::ref payload = std::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size()));
CPPUNIT_ASSERT_EQUAL(std::string("Swift"), payload->getIdentities()[0].getName());
CPPUNIT_ASSERT_EQUAL(std::string("pc"), payload->getIdentities()[0].getType());
@@ -61,7 +61,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture {
"<feature var=\"baz-feature\"/>"
"</query>"));
- DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
+ DiscoInfo::ref payload = std::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size()));
CPPUNIT_ASSERT_EQUAL(std::string("Swift"), payload->getIdentities()[0].getName());
CPPUNIT_ASSERT_EQUAL(std::string("pc"), payload->getIdentities()[0].getType());
@@ -91,7 +91,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture {
"<feature var=\"bar-feature\"/>"
"</query>"));
- DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
+ DiscoInfo::ref payload = std::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(payload->getExtensions().size()));
CPPUNIT_ASSERT_EQUAL(std::string("Bot Configuration"), payload->getExtensions()[0]->getTitle());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getFeatures().size()));
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp
index 01db978..977ef8e 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -27,7 +33,7 @@ class DiscoItemsParserTest : public CppUnit::TestFixture {
"<item jid='responder@domain' node='config' name='Configure Service'/>"
"</query>"));
- boost::shared_ptr<DiscoItems> payload = boost::dynamic_pointer_cast<DiscoItems>(parser.getPayload());
+ std::shared_ptr<DiscoItems> payload = std::dynamic_pointer_cast<DiscoItems>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getItems().size()));
CPPUNIT_ASSERT_EQUAL(std::string("List Service Configurations"), payload->getItems()[0].getName());
CPPUNIT_ASSERT_EQUAL(std::string("list"), payload->getItems()[0].getNode());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
index 529d573..5402614 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
@@ -29,7 +29,7 @@ class ErrorParserTest : public CppUnit::TestFixture {
"<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>"
"</error>"));
- ErrorPayload::ref payload = boost::dynamic_pointer_cast<ErrorPayload>(parser.getPayload());
+ ErrorPayload::ref payload = std::dynamic_pointer_cast<ErrorPayload>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition());
CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType());
CPPUNIT_ASSERT_EQUAL(std::string("boo"), payload->getText());
@@ -46,11 +46,11 @@ class ErrorParserTest : public CppUnit::TestFixture {
"<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>"
"</error>"));
- ErrorPayload::ref payload = boost::dynamic_pointer_cast<ErrorPayload>(parser.getPayload());
+ ErrorPayload::ref payload = std::dynamic_pointer_cast<ErrorPayload>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition());
CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType());
CPPUNIT_ASSERT_EQUAL(std::string("boo"), payload->getText());
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<Delay>(payload->getPayload()));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<Delay>(payload->getPayload()));
}
};
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp
index 4ffc776..ace6bcb 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp
@@ -203,7 +203,7 @@ class FormParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("first"), item[0]->getName());
CPPUNIT_ASSERT_EQUAL(std::string("Montague"), item[1]->getValues()[0]);
CPPUNIT_ASSERT_EQUAL(std::string("last"), item[1]->getName());
- boost::shared_ptr<FormField> jidField = item[2];
+ std::shared_ptr<FormField> jidField = item[2];
CPPUNIT_ASSERT_EQUAL(JID("benvolio@montague.net"), jidField->getJIDSingleValue());
CPPUNIT_ASSERT_EQUAL(std::string("jid"), item[2]->getName());
CPPUNIT_ASSERT_EQUAL(std::string("male"), item[3]->getValues()[0]);
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp
index 30af3ec..a807d4e 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp
@@ -35,12 +35,12 @@ class ForwardedParserTest : public CppUnit::TestFixture
"<iq xmlns=\"jabber:client\" type=\"get\" from=\"kindanormal@example.com/IM\" to=\"stupidnewbie@example.com\" id=\"id0\"/>"
"</forwarded>"));
- boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
+ std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getDelay());
CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(payload->getDelay()->getStamp()));
- boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(payload->getStanza());
+ std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(payload->getStanza());
CPPUNIT_ASSERT(!!iq);
CPPUNIT_ASSERT_EQUAL(JID("stupidnewbie@example.com"), iq->getTo());
CPPUNIT_ASSERT_EQUAL(JID("kindanormal@example.com/IM"), iq->getFrom());
@@ -58,12 +58,12 @@ class ForwardedParserTest : public CppUnit::TestFixture
"</message>"
"</forwarded>"));
- boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
+ std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getDelay());
CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(payload->getDelay()->getStamp()));
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(payload->getStanza());
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(payload->getStanza());
CPPUNIT_ASSERT(!!message);
const std::string expectedBody = "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.";
CPPUNIT_ASSERT_EQUAL(expectedBody, message->getBody().get());
@@ -81,11 +81,11 @@ class ForwardedParserTest : public CppUnit::TestFixture
"</message>"
"</forwarded>"));
- boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
+ std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(!payload->getDelay());
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(payload->getStanza());
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(payload->getStanza());
CPPUNIT_ASSERT(!!message);
const std::string expectedBody = "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.";
CPPUNIT_ASSERT_EQUAL(expectedBody, message->getBody().get());
@@ -102,12 +102,12 @@ class ForwardedParserTest : public CppUnit::TestFixture
"<presence xmlns=\"jabber:client\" from=\"alice@wonderland.lit/rabbithole\" to=\"madhatter@wonderland.lit\" type=\"unavailable\"/>"
"</forwarded>"));
- boost::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
+ std::shared_ptr<Forwarded> payload = parser.getPayload<Forwarded>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getDelay());
CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(payload->getDelay()->getStamp()));
- boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(payload->getStanza());
+ std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(payload->getStanza());
CPPUNIT_ASSERT(!!presence);
CPPUNIT_ASSERT_EQUAL(JID("madhatter@wonderland.lit"), presence->getTo());
CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/rabbithole"), presence->getFrom());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp
index b045ca5..6a8e2ed 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -25,7 +25,7 @@ class MAMFinParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(parser.parse(
"<fin xmlns='urn:xmpp:mam:0' queryid='f27' />"));
- boost::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>();
+ std::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT_EQUAL(false, payload->isComplete());
CPPUNIT_ASSERT_EQUAL(true, payload->isStable());
@@ -46,13 +46,13 @@ class MAMFinParserTest : public CppUnit::TestFixture
"</set>"
"</fin>"));
- boost::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>();
+ std::shared_ptr<MAMFin> payload = parser.getPayload<MAMFin>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT_EQUAL(true, payload->isComplete());
CPPUNIT_ASSERT_EQUAL(true, payload->isStable());
CPPUNIT_ASSERT(!!payload->getResultSet());
- boost::shared_ptr<ResultSet> resultSet = payload->getResultSet();
+ std::shared_ptr<ResultSet> resultSet = payload->getResultSet();
}
};
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp
index 8bdefc1..8750c2e 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -41,22 +41,22 @@ class MAMQueryParserTest : public CppUnit::TestFixture
"</query>"));
- boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
+ std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getQueryID());
CPPUNIT_ASSERT_EQUAL(std::string("id0"), *payload->getQueryID());
CPPUNIT_ASSERT_EQUAL(std::string("node1"), *payload->getNode());
CPPUNIT_ASSERT(payload->getForm());
- boost::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE");
+ std::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE");
CPPUNIT_ASSERT(fieldType);
CPPUNIT_ASSERT_EQUAL(std::string("urn:xmpp:mam:0"), fieldType->getTextSingleValue());
- boost::shared_ptr<FormField> fieldStart = payload->getForm()->getField("start");
+ std::shared_ptr<FormField> fieldStart = payload->getForm()->getField("start");
CPPUNIT_ASSERT(fieldStart);
CPPUNIT_ASSERT_EQUAL(std::string("2010-08-07T00:00:00Z"), fieldStart->getTextSingleValue());
CPPUNIT_ASSERT(payload->getResultSet());
- boost::shared_ptr<ResultSet> resultSet = payload->getResultSet();
+ std::shared_ptr<ResultSet> resultSet = payload->getResultSet();
CPPUNIT_ASSERT(resultSet->getMaxItems());
CPPUNIT_ASSERT_EQUAL(*resultSet->getMaxItems(), 10);
}
@@ -75,7 +75,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture
"</x>"
"</query>"));
- boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
+ std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
CPPUNIT_ASSERT(!!payload && !!payload->getForm() && !!payload->getForm()->getField("FORM_TYPE") && !!payload->getForm()->getField("with"));
CPPUNIT_ASSERT_EQUAL(std::string("urn:xmpp:mam:0"), payload->getForm()->getField("FORM_TYPE")->getTextSingleValue());
CPPUNIT_ASSERT_EQUAL(std::string("juliet@capulet.lit"), payload->getForm()->getField("with")->getTextSingleValue());
@@ -97,7 +97,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture
"</field>"
"</x>"
"</query>"));
- boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
+ std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
CPPUNIT_ASSERT(!!payload && !!payload->getForm() && !!payload->getForm()->getField("FORM_TYPE") && !!payload->getForm()->getField("start") && !!payload->getForm()->getField("start"));
CPPUNIT_ASSERT_EQUAL(std::string("urn:xmpp:mam:0"), payload->getForm()->getField("FORM_TYPE")->getTextSingleValue());
CPPUNIT_ASSERT_EQUAL(std::string("2010-06-07T00:00:00Z"), payload->getForm()->getField("start")->getTextSingleValue());
@@ -110,7 +110,7 @@ class MAMQueryParserTest : public CppUnit::TestFixture
"<query queryid=\"id0\" xmlns=\"urn:xmpp:mam:0\">"
"</query>"));
- boost::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
+ std::shared_ptr<MAMQuery> payload = parser.getPayload<MAMQuery>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getQueryID());
CPPUNIT_ASSERT_EQUAL(std::string("id0"), *payload->getQueryID());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp
index 7393630..15912b1 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp
@@ -35,17 +35,17 @@ class MAMResultParserTest : public CppUnit::TestFixture
"</forwarded>"
"</result>"));
- boost::shared_ptr<MAMResult> payload = parser.getPayload<MAMResult>();
+ std::shared_ptr<MAMResult> payload = parser.getPayload<MAMResult>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT_EQUAL(std::string("28482-98726-73623"), payload->getID());
CPPUNIT_ASSERT(payload->getQueryID());
CPPUNIT_ASSERT_EQUAL(std::string("f27"), *payload->getQueryID());
- boost::shared_ptr<Forwarded> forwarded = payload->getPayload();
+ std::shared_ptr<Forwarded> forwarded = payload->getPayload();
CPPUNIT_ASSERT(forwarded->getDelay());
CPPUNIT_ASSERT_EQUAL(std::string("2010-07-10T23:08:25Z"), dateTimeToString(forwarded->getDelay()->getStamp()));
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(forwarded->getStanza());
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(forwarded->getStanza());
CPPUNIT_ASSERT(!!message);
const std::string expectedBody = "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.";
CPPUNIT_ASSERT_EQUAL(expectedBody, message->getBody().get());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp
index 495aefe..d403872 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -26,7 +26,7 @@ class MUCAdminPayloadParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(parser.parse("<query xmlns=\"http://jabber.org/protocol/muc#admin\"><item affiliation=\"owner\" role=\"visitor\"><actor jid=\"kev@tester.lit\"/><reason>malice</reason></item></query>"));
- MUCAdminPayload::ref payload = boost::dynamic_pointer_cast<MUCAdminPayload>(parser.getPayload());
+ MUCAdminPayload::ref payload = std::dynamic_pointer_cast<MUCAdminPayload>(parser.getPayload());
MUCItem item = payload->getItems()[0];
CPPUNIT_ASSERT_EQUAL(MUCOccupant::Owner, item.affiliation.get());
CPPUNIT_ASSERT_EQUAL(MUCOccupant::Visitor, item.role.get());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp
index a8cf246..18597bd 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp
@@ -34,7 +34,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture
bool found110 = false;
bool found210 = false;
- MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
+ MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
foreach (MUCUserPayload::StatusCode status, payload->getStatusCodes()) {
if (status.code == 110) found110 = true;
@@ -55,7 +55,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"/>"));
- MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
+ MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT(payload->getItems().empty());
}
@@ -65,9 +65,9 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><destroy jid='alice@wonderland.lit'><reason>bert</reason></destroy></x>"));
- MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
+ MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
CPPUNIT_ASSERT(payload);
- MUCDestroyPayload::ref destroy = boost::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload());
+ MUCDestroyPayload::ref destroy = std::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload());
CPPUNIT_ASSERT(destroy);
CPPUNIT_ASSERT_EQUAL(std::string("bert"), destroy->getReason());
CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit"), destroy->getNewVenue());
@@ -78,7 +78,7 @@ class MUCUserPayloadParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><invite from='crone1@shakespeare.lit/desktop' to='alice@wonderland.lit/xxx'> <reason>Hey Hecate, this is the place for all good witches!</reason> </invite> <password>cauldronburn</password></x>"));
- MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
+ MUCUserPayload::ref payload = std::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT(payload->getInvite());
CPPUNIT_ASSERT(payload->getPassword());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
index 8e871b2..89b990c 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
+++ b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
@@ -48,19 +48,19 @@ namespace Swift {
payloadParser->handleCharacterData(data);
}
- boost::shared_ptr<Payload> getPayload() const {
+ std::shared_ptr<Payload> getPayload() const {
return payloadParser->getPayload();
}
template<typename T>
- boost::shared_ptr<T> getPayload() const {
- return boost::dynamic_pointer_cast<T>(payloadParser->getPayload());
+ std::shared_ptr<T> getPayload() const {
+ return std::dynamic_pointer_cast<T>(payloadParser->getPayload());
}
private:
XMLParser* xmlParser;
FullPayloadParserFactoryCollection factories;
- boost::shared_ptr<PayloadParser> payloadParser;
+ std::shared_ptr<PayloadParser> payloadParser;
int level;
};
}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
index e724090..2c89f0f 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -24,7 +24,7 @@ class PriorityParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(parser.parse("<priority>-120</priority>"));
- boost::shared_ptr<Priority> payload = boost::dynamic_pointer_cast<Priority>(parser.getPayload());
+ std::shared_ptr<Priority> payload = std::dynamic_pointer_cast<Priority>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(-120, payload->getPriority());
}
@@ -33,7 +33,7 @@ class PriorityParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(parser.parse("<priority>invalid</priority>"));
- boost::shared_ptr<Priority> payload = boost::dynamic_pointer_cast<Priority>(parser.getPayload());
+ std::shared_ptr<Priority> payload = std::dynamic_pointer_cast<Priority>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(0, payload->getPriority());
}
};
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp
index 2975485..06f3ae5 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp
@@ -36,9 +36,9 @@ class PrivateStorageParserTest : public CppUnit::TestFixture {
"</storage>"
"</query>"));
- boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
+ std::shared_ptr<PrivateStorage> payload = std::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
CPPUNIT_ASSERT(payload);
- boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload());
+ std::shared_ptr<Storage> storage = std::dynamic_pointer_cast<Storage>(payload->getPayload());
CPPUNIT_ASSERT(storage);
CPPUNIT_ASSERT_EQUAL(std::string("Alice"), storage->getRooms()[0].nick);
CPPUNIT_ASSERT_EQUAL(JID("swift@rooms.swift.im"), storage->getRooms()[0].jid);
@@ -49,7 +49,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(parser.parse("<query xmlns='jabber:iq:private'/>"));
- boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
+ std::shared_ptr<PrivateStorage> payload = std::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT(!payload->getPayload());
}
@@ -71,9 +71,9 @@ class PrivateStorageParserTest : public CppUnit::TestFixture {
"</storage>"
"</query>"));
- boost::shared_ptr<PrivateStorage> payload = boost::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
+ std::shared_ptr<PrivateStorage> payload = std::dynamic_pointer_cast<PrivateStorage>(parser.getPayload());
CPPUNIT_ASSERT(payload);
- boost::shared_ptr<Storage> storage = boost::dynamic_pointer_cast<Storage>(payload->getPayload());
+ std::shared_ptr<Storage> storage = std::dynamic_pointer_cast<Storage>(payload->getPayload());
CPPUNIT_ASSERT(storage);
CPPUNIT_ASSERT_EQUAL(std::string("Rabbit"), storage->getRooms()[0].nick);
}
@@ -88,7 +88,7 @@ class PrivateStorageParserTest : public CppUnit::TestFixture {
"<foo>Bar</foo>"
"</query>"));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<PrivateStorage>(testling.getPayload())->getPayload());
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<PrivateStorage>(testling.getPayload())->getPayload());
}
};
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp
index 3e42788..6d77d4a 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -22,13 +28,13 @@ class ReplaceParserTest : public CppUnit::TestFixture {
void testParseTrivial() {
PayloadsParserTester parser;
CPPUNIT_ASSERT(parser.parse("<replace id='bad1' xmlns='http://swift.im/protocol/replace'/>"));
- Replace::ref payload = boost::dynamic_pointer_cast <Replace>(parser.getPayload());
+ Replace::ref payload = std::dynamic_pointer_cast <Replace>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(std::string("bad1"), payload->getID());
}
void testParseChild() {
PayloadsParserTester parser;
CPPUNIT_ASSERT(parser.parse("<replace id='bad1' xmlns='http://swift.im/protocol/replace' ><child xmlns='blah' id=\"hi\"/></replace>"));
- Replace::ref payload = boost::dynamic_pointer_cast <Replace>(parser.getPayload());
+ Replace::ref payload = std::dynamic_pointer_cast <Replace>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(std::string("bad1"), payload->getID());
}
};
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp
index 7924e05..da5d978 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -33,7 +33,7 @@ class ResultSetParserTest : public CppUnit::TestFixture
"<after>09af3-cc343-b409f</after>"
"</set>"));
- boost::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>();
+ std::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getMaxItems());
CPPUNIT_ASSERT_EQUAL(100, *payload->getMaxItems());
@@ -60,7 +60,7 @@ class ResultSetParserTest : public CppUnit::TestFixture
"<first>stpeter@jabber.org</first>"
"</set>"));
- boost::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>();
+ std::shared_ptr<ResultSet> payload = parser.getPayload<ResultSet>();
CPPUNIT_ASSERT(!!payload);
CPPUNIT_ASSERT(payload->getFirstID());
CPPUNIT_ASSERT_EQUAL(std::string("stpeter@jabber.org"), *payload->getFirstID());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp
index e02eb7a..bc29921 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp
@@ -84,7 +84,7 @@ class VCardParserTest : public CppUnit::TestFixture {
"<MAILER>mutt</MAILER>"
"</vCard>"));
- boost::shared_ptr<VCard> payload = boost::dynamic_pointer_cast<VCard>(parser.getPayload());
+ std::shared_ptr<VCard> payload = std::dynamic_pointer_cast<VCard>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(std::string("2.0"), payload->getVersion());
CPPUNIT_ASSERT_EQUAL(std::string("Alice In Wonderland"), payload->getFullName());
CPPUNIT_ASSERT_EQUAL(std::string("Alice"), payload->getGivenName());