summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 17:23:49 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-04 08:28:23 (GMT)
commit741c45b74d5f634622eb5f757c49323274fb8937 (patch)
treeb9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften/Network
parenteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff)
downloadswift-741c45b74d5f634622eb5f757c49323274fb8937.zip
swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/BOSHConnection.cpp16
-rw-r--r--Swiften/Network/BOSHConnection.h22
-rw-r--r--Swiften/Network/BOSHConnectionPool.cpp16
-rw-r--r--Swiften/Network/BOSHConnectionPool.h10
-rw-r--r--Swiften/Network/BoostConnection.cpp8
-rw-r--r--Swiften/Network/BoostConnection.h17
-rw-r--r--Swiften/Network/BoostConnectionFactory.cpp4
-rw-r--r--Swiften/Network/BoostConnectionFactory.h6
-rw-r--r--Swiften/Network/BoostConnectionServer.cpp6
-rw-r--r--Swiften/Network/BoostConnectionServer.h20
-rw-r--r--Swiften/Network/BoostConnectionServerFactory.cpp6
-rw-r--r--Swiften/Network/BoostConnectionServerFactory.h8
-rw-r--r--Swiften/Network/BoostIOServiceThread.cpp6
-rw-r--r--Swiften/Network/BoostIOServiceThread.h9
-rw-r--r--Swiften/Network/BoostNetworkFactories.cpp4
-rw-r--r--Swiften/Network/BoostNetworkFactories.h4
-rw-r--r--Swiften/Network/BoostTimer.cpp4
-rw-r--r--Swiften/Network/BoostTimer.h15
-rw-r--r--Swiften/Network/BoostTimerFactory.cpp4
-rw-r--r--Swiften/Network/BoostTimerFactory.h6
-rw-r--r--Swiften/Network/CachingDomainNameResolver.cpp4
-rw-r--r--Swiften/Network/CachingDomainNameResolver.h4
-rw-r--r--Swiften/Network/ChainedConnector.cpp10
-rw-r--r--Swiften/Network/ChainedConnector.h14
-rw-r--r--Swiften/Network/Connection.h8
-rw-r--r--Swiften/Network/ConnectionFactory.h6
-rw-r--r--Swiften/Network/ConnectionServer.h5
-rw-r--r--Swiften/Network/ConnectionServerFactory.h6
-rw-r--r--Swiften/Network/Connector.cpp8
-rw-r--r--Swiften/Network/Connector.h18
-rw-r--r--Swiften/Network/DomainNameAddressQuery.h5
-rw-r--r--Swiften/Network/DomainNameResolver.h7
-rw-r--r--Swiften/Network/DomainNameServiceQuery.h4
-rw-r--r--Swiften/Network/DummyConnection.cpp4
-rw-r--r--Swiften/Network/DummyConnection.h6
-rw-r--r--Swiften/Network/DummyConnectionFactory.h12
-rw-r--r--Swiften/Network/DummyConnectionServer.h4
-rw-r--r--Swiften/Network/DummyConnectionServerFactory.h12
-rw-r--r--Swiften/Network/DummyTimerFactory.cpp8
-rw-r--r--Swiften/Network/DummyTimerFactory.h6
-rw-r--r--Swiften/Network/FakeConnection.h6
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.cpp6
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.h12
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp8
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnectionFactory.h8
-rw-r--r--Swiften/Network/MiniUPnPInterface.cpp5
-rw-r--r--Swiften/Network/MiniUPnPInterface.h5
-rw-r--r--Swiften/Network/NATPMPInterface.cpp5
-rw-r--r--Swiften/Network/NATPMPInterface.h5
-rw-r--r--Swiften/Network/NATTraverser.h10
-rw-r--r--Swiften/Network/NullNATTraverser.cpp15
-rw-r--r--Swiften/Network/NullNATTraverser.h8
-rw-r--r--Swiften/Network/PlatformDomainNameAddressQuery.h6
-rw-r--r--Swiften/Network/PlatformDomainNameQuery.h6
-rw-r--r--Swiften/Network/PlatformDomainNameResolver.cpp12
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.h7
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.cpp22
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.h10
-rw-r--r--Swiften/Network/ProxiedConnection.cpp2
-rw-r--r--Swiften/Network/ProxiedConnection.h12
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnection.cpp2
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnection.h6
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp8
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnectionFactory.h4
-rw-r--r--Swiften/Network/StaticDomainNameResolver.cpp20
-rw-r--r--Swiften/Network/StaticDomainNameResolver.h7
-rw-r--r--Swiften/Network/TLSConnection.cpp6
-rw-r--r--Swiften/Network/TLSConnection.h7
-rw-r--r--Swiften/Network/TLSConnectionFactory.cpp8
-rw-r--r--Swiften/Network/TLSConnectionFactory.h6
-rw-r--r--Swiften/Network/Timer.h2
-rw-r--r--Swiften/Network/TimerFactory.h4
-rwxr-xr-xSwiften/Network/UnboundDomainNameResolver.cpp25
-rwxr-xr-xSwiften/Network/UnboundDomainNameResolver.h18
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp28
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionTest.cpp28
-rw-r--r--Swiften/Network/UnitTest/ChainedConnectorTest.cpp43
-rw-r--r--Swiften/Network/UnitTest/ConnectorTest.cpp44
-rw-r--r--Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp20
79 files changed, 409 insertions, 389 deletions
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp
index 887a5f0..757b1db 100644
--- a/Swiften/Network/BOSHConnection.cpp
+++ b/Swiften/Network/BOSHConnection.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -42,10 +42,10 @@ BOSHConnection::BOSHConnection(const URL& boshURL, Connector::ref connector, XML
connectionReady_(false)
{
if (boshURL_.getScheme() == "https") {
- tlsLayer_ = boost::make_shared<TLSLayer>(tlsContextFactory, tlsOptions);
+ tlsLayer_ = std::make_shared<TLSLayer>(tlsContextFactory, tlsOptions);
// The following dummyLayer_ is needed as the TLSLayer will pass the decrypted data to its parent layer.
// The dummyLayer_ will serve as the parent layer.
- dummyLayer_ = boost::make_shared<DummyStreamLayer>(tlsLayer_.get());
+ dummyLayer_ = std::make_shared<DummyStreamLayer>(tlsLayer_.get());
}
}
@@ -78,7 +78,7 @@ void BOSHConnection::handleTLSConnected() {
void BOSHConnection::handleTLSApplicationDataRead(const SafeByteArray& data) {
SWIFT_LOG(debug) << std::endl;
- handleDataRead(boost::make_shared<SafeByteArray>(data));
+ handleDataRead(std::make_shared<SafeByteArray>(data));
}
void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) {
@@ -86,12 +86,12 @@ void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data)
connection_->write(data);
}
-void BOSHConnection::handleRawDataRead(boost::shared_ptr<SafeByteArray> data) {
+void BOSHConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) {
SWIFT_LOG(debug) << std::endl;
tlsLayer_->handleDataRead(*data.get());
}
-void BOSHConnection::handleTLSError(boost::shared_ptr<TLSError> /* error */) {
+void BOSHConnection::handleTLSError(std::shared_ptr<TLSError> /* error */) {
}
@@ -276,7 +276,7 @@ void BOSHConnection::startStream(const std::string& to, unsigned long long rid)
SWIFT_LOG(debug) << "write stream header: " << safeByteArrayToString(safeHeader) << std::endl;
}
-void BOSHConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) {
+void BOSHConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) {
onBOSHDataRead(*data);
buffer_ = concat(buffer_, *data);
std::string response = safeByteArrayToString(buffer_);
@@ -295,7 +295,7 @@ void BOSHConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) {
if (parser.getBody()) {
if (parser.getBody()->attributes.getAttribute("type") == "terminate") {
BOSHError::Type errorType = parseTerminationCondition(parser.getBody()->attributes.getAttribute("condition"));
- onSessionTerminated(errorType == BOSHError::NoError ? boost::shared_ptr<BOSHError>() : boost::make_shared<BOSHError>(errorType));
+ onSessionTerminated(errorType == BOSHError::NoError ? std::shared_ptr<BOSHError>() : std::make_shared<BOSHError>(errorType));
}
buffer_.clear();
if (waitingForStartResponse_) {
diff --git a/Swiften/Network/BOSHConnection.h b/Swiften/Network/BOSHConnection.h
index dc0f3a5..485e86a 100644
--- a/Swiften/Network/BOSHConnection.h
+++ b/Swiften/Network/BOSHConnection.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -13,7 +13,7 @@
#pragma once
-#include <boost/enable_shared_from_this.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/Error.h>
@@ -51,15 +51,15 @@ namespace Swift {
BOSHError(Type type) : SessionStream::SessionStreamError(SessionStream::SessionStreamError::ConnectionReadError), type(type) {}
Type getType() {return type;}
- typedef boost::shared_ptr<BOSHError> ref;
+ typedef std::shared_ptr<BOSHError> ref;
private:
Type type;
};
- class SWIFTEN_API BOSHConnection : public boost::enable_shared_from_this<BOSHConnection> {
+ class SWIFTEN_API BOSHConnection : public std::enable_shared_from_this<BOSHConnection> {
public:
- typedef boost::shared_ptr<BOSHConnection> ref;
+ typedef std::shared_ptr<BOSHConnection> ref;
static ref create(const URL& boshURL, Connector::ref connector, XMLParserFactory* parserFactory, TLSContextFactory* tlsContextFactory, const TLSOptions& tlsOptions) {
return ref(new BOSHConnection(boshURL, connector, parserFactory, tlsContextFactory, tlsOptions));
}
@@ -97,7 +97,7 @@ namespace Swift {
static std::pair<SafeByteArray, size_t> createHTTPRequest(const SafeByteArray& data, bool streamRestart, bool terminate, unsigned long long rid, const std::string& sid, const URL& boshURL);
void handleConnectFinished(Connection::ref);
- void handleDataRead(boost::shared_ptr<SafeByteArray> data);
+ void handleDataRead(std::shared_ptr<SafeByteArray> data);
void handleDisconnected(const boost::optional<Connection::Error>& error);
void write(const SafeByteArray& data, bool streamRestart, bool terminate); /* FIXME: refactor */
BOSHError::Type parseTerminationCondition(const std::string& text);
@@ -106,16 +106,16 @@ namespace Swift {
void handleTLSConnected();
void handleTLSApplicationDataRead(const SafeByteArray& data);
void handleTLSNetowrkDataWriteRequest(const SafeByteArray& data);
- void handleRawDataRead(boost::shared_ptr<SafeByteArray> data);
- void handleTLSError(boost::shared_ptr<TLSError> error);
+ void handleRawDataRead(std::shared_ptr<SafeByteArray> data);
+ void handleTLSError(std::shared_ptr<TLSError> error);
void writeData(const SafeByteArray& data);
URL boshURL_;
Connector::ref connector_;
XMLParserFactory* parserFactory_;
- boost::shared_ptr<Connection> connection_;
- boost::shared_ptr<HighLayer> dummyLayer_;
- boost::shared_ptr<TLSLayer> tlsLayer_;
+ std::shared_ptr<Connection> connection_;
+ std::shared_ptr<HighLayer> dummyLayer_;
+ std::shared_ptr<TLSLayer> tlsLayer_;
std::string sid_;
bool waitingForStartResponse_;
unsigned long long rid_;
diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp
index 7d5c164..9ce40d3 100644
--- a/Swiften/Network/BOSHConnectionPool.cpp
+++ b/Swiften/Network/BOSHConnectionPool.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,7 +17,7 @@
#include <Swiften/Network/HTTPConnectProxiedConnectionFactory.h>
namespace Swift {
-BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* realResolver, ConnectionFactory* connectionFactoryParameter, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, boost::shared_ptr<HTTPTrafficFilter> trafficFilter) :
+BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* realResolver, ConnectionFactory* connectionFactoryParameter, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, std::shared_ptr<HTTPTrafficFilter> trafficFilter) :
boshURL(boshURL),
connectionFactory(connectionFactoryParameter),
xmlParserFactory(parserFactory),
@@ -96,7 +96,7 @@ std::vector<Certificate::ref> BOSHConnectionPool::getPeerCertificateChain() cons
return pinnedCertificateChain_;
}
-boost::shared_ptr<CertificateVerificationError> BOSHConnectionPool::getPeerCertificateVerificationError() const {
+std::shared_ptr<CertificateVerificationError> BOSHConnectionPool::getPeerCertificateVerificationError() const {
return lastVerificationError_;
}
@@ -132,7 +132,7 @@ void BOSHConnectionPool::handleSessionStarted(const std::string& sessionID, size
void BOSHConnectionPool::handleConnectFinished(bool error, BOSHConnection::ref connection) {
if (error) {
- onSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
+ onSessionTerminated(std::make_shared<BOSHError>(BOSHError::UndefinedCondition));
/*TODO: We can probably manage to not terminate the stream here and use the rid/ack retry
* logic to just swallow the error and try again (some number of tries).
*/
@@ -235,7 +235,7 @@ void BOSHConnectionPool::tryToSendQueuedData() {
}
void BOSHConnectionPool::handleHTTPError(const std::string& /*errorCode*/) {
- handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
+ handleSessionTerminated(std::make_shared<BOSHError>(BOSHError::UndefinedCondition));
}
void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnection::ref connection) {
@@ -244,7 +244,7 @@ void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnec
handleSessionTerminated(BOSHError::ref());
}
//else if (error) {
- // handleSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
+ // handleSessionTerminated(std::make_shared<BOSHError>(BOSHError::UndefinedCondition));
//}
else {
/* We might have just freed up a connection slot to send with */
@@ -252,7 +252,7 @@ void BOSHConnectionPool::handleConnectionDisconnected(bool/* error*/, BOSHConnec
}
}
-boost::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() {
+std::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() {
Connector::ref connector = Connector::create(boshURL.getHost(), URL::getPortOrDefaultPort(boshURL), boost::optional<std::string>(), resolver, connectionFactory, timerFactory);
BOSHConnection::ref connection = BOSHConnection::create(boshURL, connector, xmlParserFactory, tlsContextFactory_, tlsOptions_);
connection->onXMPPDataRead.connect(boost::bind(&BOSHConnectionPool::handleDataRead, this, _1));
@@ -274,7 +274,7 @@ boost::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() {
return connection;
}
-void BOSHConnectionPool::destroyConnection(boost::shared_ptr<BOSHConnection> connection) {
+void BOSHConnectionPool::destroyConnection(std::shared_ptr<BOSHConnection> connection) {
connections.erase(std::remove(connections.begin(), connections.end(), connection), connections.end());
connection->onXMPPDataRead.disconnect(boost::bind(&BOSHConnectionPool::handleDataRead, this, _1));
connection->onSessionStarted.disconnect(boost::bind(&BOSHConnectionPool::handleSessionStarted, this, _1, _2));
diff --git a/Swiften/Network/BOSHConnectionPool.h b/Swiften/Network/BOSHConnectionPool.h
index 5088be6..b288505 100644
--- a/Swiften/Network/BOSHConnectionPool.h
+++ b/Swiften/Network/BOSHConnectionPool.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -26,7 +26,7 @@ namespace Swift {
class SWIFTEN_API BOSHConnectionPool : public boost::bsignals::trackable {
public:
- BOSHConnectionPool(const URL& boshURL, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, boost::shared_ptr<HTTPTrafficFilter> trafficFilter = boost::shared_ptr<HTTPTrafficFilter>());
+ BOSHConnectionPool(const URL& boshURL, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword, const TLSOptions& tlsOptions, std::shared_ptr<HTTPTrafficFilter> trafficFilter = std::shared_ptr<HTTPTrafficFilter>());
~BOSHConnectionPool();
void open();
@@ -39,7 +39,7 @@ namespace Swift {
bool isTLSEncrypted() const;
Certificate::ref getPeerCertificate() const;
std::vector<Certificate::ref> getPeerCertificateChain() const;
- boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const;
+ std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const;
boost::signal<void (BOSHError::ref)> onSessionTerminated;
boost::signal<void ()> onSessionStarted;
@@ -82,7 +82,7 @@ namespace Swift {
CertificateWithKey::ref clientCertificate;
TLSContextFactory* tlsContextFactory_;
TLSOptions tlsOptions_;
- std::vector<boost::shared_ptr<Certificate> > pinnedCertificateChain_;
- boost::shared_ptr<CertificateVerificationError> lastVerificationError_;
+ std::vector<std::shared_ptr<Certificate> > pinnedCertificateChain_;
+ std::shared_ptr<CertificateVerificationError> lastVerificationError_;
};
}
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp
index 80cb6b8..a987790 100644
--- a/Swiften/Network/BoostConnection.cpp
+++ b/Swiften/Network/BoostConnection.cpp
@@ -7,13 +7,13 @@
#include <Swiften/Network/BoostConnection.h>
#include <algorithm>
+#include <memory>
#include <string>
#include <boost/asio/placeholders.hpp>
#include <boost/asio/write.hpp>
#include <boost/bind.hpp>
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <boost/thread.hpp>
#include <Swiften/Base/Algorithm.h>
@@ -45,13 +45,13 @@ class SharedBuffer {
const boost::asio::const_buffer* end() const { return &buffer_ + 1; }
private:
- boost::shared_ptr< std::vector<char, SafeAllocator<char> > > data_;
+ std::shared_ptr< std::vector<char, SafeAllocator<char> > > data_;
boost::asio::const_buffer buffer_;
};
// -----------------------------------------------------------------------------
-BoostConnection::BoostConnection(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) :
+BoostConnection::BoostConnection(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) :
eventLoop(eventLoop), ioService(ioService), socket_(*ioService), writing_(false), closeSocketAfterNextWrite_(false) {
}
@@ -119,7 +119,7 @@ void BoostConnection::handleConnectFinished(const boost::system::error_code& err
}
void BoostConnection::doRead() {
- readBuffer_ = boost::make_shared<SafeByteArray>(BUFFER_SIZE);
+ readBuffer_ = std::make_shared<SafeByteArray>(BUFFER_SIZE);
boost::lock_guard<boost::mutex> lock(readCloseMutex_);
socket_.async_read_some(
boost::asio::buffer(*readBuffer_),
diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h
index 9909455..82208a1 100644
--- a/Swiften/Network/BoostConnection.h
+++ b/Swiften/Network/BoostConnection.h
@@ -6,9 +6,10 @@
#pragma once
+#include <memory>
+
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/tcp.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/thread/mutex.hpp>
#include <Swiften/Base/API.h>
@@ -29,13 +30,13 @@ namespace boost {
namespace Swift {
class EventLoop;
- class SWIFTEN_API BoostConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<BoostConnection> {
+ class SWIFTEN_API BoostConnection : public Connection, public EventOwner, public std::enable_shared_from_this<BoostConnection> {
public:
- typedef boost::shared_ptr<BoostConnection> ref;
+ typedef std::shared_ptr<BoostConnection> ref;
virtual ~BoostConnection();
- static ref create(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) {
+ static ref create(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) {
return ref(new BoostConnection(ioService, eventLoop));
}
@@ -55,10 +56,10 @@ namespace Swift {
Certificate::ref getPeerCertificate() const;
std::vector<Certificate::ref> getPeerCertificateChain() const;
- boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const;
+ std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const;
private:
- BoostConnection(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
+ BoostConnection(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
void handleConnectFinished(const boost::system::error_code& error);
void handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred);
@@ -69,9 +70,9 @@ namespace Swift {
private:
EventLoop* eventLoop;
- boost::shared_ptr<boost::asio::io_service> ioService;
+ std::shared_ptr<boost::asio::io_service> ioService;
boost::asio::ip::tcp::socket socket_;
- boost::shared_ptr<SafeByteArray> readBuffer_;
+ std::shared_ptr<SafeByteArray> readBuffer_;
boost::mutex writeMutex_;
bool writing_;
SafeByteArray writeQueue_;
diff --git a/Swiften/Network/BoostConnectionFactory.cpp b/Swiften/Network/BoostConnectionFactory.cpp
index d22f600..9ec30f5 100644
--- a/Swiften/Network/BoostConnectionFactory.cpp
+++ b/Swiften/Network/BoostConnectionFactory.cpp
@@ -10,10 +10,10 @@
namespace Swift {
-BoostConnectionFactory::BoostConnectionFactory(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) {
+BoostConnectionFactory::BoostConnectionFactory(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) {
}
-boost::shared_ptr<Connection> BoostConnectionFactory::createConnection() {
+std::shared_ptr<Connection> BoostConnectionFactory::createConnection() {
return BoostConnection::create(ioService, eventLoop);
}
diff --git a/Swiften/Network/BoostConnectionFactory.h b/Swiften/Network/BoostConnectionFactory.h
index 46502de..a4e3b0d 100644
--- a/Swiften/Network/BoostConnectionFactory.h
+++ b/Swiften/Network/BoostConnectionFactory.h
@@ -17,12 +17,12 @@ namespace Swift {
class SWIFTEN_API BoostConnectionFactory : public ConnectionFactory {
public:
- BoostConnectionFactory(boost::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop);
+ BoostConnectionFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop);
- virtual boost::shared_ptr<Connection> createConnection();
+ virtual std::shared_ptr<Connection> createConnection();
private:
- boost::shared_ptr<boost::asio::io_service> ioService;
+ std::shared_ptr<boost::asio::io_service> ioService;
EventLoop* eventLoop;
};
}
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp
index 99fe9b6..34b5799 100644
--- a/Swiften/Network/BoostConnectionServer.cpp
+++ b/Swiften/Network/BoostConnectionServer.cpp
@@ -19,10 +19,10 @@
namespace Swift {
-BoostConnectionServer::BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) {
+BoostConnectionServer::BoostConnectionServer(int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) {
}
-BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) {
+BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(nullptr) {
}
void BoostConnectionServer::start() {
@@ -81,7 +81,7 @@ void BoostConnectionServer::acceptNextConnection() {
boost::bind(&BoostConnectionServer::handleAccept, shared_from_this(), newConnection, boost::asio::placeholders::error));
}
-void BoostConnectionServer::handleAccept(boost::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error) {
+void BoostConnectionServer::handleAccept(std::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error) {
if (error) {
eventLoop->postEvent(
boost::bind(
diff --git a/Swiften/Network/BoostConnectionServer.h b/Swiften/Network/BoostConnectionServer.h
index 8ee2a6d..b8a1c64 100644
--- a/Swiften/Network/BoostConnectionServer.h
+++ b/Swiften/Network/BoostConnectionServer.h
@@ -6,11 +6,11 @@
#pragma once
+#include <memory>
+
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/tcp.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/optional/optional_fwd.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -19,15 +19,15 @@
#include <Swiften/Network/ConnectionServer.h>
namespace Swift {
- class SWIFTEN_API BoostConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<BoostConnectionServer> {
+ class SWIFTEN_API BoostConnectionServer : public ConnectionServer, public EventOwner, public std::enable_shared_from_this<BoostConnectionServer> {
public:
- typedef boost::shared_ptr<BoostConnectionServer> ref;
+ typedef std::shared_ptr<BoostConnectionServer> ref;
- static ref create(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) {
+ static ref create(int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) {
return ref(new BoostConnectionServer(port, ioService, eventLoop));
}
- static ref create(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) {
+ static ref create(const HostAddress &address, int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) {
return ref(new BoostConnectionServer(address, port, ioService, eventLoop));
}
@@ -40,17 +40,17 @@ namespace Swift {
boost::signal<void (boost::optional<Error>)> onStopped;
private:
- BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
- BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
+ BoostConnectionServer(int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
+ BoostConnectionServer(const HostAddress &address, int port, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
void stop(boost::optional<Error> e);
void acceptNextConnection();
- void handleAccept(boost::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error);
+ void handleAccept(std::shared_ptr<BoostConnection> newConnection, const boost::system::error_code& error);
private:
HostAddress address_;
int port_;
- boost::shared_ptr<boost::asio::io_service> ioService_;
+ std::shared_ptr<boost::asio::io_service> ioService_;
EventLoop* eventLoop;
boost::asio::ip::tcp::acceptor* acceptor_;
};
diff --git a/Swiften/Network/BoostConnectionServerFactory.cpp b/Swiften/Network/BoostConnectionServerFactory.cpp
index 25afdb6..8b3fd2f 100644
--- a/Swiften/Network/BoostConnectionServerFactory.cpp
+++ b/Swiften/Network/BoostConnectionServerFactory.cpp
@@ -16,14 +16,14 @@
namespace Swift {
-BoostConnectionServerFactory::BoostConnectionServerFactory(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) {
+BoostConnectionServerFactory::BoostConnectionServerFactory(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) {
}
-boost::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(int port) {
+std::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(int port) {
return BoostConnectionServer::create(port, ioService, eventLoop);
}
-boost::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(const Swift::HostAddress &hostAddress, int port) {
+std::shared_ptr<ConnectionServer> BoostConnectionServerFactory::createConnectionServer(const Swift::HostAddress &hostAddress, int port) {
return BoostConnectionServer::create(hostAddress, port, ioService, eventLoop);
}
diff --git a/Swiften/Network/BoostConnectionServerFactory.h b/Swiften/Network/BoostConnectionServerFactory.h
index 1e0daa3..033e63d 100644
--- a/Swiften/Network/BoostConnectionServerFactory.h
+++ b/Swiften/Network/BoostConnectionServerFactory.h
@@ -23,14 +23,14 @@ namespace Swift {
class SWIFTEN_API BoostConnectionServerFactory : public ConnectionServerFactory {
public:
- BoostConnectionServerFactory(boost::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop);
+ BoostConnectionServerFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop);
- virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port);
+ virtual std::shared_ptr<ConnectionServer> createConnectionServer(int port);
- virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress &hostAddress, int port);
+ virtual std::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress &hostAddress, int port);
private:
- boost::shared_ptr<boost::asio::io_service> ioService;
+ std::shared_ptr<boost::asio::io_service> ioService;
EventLoop* eventLoop;
};
}
diff --git a/Swiften/Network/BoostIOServiceThread.cpp b/Swiften/Network/BoostIOServiceThread.cpp
index 79112d8..0b0b7a4 100644
--- a/Swiften/Network/BoostIOServiceThread.cpp
+++ b/Swiften/Network/BoostIOServiceThread.cpp
@@ -6,17 +6,17 @@
#include <Swiften/Network/BoostIOServiceThread.h>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
namespace Swift {
-BoostIOServiceThread::BoostIOServiceThread(boost::shared_ptr<boost::asio::io_service> ioService) {
+BoostIOServiceThread::BoostIOServiceThread(std::shared_ptr<boost::asio::io_service> ioService) {
if (!!ioService) {
ioService_ = ioService;
thread_ = nullptr;
}
else {
- ioService_ = boost::make_shared<boost::asio::io_service>();
+ ioService_ = std::make_shared<boost::asio::io_service>();
thread_ = new boost::thread(boost::bind(&BoostIOServiceThread::doRun, this));
}
}
diff --git a/Swiften/Network/BoostIOServiceThread.h b/Swiften/Network/BoostIOServiceThread.h
index 54f1840..18d5a5b 100644
--- a/Swiften/Network/BoostIOServiceThread.h
+++ b/Swiften/Network/BoostIOServiceThread.h
@@ -6,8 +6,9 @@
#pragma once
+#include <memory>
+
#include <boost/asio/io_service.hpp>
-#include <boost/shared_ptr.hpp>
#include <boost/thread/thread.hpp>
#include <Swiften/Base/API.h>
@@ -23,10 +24,10 @@ namespace Swift {
* you are re-using an io_service from elsewhere (particularly if you
* are using the BoostASIOEventLoop).
*/
- BoostIOServiceThread(boost::shared_ptr<boost::asio::io_service> ioService = boost::shared_ptr<boost::asio::io_service>());
+ BoostIOServiceThread(std::shared_ptr<boost::asio::io_service> ioService = std::shared_ptr<boost::asio::io_service>());
~BoostIOServiceThread();
- boost::shared_ptr<boost::asio::io_service> getIOService() const {
+ std::shared_ptr<boost::asio::io_service> getIOService() const {
return ioService_;
}
@@ -34,7 +35,7 @@ namespace Swift {
void doRun();
private:
- boost::shared_ptr<boost::asio::io_service> ioService_;
+ std::shared_ptr<boost::asio::io_service> ioService_;
boost::thread* thread_;
};
}
diff --git a/Swiften/Network/BoostNetworkFactories.cpp b/Swiften/Network/BoostNetworkFactories.cpp
index 40282f2..9fef73c 100644
--- a/Swiften/Network/BoostNetworkFactories.cpp
+++ b/Swiften/Network/BoostNetworkFactories.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.
*/
@@ -28,7 +28,7 @@
namespace Swift {
-BoostNetworkFactories::BoostNetworkFactories(EventLoop* eventLoop, boost::shared_ptr<boost::asio::io_service> ioService) : ioServiceThread(ioService), eventLoop(eventLoop) {
+BoostNetworkFactories::BoostNetworkFactories(EventLoop* eventLoop, std::shared_ptr<boost::asio::io_service> ioService) : ioServiceThread(ioService), eventLoop(eventLoop) {
timerFactory = new BoostTimerFactory(ioServiceThread.getIOService(), eventLoop);
connectionFactory = new BoostConnectionFactory(ioServiceThread.getIOService(), eventLoop);
connectionServerFactory = new BoostConnectionServerFactory(ioServiceThread.getIOService(), eventLoop);
diff --git a/Swiften/Network/BoostNetworkFactories.h b/Swiften/Network/BoostNetworkFactories.h
index ccacbf0..72afb04 100644
--- a/Swiften/Network/BoostNetworkFactories.h
+++ b/Swiften/Network/BoostNetworkFactories.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 {
* @param ioService If this optional parameter is provided, it will be
* used for the construction of the BoostIOServiceThread.
*/
- BoostNetworkFactories(EventLoop* eventLoop, boost::shared_ptr<boost::asio::io_service> ioService = boost::shared_ptr<boost::asio::io_service>());
+ BoostNetworkFactories(EventLoop* eventLoop, std::shared_ptr<boost::asio::io_service> ioService = std::shared_ptr<boost::asio::io_service>());
virtual ~BoostNetworkFactories();
virtual TimerFactory* getTimerFactory() const SWIFTEN_OVERRIDE {
diff --git a/Swiften/Network/BoostTimer.cpp b/Swiften/Network/BoostTimer.cpp
index 734a9c8..846192c 100644
--- a/Swiften/Network/BoostTimer.cpp
+++ b/Swiften/Network/BoostTimer.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.
*/
@@ -14,7 +14,7 @@
namespace Swift {
-BoostTimer::BoostTimer(int milliseconds, boost::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) :
+BoostTimer::BoostTimer(int milliseconds, std::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) :
timeout(milliseconds), ioService(service), eventLoop(eventLoop), shuttingDown(false) {
timer.reset(new boost::asio::deadline_timer(*service));
}
diff --git a/Swiften/Network/BoostTimer.h b/Swiften/Network/BoostTimer.h
index 79c71cd..c54b401 100644
--- a/Swiften/Network/BoostTimer.h
+++ b/Swiften/Network/BoostTimer.h
@@ -1,14 +1,15 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
+
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/io_service.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/thread/mutex.hpp>
@@ -19,13 +20,13 @@
namespace Swift {
class EventLoop;
- class SWIFTEN_API BoostTimer : public Timer, public EventOwner, public boost::enable_shared_from_this<BoostTimer> {
+ class SWIFTEN_API BoostTimer : public Timer, public EventOwner, public std::enable_shared_from_this<BoostTimer> {
public:
- typedef boost::shared_ptr<BoostTimer> ref;
+ typedef std::shared_ptr<BoostTimer> ref;
virtual ~BoostTimer();
- static ref create(int milliseconds, boost::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) {
+ static ref create(int milliseconds, std::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop) {
return ref(new BoostTimer(milliseconds, service, eventLoop));
}
@@ -33,13 +34,13 @@ namespace Swift {
virtual void stop();
private:
- BoostTimer(int milliseconds, boost::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop);
+ BoostTimer(int milliseconds, std::shared_ptr<boost::asio::io_service> service, EventLoop* eventLoop);
void handleTimerTick(const boost::system::error_code& error);
private:
int timeout;
- boost::shared_ptr<boost::asio::io_service> ioService;
+ std::shared_ptr<boost::asio::io_service> ioService;
boost::scoped_ptr<boost::asio::deadline_timer> timer;
boost::mutex timerMutex;
EventLoop* eventLoop;
diff --git a/Swiften/Network/BoostTimerFactory.cpp b/Swiften/Network/BoostTimerFactory.cpp
index 086eb60..ffa9b30 100644
--- a/Swiften/Network/BoostTimerFactory.cpp
+++ b/Swiften/Network/BoostTimerFactory.cpp
@@ -10,10 +10,10 @@
namespace Swift {
-BoostTimerFactory::BoostTimerFactory(boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) {
+BoostTimerFactory::BoostTimerFactory(std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : ioService(ioService), eventLoop(eventLoop) {
}
-boost::shared_ptr<Timer> BoostTimerFactory::createTimer(int milliseconds) {
+std::shared_ptr<Timer> BoostTimerFactory::createTimer(int milliseconds) {
return BoostTimer::create(milliseconds, ioService, eventLoop);
}
diff --git a/Swiften/Network/BoostTimerFactory.h b/Swiften/Network/BoostTimerFactory.h
index 4fbabe9..ca9a833 100644
--- a/Swiften/Network/BoostTimerFactory.h
+++ b/Swiften/Network/BoostTimerFactory.h
@@ -18,12 +18,12 @@ namespace Swift {
class SWIFTEN_API BoostTimerFactory : public TimerFactory {
public:
- BoostTimerFactory(boost::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop);
+ BoostTimerFactory(std::shared_ptr<boost::asio::io_service>, EventLoop* eventLoop);
- virtual boost::shared_ptr<Timer> createTimer(int milliseconds);
+ virtual std::shared_ptr<Timer> createTimer(int milliseconds);
private:
- boost::shared_ptr<boost::asio::io_service> ioService;
+ std::shared_ptr<boost::asio::io_service> ioService;
EventLoop* eventLoop;
};
}
diff --git a/Swiften/Network/CachingDomainNameResolver.cpp b/Swiften/Network/CachingDomainNameResolver.cpp
index d731eb9..8846e09 100644
--- a/Swiften/Network/CachingDomainNameResolver.cpp
+++ b/Swiften/Network/CachingDomainNameResolver.cpp
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2012 Isode Limited.
+ * Copyright (c) 2012-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Network/CachingDomainNameResolver.h>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
namespace Swift {
diff --git a/Swiften/Network/CachingDomainNameResolver.h b/Swiften/Network/CachingDomainNameResolver.h
index 25cb86c..9339a77 100644
--- a/Swiften/Network/CachingDomainNameResolver.h
+++ b/Swiften/Network/CachingDomainNameResolver.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2012-2015 Isode Limited.
+ * Copyright (c) 2012-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/Network/DomainNameResolver.h>
diff --git a/Swiften/Network/ChainedConnector.cpp b/Swiften/Network/ChainedConnector.cpp
index 08c4aac..fbea868 100644
--- a/Swiften/Network/ChainedConnector.cpp
+++ b/Swiften/Network/ChainedConnector.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -58,14 +58,14 @@ void ChainedConnector::stop() {
currentConnector->stop();
currentConnector.reset();
}
- finish(boost::shared_ptr<Connection>(), boost::shared_ptr<Error>());
+ finish(std::shared_ptr<Connection>(), std::shared_ptr<Error>());
}
void ChainedConnector::tryNextConnectionFactory() {
assert(!currentConnector);
if (connectionFactoryQueue.empty()) {
SWIFT_LOG(debug) << "No more connection factories" << std::endl;
- finish(boost::shared_ptr<Connection>(), lastError);
+ finish(std::shared_ptr<Connection>(), lastError);
}
else {
ConnectionFactory* connectionFactory = connectionFactoryQueue.front();
@@ -78,7 +78,7 @@ void ChainedConnector::tryNextConnectionFactory() {
}
}
-void ChainedConnector::handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) {
+void ChainedConnector::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) {
SWIFT_LOG(debug) << "Connector finished" << std::endl;
currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2));
lastError = error;
@@ -91,6 +91,6 @@ void ChainedConnector::handleConnectorFinished(boost::shared_ptr<Connection> con
}
}
-void ChainedConnector::finish(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) {
+void ChainedConnector::finish(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) {
onConnectFinished(connection, error);
}
diff --git a/Swiften/Network/ChainedConnector.h b/Swiften/Network/ChainedConnector.h
index 416dccb..bba9bfa 100644
--- a/Swiften/Network/ChainedConnector.h
+++ b/Swiften/Network/ChainedConnector.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -7,11 +7,11 @@
#pragma once
#include <deque>
+#include <memory>
#include <string>
#include <vector>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Base/Error.h>
@@ -33,12 +33,12 @@ namespace Swift {
void start();
void stop();
- boost::signal<void (boost::shared_ptr<Connection>, boost::shared_ptr<Error>)> onConnectFinished;
+ boost::signal<void (std::shared_ptr<Connection>, std::shared_ptr<Error>)> onConnectFinished;
private:
- void finish(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error>);
+ void finish(std::shared_ptr<Connection> connection, std::shared_ptr<Error>);
void tryNextConnectionFactory();
- void handleConnectorFinished(boost::shared_ptr<Connection>, boost::shared_ptr<Error>);
+ void handleConnectorFinished(std::shared_ptr<Connection>, std::shared_ptr<Error>);
private:
std::string hostname;
@@ -49,7 +49,7 @@ namespace Swift {
TimerFactory* timerFactory;
int timeoutMilliseconds;
std::deque<ConnectionFactory*> connectionFactoryQueue;
- boost::shared_ptr<Connector> currentConnector;
- boost::shared_ptr<Error> lastError;
+ std::shared_ptr<Connector> currentConnector;
+ std::shared_ptr<Error> lastError;
};
}
diff --git a/Swiften/Network/Connection.h b/Swiften/Network/Connection.h
index c38b98f..1ef5824 100644
--- a/Swiften/Network/Connection.h
+++ b/Swiften/Network/Connection.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2010-2015 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/Base/SafeByteArray.h>
@@ -17,7 +17,7 @@ namespace Swift {
class SWIFTEN_API Connection {
public:
- typedef boost::shared_ptr<Connection> ref;
+ typedef std::shared_ptr<Connection> ref;
enum Error {
ReadError,
@@ -38,7 +38,7 @@ namespace Swift {
public:
boost::signal<void (bool /* error */)> onConnectFinished;
boost::signal<void (const boost::optional<Error>&)> onDisconnected;
- boost::signal<void (boost::shared_ptr<SafeByteArray>)> onDataRead;
+ boost::signal<void (std::shared_ptr<SafeByteArray>)> onDataRead;
boost::signal<void ()> onDataWritten;
};
}
diff --git a/Swiften/Network/ConnectionFactory.h b/Swiften/Network/ConnectionFactory.h
index fd65908..e749fa3 100644
--- a/Swiften/Network/ConnectionFactory.h
+++ b/Swiften/Network/ConnectionFactory.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>
@@ -17,6 +17,6 @@ namespace Swift {
public:
virtual ~ConnectionFactory();
- virtual boost::shared_ptr<Connection> createConnection() = 0;
+ virtual std::shared_ptr<Connection> createConnection() = 0;
};
}
diff --git a/Swiften/Network/ConnectionServer.h b/Swiften/Network/ConnectionServer.h
index a8c77eb..ae510e5 100644
--- a/Swiften/Network/ConnectionServer.h
+++ b/Swiften/Network/ConnectionServer.h
@@ -6,8 +6,9 @@
#pragma once
+#include <memory>
+
#include <boost/optional/optional_fwd.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -32,6 +33,6 @@ namespace Swift {
virtual void stop() = 0;
- boost::signal<void (boost::shared_ptr<Connection>)> onNewConnection;
+ boost::signal<void (std::shared_ptr<Connection>)> onNewConnection;
};
}
diff --git a/Swiften/Network/ConnectionServerFactory.h b/Swiften/Network/ConnectionServerFactory.h
index 7f988bf..413131e 100644
--- a/Swiften/Network/ConnectionServerFactory.h
+++ b/Swiften/Network/ConnectionServerFactory.h
@@ -12,7 +12,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
@@ -24,8 +24,8 @@ namespace Swift {
public:
virtual ~ConnectionServerFactory();
- virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port) = 0;
+ virtual std::shared_ptr<ConnectionServer> createConnectionServer(int port) = 0;
- virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) = 0;
+ virtual std::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) = 0;
};
}
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index bd25e70..37cf35d 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -54,7 +54,7 @@ void Connector::stop() {
currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1));
currentConnection->disconnect();
}
- finish(boost::shared_ptr<Connection>());
+ finish(std::shared_ptr<Connection>());
}
void Connector::queryAddress(const std::string& hostname) {
@@ -77,7 +77,7 @@ void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuer
void Connector::tryNextServiceOrFallback() {
if (queriedAllServices) {
SWIFT_LOG(debug) << "Queried all services" << std::endl;
- finish(boost::shared_ptr<Connection>());
+ finish(std::shared_ptr<Connection>());
}
else if (serviceQueryResults.empty()) {
SWIFT_LOG(debug) << "Falling back on A resolution" << std::endl;
@@ -165,7 +165,7 @@ void Connector::handleConnectionConnectFinished(bool error) {
}
}
-void Connector::finish(boost::shared_ptr<Connection> connection) {
+void Connector::finish(std::shared_ptr<Connection> connection) {
if (timer) {
timer->stop();
timer->onTick.disconnect(boost::bind(&Connector::handleTimeout, shared_from_this()));
@@ -183,7 +183,7 @@ void Connector::finish(boost::shared_ptr<Connection> connection) {
currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1));
currentConnection.reset();
}
- onConnectFinished(connection, (connection || foundSomeDNS) ? boost::shared_ptr<Error>() : boost::make_shared<DomainNameResolveError>());
+ onConnectFinished(connection, (connection || foundSomeDNS) ? std::shared_ptr<Error>() : std::make_shared<DomainNameResolveError>());
}
void Connector::handleTimeout() {
diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h
index 52486b6..8114dd1 100644
--- a/Swiften/Network/Connector.h
+++ b/Swiften/Network/Connector.h
@@ -7,10 +7,10 @@
#pragma once
#include <deque>
+#include <memory>
#include <string>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -26,9 +26,9 @@ namespace Swift {
class ConnectionFactory;
class TimerFactory;
- class SWIFTEN_API Connector : public boost::bsignals::trackable, public boost::enable_shared_from_this<Connector> {
+ class SWIFTEN_API Connector : public boost::bsignals::trackable, public std::enable_shared_from_this<Connector> {
public:
- typedef boost::shared_ptr<Connector> ref;
+ typedef std::shared_ptr<Connector> ref;
static Connector::ref create(const std::string& hostname, int port, const boost::optional<std::string>& serviceLookupPrefix, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
return ref(new Connector(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory));
@@ -43,7 +43,7 @@ namespace Swift {
void start();
void stop();
- boost::signal<void (boost::shared_ptr<Connection>, boost::shared_ptr<Error>)> onConnectFinished;
+ boost::signal<void (std::shared_ptr<Connection>, std::shared_ptr<Error>)> onConnectFinished;
private:
Connector(const std::string& hostname, int port, const boost::optional<std::string>& serviceLookupPrefix, DomainNameResolver*, ConnectionFactory*, TimerFactory*);
@@ -57,7 +57,7 @@ namespace Swift {
void tryConnect(const HostAddressPort& target);
void handleConnectionConnectFinished(bool error);
- void finish(boost::shared_ptr<Connection>);
+ void finish(std::shared_ptr<Connection>);
void handleTimeout();
@@ -69,13 +69,13 @@ namespace Swift {
ConnectionFactory* connectionFactory;
TimerFactory* timerFactory;
int timeoutMilliseconds;
- boost::shared_ptr<Timer> timer;
- boost::shared_ptr<DomainNameServiceQuery> serviceQuery;
+ std::shared_ptr<Timer> timer;
+ std::shared_ptr<DomainNameServiceQuery> serviceQuery;
std::deque<DomainNameServiceQuery::Result> serviceQueryResults;
- boost::shared_ptr<DomainNameAddressQuery> addressQuery;
+ std::shared_ptr<DomainNameAddressQuery> addressQuery;
std::deque<HostAddress> addressQueryResults;
bool queriedAllServices;
- boost::shared_ptr<Connection> currentConnection;
+ std::shared_ptr<Connection> currentConnection;
bool foundSomeDNS;
};
}
diff --git a/Swiften/Network/DomainNameAddressQuery.h b/Swiften/Network/DomainNameAddressQuery.h
index 10bcd5a..f6650c6 100644
--- a/Swiften/Network/DomainNameAddressQuery.h
+++ b/Swiften/Network/DomainNameAddressQuery.h
@@ -6,8 +6,9 @@
#pragma once
+#include <memory>
+
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Network/DomainNameResolveError.h>
@@ -16,7 +17,7 @@
namespace Swift {
class DomainNameAddressQuery {
public:
- typedef boost::shared_ptr<DomainNameAddressQuery> ref;
+ typedef std::shared_ptr<DomainNameAddressQuery> ref;
virtual ~DomainNameAddressQuery();
diff --git a/Swiften/Network/DomainNameResolver.h b/Swiften/Network/DomainNameResolver.h
index 97997c9..5fe30d5 100644
--- a/Swiften/Network/DomainNameResolver.h
+++ b/Swiften/Network/DomainNameResolver.h
@@ -6,10 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
namespace Swift {
@@ -21,7 +20,7 @@ namespace Swift {
public:
virtual ~DomainNameResolver();
- virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) = 0;
- virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name) = 0;
+ virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) = 0;
+ virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name) = 0;
};
}
diff --git a/Swiften/Network/DomainNameServiceQuery.h b/Swiften/Network/DomainNameServiceQuery.h
index acbccf0..b8e0e7c 100644
--- a/Swiften/Network/DomainNameServiceQuery.h
+++ b/Swiften/Network/DomainNameServiceQuery.h
@@ -6,11 +6,11 @@
#pragma once
+#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>
@@ -21,7 +21,7 @@ namespace Swift {
class SWIFTEN_API DomainNameServiceQuery {
public:
- typedef boost::shared_ptr<DomainNameServiceQuery> ref;
+ typedef std::shared_ptr<DomainNameServiceQuery> ref;
struct Result {
Result(const std::string& hostname = "", int port = -1, int priority = -1, int weight = -1) : hostname(hostname), port(port), priority(priority), weight(weight) {}
diff --git a/Swiften/Network/DummyConnection.cpp b/Swiften/Network/DummyConnection.cpp
index a4e5419..3024b21 100644
--- a/Swiften/Network/DummyConnection.cpp
+++ b/Swiften/Network/DummyConnection.cpp
@@ -7,9 +7,9 @@
#include <Swiften/Network/DummyConnection.h>
#include <cassert>
+#include <memory>
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
namespace Swift {
@@ -17,7 +17,7 @@ DummyConnection::DummyConnection(EventLoop* eventLoop) : eventLoop(eventLoop) {
}
void DummyConnection::receive(const SafeByteArray& data) {
- eventLoop->postEvent(boost::bind(boost::ref(onDataRead), boost::make_shared<SafeByteArray>(data)), shared_from_this());
+ eventLoop->postEvent(boost::bind(boost::ref(onDataRead), std::make_shared<SafeByteArray>(data)), shared_from_this());
}
void DummyConnection::listen() {
diff --git a/Swiften/Network/DummyConnection.h b/Swiften/Network/DummyConnection.h
index fcfdb15..f7b9e29 100644
--- a/Swiften/Network/DummyConnection.h
+++ b/Swiften/Network/DummyConnection.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <boost/enable_shared_from_this.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/EventLoop/EventLoop.h>
@@ -15,7 +15,7 @@
#include <Swiften/Network/HostAddressPort.h>
namespace Swift {
- class SWIFTEN_API DummyConnection : public Connection, public EventOwner, public boost::enable_shared_from_this<DummyConnection> {
+ class SWIFTEN_API DummyConnection : public Connection, public EventOwner, public std::enable_shared_from_this<DummyConnection> {
public:
DummyConnection(EventLoop* eventLoop);
diff --git a/Swiften/Network/DummyConnectionFactory.h b/Swiften/Network/DummyConnectionFactory.h
index f861312..d723283 100644
--- a/Swiften/Network/DummyConnectionFactory.h
+++ b/Swiften/Network/DummyConnectionFactory.h
@@ -4,9 +4,15 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#pragma once
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Network/ConnectionFactory.h>
#include <Swiften/Network/DummyConnection.h>
@@ -19,8 +25,8 @@ class DummyConnectionFactory : public ConnectionFactory {
public:
DummyConnectionFactory(EventLoop *eventLoop) : eventLoop(eventLoop) {}
virtual ~DummyConnectionFactory() {}
- virtual boost::shared_ptr<Connection> createConnection() {
- return boost::make_shared<DummyConnection>(eventLoop);
+ virtual std::shared_ptr<Connection> createConnection() {
+ return std::make_shared<DummyConnection>(eventLoop);
}
private:
EventLoop* eventLoop;
diff --git a/Swiften/Network/DummyConnectionServer.h b/Swiften/Network/DummyConnectionServer.h
index 0bf7386..970cbb7 100644
--- a/Swiften/Network/DummyConnectionServer.h
+++ b/Swiften/Network/DummyConnectionServer.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/enable_shared_from_this.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/EventLoop/EventLoop.h>
@@ -15,7 +15,7 @@
#include <Swiften/Network/HostAddressPort.h>
namespace Swift {
- class SWIFTEN_API DummyConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<DummyConnectionServer> {
+ class SWIFTEN_API DummyConnectionServer : public ConnectionServer, public EventOwner, public std::enable_shared_from_this<DummyConnectionServer> {
public:
DummyConnectionServer(EventLoop* /*eventLoop*/, int port) : localAddressPort(HostAddress(), port) {}
DummyConnectionServer(EventLoop* /*eventLoop*/, const Swift::HostAddress& hostAddress, int port) : localAddressPort(hostAddress, port) {}
diff --git a/Swiften/Network/DummyConnectionServerFactory.h b/Swiften/Network/DummyConnectionServerFactory.h
index 0952a38..822f95f 100644
--- a/Swiften/Network/DummyConnectionServerFactory.h
+++ b/Swiften/Network/DummyConnectionServerFactory.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Network/ConnectionServerFactory.h>
#include <Swiften/Network/DummyConnectionServer.h>
@@ -20,12 +20,12 @@ public:
DummyConnectionServerFactory(EventLoop* eventLoop) : eventLoop(eventLoop) {}
virtual ~DummyConnectionServerFactory() {}
- virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port) {
- return boost::make_shared<DummyConnectionServer>(eventLoop, port);
+ virtual std::shared_ptr<ConnectionServer> createConnectionServer(int port) {
+ return std::make_shared<DummyConnectionServer>(eventLoop, port);
}
- virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) {
- return boost::make_shared<DummyConnectionServer>(eventLoop, hostAddress, port);
+ virtual std::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress& hostAddress, int port) {
+ return std::make_shared<DummyConnectionServer>(eventLoop, hostAddress, port);
}
private:
diff --git a/Swiften/Network/DummyTimerFactory.cpp b/Swiften/Network/DummyTimerFactory.cpp
index cae5c84..cdc776c 100644
--- a/Swiften/Network/DummyTimerFactory.cpp
+++ b/Swiften/Network/DummyTimerFactory.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -41,15 +41,15 @@ class DummyTimerFactory::DummyTimer : public Timer {
DummyTimerFactory::DummyTimerFactory() : currentTime(0) {
}
-boost::shared_ptr<Timer> DummyTimerFactory::createTimer(int milliseconds) {
- boost::shared_ptr<DummyTimer> timer(new DummyTimer(milliseconds, this));
+std::shared_ptr<Timer> DummyTimerFactory::createTimer(int milliseconds) {
+ std::shared_ptr<DummyTimer> timer(new DummyTimer(milliseconds, this));
timers.push_back(timer);
return timer;
}
void DummyTimerFactory::setTime(int time) {
assert(time > currentTime);
- foreach(boost::shared_ptr<DummyTimer> timer, timers) {
+ foreach(std::shared_ptr<DummyTimer> timer, timers) {
if (timer->getAlarmTime() > currentTime && timer->getAlarmTime() <= time && timer->isRunning) {
timer->onTick();
}
diff --git a/Swiften/Network/DummyTimerFactory.h b/Swiften/Network/DummyTimerFactory.h
index bb2f813..5ccbf93 100644
--- a/Swiften/Network/DummyTimerFactory.h
+++ b/Swiften/Network/DummyTimerFactory.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.
*/
@@ -18,12 +18,12 @@ namespace Swift {
DummyTimerFactory();
- virtual boost::shared_ptr<Timer> createTimer(int milliseconds);
+ virtual std::shared_ptr<Timer> createTimer(int milliseconds);
void setTime(int time);
private:
friend class DummyTimer;
int currentTime;
- std::list<boost::shared_ptr<DummyTimer> > timers;
+ std::list<std::shared_ptr<DummyTimer> > timers;
};
}
diff --git a/Swiften/Network/FakeConnection.h b/Swiften/Network/FakeConnection.h
index c7d1f27..08c1d75 100644
--- a/Swiften/Network/FakeConnection.h
+++ b/Swiften/Network/FakeConnection.h
@@ -1,14 +1,14 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
#include <vector>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/optional.hpp>
#include <Swiften/Base/API.h>
@@ -21,7 +21,7 @@ namespace Swift {
class SWIFTEN_API FakeConnection :
public Connection,
public EventOwner,
- public boost::enable_shared_from_this<FakeConnection> {
+ public std::enable_shared_from_this<FakeConnection> {
public:
enum State {
Initial,
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.cpp b/Swiften/Network/HTTPConnectProxiedConnection.cpp
index 991e815..b9ab604 100644
--- a/Swiften/Network/HTTPConnectProxiedConnection.cpp
+++ b/Swiften/Network/HTTPConnectProxiedConnection.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -49,7 +49,7 @@ HTTPConnectProxiedConnection::~HTTPConnectProxiedConnection() {
}
-void HTTPConnectProxiedConnection::setHTTPTrafficFilter(boost::shared_ptr<HTTPTrafficFilter> trafficFilter) {
+void HTTPConnectProxiedConnection::setHTTPTrafficFilter(std::shared_ptr<HTTPTrafficFilter> trafficFilter) {
trafficFilter_ = trafficFilter;
}
@@ -112,7 +112,7 @@ void HTTPConnectProxiedConnection::sendHTTPRequest(const std::string& statusLine
write(createSafeByteArray(request.str()));
}
-void HTTPConnectProxiedConnection::handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data) {
+void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) {
std::string dataString = byteArrayToString(ByteArray(data->begin(), data->end()));
SWIFT_LOG(debug) << data << std::endl;
httpResponseBuffer_.append(dataString);
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.h b/Swiften/Network/HTTPConnectProxiedConnection.h
index adb8d08..21b3960 100644
--- a/Swiften/Network/HTTPConnectProxiedConnection.h
+++ b/Swiften/Network/HTTPConnectProxiedConnection.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -13,7 +13,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Network/ProxiedConnection.h>
@@ -27,7 +27,7 @@ namespace Swift {
class SWIFTEN_API HTTPConnectProxiedConnection : public ProxiedConnection {
public:
- typedef boost::shared_ptr<HTTPConnectProxiedConnection> ref;
+ typedef std::shared_ptr<HTTPConnectProxiedConnection> ref;
virtual ~HTTPConnectProxiedConnection();
@@ -35,13 +35,13 @@ namespace Swift {
return ref(new HTTPConnectProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, authID, authPassword));
}
- void setHTTPTrafficFilter(boost::shared_ptr<HTTPTrafficFilter> trafficFilter);
+ void setHTTPTrafficFilter(std::shared_ptr<HTTPTrafficFilter> trafficFilter);
private:
HTTPConnectProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword);
virtual void initializeProxy();
- virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data);
+ virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data);
void sendHTTPRequest(const std::string& statusLine, const std::vector<std::pair<std::string, std::string> >& headerFields);
void parseHTTPHeader(const std::string& data, std::string& statusLine, std::vector<std::pair<std::string, std::string> >& headerFields);
@@ -49,7 +49,7 @@ namespace Swift {
private:
SafeByteArray authID_;
SafeByteArray authPassword_;
- boost::shared_ptr<HTTPTrafficFilter> trafficFilter_;
+ std::shared_ptr<HTTPTrafficFilter> trafficFilter_;
std::string httpResponseBuffer_;
std::vector<std::pair<std::string, std::string> > nextHTTPRequestHeaders_;
};
diff --git a/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp b/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp
index 735791f..91ace3d 100644
--- a/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp
+++ b/Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015 Isode Limited.
+ * Copyright (c) 2012-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,14 +16,14 @@
namespace Swift {
-HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(""), authPassword_(""), httpTrafficFilter_(httpTrafficFilter) {
+HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(""), authPassword_(""), httpTrafficFilter_(httpTrafficFilter) {
}
-HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(authID), authPassword_(authPassword), httpTrafficFilter_(httpTrafficFilter) {
+HTTPConnectProxiedConnectionFactory::HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort), authID_(authID), authPassword_(authPassword), httpTrafficFilter_(httpTrafficFilter) {
}
-boost::shared_ptr<Connection> HTTPConnectProxiedConnectionFactory::createConnection() {
+std::shared_ptr<Connection> HTTPConnectProxiedConnectionFactory::createConnection() {
HTTPConnectProxiedConnection::ref proxyConnection = HTTPConnectProxiedConnection::create(resolver_, connectionFactory_, timerFactory_, proxyHost_, proxyPort_, authID_, authPassword_);
proxyConnection->setHTTPTrafficFilter(httpTrafficFilter_);
return proxyConnection;
diff --git a/Swiften/Network/HTTPConnectProxiedConnectionFactory.h b/Swiften/Network/HTTPConnectProxiedConnectionFactory.h
index 455fba0..74d6279 100644
--- a/Swiften/Network/HTTPConnectProxiedConnectionFactory.h
+++ b/Swiften/Network/HTTPConnectProxiedConnectionFactory.h
@@ -25,10 +25,10 @@ namespace Swift {
class SWIFTEN_API HTTPConnectProxiedConnectionFactory : public ConnectionFactory {
public:
- HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = boost::shared_ptr<HTTPTrafficFilter>());
- HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = boost::shared_ptr<HTTPTrafficFilter>());
+ HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = std::shared_ptr<HTTPTrafficFilter>());
+ HTTPConnectProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort, const SafeString& authID, const SafeString& authPassword, std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter = std::shared_ptr<HTTPTrafficFilter>());
- virtual boost::shared_ptr<Connection> createConnection();
+ virtual std::shared_ptr<Connection> createConnection();
private:
DomainNameResolver* resolver_;
@@ -38,6 +38,6 @@ namespace Swift {
int proxyPort_;
SafeString authID_;
SafeString authPassword_;
- boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter_;
+ std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter_;
};
}
diff --git a/Swiften/Network/MiniUPnPInterface.cpp b/Swiften/Network/MiniUPnPInterface.cpp
index b298fc6..b2afd88 100644
--- a/Swiften/Network/MiniUPnPInterface.cpp
+++ b/Swiften/Network/MiniUPnPInterface.cpp
@@ -12,8 +12,9 @@
#include <Swiften/Network/MiniUPnPInterface.h>
+#include <memory>
+
#include <boost/lexical_cast.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <miniupnpc.h>
#include <upnpcommands.h>
@@ -31,7 +32,7 @@ struct MiniUPnPInterface::Private {
IGDdatas data;
};
-MiniUPnPInterface::MiniUPnPInterface() : p(boost::make_shared<Private>()) {
+MiniUPnPInterface::MiniUPnPInterface() : p(std::make_shared<Private>()) {
p->isValid = false;
int error = 0;
p->deviceList = upnpDiscover(1500 /* timeout in ms */, nullptr, nullptr, 0, 0 /* do IPv6? */, &error);
diff --git a/Swiften/Network/MiniUPnPInterface.h b/Swiften/Network/MiniUPnPInterface.h
index 5253e71..ea956d9 100644
--- a/Swiften/Network/MiniUPnPInterface.h
+++ b/Swiften/Network/MiniUPnPInterface.h
@@ -6,9 +6,10 @@
#pragma once
+#include <memory>
+
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Network/NATPortMapping.h>
#include <Swiften/Network/NATTraversalInterface.h>
@@ -27,6 +28,6 @@ namespace Swift {
private:
struct Private;
- boost::shared_ptr<Private> p;
+ std::shared_ptr<Private> p;
};
}
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp
index 3782f75..c811212 100644
--- a/Swiften/Network/NATPMPInterface.cpp
+++ b/Swiften/Network/NATPMPInterface.cpp
@@ -12,8 +12,9 @@
#include <Swiften/Network/NATPMPInterface.h>
+#include <memory>
+
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/Log.h>
@@ -29,7 +30,7 @@ struct NATPMPInterface::Private {
natpmp_t natpmp;
};
-NATPMPInterface::NATPMPInterface() : p(boost::make_shared<Private>()) {
+NATPMPInterface::NATPMPInterface() : p(std::make_shared<Private>()) {
initnatpmp(&p->natpmp, 0, 0);
}
diff --git a/Swiften/Network/NATPMPInterface.h b/Swiften/Network/NATPMPInterface.h
index a4bb816..80f619c 100644
--- a/Swiften/Network/NATPMPInterface.h
+++ b/Swiften/Network/NATPMPInterface.h
@@ -6,9 +6,10 @@
#pragma once
+#include <memory>
+
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Network/NATPortMapping.h>
#include <Swiften/Network/NATTraversalInterface.h>
@@ -27,6 +28,6 @@ namespace Swift {
private:
struct Private;
- boost::shared_ptr<Private> p;
+ std::shared_ptr<Private> p;
};
}
diff --git a/Swiften/Network/NATTraverser.h b/Swiften/Network/NATTraverser.h
index 0ff6bb3..716bfcb 100644
--- a/Swiften/Network/NATTraverser.h
+++ b/Swiften/Network/NATTraverser.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-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>
@@ -19,8 +19,8 @@ namespace Swift {
public:
virtual ~NATTraverser();
- virtual boost::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest() = 0;
- virtual boost::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort) = 0;
- virtual boost::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort) = 0;
+ virtual std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest() = 0;
+ virtual std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort) = 0;
+ virtual std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort) = 0;
};
}
diff --git a/Swiften/Network/NullNATTraverser.cpp b/Swiften/Network/NullNATTraverser.cpp
index c4e121b..cc8bae0 100644
--- a/Swiften/Network/NullNATTraverser.cpp
+++ b/Swiften/Network/NullNATTraverser.cpp
@@ -6,8 +6,9 @@
#include <Swiften/Network/NullNATTraverser.h>
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/EventLoop/EventLoop.h>
#include <Swiften/Network/NATTraversalForwardPortRequest.h>
@@ -67,16 +68,16 @@ class NullNATTraversalRemovePortForwardingRequest : public NATTraversalRemovePor
NullNATTraverser::NullNATTraverser(EventLoop* eventLoop) : eventLoop(eventLoop) {
}
-boost::shared_ptr<NATTraversalGetPublicIPRequest> NullNATTraverser::createGetPublicIPRequest() {
- return boost::make_shared<NullNATTraversalGetPublicIPRequest>(eventLoop);
+std::shared_ptr<NATTraversalGetPublicIPRequest> NullNATTraverser::createGetPublicIPRequest() {
+ return std::make_shared<NullNATTraversalGetPublicIPRequest>(eventLoop);
}
-boost::shared_ptr<NATTraversalForwardPortRequest> NullNATTraverser::createForwardPortRequest(int, int) {
- return boost::make_shared<NullNATTraversalForwardPortRequest>(eventLoop);
+std::shared_ptr<NATTraversalForwardPortRequest> NullNATTraverser::createForwardPortRequest(int, int) {
+ return std::make_shared<NullNATTraversalForwardPortRequest>(eventLoop);
}
-boost::shared_ptr<NATTraversalRemovePortForwardingRequest> NullNATTraverser::createRemovePortForwardingRequest(int, int) {
- return boost::make_shared<NullNATTraversalRemovePortForwardingRequest>(eventLoop);
+std::shared_ptr<NATTraversalRemovePortForwardingRequest> NullNATTraverser::createRemovePortForwardingRequest(int, int) {
+ return std::make_shared<NullNATTraversalRemovePortForwardingRequest>(eventLoop);
}
}
diff --git a/Swiften/Network/NullNATTraverser.h b/Swiften/Network/NullNATTraverser.h
index 3492940..d3a6640 100644
--- a/Swiften/Network/NullNATTraverser.h
+++ b/Swiften/Network/NullNATTraverser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -15,9 +15,9 @@ namespace Swift {
public:
NullNATTraverser(EventLoop* eventLoop);
- boost::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest();
- boost::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort);
- boost::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort);
+ std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest();
+ std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort);
+ std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort);
private:
EventLoop* eventLoop;
diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.h b/Swiften/Network/PlatformDomainNameAddressQuery.h
index a5cfda7..6cb3e0a 100644
--- a/Swiften/Network/PlatformDomainNameAddressQuery.h
+++ b/Swiften/Network/PlatformDomainNameAddressQuery.h
@@ -1,15 +1,15 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
#include <string>
#include <boost/asio/io_service.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <Swiften/EventLoop/EventOwner.h>
#include <Swiften/Network/DomainNameAddressQuery.h>
@@ -19,7 +19,7 @@ namespace Swift {
class PlatformDomainNameResolver;
class EventLoop;
- class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner {
+ class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public std::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner {
public:
PlatformDomainNameAddressQuery(const boost::optional<std::string>& host, EventLoop* eventLoop, PlatformDomainNameResolver*);
virtual ~PlatformDomainNameAddressQuery();
diff --git a/Swiften/Network/PlatformDomainNameQuery.h b/Swiften/Network/PlatformDomainNameQuery.h
index 3c5e152..a279f20 100644
--- a/Swiften/Network/PlatformDomainNameQuery.h
+++ b/Swiften/Network/PlatformDomainNameQuery.h
@@ -1,19 +1,19 @@
/*
- * 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>
namespace Swift {
class PlatformDomainNameResolver;
class PlatformDomainNameQuery {
public:
- typedef boost::shared_ptr<PlatformDomainNameQuery> ref;
+ typedef std::shared_ptr<PlatformDomainNameQuery> ref;
PlatformDomainNameQuery(PlatformDomainNameResolver* resolver) : resolver(resolver) {}
virtual ~PlatformDomainNameQuery() {}
diff --git a/Swiften/Network/PlatformDomainNameResolver.cpp b/Swiften/Network/PlatformDomainNameResolver.cpp
index ed08057..ecb5247 100644
--- a/Swiften/Network/PlatformDomainNameResolver.cpp
+++ b/Swiften/Network/PlatformDomainNameResolver.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2013 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -33,22 +33,22 @@ PlatformDomainNameResolver::PlatformDomainNameResolver(IDNConverter* idnConverte
PlatformDomainNameResolver::~PlatformDomainNameResolver() {
stopRequested = true;
- addQueryToQueue(boost::shared_ptr<PlatformDomainNameQuery>());
+ addQueryToQueue(std::shared_ptr<PlatformDomainNameQuery>());
thread->join();
delete thread;
}
-boost::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
+std::shared_ptr<DomainNameServiceQuery> PlatformDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
boost::optional<std::string> encodedDomain = idnConverter->getIDNAEncoded(domain);
std::string result;
if (encodedDomain) {
result = serviceLookupPrefix + *encodedDomain;
}
- return boost::shared_ptr<DomainNameServiceQuery>(new PlatformDomainNameServiceQuery(result, eventLoop, this));
+ return std::make_shared<PlatformDomainNameServiceQuery>(result, eventLoop, this);
}
-boost::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const std::string& name) {
- return boost::shared_ptr<DomainNameAddressQuery>(new PlatformDomainNameAddressQuery(idnConverter->getIDNAEncoded(name), eventLoop, this));
+std::shared_ptr<DomainNameAddressQuery> PlatformDomainNameResolver::createAddressQuery(const std::string& name) {
+ return std::make_shared<PlatformDomainNameAddressQuery>(idnConverter->getIDNAEncoded(name), eventLoop, this);
}
void PlatformDomainNameResolver::run() {
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.h b/Swiften/Network/PlatformDomainNameServiceQuery.h
index e415005..0d690f3 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.h
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.h
@@ -1,15 +1,14 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
+#include <memory>
#include <string>
-#include <boost/enable_shared_from_this.hpp>
-
#include <Swiften/EventLoop/EventOwner.h>
#include <Swiften/Network/DomainNameServiceQuery.h>
#include <Swiften/Network/PlatformDomainNameQuery.h>
@@ -17,7 +16,7 @@
namespace Swift {
class EventLoop;
- class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner {
+ class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public std::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner {
public:
PlatformDomainNameServiceQuery(const boost::optional<std::string>& serviceName, EventLoop* eventLoop, PlatformDomainNameResolver* resolver);
virtual ~PlatformDomainNameServiceQuery();
diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp
index cb5758e..9b5ec2b 100644
--- a/Swiften/Network/PlatformNATTraversalWorker.cpp
+++ b/Swiften/Network/PlatformNATTraversalWorker.cpp
@@ -12,8 +12,8 @@
#include "PlatformNATTraversalWorker.h"
-#include <boost/smart_ptr/make_shared.hpp>
-#include <boost/enable_shared_from_this.hpp>
+#include <memory>
+#include <memory>
#include <boost/numeric/conversion/cast.hpp>
#include <Swiften/Base/Log.h>
@@ -31,9 +31,9 @@
namespace Swift {
-class PlatformNATTraversalRequest : public boost::enable_shared_from_this<PlatformNATTraversalRequest>, public EventOwner {
+class PlatformNATTraversalRequest : public std::enable_shared_from_this<PlatformNATTraversalRequest>, public EventOwner {
public:
- typedef boost::shared_ptr<PlatformNATTraversalRequest> ref;
+ typedef std::shared_ptr<PlatformNATTraversalRequest> ref;
public:
PlatformNATTraversalRequest(PlatformNATTraversalWorker* worker) : worker(worker) {
@@ -139,7 +139,7 @@ PlatformNATTraversalWorker::PlatformNATTraversalWorker(EventLoop* eventLoop) : e
PlatformNATTraversalWorker::~PlatformNATTraversalWorker() {
stopRequested = true;
- addRequestToQueue(boost::shared_ptr<PlatformNATTraversalRequest>());
+ addRequestToQueue(std::shared_ptr<PlatformNATTraversalRequest>());
thread->join();
delete thread;
#ifdef HAVE_LIBNATPMP
@@ -177,17 +177,17 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co
return nullNATTraversalInterface;
}
-boost::shared_ptr<NATTraversalGetPublicIPRequest> PlatformNATTraversalWorker::createGetPublicIPRequest() {
- return boost::make_shared<PlatformNATTraversalGetPublicIPRequest>(this);
+std::shared_ptr<NATTraversalGetPublicIPRequest> PlatformNATTraversalWorker::createGetPublicIPRequest() {
+ return std::make_shared<PlatformNATTraversalGetPublicIPRequest>(this);
}
-boost::shared_ptr<NATTraversalForwardPortRequest> PlatformNATTraversalWorker::createForwardPortRequest(int localPort, int publicPort) {
- return boost::make_shared<PlatformNATTraversalForwardPortRequest>(this, localPort, publicPort);
+std::shared_ptr<NATTraversalForwardPortRequest> PlatformNATTraversalWorker::createForwardPortRequest(int localPort, int publicPort) {
+ return std::make_shared<PlatformNATTraversalForwardPortRequest>(this, localPort, publicPort);
}
-boost::shared_ptr<NATTraversalRemovePortForwardingRequest> PlatformNATTraversalWorker::createRemovePortForwardingRequest(int localPort, int publicPort) {
+std::shared_ptr<NATTraversalRemovePortForwardingRequest> PlatformNATTraversalWorker::createRemovePortForwardingRequest(int localPort, int publicPort) {
NATPortMapping mapping(localPort, publicPort, NATPortMapping::TCP); // FIXME
- return boost::make_shared<PlatformNATTraversalRemovePortForwardingRequest>(this, mapping);
+ return std::make_shared<PlatformNATTraversalRemovePortForwardingRequest>(this, mapping);
}
void PlatformNATTraversalWorker::start() {
diff --git a/Swiften/Network/PlatformNATTraversalWorker.h b/Swiften/Network/PlatformNATTraversalWorker.h
index 280a537..35f4ea6 100644
--- a/Swiften/Network/PlatformNATTraversalWorker.h
+++ b/Swiften/Network/PlatformNATTraversalWorker.h
@@ -44,13 +44,13 @@ namespace Swift {
PlatformNATTraversalWorker(EventLoop* eventLoop);
virtual ~PlatformNATTraversalWorker();
- boost::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest();
- boost::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort);
- boost::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort);
+ std::shared_ptr<NATTraversalGetPublicIPRequest> createGetPublicIPRequest();
+ std::shared_ptr<NATTraversalForwardPortRequest> createForwardPortRequest(int localPort, int publicPort);
+ std::shared_ptr<NATTraversalRemovePortForwardingRequest> createRemovePortForwardingRequest(int localPort, int publicPort);
private:
NATTraversalInterface* getNATTraversalInterface() const;
- void addRequestToQueue(boost::shared_ptr<PlatformNATTraversalRequest>);
+ void addRequestToQueue(std::shared_ptr<PlatformNATTraversalRequest>);
void start();
void stop();
@@ -62,7 +62,7 @@ namespace Swift {
EventLoop* eventLoop;
Atomic<bool> stopRequested;
boost::thread* thread;
- std::deque<boost::shared_ptr<PlatformNATTraversalRequest> > queue;
+ std::deque<std::shared_ptr<PlatformNATTraversalRequest> > queue;
boost::mutex queueMutex;
boost::condition_variable queueNonEmpty;
diff --git a/Swiften/Network/ProxiedConnection.cpp b/Swiften/Network/ProxiedConnection.cpp
index 27f5cd9..16bab0d 100644
--- a/Swiften/Network/ProxiedConnection.cpp
+++ b/Swiften/Network/ProxiedConnection.cpp
@@ -92,7 +92,7 @@ void ProxiedConnection::handleConnectFinished(Connection::ref connection) {
}
}
-void ProxiedConnection::handleDataRead(boost::shared_ptr<SafeByteArray> data) {
+void ProxiedConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) {
if (!connected_) {
handleProxyInitializeData(data);
}
diff --git a/Swiften/Network/ProxiedConnection.h b/Swiften/Network/ProxiedConnection.h
index 80f748c..38194aa 100644
--- a/Swiften/Network/ProxiedConnection.h
+++ b/Swiften/Network/ProxiedConnection.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015 Isode Limited.
+ * Copyright (c) 2012-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -7,7 +7,7 @@
#pragma once
-#include <boost/enable_shared_from_this.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/SafeString.h>
@@ -25,7 +25,7 @@ namespace boost {
namespace Swift {
class ConnectionFactory;
- class SWIFTEN_API ProxiedConnection : public Connection, public boost::enable_shared_from_this<ProxiedConnection> {
+ class SWIFTEN_API ProxiedConnection : public Connection, public std::enable_shared_from_this<ProxiedConnection> {
public:
ProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort);
virtual ~ProxiedConnection();
@@ -40,7 +40,7 @@ namespace Swift {
private:
void handleConnectFinished(Connection::ref connection);
- void handleDataRead(boost::shared_ptr<SafeByteArray> data);
+ void handleDataRead(std::shared_ptr<SafeByteArray> data);
void handleDisconnected(const boost::optional<Error>& error);
void cancelConnector();
@@ -48,7 +48,7 @@ namespace Swift {
void setProxyInitializeFinished(bool success);
virtual void initializeProxy() = 0;
- virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data) = 0;
+ virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) = 0;
const HostAddressPort& getServer() const {
return server_;
@@ -65,7 +65,7 @@ namespace Swift {
int proxyPort_;
HostAddressPort server_;
Connector::ref connector_;
- boost::shared_ptr<Connection> connection_;
+ std::shared_ptr<Connection> connection_;
};
}
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.cpp b/Swiften/Network/SOCKS5ProxiedConnection.cpp
index 2b7a3f3..67ef4ad 100644
--- a/Swiften/Network/SOCKS5ProxiedConnection.cpp
+++ b/Swiften/Network/SOCKS5ProxiedConnection.cpp
@@ -47,7 +47,7 @@ void SOCKS5ProxiedConnection::initializeProxy() {
write(socksConnect);
}
-void SOCKS5ProxiedConnection::handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data) {
+void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) {
SafeByteArray socksConnect;
boost::asio::ip::address rawAddress = getServer().getAddress().getRawAddress();
assert(rawAddress.is_v4() || rawAddress.is_v6());
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.h b/Swiften/Network/SOCKS5ProxiedConnection.h
index edbc56c..c8faae9 100644
--- a/Swiften/Network/SOCKS5ProxiedConnection.h
+++ b/Swiften/Network/SOCKS5ProxiedConnection.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -22,7 +22,7 @@ namespace Swift {
class SWIFTEN_API SOCKS5ProxiedConnection : public ProxiedConnection {
public:
- typedef boost::shared_ptr<SOCKS5ProxiedConnection> ref;
+ typedef std::shared_ptr<SOCKS5ProxiedConnection> ref;
static ref create(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort) {
return ref(new SOCKS5ProxiedConnection(resolver, connectionFactory, timerFactory, proxyHost, proxyPort));
@@ -32,7 +32,7 @@ namespace Swift {
SOCKS5ProxiedConnection(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort);
virtual void initializeProxy();
- virtual void handleProxyInitializeData(boost::shared_ptr<SafeByteArray> data);
+ virtual void handleProxyInitializeData(std::shared_ptr<SafeByteArray> data);
private:
enum {
diff --git a/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp b/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp
index 3e24f00..01ce8ac 100644
--- a/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp
+++ b/Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <Swiften/Network/SOCKS5ProxiedConnectionFactory.h>
#include <Swiften/Network/SOCKS5ProxiedConnection.h>
@@ -13,7 +19,7 @@ namespace Swift {
SOCKS5ProxiedConnectionFactory::SOCKS5ProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort) : resolver_(resolver), connectionFactory_(connectionFactory), timerFactory_(timerFactory), proxyHost_(proxyHost), proxyPort_(proxyPort) {
}
-boost::shared_ptr<Connection> SOCKS5ProxiedConnectionFactory::createConnection() {
+std::shared_ptr<Connection> SOCKS5ProxiedConnectionFactory::createConnection() {
return SOCKS5ProxiedConnection::create(resolver_, connectionFactory_, timerFactory_, proxyHost_, proxyPort_);
}
diff --git a/Swiften/Network/SOCKS5ProxiedConnectionFactory.h b/Swiften/Network/SOCKS5ProxiedConnectionFactory.h
index 1092381..8631239 100644
--- a/Swiften/Network/SOCKS5ProxiedConnectionFactory.h
+++ b/Swiften/Network/SOCKS5ProxiedConnectionFactory.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -25,7 +25,7 @@ namespace Swift {
public:
SOCKS5ProxiedConnectionFactory(DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const std::string& proxyHost, int proxyPort);
- virtual boost::shared_ptr<Connection> createConnection();
+ virtual std::shared_ptr<Connection> createConnection();
private:
DomainNameResolver* resolver_;
diff --git a/Swiften/Network/StaticDomainNameResolver.cpp b/Swiften/Network/StaticDomainNameResolver.cpp
index 45e6c5f..3601bf2 100644
--- a/Swiften/Network/StaticDomainNameResolver.cpp
+++ b/Swiften/Network/StaticDomainNameResolver.cpp
@@ -17,8 +17,8 @@
using namespace Swift;
namespace {
- struct ServiceQuery : public DomainNameServiceQuery, public boost::enable_shared_from_this<ServiceQuery> {
- ServiceQuery(const std::string& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop, boost::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), service(service), resolver(resolver), owner(owner) {}
+ struct ServiceQuery : public DomainNameServiceQuery, public std::enable_shared_from_this<ServiceQuery> {
+ ServiceQuery(const std::string& service, Swift::StaticDomainNameResolver* resolver, EventLoop* eventLoop, std::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), service(service), resolver(resolver), owner(owner) {}
virtual void run() {
if (!resolver->getIsResponsive()) {
@@ -40,11 +40,11 @@ namespace {
EventLoop* eventLoop;
std::string service;
StaticDomainNameResolver* resolver;
- boost::shared_ptr<EventOwner> owner;
+ std::shared_ptr<EventOwner> owner;
};
- struct AddressQuery : public DomainNameAddressQuery, public boost::enable_shared_from_this<AddressQuery> {
- AddressQuery(const std::string& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop, boost::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), host(host), resolver(resolver), owner(owner) {}
+ struct AddressQuery : public DomainNameAddressQuery, public std::enable_shared_from_this<AddressQuery> {
+ AddressQuery(const std::string& host, StaticDomainNameResolver* resolver, EventLoop* eventLoop, std::shared_ptr<EventOwner> owner) : eventLoop(eventLoop), host(host), resolver(resolver), owner(owner) {}
virtual void run() {
if (!resolver->getIsResponsive()) {
@@ -67,7 +67,7 @@ namespace {
EventLoop* eventLoop;
std::string host;
StaticDomainNameResolver* resolver;
- boost::shared_ptr<EventOwner> owner;
+ std::shared_ptr<EventOwner> owner;
};
}
@@ -109,12 +109,12 @@ void StaticDomainNameResolver::addXMPPClientService(const std::string& domain, c
addService("_xmpp-client._tcp." + domain, ServiceQuery::Result(hostname, port, 0, 0));
}
-boost::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
- return boost::shared_ptr<DomainNameServiceQuery>(new ServiceQuery(serviceLookupPrefix + domain, this, eventLoop, owner));
+std::shared_ptr<DomainNameServiceQuery> StaticDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
+ return std::make_shared<ServiceQuery>(serviceLookupPrefix + domain, this, eventLoop, owner);
}
-boost::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const std::string& name) {
- return boost::shared_ptr<DomainNameAddressQuery>(new AddressQuery(name, this, eventLoop, owner));
+std::shared_ptr<DomainNameAddressQuery> StaticDomainNameResolver::createAddressQuery(const std::string& name) {
+ return std::make_shared<AddressQuery>(name, this, eventLoop, owner);
}
}
diff --git a/Swiften/Network/StaticDomainNameResolver.h b/Swiften/Network/StaticDomainNameResolver.h
index 6d38a26..76394d0 100644
--- a/Swiften/Network/StaticDomainNameResolver.h
+++ b/Swiften/Network/StaticDomainNameResolver.h
@@ -7,6 +7,7 @@
#pragma once
#include <map>
+#include <memory>
#include <vector>
#include <Swiften/Base/API.h>
@@ -48,13 +49,13 @@ namespace Swift {
isResponsive = b;
}
- virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain);
- virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name);
+ virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain);
+ virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name);
private:
EventLoop* eventLoop;
bool isResponsive;
AddressesMap addresses;
ServicesCollection services;
- boost::shared_ptr<EventOwner> owner;
+ std::shared_ptr<EventOwner> owner;
};
}
diff --git a/Swiften/Network/TLSConnection.cpp b/Swiften/Network/TLSConnection.cpp
index 4099de7..7c293d1 100644
--- a/Swiften/Network/TLSConnection.cpp
+++ b/Swiften/Network/TLSConnection.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -47,7 +47,7 @@ void TLSConnection::handleTLSDataForNetwork(const SafeByteArray& data) {
}
void TLSConnection::handleTLSDataForApplication(const SafeByteArray& data) {
- onDataRead(boost::make_shared<SafeByteArray>(data));
+ onDataRead(std::make_shared<SafeByteArray>(data));
}
void TLSConnection::connect(const HostAddressPort& address) {
@@ -88,7 +88,7 @@ void TLSConnection::handleRawDisconnected(const boost::optional<Error>& error) {
onDisconnected(error);
}
-void TLSConnection::handleRawDataRead(boost::shared_ptr<SafeByteArray> data) {
+void TLSConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) {
context->handleDataFromNetwork(*data);
}
diff --git a/Swiften/Network/TLSConnection.h b/Swiften/Network/TLSConnection.h
index 41543a2..fdcdb6d 100644
--- a/Swiften/Network/TLSConnection.h
+++ b/Swiften/Network/TLSConnection.h
@@ -1,13 +1,12 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/SafeByteArray.h>
@@ -39,7 +38,7 @@ namespace Swift {
private:
void handleRawConnectFinished(bool error);
void handleRawDisconnected(const boost::optional<Error>& error);
- void handleRawDataRead(boost::shared_ptr<SafeByteArray> data);
+ void handleRawDataRead(std::shared_ptr<SafeByteArray> data);
void handleRawDataWritten();
void handleTLSConnectFinished(bool error);
void handleTLSDataForNetwork(const SafeByteArray& data);
diff --git a/Swiften/Network/TLSConnectionFactory.cpp b/Swiften/Network/TLSConnectionFactory.cpp
index e0396e2..b311c7d 100644
--- a/Swiften/Network/TLSConnectionFactory.cpp
+++ b/Swiften/Network/TLSConnectionFactory.cpp
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Network/TLSConnectionFactory.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Network/TLSConnection.h>
@@ -21,8 +21,8 @@ TLSConnectionFactory::~TLSConnectionFactory() {
}
-boost::shared_ptr<Connection> TLSConnectionFactory::createConnection() {
- return boost::make_shared<TLSConnection>(connectionFactory->createConnection(), contextFactory, options_);
+std::shared_ptr<Connection> TLSConnectionFactory::createConnection() {
+ return std::make_shared<TLSConnection>(connectionFactory->createConnection(), contextFactory, options_);
}
}
diff --git a/Swiften/Network/TLSConnectionFactory.h b/Swiften/Network/TLSConnectionFactory.h
index 8e39c35..148e345 100644
--- a/Swiften/Network/TLSConnectionFactory.h
+++ b/Swiften/Network/TLSConnectionFactory.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2011-2015 Isode Limited.
+ * Copyright (c) 2011-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/Network/ConnectionFactory.h>
@@ -21,7 +21,7 @@ namespace Swift {
TLSConnectionFactory(TLSContextFactory* contextFactory, ConnectionFactory* connectionFactory, const TLSOptions&);
virtual ~TLSConnectionFactory();
- virtual boost::shared_ptr<Connection> createConnection();
+ virtual std::shared_ptr<Connection> createConnection();
private:
TLSContextFactory* contextFactory;
ConnectionFactory* connectionFactory;
diff --git a/Swiften/Network/Timer.h b/Swiften/Network/Timer.h
index 1abf5bc..501fbd8 100644
--- a/Swiften/Network/Timer.h
+++ b/Swiften/Network/Timer.h
@@ -15,7 +15,7 @@ namespace Swift {
*/
class SWIFTEN_API Timer {
public:
- typedef boost::shared_ptr<Timer> ref;
+ typedef std::shared_ptr<Timer> ref;
virtual ~Timer();
diff --git a/Swiften/Network/TimerFactory.h b/Swiften/Network/TimerFactory.h
index 47e89f8..ebb1b6e 100644
--- a/Swiften/Network/TimerFactory.h
+++ b/Swiften/Network/TimerFactory.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/Network/Timer.h>
diff --git a/Swiften/Network/UnboundDomainNameResolver.cpp b/Swiften/Network/UnboundDomainNameResolver.cpp
index a9fed24..380e087 100755
--- a/Swiften/Network/UnboundDomainNameResolver.cpp
+++ b/Swiften/Network/UnboundDomainNameResolver.cpp
@@ -10,11 +10,10 @@
* See the COPYING file for more information.
*/
+#include <memory>
#include <vector>
#include <boost/bind.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <UnboundDomainNameResolver.h>
#include <arpa/inet.h>
@@ -44,12 +43,12 @@ class UnboundQuery {
};
struct UnboundWrapperHelper {
- UnboundWrapperHelper(UnboundDomainNameResolver* resolver, boost::shared_ptr<UnboundQuery> query) : resolver(resolver), query(query) {}
+ UnboundWrapperHelper(UnboundDomainNameResolver* resolver, std::shared_ptr<UnboundQuery> query) : resolver(resolver), query(query) {}
UnboundDomainNameResolver* resolver;
- boost::shared_ptr<UnboundQuery> query;
+ std::shared_ptr<UnboundQuery> query;
};
-class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public UnboundQuery, public boost::enable_shared_from_this<UnboundDomainNameServiceQuery> {
+class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public UnboundQuery, public std::enable_shared_from_this<UnboundDomainNameServiceQuery> {
public:
UnboundDomainNameServiceQuery(UnboundDomainNameResolver* resolver, ub_ctx* context, std::string name) : UnboundQuery(resolver, context), name(name) {
}
@@ -121,7 +120,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
std::string name;
};
-class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public UnboundQuery, public boost::enable_shared_from_this<UnboundDomainNameAddressQuery> {
+class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public UnboundQuery, public std::enable_shared_from_this<UnboundDomainNameAddressQuery> {
public:
UnboundDomainNameAddressQuery(UnboundDomainNameResolver* resolver, ub_ctx* context, std::string name) : UnboundQuery(resolver, context), name(name) {
}
@@ -179,12 +178,12 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
std::string name;
};
-UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) {
+UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) {
ubContext = ub_ctx_create();
if(!ubContext) {
SWIFT_LOG(debug) << "could not create unbound context" << std::endl;
}
- eventOwner = boost::make_shared<EventOwner>();
+ eventOwner = std::make_shared<EventOwner>();
ub_ctx_async(ubContext, true);
@@ -211,7 +210,7 @@ UnboundDomainNameResolver::~UnboundDomainNameResolver() {
}
}
-void UnboundDomainNameResolver::unbound_callback(boost::shared_ptr<UnboundQuery> query, int err, ub_result* result) {
+void UnboundDomainNameResolver::unbound_callback(std::shared_ptr<UnboundQuery> query, int err, ub_result* result) {
query->handleResult(err, result);
}
@@ -236,17 +235,17 @@ void UnboundDomainNameResolver::processData() {
}
}
-boost::shared_ptr<DomainNameServiceQuery> UnboundDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
+std::shared_ptr<DomainNameServiceQuery> UnboundDomainNameResolver::createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain) {
boost::optional<std::string> encodedDomain = idnConverter->getIDNAEncoded(domain);
std::string result;
if (encodedDomain) {
result = serviceLookupPrefix + *encodedDomain;
}
- return boost::make_shared<UnboundDomainNameServiceQuery>(this, ubContext, result);
+ return std::make_shared<UnboundDomainNameServiceQuery>(this, ubContext, result);
}
-boost::shared_ptr<DomainNameAddressQuery> UnboundDomainNameResolver::createAddressQuery(const std::string& name) {
- return boost::make_shared<UnboundDomainNameAddressQuery>(this, ubContext, idnConverter->getIDNAEncoded(name).get_value_or(""));
+std::shared_ptr<DomainNameAddressQuery> UnboundDomainNameResolver::createAddressQuery(const std::string& name) {
+ return std::make_shared<UnboundDomainNameAddressQuery>(this, ubContext, idnConverter->getIDNAEncoded(name).get_value_or(""));
}
}
diff --git a/Swiften/Network/UnboundDomainNameResolver.h b/Swiften/Network/UnboundDomainNameResolver.h
index afb21c8..a97e385 100755
--- a/Swiften/Network/UnboundDomainNameResolver.h
+++ b/Swiften/Network/UnboundDomainNameResolver.h
@@ -12,9 +12,9 @@
#pragma once
+#include <memory>
+
#include <boost/asio.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/EventLoop/EventOwner.h>
#include <Swiften/Network/DomainNameResolver.h>
@@ -31,26 +31,26 @@ namespace Swift {
class UnboundDomainNameResolver;
class UnboundQuery;
- class UnboundDomainNameResolver : public DomainNameResolver, public EventOwner, public boost::enable_shared_from_this<UnboundDomainNameResolver> {
+ class UnboundDomainNameResolver : public DomainNameResolver, public EventOwner, public std::enable_shared_from_this<UnboundDomainNameResolver> {
public:
- UnboundDomainNameResolver(IDNConverter* idnConverter, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
+ UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop);
virtual ~UnboundDomainNameResolver();
- virtual boost::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain);
- virtual boost::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name);
+ virtual std::shared_ptr<DomainNameServiceQuery> createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain);
+ virtual std::shared_ptr<DomainNameAddressQuery> createAddressQuery(const std::string& name);
static void unbound_callback_wrapper(void* data, int err, ub_result* result);
private:
- void unbound_callback(boost::shared_ptr<UnboundQuery> query, int err, ub_result* result);
+ void unbound_callback(std::shared_ptr<UnboundQuery> query, int err, ub_result* result);
void handleUBSocketReadable(boost::system::error_code);
void processData();
private:
IDNConverter* idnConverter;
- boost::shared_ptr<EventOwner> eventOwner;
- boost::shared_ptr<boost::asio::io_service> ioService;
+ std::shared_ptr<EventOwner> eventOwner;
+ std::shared_ptr<boost::asio::io_service> ioService;
boost::asio::posix::stream_descriptor ubDescriptior;
EventLoop* eventLoop;
ub_ctx* ubContext;
diff --git a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
index 12b48a9..8dbd09e 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp
@@ -4,11 +4,11 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <QA/Checker/IO.h>
@@ -29,7 +29,7 @@
using namespace Swift;
-typedef boost::shared_ptr<BOSHConnectionPool> PoolRef;
+typedef std::shared_ptr<BOSHConnectionPool> PoolRef;
class BOSHConnectionPoolTest : public CppUnit::TestFixture {
@@ -167,8 +167,8 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
}
void testConnectionCount_ThreeWritesTwoReads() {
- boost::shared_ptr<MockConnection> c0;
- boost::shared_ptr<MockConnection> c1;
+ std::shared_ptr<MockConnection> c0;
+ std::shared_ptr<MockConnection> c1;
unsigned long long rid = initialRID;
PoolRef testling = createTestling();
@@ -294,7 +294,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
}
void testWrite_Empty() {
- boost::shared_ptr<MockConnection> c0;
+ std::shared_ptr<MockConnection> c0;
PoolRef testling = createTestling();
CPPUNIT_ASSERT_EQUAL(st(1), connectionFactory->connections.size());
@@ -406,32 +406,32 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture {
MockConnectionFactory(EventLoop* eventLoop, bool autoFinishConnect = true) : eventLoop(eventLoop), autoFinishConnect(autoFinishConnect) {
}
- boost::shared_ptr<Connection> createConnection() {
- boost::shared_ptr<MockConnection> connection = boost::make_shared<MockConnection>(failingPorts, eventLoop, autoFinishConnect);
+ std::shared_ptr<Connection> createConnection() {
+ std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop, autoFinishConnect);
connections.push_back(connection);
return connection;
}
EventLoop* eventLoop;
- std::vector< boost::shared_ptr<MockConnection> > connections;
+ std::vector< std::shared_ptr<MockConnection> > connections;
std::vector<HostAddressPort> failingPorts;
bool autoFinishConnect;
};
- void readResponse(const std::string& response, boost::shared_ptr<MockConnection> connection) {
+ void readResponse(const std::string& response, std::shared_ptr<MockConnection> connection) {
connection->pending = false;
- boost::shared_ptr<SafeByteArray> data1 = boost::make_shared<SafeByteArray>(createSafeByteArray(
+ std::shared_ptr<SafeByteArray> data1 = std::make_shared<SafeByteArray>(createSafeByteArray(
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/xml; charset=utf-8\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Access-Control-Allow-Headers: Content-Type\r\n"
"Content-Length: "));
connection->onDataRead(data1);
- boost::shared_ptr<SafeByteArray> data2 = boost::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size())));
+ std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size())));
connection->onDataRead(data2);
- boost::shared_ptr<SafeByteArray> data3 = boost::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n"));
+ std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n"));
connection->onDataRead(data3);
- boost::shared_ptr<SafeByteArray> data4 = boost::make_shared<SafeByteArray>(createSafeByteArray(response));
+ std::shared_ptr<SafeByteArray> data4 = std::make_shared<SafeByteArray>(createSafeByteArray(response));
connection->onDataRead(data4);
}
diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
index abd020f..a791e96 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
@@ -4,11 +4,11 @@
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <QA/Checker/IO.h>
@@ -151,17 +151,17 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
testling->connect();
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), connectionFactory->connections.size());
- boost::shared_ptr<MockConnection> connection = connectionFactory->connections[0];
- boost::shared_ptr<SafeByteArray> data1 = boost::make_shared<SafeByteArray>(createSafeByteArray(
+ std::shared_ptr<MockConnection> connection = connectionFactory->connections[0];
+ std::shared_ptr<SafeByteArray> data1 = std::make_shared<SafeByteArray>(createSafeByteArray(
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/xml; charset=utf-8\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Access-Control-Allow-Headers: Content-Type\r\n"
"Content-Length: 64\r\n"));
- boost::shared_ptr<SafeByteArray> data2 = boost::make_shared<SafeByteArray>(createSafeByteArray(
+ std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(
"\r\n<body xmlns='http://jabber.org/protocol/httpbind'>"
"<bl"));
- boost::shared_ptr<SafeByteArray> data3 = boost::make_shared<SafeByteArray>(createSafeByteArray(
+ std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray(
"ah/>"
"</body>"));
connection->onDataRead(data1);
@@ -258,30 +258,30 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop) {
}
- boost::shared_ptr<Connection> createConnection() {
- boost::shared_ptr<MockConnection> connection = boost::make_shared<MockConnection>(failingPorts, eventLoop);
+ std::shared_ptr<Connection> createConnection() {
+ std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop);
connections.push_back(connection);
return connection;
}
EventLoop* eventLoop;
- std::vector< boost::shared_ptr<MockConnection> > connections;
+ std::vector< std::shared_ptr<MockConnection> > connections;
std::vector<HostAddressPort> failingPorts;
};
- void readResponse(const std::string& response, boost::shared_ptr<MockConnection> connection) {
- boost::shared_ptr<SafeByteArray> data1 = boost::make_shared<SafeByteArray>(createSafeByteArray(
+ void readResponse(const std::string& response, std::shared_ptr<MockConnection> connection) {
+ std::shared_ptr<SafeByteArray> data1 = std::make_shared<SafeByteArray>(createSafeByteArray(
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/xml; charset=utf-8\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Access-Control-Allow-Headers: Content-Type\r\n"
"Content-Length: "));
connection->onDataRead(data1);
- boost::shared_ptr<SafeByteArray> data2 = boost::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size())));
+ std::shared_ptr<SafeByteArray> data2 = std::make_shared<SafeByteArray>(createSafeByteArray(boost::lexical_cast<std::string>(response.size())));
connection->onDataRead(data2);
- boost::shared_ptr<SafeByteArray> data3 = boost::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n"));
+ std::shared_ptr<SafeByteArray> data3 = std::make_shared<SafeByteArray>(createSafeByteArray("\r\n\r\n"));
connection->onDataRead(data3);
- boost::shared_ptr<SafeByteArray> data4 = boost::make_shared<SafeByteArray>(createSafeByteArray(response));
+ std::shared_ptr<SafeByteArray> data4 = std::make_shared<SafeByteArray>(createSafeByteArray(response));
connection->onDataRead(data4);
}
diff --git a/Swiften/Network/UnitTest/ChainedConnectorTest.cpp b/Swiften/Network/UnitTest/ChainedConnectorTest.cpp
index 9496e13..3fad433 100644
--- a/Swiften/Network/UnitTest/ChainedConnectorTest.cpp
+++ b/Swiften/Network/UnitTest/ChainedConnectorTest.cpp
@@ -1,11 +1,12 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -51,7 +52,7 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
}
void testConnect_FirstConnectorSucceeds() {
- boost::shared_ptr<ChainedConnector> testling(createConnector());
+ std::shared_ptr<ChainedConnector> testling(createConnector());
connectionFactory1->connects = true;
connectionFactory2->connects = false;
@@ -60,12 +61,12 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
- CPPUNIT_ASSERT_EQUAL(1, boost::dynamic_pointer_cast<MockConnection>(connections[0])->id);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT_EQUAL(1, std::dynamic_pointer_cast<MockConnection>(connections[0])->id);
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_SecondConnectorSucceeds() {
- boost::shared_ptr<ChainedConnector> testling(createConnector());
+ std::shared_ptr<ChainedConnector> testling(createConnector());
connectionFactory1->connects = false;
connectionFactory2->connects = true;
@@ -74,12 +75,12 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
- CPPUNIT_ASSERT_EQUAL(2, boost::dynamic_pointer_cast<MockConnection>(connections[0])->id);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT_EQUAL(2, std::dynamic_pointer_cast<MockConnection>(connections[0])->id);
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_NoConnectorSucceeds() {
- boost::shared_ptr<ChainedConnector> testling(createConnector());
+ std::shared_ptr<ChainedConnector> testling(createConnector());
connectionFactory1->connects = false;
connectionFactory2->connects = false;
@@ -88,14 +89,14 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_NoDNS() {
/* Reset resolver so there's no record */
delete resolver;
resolver = new StaticDomainNameResolver(eventLoop);
- boost::shared_ptr<ChainedConnector> testling(createConnector());
+ std::shared_ptr<ChainedConnector> testling(createConnector());
connectionFactory1->connects = false;
connectionFactory2->connects = false;
@@ -105,11 +106,11 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testStop() {
- boost::shared_ptr<ChainedConnector> testling(createConnector());
+ std::shared_ptr<ChainedConnector> testling(createConnector());
connectionFactory1->connects = true;
connectionFactory2->connects = false;
@@ -122,18 +123,18 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<ChainedConnector> createConnector() {
+ std::shared_ptr<ChainedConnector> createConnector() {
std::vector<ConnectionFactory*> factories;
factories.push_back(connectionFactory1);
factories.push_back(connectionFactory2);
- boost::shared_ptr<ChainedConnector> connector = boost::make_shared<ChainedConnector>("foo.com", -1, boost::optional<std::string>("_xmpp-client._tcp."), resolver, factories, timerFactory);
+ std::shared_ptr<ChainedConnector> connector = std::make_shared<ChainedConnector>("foo.com", -1, boost::optional<std::string>("_xmpp-client._tcp."), resolver, factories, timerFactory);
connector->onConnectFinished.connect(boost::bind(&ChainedConnectorTest::handleConnectorFinished, this, _1, _2));
return connector;
}
- void handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> resultError) {
+ void handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> resultError) {
error = resultError;
- boost::shared_ptr<MockConnection> c(boost::dynamic_pointer_cast<MockConnection>(connection));
+ std::shared_ptr<MockConnection> c(std::dynamic_pointer_cast<MockConnection>(connection));
if (connection) {
assert(c);
}
@@ -164,8 +165,8 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
MockConnectionFactory(EventLoop* eventLoop, int id) : eventLoop(eventLoop), connects(true), id(id) {
}
- boost::shared_ptr<Connection> createConnection() {
- return boost::make_shared<MockConnection>(connects, id, eventLoop);
+ std::shared_ptr<Connection> createConnection() {
+ return std::make_shared<MockConnection>(connects, id, eventLoop);
}
EventLoop* eventLoop;
@@ -180,8 +181,8 @@ class ChainedConnectorTest : public CppUnit::TestFixture {
MockConnectionFactory* connectionFactory1;
MockConnectionFactory* connectionFactory2;
DummyTimerFactory* timerFactory;
- std::vector< boost::shared_ptr<MockConnection> > connections;
- boost::shared_ptr<Error> error;
+ std::vector< std::shared_ptr<MockConnection> > connections;
+ std::shared_ptr<Error> error;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ChainedConnectorTest);
diff --git a/Swiften/Network/UnitTest/ConnectorTest.cpp b/Swiften/Network/UnitTest/ConnectorTest.cpp
index ac2bc83..20ad68d 100644
--- a/Swiften/Network/UnitTest/ConnectorTest.cpp
+++ b/Swiften/Network/UnitTest/ConnectorTest.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.
*/
@@ -71,7 +71,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(host1 == *(connections[0]->hostAddressPort));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_NoServiceLookups() {
@@ -87,7 +87,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(host3.getAddress() == (*(connections[0]->hostAddressPort)).getAddress());
CPPUNIT_ASSERT(4321 == (*(connections[0]->hostAddressPort)).getPort());
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_NoServiceLookups_DefaultPort() {
@@ -103,7 +103,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(host3.getAddress() == (*(connections[0]->hostAddressPort)).getAddress());
CPPUNIT_ASSERT_EQUAL(5222, (*(connections[0]->hostAddressPort)).getPort());
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_NoSRVHost() {
@@ -116,7 +116,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(host3 == *(connections[0]->hostAddressPort));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_FirstAddressHostFails() {
@@ -135,7 +135,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(HostAddressPort(address2, 1234) == *(connections[0]->hostAddressPort));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_NoHosts() {
@@ -146,7 +146,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_FirstSRVHostFails() {
@@ -160,7 +160,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(host2 == *(connections[0]->hostAddressPort));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_AllSRVHostsFailWithoutFallbackHost() {
@@ -175,7 +175,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_AllSRVHostsFailWithFallbackHost() {
@@ -192,7 +192,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(host3 == *(connections[0]->hostAddressPort));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_SRVAndFallbackHostsFail() {
@@ -207,7 +207,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
/*void testConnect_TimeoutDuringResolve() {
@@ -221,7 +221,7 @@ class ConnectorTest : public CppUnit::TestFixture {
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error));
CPPUNIT_ASSERT(!connections[0]);
}*/
@@ -238,7 +238,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testConnect_TimeoutDuringConnectToCandidateFallsBack() {
@@ -261,7 +261,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
CPPUNIT_ASSERT(HostAddressPort(address2, 1234) == *(connections[0]->hostAddressPort));
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
@@ -277,7 +277,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(connections[0]);
- CPPUNIT_ASSERT(!boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(!std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testStop_DuringSRVQuery() {
@@ -291,7 +291,7 @@ class ConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connections.size()));
CPPUNIT_ASSERT(!connections[0]);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<DomainNameResolveError>(error));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<DomainNameResolveError>(error));
}
void testStop_Timeout() {
@@ -318,8 +318,8 @@ class ConnectorTest : public CppUnit::TestFixture {
return connector;
}
- void handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> resultError) {
- boost::shared_ptr<MockConnection> c(boost::dynamic_pointer_cast<MockConnection>(connection));
+ void handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> resultError) {
+ std::shared_ptr<MockConnection> c(std::dynamic_pointer_cast<MockConnection>(connection));
if (connection) {
assert(c);
}
@@ -355,8 +355,8 @@ class ConnectorTest : public CppUnit::TestFixture {
MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop), isResponsive(true) {
}
- boost::shared_ptr<Connection> createConnection() {
- return boost::shared_ptr<Connection>(new MockConnection(failingPorts, isResponsive, eventLoop));
+ std::shared_ptr<Connection> createConnection() {
+ return std::make_shared<MockConnection>(failingPorts, isResponsive, eventLoop);
}
EventLoop* eventLoop;
@@ -372,8 +372,8 @@ class ConnectorTest : public CppUnit::TestFixture {
StaticDomainNameResolver* resolver;
MockConnectionFactory* connectionFactory;
DummyTimerFactory* timerFactory;
- std::vector< boost::shared_ptr<MockConnection> > connections;
- boost::shared_ptr<Error> error;
+ std::vector< std::shared_ptr<MockConnection> > connections;
+ std::shared_ptr<Error> error;
};
diff --git a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp
index aa3d578..232847b 100644
--- a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp
+++ b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp
@@ -1,15 +1,15 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
+#include <memory>
+
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <QA/Checker/IO.h>
@@ -254,7 +254,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture {
void testTrafficFilter() {
HTTPConnectProxiedConnection::ref testling(createTestling());
- boost::shared_ptr<ExampleHTTPTrafficFilter> httpTrafficFilter = boost::make_shared<ExampleHTTPTrafficFilter>();
+ std::shared_ptr<ExampleHTTPTrafficFilter> httpTrafficFilter = std::make_shared<ExampleHTTPTrafficFilter>();
testling->setHTTPTrafficFilter(httpTrafficFilter);
connect(testling, HostAddressPort(HostAddress("2.2.2.2"), 2345));
@@ -295,7 +295,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture {
void testTrafficFilterNoConnectionReuse() {
HTTPConnectProxiedConnection::ref testling = createTestling();
- boost::shared_ptr<ProxyAuthenticationHTTPTrafficFilter> httpTrafficFilter = boost::make_shared<ProxyAuthenticationHTTPTrafficFilter>();
+ std::shared_ptr<ProxyAuthenticationHTTPTrafficFilter> httpTrafficFilter = std::make_shared<ProxyAuthenticationHTTPTrafficFilter>();
testling->setHTTPTrafficFilter(httpTrafficFilter);
connect(testling, HostAddressPort(HostAddress("2.2.2.2"), 2345));
@@ -351,7 +351,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture {
private:
HTTPConnectProxiedConnection::ref createTestling() {
- boost::shared_ptr<HTTPConnectProxiedConnection> c = HTTPConnectProxiedConnection::create(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, "", "");
+ std::shared_ptr<HTTPConnectProxiedConnection> c = HTTPConnectProxiedConnection::create(resolver, connectionFactory, timerFactory, proxyHost, proxyPort, "", "");
c->onConnectFinished.connect(boost::bind(&HTTPConnectProxiedConnectionTest::handleConnectFinished, this, _1));
c->onDisconnected.connect(boost::bind(&HTTPConnectProxiedConnectionTest::handleDisconnected, this, _1));
c->onDataRead.connect(boost::bind(&HTTPConnectProxiedConnectionTest::handleDataRead, this, _1));
@@ -368,7 +368,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture {
disconnectedError = e;
}
- void handleDataRead(boost::shared_ptr<SafeByteArray> d) {
+ void handleDataRead(std::shared_ptr<SafeByteArray> d) {
append(dataRead, *d);
}
@@ -408,15 +408,15 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture {
MockConnectionFactory(EventLoop* eventLoop) : eventLoop(eventLoop) {
}
- boost::shared_ptr<Connection> createConnection() {
- boost::shared_ptr<MockConnection> connection = boost::make_shared<MockConnection>(failingPorts, eventLoop);
+ std::shared_ptr<Connection> createConnection() {
+ std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop);
connections.push_back(connection);
SWIFT_LOG(debug) << "new connection created" << std::endl;
return connection;
}
EventLoop* eventLoop;
- std::vector< boost::shared_ptr<MockConnection> > connections;
+ std::vector< std::shared_ptr<MockConnection> > connections;
std::vector<HostAddressPort> failingPorts;
};