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/LinkLocal | |
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/LinkLocal')
38 files changed, 189 insertions, 198 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h index 767ee1d..a227613 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h @@ -17,7 +17,7 @@ namespace Swift { class AvahiBrowseQuery : public DNSSDBrowseQuery, public AvahiQuery { public: - AvahiBrowseQuery(boost::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : AvahiQuery(q, eventLoop), browser(NULL) { + AvahiBrowseQuery(std::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : AvahiQuery(q, eventLoop), browser(NULL) { } void startBrowsing(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp index 11f1650..1b79946 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp @@ -21,20 +21,20 @@ AvahiQuerier::AvahiQuerier(EventLoop* eventLoop) : eventLoop(eventLoop), client( AvahiQuerier::~AvahiQuerier() { } -boost::shared_ptr<DNSSDBrowseQuery> AvahiQuerier::createBrowseQuery() { - return boost::shared_ptr<DNSSDBrowseQuery>(new AvahiBrowseQuery(shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDBrowseQuery> AvahiQuerier::createBrowseQuery() { + return std::make_shared<AvahiBrowseQuery>(shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDRegisterQuery> AvahiQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { - return boost::shared_ptr<DNSSDRegisterQuery>(new AvahiRegisterQuery(name, port, info, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDRegisterQuery> AvahiQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { + return std::make_shared<AvahiRegisterQuery>(name, port, info, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveServiceQuery> AvahiQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { - return boost::shared_ptr<DNSSDResolveServiceQuery>(new AvahiResolveServiceQuery(service, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveServiceQuery> AvahiQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { + return std::make_shared<AvahiResolveServiceQuery>(service, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveHostnameQuery> AvahiQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { - return boost::shared_ptr<DNSSDResolveHostnameQuery>(new AvahiResolveHostnameQuery(hostname, interfaceIndex, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveHostnameQuery> AvahiQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { + return std::make_shared<AvahiResolveHostnameQuery>(hostname, interfaceIndex, shared_from_this(), eventLoop); } void AvahiQuerier::start() { diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h index fa9580e..5dce19d 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <avahi-client/client.h> #include <avahi-client/lookup.h> @@ -24,17 +23,17 @@ namespace Swift { class AvahiQuerier : public DNSSDQuerier, - public boost::enable_shared_from_this<AvahiQuerier> { + public std::enable_shared_from_this<AvahiQuerier> { public: AvahiQuerier(EventLoop* eventLoop); ~AvahiQuerier(); - boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); - boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); - boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); - boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); void start(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp index 97a7912..08997f6 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.cpp @@ -10,7 +10,7 @@ namespace Swift { -AvahiQuery::AvahiQuery(boost::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : querier(q), eventLoop(eventLoop) { +AvahiQuery::AvahiQuery(std::shared_ptr<AvahiQuerier> q, EventLoop* eventLoop) : querier(q), eventLoop(eventLoop) { } AvahiQuery::~AvahiQuery() { diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h index 5752003..1b98bbf 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/EventLoop/EventOwner.h> @@ -17,13 +16,13 @@ namespace Swift { class AvahiQuery : public EventOwner, - public boost::enable_shared_from_this<AvahiQuery> { + public std::enable_shared_from_this<AvahiQuery> { public: - AvahiQuery(boost::shared_ptr<AvahiQuerier>, EventLoop* eventLoop); + AvahiQuery(std::shared_ptr<AvahiQuerier>, EventLoop* eventLoop); virtual ~AvahiQuery(); protected: - boost::shared_ptr<AvahiQuerier> querier; + std::shared_ptr<AvahiQuerier> querier; EventLoop* eventLoop; }; } diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h index 5570559..68281d0 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h @@ -18,7 +18,7 @@ namespace Swift { class AvahiRegisterQuery : public DNSSDRegisterQuery, public AvahiQuery { public: - AvahiRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), name(name), port(port), txtRecord(txtRecord), group(0) { + AvahiRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), name(name), port(port), txtRecord(txtRecord), group(0) { } void registerService(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp index af1a048..6510275 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp @@ -12,7 +12,7 @@ namespace Swift { -AvahiResolveHostnameQuery::AvahiResolveHostnameQuery(const std::string& hostname, int, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { +AvahiResolveHostnameQuery::AvahiResolveHostnameQuery(const std::string& hostname, int, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { std::cout << "Resolving hostname " << hostname << std::endl; } diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h index 9d21bf9..5498285 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h @@ -20,7 +20,7 @@ namespace Swift { class AvahiResolveHostnameQuery : public DNSSDResolveHostnameQuery, public AvahiQuery { public: - AvahiResolveHostnameQuery(const std::string& hostname, int, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop); + AvahiResolveHostnameQuery(const std::string& hostname, int, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop); void run(); diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h index c95d131..c05c73e 100644 --- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h @@ -19,7 +19,7 @@ namespace Swift { class AvahiResolveServiceQuery : public DNSSDResolveServiceQuery, public AvahiQuery { public: - AvahiResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), service(service), resolver(NULL) { + AvahiResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), service(service), resolver(NULL) { } void start(); diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h index 988f025..c049ed2 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h @@ -17,7 +17,7 @@ namespace Swift { class BonjourBrowseQuery : public DNSSDBrowseQuery, public BonjourQuery { public: - BonjourBrowseQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : BonjourQuery(q, eventLoop) { + BonjourBrowseQuery(std::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : BonjourQuery(q, eventLoop) { DNSServiceErrorType result = DNSServiceBrowse( &sdRef, 0, 0, "_presence._tcp", nullptr, &BonjourBrowseQuery::handleServiceDiscoveredStatic, this); diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp index fda5032..e6d8b94 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp @@ -33,23 +33,23 @@ BonjourQuerier::~BonjourQuerier() { assert(!thread); } -boost::shared_ptr<DNSSDBrowseQuery> BonjourQuerier::createBrowseQuery() { - return boost::shared_ptr<DNSSDBrowseQuery>(new BonjourBrowseQuery(shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDBrowseQuery> BonjourQuerier::createBrowseQuery() { + return std::make_shared<BonjourBrowseQuery>(shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { - return boost::shared_ptr<DNSSDRegisterQuery>(new BonjourRegisterQuery(name, port, info, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDRegisterQuery> BonjourQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { + return std::make_shared<BonjourRegisterQuery>(name, port, info, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { - return boost::shared_ptr<DNSSDResolveServiceQuery>(new BonjourResolveServiceQuery(service, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveServiceQuery> BonjourQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { + return std::make_shared<BonjourResolveServiceQuery>(service, shared_from_this(), eventLoop); } -boost::shared_ptr<DNSSDResolveHostnameQuery> BonjourQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { - return boost::shared_ptr<DNSSDResolveHostnameQuery>(new BonjourResolveHostnameQuery(hostname, interfaceIndex, shared_from_this(), eventLoop)); +std::shared_ptr<DNSSDResolveHostnameQuery> BonjourQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { + return std::make_shared<BonjourResolveHostnameQuery>(hostname, interfaceIndex, shared_from_this(), eventLoop); } -void BonjourQuerier::addRunningQuery(boost::shared_ptr<BonjourQuery> query) { +void BonjourQuerier::addRunningQuery(std::shared_ptr<BonjourQuery> query) { { boost::lock_guard<boost::mutex> lock(runningQueriesMutex); runningQueries.push_back(query); @@ -58,7 +58,7 @@ void BonjourQuerier::addRunningQuery(boost::shared_ptr<BonjourQuery> query) { interruptSelect(); } -void BonjourQuerier::removeRunningQuery(boost::shared_ptr<BonjourQuery> query) { +void BonjourQuerier::removeRunningQuery(std::shared_ptr<BonjourQuery> query) { { boost::lock_guard<boost::mutex> lock(runningQueriesMutex); erase(runningQueries, query); @@ -106,7 +106,7 @@ void BonjourQuerier::run() { maxSocket = interruptSelectReadSocket; FD_SET(interruptSelectReadSocket, &fdSet); - foreach(const boost::shared_ptr<BonjourQuery>& query, runningQueries) { + foreach(const std::shared_ptr<BonjourQuery>& query, runningQueries) { int socketID = query->getSocketID(); maxSocket = std::max(maxSocket, socketID); FD_SET(socketID, &fdSet); @@ -124,7 +124,7 @@ void BonjourQuerier::run() { { boost::lock_guard<boost::mutex> lock(runningQueriesMutex); - foreach(boost::shared_ptr<BonjourQuery> query, runningQueries) { + foreach(std::shared_ptr<BonjourQuery> query, runningQueries) { if (FD_ISSET(query->getSocketID(), &fdSet)) { query->processResult(); } diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h index 74140ac..199eeb2 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h @@ -7,9 +7,8 @@ #pragma once #include <list> +#include <memory> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/thread.hpp> @@ -20,17 +19,17 @@ namespace Swift { class BonjourQuerier : public DNSSDQuerier, - public boost::enable_shared_from_this<BonjourQuerier> { + public std::enable_shared_from_this<BonjourQuerier> { public: BonjourQuerier(EventLoop* eventLoop); ~BonjourQuerier(); - boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); - boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); - boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); - boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); void start(); @@ -39,8 +38,8 @@ namespace Swift { private: friend class BonjourQuery; - void addRunningQuery(boost::shared_ptr<BonjourQuery>); - void removeRunningQuery(boost::shared_ptr<BonjourQuery>); + void addRunningQuery(std::shared_ptr<BonjourQuery>); + void removeRunningQuery(std::shared_ptr<BonjourQuery>); void interruptSelect(); void run(); @@ -49,7 +48,7 @@ namespace Swift { bool stopRequested; boost::thread* thread; boost::mutex runningQueriesMutex; - std::list< boost::shared_ptr<BonjourQuery> > runningQueries; + std::list< std::shared_ptr<BonjourQuery> > runningQueries; int interruptSelectReadSocket; int interruptSelectWriteSocket; boost::condition_variable runningQueriesAvailableEvent; diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp index fa4b6fe..5f9a98f 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp @@ -10,7 +10,7 @@ namespace Swift { -BonjourQuery::BonjourQuery(boost::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(nullptr) { +BonjourQuery::BonjourQuery(std::shared_ptr<BonjourQuerier> q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(nullptr) { } BonjourQuery::~BonjourQuery() { diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h index 2e3eb80..5520158 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h @@ -6,8 +6,8 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> + #include <boost/thread/mutex.hpp> #include <dns_sd.h> @@ -20,9 +20,9 @@ namespace Swift { class BonjourQuery : public EventOwner, - public boost::enable_shared_from_this<BonjourQuery> { + public std::enable_shared_from_this<BonjourQuery> { public: - BonjourQuery(boost::shared_ptr<BonjourQuerier>, EventLoop* eventLoop); + BonjourQuery(std::shared_ptr<BonjourQuerier>, EventLoop* eventLoop); virtual ~BonjourQuery(); void processResult(); @@ -34,7 +34,7 @@ namespace Swift { protected: EventLoop* eventLoop; - boost::shared_ptr<BonjourQuerier> querier; + std::shared_ptr<BonjourQuerier> querier; mutable boost::mutex sdRefMutex; DNSServiceRef sdRef; }; diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h index 67c96bd..776b434 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h @@ -19,7 +19,7 @@ namespace Swift { class BonjourRegisterQuery : public DNSSDRegisterQuery, public BonjourQuery { public: - BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceRegister( &sdRef, 0, 0, name.c_str(), "_presence._tcp", nullptr, nullptr, boost::numeric_cast<unsigned short>(port), boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h index adc5486..dbf3f0e 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h @@ -22,7 +22,7 @@ namespace Swift { class BonjourResolveHostnameQuery : public DNSSDResolveHostnameQuery, public BonjourQuery { public: - BonjourResolveHostnameQuery(const std::string& hostname, int interfaceIndex, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourResolveHostnameQuery(const std::string& hostname, int interfaceIndex, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceGetAddrInfo( &sdRef, 0, boost::numeric_cast<unsigned int>(interfaceIndex), kDNSServiceProtocol_IPv4, hostname.c_str(), diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h index ee20a25..86b6015 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h @@ -17,7 +17,7 @@ namespace Swift { class BonjourResolveServiceQuery : public DNSSDResolveServiceQuery, public BonjourQuery { public: - BonjourResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { + BonjourResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) { DNSServiceErrorType result = DNSServiceResolve( &sdRef, 0, boost::numeric_cast<unsigned int>(service.getNetworkInterfaceID()), service.getName().c_str(), service.getType().c_str(), diff --git a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h index 85051fe..8f3c3ec 100644 --- a/Swiften/LinkLocal/DNSSD/DNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/DNSSDQuerier.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/ByteArray.h> @@ -24,12 +24,12 @@ namespace Swift { virtual void start() = 0; virtual void stop() = 0; - virtual boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery() = 0; - virtual boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + virtual std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery() = 0; + virtual std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info) = 0; - virtual boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + virtual std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&) = 0; - virtual boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + virtual std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex) = 0; }; } diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h index 860de41..15d8128 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h @@ -14,7 +14,7 @@ namespace Swift { class FakeDNSSDBrowseQuery : public DNSSDBrowseQuery, public FakeDNSSDQuery { public: - FakeDNSSDBrowseQuery(boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier) { + FakeDNSSDBrowseQuery(std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier) { } void startBrowsing() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp index 89698a6..63ad3b8 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp @@ -29,42 +29,42 @@ FakeDNSSDQuerier::~FakeDNSSDQuerier() { } } -boost::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() { - return boost::shared_ptr<DNSSDBrowseQuery>(new FakeDNSSDBrowseQuery(shared_from_this())); +std::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() { + return std::make_shared<FakeDNSSDBrowseQuery>(shared_from_this()); } -boost::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { - return boost::shared_ptr<DNSSDRegisterQuery>(new FakeDNSSDRegisterQuery(name, port, info, shared_from_this())); +std::shared_ptr<DNSSDRegisterQuery> FakeDNSSDQuerier::createRegisterQuery(const std::string& name, int port, const ByteArray& info) { + return std::make_shared<FakeDNSSDRegisterQuery>(name, port, info, shared_from_this()); } -boost::shared_ptr<DNSSDResolveServiceQuery> FakeDNSSDQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { - return boost::shared_ptr<DNSSDResolveServiceQuery>(new FakeDNSSDResolveServiceQuery(service, shared_from_this())); +std::shared_ptr<DNSSDResolveServiceQuery> FakeDNSSDQuerier::createResolveServiceQuery(const DNSSDServiceID& service) { + return std::make_shared<FakeDNSSDResolveServiceQuery>(service, shared_from_this()); } -boost::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { - return boost::shared_ptr<DNSSDResolveHostnameQuery>(new FakeDNSSDResolveHostnameQuery(hostname, interfaceIndex, shared_from_this())); +std::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHostnameQuery(const std::string& hostname, int interfaceIndex) { + return std::make_shared<FakeDNSSDResolveHostnameQuery>(hostname, interfaceIndex, shared_from_this()); } -void FakeDNSSDQuerier::addRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) { +void FakeDNSSDQuerier::addRunningQuery(std::shared_ptr<FakeDNSSDQuery> query) { runningQueries.push_back(query); allQueriesEverRun.push_back(query); - if (boost::shared_ptr<FakeDNSSDBrowseQuery> browseQuery = boost::dynamic_pointer_cast<FakeDNSSDBrowseQuery>(query)) { + if (std::shared_ptr<FakeDNSSDBrowseQuery> browseQuery = std::dynamic_pointer_cast<FakeDNSSDBrowseQuery>(query)) { foreach(const DNSSDServiceID& service, services) { eventLoop->postEvent(boost::bind(boost::ref(browseQuery->onServiceAdded), service), shared_from_this()); } } - else if (boost::shared_ptr<FakeDNSSDResolveServiceQuery> resolveQuery = boost::dynamic_pointer_cast<FakeDNSSDResolveServiceQuery>(query)) { + else if (std::shared_ptr<FakeDNSSDResolveServiceQuery> resolveQuery = std::dynamic_pointer_cast<FakeDNSSDResolveServiceQuery>(query)) { for(ServiceInfoMap::const_iterator i = serviceInfo.begin(); i != serviceInfo.end(); ++i) { if (i->first == resolveQuery->service) { eventLoop->postEvent(boost::bind(boost::ref(resolveQuery->onServiceResolved), i->second), shared_from_this()); } } } - else if (boost::shared_ptr<FakeDNSSDRegisterQuery> registerQuery = boost::dynamic_pointer_cast<FakeDNSSDRegisterQuery>(query)) { + else if (std::shared_ptr<FakeDNSSDRegisterQuery> registerQuery = std::dynamic_pointer_cast<FakeDNSSDRegisterQuery>(query)) { DNSSDServiceID service(registerQuery->name, domain); eventLoop->postEvent(boost::bind(boost::ref(registerQuery->onRegisterFinished), service), shared_from_this()); } - else if (boost::shared_ptr<FakeDNSSDResolveHostnameQuery> resolveHostnameQuery = boost::dynamic_pointer_cast<FakeDNSSDResolveHostnameQuery>(query)) { + else if (std::shared_ptr<FakeDNSSDResolveHostnameQuery> resolveHostnameQuery = std::dynamic_pointer_cast<FakeDNSSDResolveHostnameQuery>(query)) { std::map<std::string,boost::optional<HostAddress> >::const_iterator i = addresses.find(resolveHostnameQuery->hostname); if (i != addresses.end()) { eventLoop->postEvent( @@ -75,13 +75,13 @@ void FakeDNSSDQuerier::addRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) } } -void FakeDNSSDQuerier::removeRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) { +void FakeDNSSDQuerier::removeRunningQuery(std::shared_ptr<FakeDNSSDQuery> query) { erase(runningQueries, query); } void FakeDNSSDQuerier::addService(const DNSSDServiceID& id) { services.insert(id); - foreach(const boost::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { eventLoop->postEvent(boost::bind(boost::ref(query->onServiceAdded), id), shared_from_this()); } } @@ -89,7 +89,7 @@ void FakeDNSSDQuerier::addService(const DNSSDServiceID& id) { void FakeDNSSDQuerier::removeService(const DNSSDServiceID& id) { services.erase(id); serviceInfo.erase(id); - foreach(const boost::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { eventLoop->postEvent(boost::bind(boost::ref(query->onServiceRemoved), id), shared_from_this()); } } @@ -99,7 +99,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol if (!r.second) { r.first->second = info; } - foreach(const boost::shared_ptr<FakeDNSSDResolveServiceQuery>& query, getQueries<FakeDNSSDResolveServiceQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDResolveServiceQuery>& query, getQueries<FakeDNSSDResolveServiceQuery>()) { if (query->service == id) { eventLoop->postEvent(boost::bind(boost::ref(query->onServiceResolved), info), shared_from_this()); } @@ -107,7 +107,7 @@ void FakeDNSSDQuerier::setServiceInfo(const DNSSDServiceID& id, const DNSSDResol } bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, const ByteArray& info) { - foreach(const boost::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { if (query->name == name && query->port == port && query->info == info) { return true; } @@ -116,20 +116,20 @@ bool FakeDNSSDQuerier::isServiceRegistered(const std::string& name, int port, co } void FakeDNSSDQuerier::setBrowseError() { - foreach(const boost::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDBrowseQuery>& query, getQueries<FakeDNSSDBrowseQuery>()) { eventLoop->postEvent(boost::ref(query->onError), shared_from_this()); } } void FakeDNSSDQuerier::setRegisterError() { - foreach(const boost::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDRegisterQuery>& query, getQueries<FakeDNSSDRegisterQuery>()) { eventLoop->postEvent(boost::bind(boost::ref(query->onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this()); } } void FakeDNSSDQuerier::setAddress(const std::string& hostname, boost::optional<HostAddress> address) { addresses[hostname] = address; - foreach(const boost::shared_ptr<FakeDNSSDResolveHostnameQuery>& query, getQueries<FakeDNSSDResolveHostnameQuery>()) { + foreach(const std::shared_ptr<FakeDNSSDResolveHostnameQuery>& query, getQueries<FakeDNSSDResolveHostnameQuery>()) { if (query->hostname == hostname) { eventLoop->postEvent(boost::bind( boost::ref(query->onHostnameResolved), address), shared_from_this()); diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h index 536bf90..85fdc3a 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h @@ -7,12 +7,10 @@ #pragma once #include <list> +#include <memory> #include <set> #include <string> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/EventLoop/EventOwner.h> @@ -28,7 +26,7 @@ namespace Swift { class SWIFTEN_API FakeDNSSDQuerier : public DNSSDQuerier, public EventOwner, - public boost::enable_shared_from_this<FakeDNSSDQuerier> { + public std::enable_shared_from_this<FakeDNSSDQuerier> { public: FakeDNSSDQuerier(const std::string& domain, EventLoop* eventLoop); ~FakeDNSSDQuerier(); @@ -40,16 +38,16 @@ namespace Swift { allQueriesEverRun.clear(); } - boost::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); - boost::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( + std::shared_ptr<DNSSDBrowseQuery> createBrowseQuery(); + std::shared_ptr<DNSSDRegisterQuery> createRegisterQuery( const std::string& name, int port, const ByteArray& info); - boost::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( + std::shared_ptr<DNSSDResolveServiceQuery> createResolveServiceQuery( const DNSSDServiceID&); - boost::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( + std::shared_ptr<DNSSDResolveHostnameQuery> createResolveHostnameQuery( const std::string& hostname, int interfaceIndex); - void addRunningQuery(boost::shared_ptr<FakeDNSSDQuery>); - void removeRunningQuery(boost::shared_ptr<FakeDNSSDQuery>); + void addRunningQuery(std::shared_ptr<FakeDNSSDQuery>); + void removeRunningQuery(std::shared_ptr<FakeDNSSDQuery>); void addService(const DNSSDServiceID& id); void removeService(const DNSSDServiceID& id); @@ -62,10 +60,10 @@ namespace Swift { public: template<typename T> - std::vector< boost::shared_ptr<T> > getAllQueriesEverRun() const { - std::vector< boost::shared_ptr<T> > result; + std::vector< std::shared_ptr<T> > getAllQueriesEverRun() const { + std::vector< std::shared_ptr<T> > result; for (QueryList::const_iterator i = allQueriesEverRun.begin(); i != allQueriesEverRun.end(); ++i) { - if (boost::shared_ptr<T> resultQuery = boost::dynamic_pointer_cast<T>(*i)) { + if (std::shared_ptr<T> resultQuery = std::dynamic_pointer_cast<T>(*i)) { result.push_back(resultQuery); } } @@ -74,10 +72,10 @@ namespace Swift { private: template<typename T> - std::vector< boost::shared_ptr<T> > getQueries() const { - std::vector< boost::shared_ptr<T> > result; + std::vector< std::shared_ptr<T> > getQueries() const { + std::vector< std::shared_ptr<T> > result; for (QueryList::const_iterator i = runningQueries.begin(); i != runningQueries.end(); ++i) { - if (boost::shared_ptr<T> resultQuery = boost::dynamic_pointer_cast<T>(*i)) { + if (std::shared_ptr<T> resultQuery = std::dynamic_pointer_cast<T>(*i)) { result.push_back(resultQuery); } } @@ -87,7 +85,7 @@ namespace Swift { private: std::string domain; EventLoop* eventLoop; - typedef std::list< boost::shared_ptr<FakeDNSSDQuery> > QueryList; + typedef std::list< std::shared_ptr<FakeDNSSDQuery> > QueryList; QueryList runningQueries; QueryList allQueriesEverRun; std::set<DNSSDServiceID> services; diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp index 980b757..0e05968 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp @@ -10,7 +10,7 @@ namespace Swift { -FakeDNSSDQuery::FakeDNSSDQuery(boost::shared_ptr<FakeDNSSDQuerier> querier) : querier(querier) { +FakeDNSSDQuery::FakeDNSSDQuery(std::shared_ptr<FakeDNSSDQuerier> querier) : querier(querier) { } FakeDNSSDQuery::~FakeDNSSDQuery() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h index 0d7dedc..5d869d4 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h @@ -6,8 +6,7 @@ #pragma once -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/EventLoop/EventOwner.h> @@ -16,9 +15,9 @@ namespace Swift { class FakeDNSSDQuery : public EventOwner, - public boost::enable_shared_from_this<FakeDNSSDQuery> { + public std::enable_shared_from_this<FakeDNSSDQuery> { public: - FakeDNSSDQuery(boost::shared_ptr<FakeDNSSDQuerier>); + FakeDNSSDQuery(std::shared_ptr<FakeDNSSDQuerier>); virtual ~FakeDNSSDQuery(); protected: @@ -26,6 +25,6 @@ namespace Swift { void finish(); protected: - boost::shared_ptr<FakeDNSSDQuerier> querier; + std::shared_ptr<FakeDNSSDQuerier> querier; }; } diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h index 484b2c2..7478841 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h @@ -17,7 +17,7 @@ namespace Swift { class FakeDNSSDRegisterQuery : public DNSSDRegisterQuery, public FakeDNSSDQuery { public: - FakeDNSSDRegisterQuery(const std::string& name, int port, const ByteArray& info, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) { + FakeDNSSDRegisterQuery(const std::string& name, int port, const ByteArray& info, std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), name(name), port(port), info(info) { } void registerService() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h index 0b6a95d..60dc144 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h @@ -17,7 +17,7 @@ namespace Swift { class FakeDNSSDResolveHostnameQuery : public DNSSDResolveHostnameQuery, public FakeDNSSDQuery { public: - FakeDNSSDResolveHostnameQuery(const std::string& hostname, int interfaceIndex, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), hostname(hostname), interfaceIndex(interfaceIndex) { + FakeDNSSDResolveHostnameQuery(const std::string& hostname, int interfaceIndex, std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), hostname(hostname), interfaceIndex(interfaceIndex) { } void run() { diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h index 180fbb2..8a02e7b 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h @@ -15,7 +15,7 @@ namespace Swift { class FakeDNSSDResolveServiceQuery : public DNSSDResolveServiceQuery, public FakeDNSSDQuery { public: - FakeDNSSDResolveServiceQuery(const DNSSDServiceID& service, boost::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), service(service) { + FakeDNSSDResolveServiceQuery(const DNSSDServiceID& service, std::shared_ptr<FakeDNSSDQuerier> querier) : FakeDNSSDQuery(querier), service(service) { } void start() { diff --git a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp index f2bfa2e..e20326b 100644 --- a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp +++ b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp @@ -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. */ @@ -18,14 +18,14 @@ namespace Swift { PlatformDNSSDQuerierFactory::PlatformDNSSDQuerierFactory(EventLoop* eventLoop) : eventLoop(eventLoop) { } -boost::shared_ptr<DNSSDQuerier> PlatformDNSSDQuerierFactory::createQuerier() { +std::shared_ptr<DNSSDQuerier> PlatformDNSSDQuerierFactory::createQuerier() { #if defined(HAVE_BONJOUR) - return boost::shared_ptr<DNSSDQuerier>(new BonjourQuerier(eventLoop)); + return std::make_shared<BonjourQuerier>(eventLoop); #elif defined(HAVE_AVAHI) - return boost::shared_ptr<DNSSDQuerier>(new AvahiQuerier(eventLoop)); + return std::make_shared<AvahiQuerier>(eventLoop); #else (void)eventLoop; - return boost::shared_ptr<DNSSDQuerier>(); + return std::shared_ptr<DNSSDQuerier>(); #endif } diff --git a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h index dc40d01..68e10cf 100644 --- a/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h +++ b/Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.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> @@ -18,7 +18,7 @@ namespace Swift { public: PlatformDNSSDQuerierFactory(EventLoop* eventLoop); - boost::shared_ptr<DNSSDQuerier> createQuerier(); + std::shared_ptr<DNSSDQuerier> createQuerier(); bool canCreate(); diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp index 435b065..9d446a9 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp @@ -6,8 +6,9 @@ #include <Swiften/LinkLocal/IncomingLinkLocalSession.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/IQ.h> #include <Swiften/Elements/ProtocolHeader.h> @@ -21,7 +22,7 @@ namespace Swift { IncomingLinkLocalSession::IncomingLinkLocalSession( const JID& localJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory) : @@ -42,15 +43,15 @@ void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingH getXMPPLayer()->writeHeader(header); if (incomingHeader.getVersion() == "1.0") { - getXMPPLayer()->writeElement(boost::make_shared<StreamFeatures>()); + getXMPPLayer()->writeElement(std::make_shared<StreamFeatures>()); } else { setInitialized(); } } -void IncomingLinkLocalSession::handleElement(boost::shared_ptr<ToplevelElement> element) { - boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element); +void IncomingLinkLocalSession::handleElement(std::shared_ptr<ToplevelElement> element) { + std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element); // If we get our first stanza before streamfeatures, our session is implicitly // initialized if (stanza && !isInitialized()) { diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.h b/Swiften/LinkLocal/IncomingLinkLocalSession.h index 44a8719..b3f0866 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.h +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.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> @@ -25,7 +25,7 @@ namespace Swift { public: IncomingLinkLocalSession( const JID& localJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); @@ -33,7 +33,7 @@ namespace Swift { boost::signal<void ()> onSessionStarted; private: - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); void setInitialized(); bool isInitialized() const { diff --git a/Swiften/LinkLocal/LinkLocalConnector.cpp b/Swiften/LinkLocal/LinkLocalConnector.cpp index 9123e8e..d961030 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.cpp +++ b/Swiften/LinkLocal/LinkLocalConnector.cpp @@ -19,8 +19,8 @@ namespace Swift { LinkLocalConnector::LinkLocalConnector( const LinkLocalService& service, - boost::shared_ptr<DNSSDQuerier> querier, - boost::shared_ptr<Connection> connection) : + std::shared_ptr<DNSSDQuerier> querier, + std::shared_ptr<Connection> connection) : service(service), querier(querier), connection(connection) { @@ -36,7 +36,7 @@ void LinkLocalConnector::connect() { service.getID().getNetworkInterfaceID()); resolveQueryHostNameResolvedConnection = resolveQuery->onHostnameResolved.connect(boost::bind( &LinkLocalConnector::handleHostnameResolved, - boost::dynamic_pointer_cast<LinkLocalConnector>(shared_from_this()), + std::dynamic_pointer_cast<LinkLocalConnector>(shared_from_this()), _1)); resolveQuery->run(); } @@ -71,7 +71,7 @@ void LinkLocalConnector::handleConnected(bool error) { connectionConnectFinishedConnection.disconnect(); } -void LinkLocalConnector::queueElement(boost::shared_ptr<ToplevelElement> element) { +void LinkLocalConnector::queueElement(std::shared_ptr<ToplevelElement> element) { queuedElements.push_back(element); } diff --git a/Swiften/LinkLocal/LinkLocalConnector.h b/Swiften/LinkLocal/LinkLocalConnector.h index 4e05dce..a55d1b6 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.h +++ b/Swiften/LinkLocal/LinkLocalConnector.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/LinkLocal/LinkLocalService.h> @@ -25,12 +23,12 @@ namespace Swift { class DNSSDQuerier; class DNSSDResolveHostnameQuery; - class SWIFTEN_API LinkLocalConnector : public boost::enable_shared_from_this<LinkLocalConnector> { + class SWIFTEN_API LinkLocalConnector : public std::enable_shared_from_this<LinkLocalConnector> { public: LinkLocalConnector( const LinkLocalService& service, - boost::shared_ptr<DNSSDQuerier> querier, - boost::shared_ptr<Connection> connection); + std::shared_ptr<DNSSDQuerier> querier, + std::shared_ptr<Connection> connection); ~LinkLocalConnector(); const LinkLocalService& getService() const { @@ -39,13 +37,13 @@ namespace Swift { void connect(); void cancel(); - void queueElement(boost::shared_ptr<ToplevelElement> element); + void queueElement(std::shared_ptr<ToplevelElement> element); - const std::vector<boost::shared_ptr<ToplevelElement> >& getQueuedElements() const { + const std::vector<std::shared_ptr<ToplevelElement> >& getQueuedElements() const { return queuedElements; } - boost::shared_ptr<Connection> getConnection() const { + std::shared_ptr<Connection> getConnection() const { return connection; } @@ -57,11 +55,11 @@ namespace Swift { private: LinkLocalService service; - boost::shared_ptr<DNSSDQuerier> querier; - boost::shared_ptr<DNSSDResolveHostnameQuery> resolveQuery; + std::shared_ptr<DNSSDQuerier> querier; + std::shared_ptr<DNSSDResolveHostnameQuery> resolveQuery; boost::bsignals::connection resolveQueryHostNameResolvedConnection; - boost::shared_ptr<Connection> connection; + std::shared_ptr<Connection> connection; boost::bsignals::connection connectionConnectFinishedConnection; - std::vector<boost::shared_ptr<ToplevelElement> > queuedElements; + std::vector<std::shared_ptr<ToplevelElement> > queuedElements; }; } diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp index d9dfd64..e3b6028 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp @@ -15,7 +15,7 @@ namespace Swift { -LinkLocalServiceBrowser::LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier) : querier(querier), haveError(false) { +LinkLocalServiceBrowser::LinkLocalServiceBrowser(std::shared_ptr<DNSSDQuerier> querier) : querier(querier), haveError(false) { } LinkLocalServiceBrowser::~LinkLocalServiceBrowser() { @@ -98,10 +98,10 @@ void LinkLocalServiceBrowser::handleServiceAdded(const DNSSDServiceID& service) return; } - std::pair<ResolveQueryMap::iterator, bool> r = resolveQueries.insert(std::make_pair(service, boost::shared_ptr<DNSSDResolveServiceQuery>())); + std::pair<ResolveQueryMap::iterator, bool> r = resolveQueries.insert(std::make_pair(service, std::shared_ptr<DNSSDResolveServiceQuery>())); if (r.second) { // There was no existing query yet. Start a new query. - boost::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(service); + std::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(service); resolveQuery->onServiceResolved.connect( boost::bind(&LinkLocalServiceBrowser::handleServiceResolved, this, service, _1)); r.first->second = resolveQuery; diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.h b/Swiften/LinkLocal/LinkLocalServiceBrowser.h index 3795258..2b0545e 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.h +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.h @@ -7,11 +7,11 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> @@ -25,7 +25,7 @@ namespace Swift { class SWIFTEN_API LinkLocalServiceBrowser { public: - LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> querier); + LinkLocalServiceBrowser(std::shared_ptr<DNSSDQuerier> querier); ~LinkLocalServiceBrowser(); void start(); @@ -45,7 +45,7 @@ namespace Swift { std::vector<LinkLocalService> getServices() const; // FIXME: Ugly that we need this - boost::shared_ptr<DNSSDQuerier> getQuerier() const { + std::shared_ptr<DNSSDQuerier> getQuerier() const { return querier; } @@ -63,11 +63,11 @@ namespace Swift { void handleBrowseError(); private: - boost::shared_ptr<DNSSDQuerier> querier; + std::shared_ptr<DNSSDQuerier> querier; boost::optional<DNSSDServiceID> selfService; - boost::shared_ptr<DNSSDBrowseQuery> browseQuery; - boost::shared_ptr<DNSSDRegisterQuery> registerQuery; - typedef std::map<DNSSDServiceID, boost::shared_ptr<DNSSDResolveServiceQuery> > ResolveQueryMap; + std::shared_ptr<DNSSDBrowseQuery> browseQuery; + std::shared_ptr<DNSSDRegisterQuery> registerQuery; + typedef std::map<DNSSDServiceID, std::shared_ptr<DNSSDResolveServiceQuery> > ResolveQueryMap; ResolveQueryMap resolveQueries; typedef std::map<DNSSDServiceID, DNSSDResolveServiceQuery::Result> ServiceMap; ServiceMap services; diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp index 89d0e89..f97d9a1 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp @@ -19,7 +19,7 @@ namespace Swift { OutgoingLinkLocalSession::OutgoingLinkLocalSession( const JID& localJID, const JID& remoteJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory) : @@ -35,17 +35,17 @@ void OutgoingLinkLocalSession::handleSessionStarted() { } void OutgoingLinkLocalSession::handleStreamStart(const ProtocolHeader&) { - foreach(const boost::shared_ptr<ToplevelElement>& stanza, queuedElements_) { + foreach(const std::shared_ptr<ToplevelElement>& stanza, queuedElements_) { sendElement(stanza); } queuedElements_.clear(); } -void OutgoingLinkLocalSession::handleElement(boost::shared_ptr<ToplevelElement> element) { +void OutgoingLinkLocalSession::handleElement(std::shared_ptr<ToplevelElement> element) { onElementReceived(element); } -void OutgoingLinkLocalSession::queueElement(boost::shared_ptr<ToplevelElement> element) { +void OutgoingLinkLocalSession::queueElement(std::shared_ptr<ToplevelElement> element) { queuedElements_.push_back(element); } diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h index b467918..2f08ed3 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h @@ -6,11 +6,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/enable_shared_from_this.hpp> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/API.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> @@ -28,19 +26,19 @@ namespace Swift { OutgoingLinkLocalSession( const JID& localJID, const JID& remoteJID, - boost::shared_ptr<Connection> connection, + std::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); - void queueElement(boost::shared_ptr<ToplevelElement> element); + void queueElement(std::shared_ptr<ToplevelElement> element); private: void handleSessionStarted(); - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(std::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); private: - std::vector<boost::shared_ptr<ToplevelElement> > queuedElements_; + std::vector<std::shared_ptr<ToplevelElement> > queuedElements_; }; } diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp index 3511f90..3c5e098 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp @@ -31,8 +31,8 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::make_shared<FakeDNSSDQuerier>("rabbithole.local", eventLoop); - connection = boost::make_shared<FakeConnection>(eventLoop); + querier = std::make_shared<FakeDNSSDQuerier>("rabbithole.local", eventLoop); + connection = std::make_shared<FakeConnection>(eventLoop); connectFinished = false; } @@ -42,7 +42,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testConnect() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", HostAddress("192.168.1.1")); @@ -57,7 +57,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testConnect_UnableToResolve() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", boost::optional<HostAddress>()); @@ -70,7 +70,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testConnect_UnableToConnect() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", HostAddress("192.168.1.1")); connection->setError(Connection::ReadError); @@ -84,7 +84,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testCancel_DuringResolve() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); testling->connect(); eventLoop->processEvents(); @@ -99,7 +99,7 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } void testCancel_DuringConnect() { - boost::shared_ptr<LinkLocalConnector> + std::shared_ptr<LinkLocalConnector> testling(createConnector("rabbithole.local", 1234)); querier->setAddress("rabbithole.local", HostAddress("192.168.1.1")); connection->setDelayConnect(); @@ -114,13 +114,13 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, int port) { + std::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, int port) { LinkLocalService service( DNSSDServiceID("myname", "local."), DNSSDResolveServiceQuery::Result( "myname._presence._tcp.local", hostname, port, LinkLocalServiceInfo().toTXTRecord())); - boost::shared_ptr<LinkLocalConnector> result( + std::shared_ptr<LinkLocalConnector> result( new LinkLocalConnector(service, querier, connection)); result->onConnectFinished.connect( boost::bind(&LinkLocalConnectorTest::handleConnected, this, _1)); @@ -134,8 +134,8 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; - boost::shared_ptr<FakeDNSSDQuerier> querier; - boost::shared_ptr<FakeConnection> connection; + std::shared_ptr<FakeDNSSDQuerier> querier; + std::shared_ptr<FakeConnection> connection; bool connectFinished; bool connectError; }; diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp index 6d8ba97..a80d748 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp @@ -5,9 +5,9 @@ */ #include <map> +#include <memory> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -45,7 +45,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { public: void setUp() { eventLoop = new DummyEventLoop(); - querier = boost::make_shared<FakeDNSSDQuerier>("wonderland.lit", eventLoop); + querier = std::make_shared<FakeDNSSDQuerier>("wonderland.lit", eventLoop); aliceServiceID = new DNSSDServiceID("alice", "wonderland.lit"); aliceServiceInfo = new DNSSDResolveServiceQuery::Result("_presence._tcp.wonderland.lit", "xmpp.wonderland.lit", 1234, LinkLocalServiceInfo().toTXTRecord()); testServiceID = new DNSSDServiceID("foo", "bar.local"); @@ -70,14 +70,14 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testConstructor() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); CPPUNIT_ASSERT(!testling->isRunning()); CPPUNIT_ASSERT(!testling->hasError()); } void testStart() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); CPPUNIT_ASSERT(testling->isRunning()); @@ -87,7 +87,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -109,7 +109,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_NoServiceInfo() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -123,7 +123,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_RegisteredService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -140,7 +140,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_UnregisteredService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); testling->registerService("alice", 1234, LinkLocalServiceInfo()); @@ -166,7 +166,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceRemoved_UnregisteredService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); testling->registerService("alice", 1234, LinkLocalServiceInfo()); @@ -183,7 +183,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceAdded_Twice() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -208,7 +208,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { void testServiceChanged() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setServiceInfo(*testServiceID,*testServiceInfo); querier->addService(*testServiceID); @@ -231,7 +231,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testServiceRemoved() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setServiceInfo(*testServiceID,*testServiceInfo); querier->addService(*testServiceID); @@ -252,7 +252,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testError_BrowseErrorAfterStart() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setBrowseError(); @@ -264,7 +264,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testError_BrowseErrorAfterResolve() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); querier->setServiceInfo(*testServiceID,*testServiceInfo); querier->addService(*testServiceID); @@ -283,7 +283,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testRegisterService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -299,7 +299,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testRegisterService_Error() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); LinkLocalServiceInfo info; testling->registerService("foo@bar", 1234, info); @@ -315,7 +315,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testRegisterService_Reregister() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); LinkLocalServiceInfo info; @@ -335,7 +335,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } void testUpdateService() { - boost::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); + std::shared_ptr<LinkLocalServiceBrowser> testling = createTestling(); testling->start(); eventLoop->processEvents(); @@ -352,8 +352,8 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<LinkLocalServiceBrowser> createTestling() { - boost::shared_ptr<LinkLocalServiceBrowser> testling( + std::shared_ptr<LinkLocalServiceBrowser> createTestling() { + std::shared_ptr<LinkLocalServiceBrowser> testling( new LinkLocalServiceBrowser(querier)); testling->onServiceAdded.connect(boost::bind( &LinkLocalServiceBrowserTest::handleServiceAdded, this, _1)); @@ -397,7 +397,7 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { private: DummyEventLoop* eventLoop; - boost::shared_ptr<FakeDNSSDQuerier> querier; + std::shared_ptr<FakeDNSSDQuerier> querier; std::vector<LinkLocalService> addedServices; std::vector<LinkLocalService> changedServices; std::vector<LinkLocalService> removedServices; |