diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 17:23:49 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-04 08:28:23 (GMT) |
commit | 741c45b74d5f634622eb5f757c49323274fb8937 (patch) | |
tree | b9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften/Client/ClientBlockListManager.cpp | |
parent | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff) | |
download | swift-741c45b74d5f634622eb5f757c49323274fb8937.zip swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2 |
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed'
replacement calls to all source files:
's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g'
's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g'
's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g'
's/boost::make_shared/std::make_shared/g'
's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g'
's/boost::shared_ptr/std::shared_ptr/g'
's/boost::weak_ptr/std::weak_ptr/g'
's/boost::enable_shared_from_this/std::enable_shared_from_this/g'
The remaining issues have been fixed manually.
Test-Information:
Code builds on OS X 10.11.4 and unit tests pass.
Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swiften/Client/ClientBlockListManager.cpp')
-rw-r--r-- | Swiften/Client/ClientBlockListManager.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Swiften/Client/ClientBlockListManager.cpp b/Swiften/Client/ClientBlockListManager.cpp index 84a5639..bfdec30 100644 --- a/Swiften/Client/ClientBlockListManager.cpp +++ b/Swiften/Client/ClientBlockListManager.cpp @@ -7,9 +7,9 @@ #include <Swiften/Client/ClientBlockListManager.h> #include <cassert> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Client/BlockListImpl.h> @@ -18,15 +18,15 @@ using namespace Swift; namespace { class BlockResponder : public SetResponder<BlockPayload> { public: - BlockResponder(boost::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<BlockPayload>(iqRouter), blockList(blockList) { + BlockResponder(std::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<BlockPayload>(iqRouter), blockList(blockList) { } - virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<BlockPayload> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<BlockPayload> payload) { if (getIQRouter()->isAccountJID(from)) { if (payload) { blockList->addItems(payload->getItems()); } - sendResponse(from, id, boost::shared_ptr<BlockPayload>()); + sendResponse(from, id, std::shared_ptr<BlockPayload>()); } else { sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel); @@ -35,15 +35,15 @@ namespace { } private: - boost::shared_ptr<BlockListImpl> blockList; + std::shared_ptr<BlockListImpl> blockList; }; class UnblockResponder : public SetResponder<UnblockPayload> { public: - UnblockResponder(boost::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<UnblockPayload>(iqRouter), blockList(blockList) { + UnblockResponder(std::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<UnblockPayload>(iqRouter), blockList(blockList) { } - virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<UnblockPayload> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<UnblockPayload> payload) { if (getIQRouter()->isAccountJID(from)) { if (payload) { if (payload->getItems().empty()) { @@ -53,7 +53,7 @@ namespace { blockList->removeItems(payload->getItems()); } } - sendResponse(from, id, boost::shared_ptr<UnblockPayload>()); + sendResponse(from, id, std::shared_ptr<UnblockPayload>()); } else { sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel); @@ -62,7 +62,7 @@ namespace { } private: - boost::shared_ptr<BlockListImpl> blockList; + std::shared_ptr<BlockListImpl> blockList; }; } @@ -77,20 +77,20 @@ ClientBlockListManager::~ClientBlockListManager() { } } -boost::shared_ptr<BlockList> ClientBlockListManager::getBlockList() { +std::shared_ptr<BlockList> ClientBlockListManager::getBlockList() { if (!blockList) { - blockList = boost::make_shared<BlockListImpl>(); + blockList = std::make_shared<BlockListImpl>(); blockList->setState(BlockList::Init); } return blockList; } -boost::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() { +std::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() { if (!blockList) { - blockList = boost::make_shared<BlockListImpl>(); + blockList = std::make_shared<BlockListImpl>(); } blockList->setState(BlockList::Requesting); - boost::shared_ptr<GenericRequest<BlockListPayload> > getRequest = boost::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), boost::make_shared<BlockListPayload>(), iqRouter); + std::shared_ptr<GenericRequest<BlockListPayload> > getRequest = std::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), std::make_shared<BlockListPayload>(), iqRouter); getRequest->onResponse.connect(boost::bind(&ClientBlockListManager::handleBlockListReceived, this, _1, _2)); getRequest->send(); return blockList; @@ -101,8 +101,8 @@ GenericRequest<BlockPayload>::ref ClientBlockListManager::createBlockJIDRequest( } GenericRequest<BlockPayload>::ref ClientBlockListManager::createBlockJIDsRequest(const std::vector<JID>& jids) { - boost::shared_ptr<BlockPayload> payload = boost::make_shared<BlockPayload>(jids); - return boost::make_shared< GenericRequest<BlockPayload> >(IQ::Set, JID(), payload, iqRouter); + std::shared_ptr<BlockPayload> payload = std::make_shared<BlockPayload>(jids); + return std::make_shared< GenericRequest<BlockPayload> >(IQ::Set, JID(), payload, iqRouter); } GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDRequest(const JID& jid) { @@ -110,8 +110,8 @@ GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDRequ } GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDsRequest(const std::vector<JID>& jids) { - boost::shared_ptr<UnblockPayload> payload = boost::make_shared<UnblockPayload>(jids); - return boost::make_shared< GenericRequest<UnblockPayload> >(IQ::Set, JID(), payload, iqRouter); + std::shared_ptr<UnblockPayload> payload = std::make_shared<UnblockPayload>(jids); + return std::make_shared< GenericRequest<UnblockPayload> >(IQ::Set, JID(), payload, iqRouter); } GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockAllRequest() { @@ -119,7 +119,7 @@ GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockAllRequ } -void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockListPayload> payload, ErrorPayload::ref error) { +void ClientBlockListManager::handleBlockListReceived(std::shared_ptr<BlockListPayload> payload, ErrorPayload::ref error) { if (error || !payload) { blockList->setState(BlockList::Error); } @@ -127,11 +127,11 @@ void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockList blockList->setItems(payload->getItems()); blockList->setState(BlockList::Available); if (!blockResponder) { - blockResponder = boost::make_shared<BlockResponder>(blockList, iqRouter); + blockResponder = std::make_shared<BlockResponder>(blockList, iqRouter); blockResponder->start(); } if (!unblockResponder) { - unblockResponder = boost::make_shared<UnblockResponder>(blockList, iqRouter); + unblockResponder = std::make_shared<UnblockResponder>(blockList, iqRouter); unblockResponder->start(); } } |