summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Queries')
-rw-r--r--Swiften/Queries/DummyIQChannel.h6
-rw-r--r--Swiften/Queries/GenericRequest.h18
-rw-r--r--Swiften/Queries/GetResponder.h4
-rw-r--r--Swiften/Queries/IQChannel.h7
-rw-r--r--Swiften/Queries/IQHandler.h6
-rw-r--r--Swiften/Queries/IQRouter.cpp18
-rw-r--r--Swiften/Queries/IQRouter.h15
-rw-r--r--Swiften/Queries/PubSubRequest.h20
-rw-r--r--Swiften/Queries/RawRequest.h9
-rw-r--r--Swiften/Queries/Request.cpp16
-rw-r--r--Swiften/Queries/Request.h19
-rw-r--r--Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h2
-rw-r--r--Swiften/Queries/Requests/GetPrivateStorageRequest.h17
-rw-r--r--Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h6
-rw-r--r--Swiften/Queries/Requests/GetSoftwareVersionRequest.h6
-rw-r--r--Swiften/Queries/Requests/SetPrivateStorageRequest.h11
-rw-r--r--Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h8
-rw-r--r--Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp25
-rw-r--r--Swiften/Queries/Responder.h12
-rw-r--r--Swiften/Queries/Responders/SoftwareVersionResponder.cpp6
-rw-r--r--Swiften/Queries/Responders/SoftwareVersionResponder.h2
-rw-r--r--Swiften/Queries/SetResponder.h4
-rw-r--r--Swiften/Queries/UnitTest/IQRouterTest.cpp30
-rw-r--r--Swiften/Queries/UnitTest/RequestTest.cpp50
-rw-r--r--Swiften/Queries/UnitTest/ResponderTest.cpp22
25 files changed, 167 insertions, 172 deletions
diff --git a/Swiften/Queries/DummyIQChannel.h b/Swiften/Queries/DummyIQChannel.h
index 3f896e0..5ec68ca 100644
--- a/Swiften/Queries/DummyIQChannel.h
+++ b/Swiften/Queries/DummyIQChannel.h
@@ -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.
*/
@@ -15,7 +15,7 @@ namespace Swift {
public:
DummyIQChannel() {}
- virtual void sendIQ(boost::shared_ptr<IQ> iq) {
+ virtual void sendIQ(std::shared_ptr<IQ> iq) {
iqs_.push_back(iq);
}
@@ -27,6 +27,6 @@ namespace Swift {
return true;
}
- std::vector<boost::shared_ptr<IQ> > iqs_;
+ std::vector<std::shared_ptr<IQ> > iqs_;
};
}
diff --git a/Swiften/Queries/GenericRequest.h b/Swiften/Queries/GenericRequest.h
index ad3ec19..2795a54 100644
--- a/Swiften/Queries/GenericRequest.h
+++ b/Swiften/Queries/GenericRequest.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -23,7 +23,7 @@ namespace Swift {
template<typename PAYLOAD_TYPE>
class SWIFTEN_API GenericRequest : public Request {
public:
- typedef boost::shared_ptr<GenericRequest<PAYLOAD_TYPE> > ref;
+ typedef std::shared_ptr<GenericRequest<PAYLOAD_TYPE> > ref;
public:
/**
@@ -36,7 +36,7 @@ namespace Swift {
GenericRequest(
IQ::Type type,
const JID& receiver,
- boost::shared_ptr<Payload> payload,
+ std::shared_ptr<Payload> payload,
IQRouter* router) :
Request(type, receiver, payload, router) {
}
@@ -53,7 +53,7 @@ namespace Swift {
IQ::Type type,
const JID& sender,
const JID& receiver,
- boost::shared_ptr<Payload> payload,
+ std::shared_ptr<Payload> payload,
IQRouter* router) :
Request(type, sender, receiver, payload, router) {
}
@@ -61,19 +61,19 @@ namespace Swift {
/**
* Internal method, do not use.
*/
- virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
- onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error);
+ virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) {
+ onResponse(std::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error);
}
public:
- boost::shared_ptr<PAYLOAD_TYPE> getPayloadGeneric() const {
- return boost::dynamic_pointer_cast<PAYLOAD_TYPE>(getPayload());
+ std::shared_ptr<PAYLOAD_TYPE> getPayloadGeneric() const {
+ return std::dynamic_pointer_cast<PAYLOAD_TYPE>(getPayload());
}
public:
/**
* Signal emitted when a reply to the iq has been received. Contains a payload if one was present, and an error if one was present.
*/
- boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse;
+ boost::signal<void (std::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse;
};
}
diff --git a/Swiften/Queries/GetResponder.h b/Swiften/Queries/GetResponder.h
index cda23d6..18dd694 100644
--- a/Swiften/Queries/GetResponder.h
+++ b/Swiften/Queries/GetResponder.h
@@ -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.
*/
@@ -16,6 +16,6 @@ namespace Swift {
GetResponder(IQRouter* router) : Responder<T>(router) {}
private:
- virtual bool handleSetRequest(const JID&, const JID&, const std::string&, boost::shared_ptr<T>) { return false; }
+ virtual bool handleSetRequest(const JID&, const JID&, const std::string&, std::shared_ptr<T>) { return false; }
};
}
diff --git a/Swiften/Queries/IQChannel.h b/Swiften/Queries/IQChannel.h
index d762847..2974ecc 100644
--- a/Swiften/Queries/IQChannel.h
+++ b/Swiften/Queries/IQChannel.h
@@ -6,10 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Elements/IQ.h>
@@ -19,11 +18,11 @@ namespace Swift {
public:
virtual ~IQChannel();
- virtual void sendIQ(boost::shared_ptr<IQ>) = 0;
+ virtual void sendIQ(std::shared_ptr<IQ>) = 0;
virtual std::string getNewIQID() = 0;
virtual bool isAvailable() const = 0;
- boost::signal<void (boost::shared_ptr<IQ>)> onIQReceived;
+ boost::signal<void (std::shared_ptr<IQ>)> onIQReceived;
};
}
diff --git a/Swiften/Queries/IQHandler.h b/Swiften/Queries/IQHandler.h
index 3581b85..1bfdf0f 100644
--- a/Swiften/Queries/IQHandler.h
+++ b/Swiften/Queries/IQHandler.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/IQ.h>
@@ -18,6 +18,6 @@ namespace Swift {
public:
virtual ~IQHandler();
- virtual bool handleIQ(boost::shared_ptr<IQ>) = 0;
+ virtual bool handleIQ(std::shared_ptr<IQ>) = 0;
};
}
diff --git a/Swiften/Queries/IQRouter.cpp b/Swiften/Queries/IQRouter.cpp
index b32cdf1..e28c2f4 100644
--- a/Swiften/Queries/IQRouter.cpp
+++ b/Swiften/Queries/IQRouter.cpp
@@ -30,13 +30,13 @@ bool IQRouter::isAvailable() {
return channel_->isAvailable();
}
-void IQRouter::handleIQ(boost::shared_ptr<IQ> iq) {
+void IQRouter::handleIQ(std::shared_ptr<IQ> iq) {
queueRemoves_ = true;
bool handled = false;
// Go through the handlers in reverse order, to give precedence to the last added handler
- std::vector<boost::shared_ptr<IQHandler> >::const_reverse_iterator i = handlers_.rbegin();
- std::vector<boost::shared_ptr<IQHandler> >::const_reverse_iterator rend = handlers_.rend();
+ std::vector<std::shared_ptr<IQHandler> >::const_reverse_iterator i = handlers_.rbegin();
+ std::vector<std::shared_ptr<IQHandler> >::const_reverse_iterator rend = handlers_.rend();
for (; i != rend; ++i) {
handled |= (*i)->handleIQ(iq);
if (handled) {
@@ -53,25 +53,25 @@ void IQRouter::handleIQ(boost::shared_ptr<IQ> iq) {
}
void IQRouter::processPendingRemoves() {
- foreach(boost::shared_ptr<IQHandler> handler, queuedRemoves_) {
+ foreach(std::shared_ptr<IQHandler> handler, queuedRemoves_) {
erase(handlers_, handler);
}
queuedRemoves_.clear();
}
void IQRouter::addHandler(IQHandler* handler) {
- addHandler(boost::shared_ptr<IQHandler>(handler, noop));
+ addHandler(std::shared_ptr<IQHandler>(handler, noop));
}
void IQRouter::removeHandler(IQHandler* handler) {
- removeHandler(boost::shared_ptr<IQHandler>(handler, noop));
+ removeHandler(std::shared_ptr<IQHandler>(handler, noop));
}
-void IQRouter::addHandler(boost::shared_ptr<IQHandler> handler) {
+void IQRouter::addHandler(std::shared_ptr<IQHandler> handler) {
handlers_.push_back(handler);
}
-void IQRouter::removeHandler(boost::shared_ptr<IQHandler> handler) {
+void IQRouter::removeHandler(std::shared_ptr<IQHandler> handler) {
if (queueRemoves_) {
queuedRemoves_.push_back(handler);
}
@@ -80,7 +80,7 @@ void IQRouter::removeHandler(boost::shared_ptr<IQHandler> handler) {
}
}
-void IQRouter::sendIQ(boost::shared_ptr<IQ> iq) {
+void IQRouter::sendIQ(std::shared_ptr<IQ> iq) {
if (from_.isValid() && !iq->getFrom().isValid()) {
iq->setFrom(from_);
}
diff --git a/Swiften/Queries/IQRouter.h b/Swiften/Queries/IQRouter.h
index 376fb08..eda7cfb 100644
--- a/Swiften/Queries/IQRouter.h
+++ b/Swiften/Queries/IQRouter.h
@@ -6,11 +6,10 @@
#pragma once
+#include <memory>
#include <string>
#include <vector>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Elements/IQ.h>
@@ -50,8 +49,8 @@ namespace Swift {
void addHandler(IQHandler* handler);
void removeHandler(IQHandler* handler);
- void addHandler(boost::shared_ptr<IQHandler> handler);
- void removeHandler(boost::shared_ptr<IQHandler> handler);
+ void addHandler(std::shared_ptr<IQHandler> handler);
+ void removeHandler(std::shared_ptr<IQHandler> handler);
/**
* Sends an IQ stanza.
@@ -60,7 +59,7 @@ namespace Swift {
* be set as the 'from' address on iq before sending
* it.
*/
- void sendIQ(boost::shared_ptr<IQ> iq);
+ void sendIQ(std::shared_ptr<IQ> iq);
std::string getNewIQID();
bool isAvailable();
@@ -76,15 +75,15 @@ namespace Swift {
}
private:
- void handleIQ(boost::shared_ptr<IQ> iq);
+ void handleIQ(std::shared_ptr<IQ> iq);
void processPendingRemoves();
private:
IQChannel* channel_;
JID jid_;
JID from_;
- std::vector< boost::shared_ptr<IQHandler> > handlers_;
- std::vector< boost::shared_ptr<IQHandler> > queuedRemoves_;
+ std::vector< std::shared_ptr<IQHandler> > handlers_;
+ std::vector< std::shared_ptr<IQHandler> > queuedRemoves_;
bool queueRemoves_;
};
}
diff --git a/Swiften/Queries/PubSubRequest.h b/Swiften/Queries/PubSubRequest.h
index 7218f83..888b531 100644
--- a/Swiften/Queries/PubSubRequest.h
+++ b/Swiften/Queries/PubSubRequest.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -56,10 +56,10 @@ namespace Swift {
PubSubRequest(
IQ::Type type,
const JID& receiver,
- boost::shared_ptr<T> payload,
+ std::shared_ptr<T> payload,
IQRouter* router) :
Request(type, receiver, router) {
- boost::shared_ptr<ContainerType> wrapper = boost::make_shared<ContainerType>();
+ std::shared_ptr<ContainerType> wrapper = std::make_shared<ContainerType>();
wrapper->setPayload(payload);
setPayload(wrapper);
}
@@ -68,24 +68,24 @@ namespace Swift {
IQ::Type type,
const JID& sender,
const JID& receiver,
- boost::shared_ptr<T> payload,
+ std::shared_ptr<T> payload,
IQRouter* router) :
Request(type, sender, receiver, router) {
- boost::shared_ptr<ContainerType> wrapper = boost::make_shared<ContainerType>();
+ std::shared_ptr<ContainerType> wrapper = std::make_shared<ContainerType>();
wrapper->setPayload(payload);
setPayload(wrapper);
}
virtual void handleResponse(
- boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
- boost::shared_ptr<ResponseType> result;
- if (boost::shared_ptr<ContainerType> container = boost::dynamic_pointer_cast<ContainerType>(payload)) {
- result = boost::dynamic_pointer_cast<ResponseType>(container->getPayload());
+ std::shared_ptr<Payload> payload, ErrorPayload::ref error) {
+ std::shared_ptr<ResponseType> result;
+ if (std::shared_ptr<ContainerType> container = std::dynamic_pointer_cast<ContainerType>(payload)) {
+ result = std::dynamic_pointer_cast<ResponseType>(container->getPayload());
}
onResponse(result, error);
}
public:
- boost::signal<void (boost::shared_ptr<ResponseType>, ErrorPayload::ref)> onResponse;
+ boost::signal<void (std::shared_ptr<ResponseType>, ErrorPayload::ref)> onResponse;
};
}
diff --git a/Swiften/Queries/RawRequest.h b/Swiften/Queries/RawRequest.h
index c4ab85c..90290e8 100644
--- a/Swiften/Queries/RawRequest.h
+++ b/Swiften/Queries/RawRequest.h
@@ -6,10 +6,9 @@
#pragma once
+#include <memory>
#include <typeinfo>
-#include <boost/smart_ptr/make_shared.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Elements/ErrorPayload.h>
@@ -22,7 +21,7 @@
namespace Swift {
class SWIFTEN_API RawRequest : public Request {
public:
- typedef boost::shared_ptr<RawRequest> ref;
+ typedef std::shared_ptr<RawRequest> ref;
static ref create(IQ::Type type, const JID& recipient, const std::string& data, IQRouter* router) {
return ref(new RawRequest(type, recipient, data, router));
@@ -31,10 +30,10 @@ namespace Swift {
boost::signal<void (const std::string&)> onResponse;
private:
- RawRequest(IQ::Type type, const JID& receiver, const std::string& data, IQRouter* router) : Request(type, receiver, boost::make_shared<RawXMLPayload>(data), router) {
+ RawRequest(IQ::Type type, const JID& receiver, const std::string& data, IQRouter* router) : Request(type, receiver, std::make_shared<RawXMLPayload>(data), router) {
}
- virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
+ virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) {
if (error) {
onResponse(ErrorSerializer(&serializers).serializePayload(error));
}
diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp
index a8dff24..12eaae5 100644
--- a/Swiften/Queries/Request.cpp
+++ b/Swiften/Queries/Request.cpp
@@ -12,13 +12,13 @@
namespace Swift {
-Request::Request(IQ::Type type, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), receiver_(receiver), payload_(payload), sent_(false) {
+Request::Request(IQ::Type type, const JID& receiver, std::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), receiver_(receiver), payload_(payload), sent_(false) {
}
Request::Request(IQ::Type type, const JID& receiver, IQRouter* router) : router_(router), type_(type), receiver_(receiver), sent_(false) {
}
-Request::Request(IQ::Type type, const JID& sender, const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), payload_(payload), sent_(false) {
+Request::Request(IQ::Type type, const JID& sender, const JID& receiver, std::shared_ptr<Payload> payload, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), payload_(payload), sent_(false) {
}
Request::Request(IQ::Type type, const JID& sender, const JID& receiver, IQRouter* router) : router_(router), type_(type), sender_(sender), receiver_(receiver), sent_(false) {
@@ -29,7 +29,7 @@ std::string Request::send() {
assert(!sent_);
sent_ = true;
- boost::shared_ptr<IQ> iq(new IQ(type_));
+ std::shared_ptr<IQ> iq(new IQ(type_));
iq->setTo(receiver_);
iq->setFrom(sender_);
iq->addPayload(payload_);
@@ -47,14 +47,14 @@ std::string Request::send() {
return id_;
}
-bool Request::handleIQ(boost::shared_ptr<IQ> iq) {
+bool Request::handleIQ(std::shared_ptr<IQ> iq) {
bool handled = false;
if (iq->getType() == IQ::Result || iq->getType() == IQ::Error) {
if (sent_ && iq->getID() == id_) {
if (isCorrectSender(iq->getFrom())) {
if (iq->getType() == IQ::Result) {
- boost::shared_ptr<Payload> payload = iq->getPayloadOfSameType(payload_);
- if (!payload && boost::dynamic_pointer_cast<RawXMLPayload>(payload_) && !iq->getPayloads().empty()) {
+ std::shared_ptr<Payload> payload = iq->getPayloadOfSameType(payload_);
+ if (!payload && std::dynamic_pointer_cast<RawXMLPayload>(payload_) && !iq->getPayloads().empty()) {
payload = iq->getPayloads().front();
}
handleResponse(payload, ErrorPayload::ref());
@@ -62,10 +62,10 @@ bool Request::handleIQ(boost::shared_ptr<IQ> iq) {
else {
ErrorPayload::ref errorPayload = iq->getPayload<ErrorPayload>();
if (errorPayload) {
- handleResponse(boost::shared_ptr<Payload>(), errorPayload);
+ handleResponse(std::shared_ptr<Payload>(), errorPayload);
}
else {
- handleResponse(boost::shared_ptr<Payload>(), ErrorPayload::ref(new ErrorPayload(ErrorPayload::UndefinedCondition)));
+ handleResponse(std::shared_ptr<Payload>(), ErrorPayload::ref(new ErrorPayload(ErrorPayload::UndefinedCondition)));
}
}
router_->removeHandler(this);
diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h
index 7ad0dd6..a62c103 100644
--- a/Swiften/Queries/Request.h
+++ b/Swiften/Queries/Request.h
@@ -6,11 +6,10 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/ErrorPayload.h>
@@ -23,7 +22,7 @@ namespace Swift {
/**
* An IQ get/set request query.
*/
- class SWIFTEN_API Request : public IQHandler, public boost::enable_shared_from_this<Request> {
+ class SWIFTEN_API Request : public IQHandler, public std::enable_shared_from_this<Request> {
public:
std::string send();
@@ -48,7 +47,7 @@ namespace Swift {
Request(
IQ::Type type,
const JID& receiver,
- boost::shared_ptr<Payload> payload,
+ std::shared_ptr<Payload> payload,
IQRouter* router);
/**
@@ -59,7 +58,7 @@ namespace Swift {
IQ::Type type,
const JID& sender,
const JID& receiver,
- boost::shared_ptr<Payload> payload,
+ std::shared_ptr<Payload> payload,
IQRouter* router);
@@ -81,18 +80,18 @@ namespace Swift {
IQRouter* router);
- virtual void setPayload(boost::shared_ptr<Payload> payload) {
+ virtual void setPayload(std::shared_ptr<Payload> payload) {
payload_ = payload;
}
- boost::shared_ptr<Payload> getPayload() const {
+ std::shared_ptr<Payload> getPayload() const {
return payload_;
}
- virtual void handleResponse(boost::shared_ptr<Payload>, boost::shared_ptr<ErrorPayload>) = 0;
+ virtual void handleResponse(std::shared_ptr<Payload>, std::shared_ptr<ErrorPayload>) = 0;
private:
- bool handleIQ(boost::shared_ptr<IQ>);
+ bool handleIQ(std::shared_ptr<IQ>);
bool isCorrectSender(const JID& jid);
private:
@@ -100,7 +99,7 @@ namespace Swift {
IQ::Type type_;
JID sender_;
JID receiver_;
- boost::shared_ptr<Payload> payload_;
+ std::shared_ptr<Payload> payload_;
std::string id_;
bool sent_;
};
diff --git a/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h b/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h
index ad4caf7..b187fa5 100644
--- a/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h
+++ b/Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h
@@ -13,7 +13,7 @@
namespace Swift {
class SWIFTEN_API GetInBandRegistrationFormRequest : public GenericRequest<InBandRegistrationPayload> {
public:
- typedef boost::shared_ptr<GetInBandRegistrationFormRequest> ref;
+ typedef std::shared_ptr<GetInBandRegistrationFormRequest> ref;
static ref create(const JID& to, IQRouter* router) {
return ref(new GetInBandRegistrationFormRequest(to, router));
diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h
index eecd4d4..e5904fe 100644
--- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h
+++ b/Swiften/Queries/Requests/GetPrivateStorageRequest.h
@@ -6,8 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -19,27 +18,27 @@ namespace Swift {
template<typename PAYLOAD_TYPE>
class SWIFTEN_API GetPrivateStorageRequest : public Request {
public:
- typedef boost::shared_ptr<GetPrivateStorageRequest<PAYLOAD_TYPE> > ref;
+ typedef std::shared_ptr<GetPrivateStorageRequest<PAYLOAD_TYPE> > ref;
static ref create(IQRouter* router) {
return ref(new GetPrivateStorageRequest(router));
}
private:
- GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::make_shared<PrivateStorage>(boost::shared_ptr<Payload>(new PAYLOAD_TYPE())), router) {
+ GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), std::make_shared<PrivateStorage>(std::make_shared<PAYLOAD_TYPE>()), router) {
}
- virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
- boost::shared_ptr<PrivateStorage> storage = boost::dynamic_pointer_cast<PrivateStorage>(payload);
+ virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) {
+ std::shared_ptr<PrivateStorage> storage = std::dynamic_pointer_cast<PrivateStorage>(payload);
if (storage) {
- onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error);
+ onResponse(std::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error);
}
else {
- onResponse(boost::shared_ptr<PAYLOAD_TYPE>(), error);
+ onResponse(std::shared_ptr<PAYLOAD_TYPE>(), error);
}
}
public:
- boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse;
+ boost::signal<void (std::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse;
};
}
diff --git a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
index a474be5..0a3502f 100644
--- a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
+++ b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/SecurityLabelsCatalog.h>
@@ -15,7 +15,7 @@
namespace Swift {
class SWIFTEN_API GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog> {
public:
- typedef boost::shared_ptr<GetSecurityLabelsCatalogRequest> ref;
+ typedef std::shared_ptr<GetSecurityLabelsCatalogRequest> ref;
static ref create(const JID& recipient, IQRouter* router) {
return ref(new GetSecurityLabelsCatalogRequest(recipient, router));
@@ -26,7 +26,7 @@ namespace Swift {
const JID& recipient,
IQRouter* router) :
GenericRequest<SecurityLabelsCatalog>(
- IQ::Get, JID(), boost::make_shared<SecurityLabelsCatalog>(recipient), router) {
+ IQ::Get, JID(), std::make_shared<SecurityLabelsCatalog>(recipient), router) {
}
};
}
diff --git a/Swiften/Queries/Requests/GetSoftwareVersionRequest.h b/Swiften/Queries/Requests/GetSoftwareVersionRequest.h
index 9533651..5660dd8 100644
--- a/Swiften/Queries/Requests/GetSoftwareVersionRequest.h
+++ b/Swiften/Queries/Requests/GetSoftwareVersionRequest.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/SoftwareVersion.h>
@@ -15,7 +15,7 @@
namespace Swift {
class SWIFTEN_API GetSoftwareVersionRequest : public GenericRequest<SoftwareVersion> {
public:
- typedef boost::shared_ptr<GetSoftwareVersionRequest> ref;
+ typedef std::shared_ptr<GetSoftwareVersionRequest> ref;
static ref create(const JID& recipient, IQRouter* router) {
return ref(new GetSoftwareVersionRequest(recipient, router));
@@ -26,7 +26,7 @@ namespace Swift {
const JID& recipient,
IQRouter* router) :
GenericRequest<SoftwareVersion>(
- IQ::Get, recipient, boost::make_shared<SoftwareVersion>(), router) {
+ IQ::Get, recipient, std::make_shared<SoftwareVersion>(), router) {
}
};
}
diff --git a/Swiften/Queries/Requests/SetPrivateStorageRequest.h b/Swiften/Queries/Requests/SetPrivateStorageRequest.h
index 703b749..7cc47fb 100644
--- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h
+++ b/Swiften/Queries/Requests/SetPrivateStorageRequest.h
@@ -6,8 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -19,17 +18,17 @@ namespace Swift {
template<typename PAYLOAD_TYPE>
class SWIFTEN_API SetPrivateStorageRequest : public Request {
public:
- typedef boost::shared_ptr<SetPrivateStorageRequest<PAYLOAD_TYPE> > ref;
+ typedef std::shared_ptr<SetPrivateStorageRequest<PAYLOAD_TYPE> > ref;
- static ref create(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) {
+ static ref create(std::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) {
return ref(new SetPrivateStorageRequest<PAYLOAD_TYPE>(payload, router));
}
private:
- SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::make_shared<PrivateStorage>(payload), router) {
+ SetPrivateStorageRequest(std::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), std::make_shared<PrivateStorage>(payload), router) {
}
- virtual void handleResponse(boost::shared_ptr<Payload>, ErrorPayload::ref error) {
+ virtual void handleResponse(std::shared_ptr<Payload>, ErrorPayload::ref error) {
onResponse(error);
}
diff --git a/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h b/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h
index 94a497b..e2ed751 100644
--- a/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h
+++ b/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -16,7 +16,7 @@
namespace Swift {
class SWIFTEN_API SetInBandRegistrationRequest : public Request {
public:
- typedef boost::shared_ptr<SetInBandRegistrationRequest> ref;
+ typedef std::shared_ptr<SetInBandRegistrationRequest> ref;
static ref create(const JID& to, InBandRegistrationPayload::ref payload, IQRouter* router) {
return ref(new SetInBandRegistrationRequest(to, payload, router));
@@ -26,11 +26,11 @@ namespace Swift {
SetInBandRegistrationRequest(const JID& to, InBandRegistrationPayload::ref payload, IQRouter* router) : Request(IQ::Set, to, InBandRegistrationPayload::ref(payload), router) {
}
- virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
+ virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) {
onResponse(payload, error);
}
public:
- boost::signal<void (boost::shared_ptr<Payload>, ErrorPayload::ref)> onResponse;
+ boost::signal<void (std::shared_ptr<Payload>, ErrorPayload::ref)> onResponse;
};
}
diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
index 1efe523..6c4c495 100644
--- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
+++ b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp
@@ -4,8 +4,9 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -49,9 +50,9 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->iqs_.size()));
CPPUNIT_ASSERT_EQUAL(JID(), channel->iqs_[0]->getTo());
CPPUNIT_ASSERT_EQUAL(IQ::Get, channel->iqs_[0]->getType());
- boost::shared_ptr<PrivateStorage> storage = channel->iqs_[0]->getPayload<PrivateStorage>();
+ std::shared_ptr<PrivateStorage> storage = channel->iqs_[0]->getPayload<PrivateStorage>();
CPPUNIT_ASSERT(storage);
- boost::shared_ptr<MyPayload> payload = boost::dynamic_pointer_cast<MyPayload>(storage->getPayload());
+ std::shared_ptr<MyPayload> payload = std::dynamic_pointer_cast<MyPayload>(storage->getPayload());
CPPUNIT_ASSERT(payload);
}
@@ -62,7 +63,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture {
channel->onIQReceived(createResponse("test-id", "foo"));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(responses.size()));
- CPPUNIT_ASSERT_EQUAL(std::string("foo"), boost::dynamic_pointer_cast<MyPayload>(responses[0])->text);
+ CPPUNIT_ASSERT_EQUAL(std::string("foo"), std::dynamic_pointer_cast<MyPayload>(responses[0])->text);
}
void testHandleResponse_Error() {
@@ -76,7 +77,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture {
}
private:
- void handleResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) {
+ void handleResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) {
if (e) {
errors.push_back(*e);
}
@@ -85,17 +86,17 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture {
}
}
- boost::shared_ptr<IQ> createResponse(const std::string& id, const std::string& text) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Result));
- boost::shared_ptr<PrivateStorage> storage(new PrivateStorage());
- storage->setPayload(boost::shared_ptr<Payload>(new MyPayload(text)));
+ std::shared_ptr<IQ> createResponse(const std::string& id, const std::string& text) {
+ std::shared_ptr<IQ> iq(new IQ(IQ::Result));
+ std::shared_ptr<PrivateStorage> storage(new PrivateStorage());
+ storage->setPayload(std::make_shared<MyPayload>(text));
iq->addPayload(storage);
iq->setID(id);
return iq;
}
- boost::shared_ptr<IQ> createError(const std::string& id) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Error));
+ std::shared_ptr<IQ> createError(const std::string& id) {
+ std::shared_ptr<IQ> iq(new IQ(IQ::Error));
iq->setID(id);
return iq;
}
@@ -104,7 +105,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture {
IQRouter* router;
DummyIQChannel* channel;
std::vector< ErrorPayload > errors;
- std::vector< boost::shared_ptr<Payload> > responses;
+ std::vector< std::shared_ptr<Payload> > responses;
};
CPPUNIT_TEST_SUITE_REGISTRATION(GetPrivateStorageRequestTest);
diff --git a/Swiften/Queries/Responder.h b/Swiften/Queries/Responder.h
index 94195f8..0974adf 100644
--- a/Swiften/Queries/Responder.h
+++ b/Swiften/Queries/Responder.h
@@ -58,26 +58,26 @@ namespace Swift {
*
* This method is implemented in the concrete subclasses.
*/
- virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) = 0;
+ virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) = 0;
/**
* Handle an incoming IQ-Set request containing a payload of class PAYLOAD_TYPE.
*
* This method is implemented in the concrete subclasses.
*/
- virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) = 0;
+ virtual bool handleSetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) = 0;
/**
* Convenience function for sending an IQ response.
*/
- void sendResponse(const JID& to, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) {
+ void sendResponse(const JID& to, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) {
router_->sendIQ(IQ::createResult(to, id, payload));
}
/**
* Convenience function for sending an IQ response, with a specific from address.
*/
- void sendResponse(const JID& to, const JID& from, const std::string& id, boost::shared_ptr<PAYLOAD_TYPE> payload) {
+ void sendResponse(const JID& to, const JID& from, const std::string& id, std::shared_ptr<PAYLOAD_TYPE> payload) {
router_->sendIQ(IQ::createResult(to, from, id, payload));
}
@@ -104,9 +104,9 @@ namespace Swift {
}
private:
- virtual bool handleIQ(boost::shared_ptr<IQ> iq) {
+ virtual bool handleIQ(std::shared_ptr<IQ> iq) {
if (iq->getType() == IQ::Set || iq->getType() == IQ::Get) {
- boost::shared_ptr<PAYLOAD_TYPE> payload(iq->getPayload<PAYLOAD_TYPE>());
+ std::shared_ptr<PAYLOAD_TYPE> payload(iq->getPayload<PAYLOAD_TYPE>());
if (payload) {
bool result;
if (iq->getType() == IQ::Set) {
diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp
index df73dc6..5071f6e 100644
--- a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp
+++ b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp
@@ -6,7 +6,7 @@
#include <Swiften/Queries/Responders/SoftwareVersionResponder.h>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Queries/IQRouter.h>
@@ -21,8 +21,8 @@ void SoftwareVersionResponder::setVersion(const std::string& client, const std::
this->os = os;
}
-bool SoftwareVersionResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<SoftwareVersion>) {
- sendResponse(from, id, boost::make_shared<SoftwareVersion>(client, version, os));
+bool SoftwareVersionResponder::handleGetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<SoftwareVersion>) {
+ sendResponse(from, id, std::make_shared<SoftwareVersion>(client, version, os));
return true;
}
diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.h b/Swiften/Queries/Responders/SoftwareVersionResponder.h
index e336341..4bb3425 100644
--- a/Swiften/Queries/Responders/SoftwareVersionResponder.h
+++ b/Swiften/Queries/Responders/SoftwareVersionResponder.h
@@ -20,7 +20,7 @@ namespace Swift {
void setVersion(const std::string& client, const std::string& version, const std::string& os = "");
private:
- virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<SoftwareVersion> payload);
+ virtual bool handleGetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<SoftwareVersion> payload);
private:
std::string client;
diff --git a/Swiften/Queries/SetResponder.h b/Swiften/Queries/SetResponder.h
index 44d5b66..e2842f4 100644
--- a/Swiften/Queries/SetResponder.h
+++ b/Swiften/Queries/SetResponder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,6 +16,6 @@ namespace Swift {
SetResponder(IQRouter* router) : Responder<T>(router) {}
private:
- virtual bool handleGetRequest(const JID&, const JID&, const std::string&, boost::shared_ptr<T>) { return false; }
+ virtual bool handleGetRequest(const JID&, const JID&, const std::string&, std::shared_ptr<T>) { return false; }
};
}
diff --git a/Swiften/Queries/UnitTest/IQRouterTest.cpp b/Swiften/Queries/UnitTest/IQRouterTest.cpp
index d0d4911..0acb87b 100644
--- a/Swiften/Queries/UnitTest/IQRouterTest.cpp
+++ b/Swiften/Queries/UnitTest/IQRouterTest.cpp
@@ -4,9 +4,9 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -45,7 +45,7 @@ class IQRouterTest : public CppUnit::TestFixture {
DummyIQHandler handler2(true, &testling);
testling.removeHandler(&handler1);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(0, handler1.called);
CPPUNIT_ASSERT_EQUAL(1, handler2.called);
@@ -56,9 +56,9 @@ class IQRouterTest : public CppUnit::TestFixture {
DummyIQHandler handler2(true, &testling);
DummyIQHandler handler1(true, &testling);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
testling.removeHandler(&handler1);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(1, handler1.called);
CPPUNIT_ASSERT_EQUAL(1, handler2.called);
@@ -69,7 +69,7 @@ class IQRouterTest : public CppUnit::TestFixture {
DummyIQHandler handler2(false, &testling);
DummyIQHandler handler1(true, &testling);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(1, handler1.called);
CPPUNIT_ASSERT_EQUAL(0, handler2.called);
@@ -81,7 +81,7 @@ class IQRouterTest : public CppUnit::TestFixture {
DummyIQHandler handler2(true, &testling);
DummyIQHandler handler1(false, &testling);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(1, handler1.called);
CPPUNIT_ASSERT_EQUAL(1, handler2.called);
@@ -92,7 +92,7 @@ class IQRouterTest : public CppUnit::TestFixture {
IQRouter testling(channel_);
DummyIQHandler handler(false, &testling);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
CPPUNIT_ASSERT(channel_->iqs_[0]->getPayload<ErrorPayload>());
@@ -104,8 +104,8 @@ class IQRouterTest : public CppUnit::TestFixture {
DummyIQHandler handler2(true, &testling);
RemovingIQHandler handler1(&testling);
- channel_->onIQReceived(boost::make_shared<IQ>());
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(1, handler1.called);
CPPUNIT_ASSERT_EQUAL(2, handler2.called);
@@ -115,7 +115,7 @@ class IQRouterTest : public CppUnit::TestFixture {
IQRouter testling(channel_);
testling.setFrom(JID("foo@bar.com/baz"));
- testling.sendIQ(boost::make_shared<IQ>());
+ testling.sendIQ(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), channel_->iqs_[0]->getFrom());
}
@@ -123,7 +123,7 @@ class IQRouterTest : public CppUnit::TestFixture {
void testSendIQ_WithoutFrom() {
IQRouter testling(channel_);
- testling.sendIQ(boost::make_shared<IQ>());
+ testling.sendIQ(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(JID(), channel_->iqs_[0]->getFrom());
}
@@ -133,7 +133,7 @@ class IQRouterTest : public CppUnit::TestFixture {
testling.setFrom(JID("foo@bar.com/baz"));
DummyIQHandler handler(false, &testling);
- channel_->onIQReceived(boost::make_shared<IQ>());
+ channel_->onIQReceived(std::make_shared<IQ>());
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), channel_->iqs_[0]->getFrom());
}
@@ -148,7 +148,7 @@ class IQRouterTest : public CppUnit::TestFixture {
router->removeHandler(this);
}
- virtual bool handleIQ(boost::shared_ptr<IQ>) {
+ virtual bool handleIQ(std::shared_ptr<IQ>) {
called++;
return handle;
}
@@ -162,7 +162,7 @@ class IQRouterTest : public CppUnit::TestFixture {
router->addHandler(this);
}
- virtual bool handleIQ(boost::shared_ptr<IQ>) {
+ virtual bool handleIQ(std::shared_ptr<IQ>) {
called++;
router->removeHandler(this);
return false;
diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp
index 93aa9b1..56daffa 100644
--- a/Swiften/Queries/UnitTest/RequestTest.cpp
+++ b/Swiften/Queries/UnitTest/RequestTest.cpp
@@ -4,9 +4,9 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -56,25 +56,25 @@ class RequestTest : public CppUnit::TestFixture {
MyRequest(
IQ::Type type,
const JID& receiver,
- boost::shared_ptr<Payload> payload,
+ std::shared_ptr<Payload> payload,
IQRouter* router) :
Request(type, receiver, payload, router) {
}
- virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
+ virtual void handleResponse(std::shared_ptr<Payload> payload, ErrorPayload::ref error) {
onResponse(payload, error);
}
public:
- boost::signal<void (boost::shared_ptr<Payload>, ErrorPayload::ref)> onResponse;
+ boost::signal<void (std::shared_ptr<Payload>, ErrorPayload::ref)> onResponse;
};
public:
void setUp() {
channel_ = new DummyIQChannel();
router_ = new IQRouter(channel_);
- payload_ = boost::shared_ptr<Payload>(new MyPayload("foo"));
- responsePayload_ = boost::shared_ptr<Payload>(new MyPayload("bar"));
+ payload_ = std::make_shared<MyPayload>("foo");
+ responsePayload_ = std::make_shared<MyPayload>("bar");
responsesReceived_ = 0;
}
@@ -131,8 +131,8 @@ class RequestTest : public CppUnit::TestFixture {
testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2));
testling.send();
- boost::shared_ptr<IQ> error = createError(JID("foo@bar.com/baz"),"test-id");
- boost::shared_ptr<Payload> errorPayload = boost::make_shared<ErrorPayload>(ErrorPayload::InternalServerError);
+ std::shared_ptr<IQ> error = createError(JID("foo@bar.com/baz"),"test-id");
+ std::shared_ptr<Payload> errorPayload = std::make_shared<ErrorPayload>(ErrorPayload::InternalServerError);
error->addPayload(errorPayload);
channel_->onIQReceived(error);
@@ -170,7 +170,7 @@ class RequestTest : public CppUnit::TestFixture {
testling.onResponse.connect(boost::bind(&RequestTest::handleDifferentResponse, this, _1, _2));
testling.send();
- responsePayload_ = boost::make_shared<MyOtherPayload>();
+ responsePayload_ = std::make_shared<MyOtherPayload>();
channel_->onIQReceived(createResponse(JID("foo@bar.com/baz"),"test-id"));
CPPUNIT_ASSERT_EQUAL(1, responsesReceived_);
@@ -179,12 +179,12 @@ class RequestTest : public CppUnit::TestFixture {
}
void testHandleIQ_RawXMLPayload() {
- payload_ = boost::make_shared<RawXMLPayload>("<bla/>");
+ payload_ = std::make_shared<RawXMLPayload>("<bla/>");
MyRequest testling(IQ::Get, JID("foo@bar.com/baz"), payload_, router_);
testling.onResponse.connect(boost::bind(&RequestTest::handleRawXMLResponse, this, _1, _2));
testling.send();
- responsePayload_ = boost::make_shared<MyOtherPayload>();
+ responsePayload_ = std::make_shared<MyOtherPayload>();
channel_->onIQReceived(createResponse(JID("foo@bar.com/baz"),"test-id"));
CPPUNIT_ASSERT_EQUAL(1, responsesReceived_);
@@ -197,7 +197,7 @@ class RequestTest : public CppUnit::TestFixture {
testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2));
testling.send();
- boost::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"),"test-id");
+ std::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"),"test-id");
response->setType(IQ::Get);
channel_->onIQReceived(response);
@@ -211,7 +211,7 @@ class RequestTest : public CppUnit::TestFixture {
testling.onResponse.connect(boost::bind(&RequestTest::handleResponse, this, _1, _2));
testling.send();
- boost::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"), "test-id");
+ std::shared_ptr<IQ> response = createResponse(JID("foo@bar.com/baz"), "test-id");
response->setType(IQ::Set);
channel_->onIQReceived(response);
@@ -315,41 +315,41 @@ class RequestTest : public CppUnit::TestFixture {
private:
- void handleResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) {
+ void handleResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) {
if (e) {
receivedErrors.push_back(*e);
}
else {
- boost::shared_ptr<MyPayload> payload(boost::dynamic_pointer_cast<MyPayload>(p));
+ std::shared_ptr<MyPayload> payload(std::dynamic_pointer_cast<MyPayload>(p));
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT_EQUAL(std::string("bar"), payload->text_);
++responsesReceived_;
}
}
- void handleDifferentResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) {
+ void handleDifferentResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) {
CPPUNIT_ASSERT(!e);
CPPUNIT_ASSERT(!p);
++responsesReceived_;
}
- void handleRawXMLResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) {
+ void handleRawXMLResponse(std::shared_ptr<Payload> p, ErrorPayload::ref e) {
CPPUNIT_ASSERT(!e);
CPPUNIT_ASSERT(p);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<MyOtherPayload>(p));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<MyOtherPayload>(p));
++responsesReceived_;
}
- boost::shared_ptr<IQ> createResponse(const JID& from, const std::string& id) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Result));
+ std::shared_ptr<IQ> createResponse(const JID& from, const std::string& id) {
+ std::shared_ptr<IQ> iq(new IQ(IQ::Result));
iq->setFrom(from);
iq->addPayload(responsePayload_);
iq->setID(id);
return iq;
}
- boost::shared_ptr<IQ> createError(const JID& from, const std::string& id) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Error));
+ std::shared_ptr<IQ> createError(const JID& from, const std::string& id) {
+ std::shared_ptr<IQ> iq(new IQ(IQ::Error));
iq->setFrom(from);
iq->setID(id);
return iq;
@@ -358,8 +358,8 @@ class RequestTest : public CppUnit::TestFixture {
private:
IQRouter* router_;
DummyIQChannel* channel_;
- boost::shared_ptr<Payload> payload_;
- boost::shared_ptr<Payload> responsePayload_;
+ std::shared_ptr<Payload> payload_;
+ std::shared_ptr<Payload> responsePayload_;
int responsesReceived_;
std::vector<ErrorPayload> receivedErrors;
};
diff --git a/Swiften/Queries/UnitTest/ResponderTest.cpp b/Swiften/Queries/UnitTest/ResponderTest.cpp
index c3474f2..98c1448 100644
--- a/Swiften/Queries/UnitTest/ResponderTest.cpp
+++ b/Swiften/Queries/UnitTest/ResponderTest.cpp
@@ -4,9 +4,9 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -34,7 +34,7 @@ class ResponderTest : public CppUnit::TestFixture {
void setUp() {
channel_ = new DummyIQChannel();
router_ = new IQRouter(channel_);
- payload_ = boost::make_shared<SoftwareVersion>("foo");
+ payload_ = std::make_shared<SoftwareVersion>("foo");
}
void tearDown() {
@@ -110,15 +110,15 @@ class ResponderTest : public CppUnit::TestFixture {
void testHandleIQ_NoPayload() {
MyResponder testling(router_);
- CPPUNIT_ASSERT(!dynamic_cast<IQHandler*>(&testling)->handleIQ(boost::make_shared<IQ>(IQ::Get)));
+ CPPUNIT_ASSERT(!dynamic_cast<IQHandler*>(&testling)->handleIQ(std::make_shared<IQ>(IQ::Get)));
CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.getPayloads_.size()));
CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(testling.setPayloads_.size()));
}
private:
- boost::shared_ptr<IQ> createRequest(IQ::Type type) {
- boost::shared_ptr<IQ> iq(new IQ(type));
+ std::shared_ptr<IQ> createRequest(IQ::Type type) {
+ std::shared_ptr<IQ> iq(new IQ(type));
iq->addPayload(payload_);
iq->setID("myid");
iq->setFrom(JID("foo@bar.com/baz"));
@@ -130,13 +130,13 @@ class ResponderTest : public CppUnit::TestFixture {
public:
MyResponder(IQRouter* router) : Responder<SoftwareVersion>(router), getRequestResponse_(true), setRequestResponse_(true) {}
- virtual bool handleGetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<SoftwareVersion> payload) {
+ virtual bool handleGetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<SoftwareVersion> payload) {
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from);
CPPUNIT_ASSERT_EQUAL(std::string("myid"), id);
getPayloads_.push_back(payload);
return getRequestResponse_;
}
- virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<SoftwareVersion> payload) {
+ virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<SoftwareVersion> payload) {
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from);
CPPUNIT_ASSERT_EQUAL(std::string("myid"), id);
setPayloads_.push_back(payload);
@@ -145,14 +145,14 @@ class ResponderTest : public CppUnit::TestFixture {
bool getRequestResponse_;
bool setRequestResponse_;
- std::vector<boost::shared_ptr<SoftwareVersion> > getPayloads_;
- std::vector<boost::shared_ptr<SoftwareVersion> > setPayloads_;
+ std::vector<std::shared_ptr<SoftwareVersion> > getPayloads_;
+ std::vector<std::shared_ptr<SoftwareVersion> > setPayloads_;
};
private:
IQRouter* router_;
DummyIQChannel* channel_;
- boost::shared_ptr<SoftwareVersion> payload_;
+ std::shared_ptr<SoftwareVersion> payload_;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ResponderTest);