summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Component')
-rw-r--r--Swiften/Component/ComponentConnector.cpp10
-rw-r--r--Swiften/Component/ComponentConnector.h17
-rw-r--r--Swiften/Component/ComponentSession.cpp23
-rw-r--r--Swiften/Component/ComponentSession.h28
-rw-r--r--Swiften/Component/ComponentSessionStanzaChannel.cpp20
-rw-r--r--Swiften/Component/ComponentSessionStanzaChannel.h18
-rw-r--r--Swiften/Component/CoreComponent.cpp14
-rw-r--r--Swiften/Component/CoreComponent.h21
-rw-r--r--Swiften/Component/UnitTest/ComponentConnectorTest.cpp12
-rw-r--r--Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp6
-rw-r--r--Swiften/Component/UnitTest/ComponentSessionTest.cpp38
11 files changed, 102 insertions, 105 deletions
diff --git a/Swiften/Component/ComponentConnector.cpp b/Swiften/Component/ComponentConnector.cpp
index 410c19e..632eb84 100644
--- a/Swiften/Component/ComponentConnector.cpp
+++ b/Swiften/Component/ComponentConnector.cpp
@@ -39,14 +39,14 @@ void ComponentConnector::start() {
}
void ComponentConnector::stop() {
- finish(boost::shared_ptr<Connection>());
+ finish(std::shared_ptr<Connection>());
}
void ComponentConnector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) {
addressQuery.reset();
if (error || addresses.empty()) {
- finish(boost::shared_ptr<Connection>());
+ finish(std::shared_ptr<Connection>());
}
else {
addressQueryResults = std::deque<HostAddress>(addresses.begin(), addresses.end());
@@ -76,7 +76,7 @@ void ComponentConnector::handleConnectionConnectFinished(bool error) {
tryNextAddress();
}
else {
- finish(boost::shared_ptr<Connection>());
+ finish(std::shared_ptr<Connection>());
}
}
else {
@@ -84,7 +84,7 @@ void ComponentConnector::handleConnectionConnectFinished(bool error) {
}
}
-void ComponentConnector::finish(boost::shared_ptr<Connection> connection) {
+void ComponentConnector::finish(std::shared_ptr<Connection> connection) {
if (timer) {
timer->stop();
timer->onTick.disconnect(boost::bind(&ComponentConnector::handleTimeout, shared_from_this()));
@@ -102,7 +102,7 @@ void ComponentConnector::finish(boost::shared_ptr<Connection> connection) {
}
void ComponentConnector::handleTimeout() {
- finish(boost::shared_ptr<Connection>());
+ finish(std::shared_ptr<Connection>());
}
}
diff --git a/Swiften/Component/ComponentConnector.h b/Swiften/Component/ComponentConnector.h
index 68cb0d7..831851a 100644
--- a/Swiften/Component/ComponentConnector.h
+++ b/Swiften/Component/ComponentConnector.h
@@ -7,10 +7,9 @@
#pragma once
#include <deque>
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Network/Connection.h>
@@ -24,9 +23,9 @@ namespace Swift {
class ConnectionFactory;
class TimerFactory;
- class SWIFTEN_API ComponentConnector : public boost::bsignals::trackable, public boost::enable_shared_from_this<ComponentConnector> {
+ class SWIFTEN_API ComponentConnector : public boost::bsignals::trackable, public std::enable_shared_from_this<ComponentConnector> {
public:
- typedef boost::shared_ptr<ComponentConnector> ref;
+ typedef std::shared_ptr<ComponentConnector> ref;
static ComponentConnector::ref create(const std::string& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
return ref(new ComponentConnector(hostname, port, resolver, connectionFactory, timerFactory));
@@ -37,7 +36,7 @@ namespace Swift {
void start();
void stop();
- boost::signal<void (boost::shared_ptr<Connection>)> onConnectFinished;
+ boost::signal<void (std::shared_ptr<Connection>)> onConnectFinished;
private:
ComponentConnector(const std::string& hostname, int port, DomainNameResolver*, ConnectionFactory*, TimerFactory*);
@@ -47,7 +46,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();
@@ -58,9 +57,9 @@ namespace Swift {
ConnectionFactory* connectionFactory;
TimerFactory* timerFactory;
int timeoutMilliseconds;
- boost::shared_ptr<Timer> timer;
- boost::shared_ptr<DomainNameAddressQuery> addressQuery;
+ std::shared_ptr<Timer> timer;
+ std::shared_ptr<DomainNameAddressQuery> addressQuery;
std::deque<HostAddress> addressQueryResults;
- boost::shared_ptr<Connection> currentConnection;
+ std::shared_ptr<Connection> currentConnection;
};
}
diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp
index 46c88db..0805ac1 100644
--- a/Swiften/Component/ComponentSession.cpp
+++ b/Swiften/Component/ComponentSession.cpp
@@ -6,8 +6,9 @@
#include <Swiften/Component/ComponentSession.h>
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Component/ComponentHandshakeGenerator.h>
#include <Swiften/Elements/ComponentHandshake.h>
@@ -17,7 +18,7 @@
namespace Swift {
-ComponentSession::ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream, CryptoProvider* crypto) : jid(jid), secret(secret), stream(stream), crypto(crypto), state(Initial) {
+ComponentSession::ComponentSession(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream> stream, CryptoProvider* crypto) : jid(jid), secret(secret), stream(stream), crypto(crypto), state(Initial) {
}
ComponentSession::~ComponentSession() {
@@ -39,7 +40,7 @@ void ComponentSession::sendStreamHeader() {
stream->writeHeader(header);
}
-void ComponentSession::sendStanza(boost::shared_ptr<Stanza> stanza) {
+void ComponentSession::sendStanza(std::shared_ptr<Stanza> stanza) {
stream->writeElement(stanza);
}
@@ -49,8 +50,8 @@ void ComponentSession::handleStreamStart(const ProtocolHeader& header) {
stream->writeElement(ComponentHandshake::ref(new ComponentHandshake(ComponentHandshakeGenerator::getHandshake(header.getID(), secret, crypto))));
}
-void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
- if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) {
+void ComponentSession::handleElement(std::shared_ptr<ToplevelElement> element) {
+ if (std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element)) {
if (getState() == Initialized) {
onStanzaReceived(stanza);
}
@@ -58,7 +59,7 @@ void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element)
finishSession(Error::UnexpectedElementError);
}
}
- else if (boost::dynamic_pointer_cast<ComponentHandshake>(element)) {
+ else if (std::dynamic_pointer_cast<ComponentHandshake>(element)) {
if (!checkState(Authenticating)) {
return;
}
@@ -67,7 +68,7 @@ void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element)
onInitialized();
}
else if (getState() == Authenticating) {
- if (boost::dynamic_pointer_cast<StreamFeatures>(element)) {
+ if (std::dynamic_pointer_cast<StreamFeatures>(element)) {
// M-Link sends stream features, so swallow that.
}
else {
@@ -88,7 +89,7 @@ bool ComponentSession::checkState(State state) {
return true;
}
-void ComponentSession::handleStreamClosed(boost::shared_ptr<Swift::Error> streamError) {
+void ComponentSession::handleStreamClosed(std::shared_ptr<Swift::Error> streamError) {
State oldState = state;
state = Finished;
stream->setWhitespacePingEnabled(false);
@@ -104,14 +105,14 @@ void ComponentSession::handleStreamClosed(boost::shared_ptr<Swift::Error> stream
}
void ComponentSession::finish() {
- finishSession(boost::shared_ptr<Error>());
+ finishSession(std::shared_ptr<Error>());
}
void ComponentSession::finishSession(Error::Type error) {
- finishSession(boost::make_shared<Swift::ComponentSession::Error>(error));
+ finishSession(std::make_shared<Swift::ComponentSession::Error>(error));
}
-void ComponentSession::finishSession(boost::shared_ptr<Swift::Error> finishError) {
+void ComponentSession::finishSession(std::shared_ptr<Swift::Error> finishError) {
state = Finishing;
error = finishError;
assert(stream->isOpen());
diff --git a/Swiften/Component/ComponentSession.h b/Swiften/Component/ComponentSession.h
index 608bb79..97f5378 100644
--- a/Swiften/Component/ComponentSession.h
+++ b/Swiften/Component/ComponentSession.h
@@ -6,11 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/Error.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -23,7 +21,7 @@ namespace Swift {
class ComponentAuthenticator;
class CryptoProvider;
- class SWIFTEN_API ComponentSession : public boost::enable_shared_from_this<ComponentSession> {
+ class SWIFTEN_API ComponentSession : public std::enable_shared_from_this<ComponentSession> {
public:
enum State {
Initial,
@@ -44,8 +42,8 @@ namespace Swift {
~ComponentSession();
- static boost::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream, CryptoProvider* crypto) {
- return boost::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream, crypto));
+ static std::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream> stream, CryptoProvider* crypto) {
+ return std::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream, crypto));
}
State getState() const {
@@ -55,33 +53,33 @@ namespace Swift {
void start();
void finish();
- void sendStanza(boost::shared_ptr<Stanza>);
+ void sendStanza(std::shared_ptr<Stanza>);
public:
boost::signal<void ()> onInitialized;
- boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived;
+ boost::signal<void (std::shared_ptr<Swift::Error>)> onFinished;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaReceived;
private:
- ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream>, CryptoProvider*);
+ ComponentSession(const JID& jid, const std::string& secret, std::shared_ptr<SessionStream>, CryptoProvider*);
void finishSession(Error::Type error);
- void finishSession(boost::shared_ptr<Swift::Error> error);
+ void finishSession(std::shared_ptr<Swift::Error> error);
void sendStreamHeader();
- void handleElement(boost::shared_ptr<ToplevelElement>);
+ void handleElement(std::shared_ptr<ToplevelElement>);
void handleStreamStart(const ProtocolHeader&);
- void handleStreamClosed(boost::shared_ptr<Swift::Error>);
+ void handleStreamClosed(std::shared_ptr<Swift::Error>);
bool checkState(State);
private:
JID jid;
std::string secret;
- boost::shared_ptr<SessionStream> stream;
+ std::shared_ptr<SessionStream> stream;
CryptoProvider* crypto;
- boost::shared_ptr<Swift::Error> error;
+ std::shared_ptr<Swift::Error> error;
State state;
};
}
diff --git a/Swiften/Component/ComponentSessionStanzaChannel.cpp b/Swiften/Component/ComponentSessionStanzaChannel.cpp
index ffb1f13..282d9f1 100644
--- a/Swiften/Component/ComponentSessionStanzaChannel.cpp
+++ b/Swiften/Component/ComponentSessionStanzaChannel.cpp
@@ -12,7 +12,7 @@
namespace Swift {
-void ComponentSessionStanzaChannel::setSession(boost::shared_ptr<ComponentSession> session) {
+void ComponentSessionStanzaChannel::setSession(std::shared_ptr<ComponentSession> session) {
assert(!this->session);
this->session = session;
session->onInitialized.connect(boost::bind(&ComponentSessionStanzaChannel::handleSessionInitialized, this));
@@ -20,15 +20,15 @@ void ComponentSessionStanzaChannel::setSession(boost::shared_ptr<ComponentSessio
session->onStanzaReceived.connect(boost::bind(&ComponentSessionStanzaChannel::handleStanza, this, _1));
}
-void ComponentSessionStanzaChannel::sendIQ(boost::shared_ptr<IQ> iq) {
+void ComponentSessionStanzaChannel::sendIQ(std::shared_ptr<IQ> iq) {
send(iq);
}
-void ComponentSessionStanzaChannel::sendMessage(boost::shared_ptr<Message> message) {
+void ComponentSessionStanzaChannel::sendMessage(std::shared_ptr<Message> message) {
send(message);
}
-void ComponentSessionStanzaChannel::sendPresence(boost::shared_ptr<Presence> presence) {
+void ComponentSessionStanzaChannel::sendPresence(std::shared_ptr<Presence> presence) {
send(presence);
}
@@ -36,7 +36,7 @@ std::string ComponentSessionStanzaChannel::getNewIQID() {
return idGenerator.generateID();
}
-void ComponentSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) {
+void ComponentSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) {
if (!isAvailable()) {
std::cerr << "Warning: Component: Trying to send a stanza while disconnected." << std::endl;
return;
@@ -44,7 +44,7 @@ void ComponentSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) {
session->sendStanza(stanza);
}
-void ComponentSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Error>) {
+void ComponentSessionStanzaChannel::handleSessionFinished(std::shared_ptr<Error>) {
session->onFinished.disconnect(boost::bind(&ComponentSessionStanzaChannel::handleSessionFinished, this, _1));
session->onStanzaReceived.disconnect(boost::bind(&ComponentSessionStanzaChannel::handleStanza, this, _1));
session->onInitialized.disconnect(boost::bind(&ComponentSessionStanzaChannel::handleSessionInitialized, this));
@@ -53,20 +53,20 @@ void ComponentSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Erro
onAvailableChanged(false);
}
-void ComponentSessionStanzaChannel::handleStanza(boost::shared_ptr<Stanza> stanza) {
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(stanza);
+void ComponentSessionStanzaChannel::handleStanza(std::shared_ptr<Stanza> stanza) {
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(stanza);
if (message) {
onMessageReceived(message);
return;
}
- boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(stanza);
+ std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(stanza);
if (presence) {
onPresenceReceived(presence);
return;
}
- boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(stanza);
+ std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(stanza);
if (iq) {
onIQReceived(iq);
return;
diff --git a/Swiften/Component/ComponentSessionStanzaChannel.h b/Swiften/Component/ComponentSessionStanzaChannel.h
index 31931ea..ad38edc 100644
--- a/Swiften/Component/ComponentSessionStanzaChannel.h
+++ b/Swiften/Component/ComponentSessionStanzaChannel.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/IDGenerator.h>
@@ -22,11 +22,11 @@ namespace Swift {
*/
class SWIFTEN_API ComponentSessionStanzaChannel : public StanzaChannel {
public:
- void setSession(boost::shared_ptr<ComponentSession> session);
+ void setSession(std::shared_ptr<ComponentSession> session);
- void sendIQ(boost::shared_ptr<IQ> iq);
- void sendMessage(boost::shared_ptr<Message> message);
- void sendPresence(boost::shared_ptr<Presence> presence);
+ void sendIQ(std::shared_ptr<IQ> iq);
+ void sendMessage(std::shared_ptr<Message> message);
+ void sendPresence(std::shared_ptr<Presence> presence);
bool getStreamManagementEnabled() const {
return false;
@@ -43,14 +43,14 @@ namespace Swift {
private:
std::string getNewIQID();
- void send(boost::shared_ptr<Stanza> stanza);
- void handleSessionFinished(boost::shared_ptr<Error> error);
- void handleStanza(boost::shared_ptr<Stanza> stanza);
+ void send(std::shared_ptr<Stanza> stanza);
+ void handleSessionFinished(std::shared_ptr<Error> error);
+ void handleStanza(std::shared_ptr<Stanza> stanza);
void handleSessionInitialized();
private:
IDGenerator idGenerator;
- boost::shared_ptr<ComponentSession> session;
+ std::shared_ptr<ComponentSession> session;
};
}
diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp
index ac4f14e..dfa0896 100644
--- a/Swiften/Component/CoreComponent.cpp
+++ b/Swiften/Component/CoreComponent.cpp
@@ -52,7 +52,7 @@ void CoreComponent::connect(const std::string& host, int port) {
connector_->start();
}
-void CoreComponent::handleConnectorFinished(boost::shared_ptr<Connection> connection) {
+void CoreComponent::handleConnectorFinished(std::shared_ptr<Connection> connection) {
connector_->onConnectFinished.disconnect(boost::bind(&CoreComponent::handleConnectorFinished, this, _1));
connector_.reset();
if (!connection) {
@@ -65,7 +65,7 @@ void CoreComponent::handleConnectorFinished(boost::shared_ptr<Connection> connec
connection_ = connection;
assert(!sessionStream_);
- sessionStream_ = boost::shared_ptr<BasicSessionStream>(new BasicSessionStream(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), nullptr, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions()));
+ sessionStream_ = std::make_shared<BasicSessionStream>(ComponentStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), nullptr, networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), TLSOptions());
sessionStream_->onDataRead.connect(boost::bind(&CoreComponent::handleDataRead, this, _1));
sessionStream_->onDataWritten.connect(boost::bind(&CoreComponent::handleDataWritten, this, _1));
@@ -93,7 +93,7 @@ void CoreComponent::disconnect() {
disconnectRequested_ = false;
}
-void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) {
+void CoreComponent::handleSessionFinished(std::shared_ptr<Error> error) {
session_->onFinished.disconnect(boost::bind(&CoreComponent::handleSessionFinished, this, _1));
session_.reset();
@@ -106,7 +106,7 @@ void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) {
if (error) {
ComponentError componentError;
- if (boost::shared_ptr<ComponentSession::Error> actualError = boost::dynamic_pointer_cast<ComponentSession::Error>(error)) {
+ if (std::shared_ptr<ComponentSession::Error> actualError = std::dynamic_pointer_cast<ComponentSession::Error>(error)) {
switch(actualError->type) {
case ComponentSession::Error::AuthenticationFailedError:
componentError = ComponentError(ComponentError::AuthenticationFailedError);
@@ -116,7 +116,7 @@ void CoreComponent::handleSessionFinished(boost::shared_ptr<Error> error) {
break;
}
}
- else if (boost::shared_ptr<SessionStream::SessionStreamError> actualError = boost::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) {
+ else if (std::shared_ptr<SessionStream::SessionStreamError> actualError = std::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) {
switch(actualError->type) {
case SessionStream::SessionStreamError::ParseError:
componentError = ComponentError(ComponentError::XMLError);
@@ -155,11 +155,11 @@ void CoreComponent::handleStanzaChannelAvailableChanged(bool available) {
}
}
-void CoreComponent::sendMessage(boost::shared_ptr<Message> message) {
+void CoreComponent::sendMessage(std::shared_ptr<Message> message) {
stanzaChannel_->sendMessage(message);
}
-void CoreComponent::sendPresence(boost::shared_ptr<Presence> presence) {
+void CoreComponent::sendPresence(std::shared_ptr<Presence> presence) {
stanzaChannel_->sendPresence(presence);
}
diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h
index ff88173..3368671 100644
--- a/Swiften/Component/CoreComponent.h
+++ b/Swiften/Component/CoreComponent.h
@@ -6,10 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/Error.h>
#include <Swiften/Base/SafeByteArray.h>
@@ -50,8 +49,8 @@ namespace Swift {
void connect(const std::string& host, int port);
void disconnect();
- void sendMessage(boost::shared_ptr<Message>);
- void sendPresence(boost::shared_ptr<Presence>);
+ void sendMessage(std::shared_ptr<Message>);
+ void sendPresence(std::shared_ptr<Presence>);
void sendData(const std::string& data);
IQRouter* getIQRouter() const {
@@ -79,13 +78,13 @@ namespace Swift {
boost::signal<void (const SafeByteArray&)> onDataRead;
boost::signal<void (const SafeByteArray&)> onDataWritten;
- boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived;
- boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived;
+ boost::signal<void (std::shared_ptr<Message>)> onMessageReceived;
+ boost::signal<void (std::shared_ptr<Presence>) > onPresenceReceived;
private:
- void handleConnectorFinished(boost::shared_ptr<Connection>);
+ void handleConnectorFinished(std::shared_ptr<Connection>);
void handleStanzaChannelAvailableChanged(bool available);
- void handleSessionFinished(boost::shared_ptr<Error>);
+ void handleSessionFinished(std::shared_ptr<Error>);
void handleDataRead(const SafeByteArray&);
void handleDataWritten(const SafeByteArray&);
@@ -96,9 +95,9 @@ namespace Swift {
ComponentSessionStanzaChannel* stanzaChannel_;
IQRouter* iqRouter_;
ComponentConnector::ref connector_;
- boost::shared_ptr<Connection> connection_;
- boost::shared_ptr<BasicSessionStream> sessionStream_;
- boost::shared_ptr<ComponentSession> session_;
+ std::shared_ptr<Connection> connection_;
+ std::shared_ptr<BasicSessionStream> sessionStream_;
+ std::shared_ptr<ComponentSession> session_;
bool disconnectRequested_;
};
}
diff --git a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp
index 04a6a9e..3515a0a 100644
--- a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp
+++ b/Swiften/Component/UnitTest/ComponentConnectorTest.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.
*/
@@ -152,8 +152,8 @@ class ComponentConnectorTest : public CppUnit::TestFixture {
return connector;
}
- void handleConnectorFinished(boost::shared_ptr<Connection> connection) {
- boost::shared_ptr<MockConnection> c(boost::dynamic_pointer_cast<MockConnection>(connection));
+ void handleConnectorFinished(std::shared_ptr<Connection> connection) {
+ std::shared_ptr<MockConnection> c(std::dynamic_pointer_cast<MockConnection>(connection));
if (connection) {
assert(c);
}
@@ -188,8 +188,8 @@ class ComponentConnectorTest : 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;
@@ -204,7 +204,7 @@ class ComponentConnectorTest : public CppUnit::TestFixture {
StaticDomainNameResolver* resolver;
MockConnectionFactory* connectionFactory;
DummyTimerFactory* timerFactory;
- std::vector< boost::shared_ptr<MockConnection> > connections;
+ std::vector< std::shared_ptr<MockConnection> > connections;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ComponentConnectorTest);
diff --git a/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp b/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp
index 82f43f6..ce8eaa4 100644
--- a/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp
+++ b/Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.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.
*/
@@ -21,7 +21,7 @@ class ComponentHandshakeGeneratorTest : public CppUnit::TestFixture {
public:
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
}
void testGetHandshake() {
@@ -35,7 +35,7 @@ class ComponentHandshakeGeneratorTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ComponentHandshakeGeneratorTest);
diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp
index 1726794..63c89dc 100644
--- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp
+++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp
@@ -30,13 +30,13 @@ class ComponentSessionTest : public CppUnit::TestFixture {
public:
void setUp() {
- server = boost::make_shared<MockSessionStream>();
+ server = std::make_shared<MockSessionStream>();
sessionFinishedReceived = false;
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
}
void testStart() {
- boost::shared_ptr<ComponentSession> session(createSession());
+ std::shared_ptr<ComponentSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -51,7 +51,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {
}
void testStart_Error() {
- boost::shared_ptr<ComponentSession> session(createSession());
+ std::shared_ptr<ComponentSession> session(createSession());
session->start();
server->breakConnection();
@@ -61,7 +61,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {
}
void testStart_Unauthorized() {
- boost::shared_ptr<ComponentSession> session(createSession());
+ std::shared_ptr<ComponentSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -74,13 +74,13 @@ class ComponentSessionTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<ComponentSession> createSession() {
- boost::shared_ptr<ComponentSession> session = ComponentSession::create(JID("service.foo.com"), "servicesecret", server, crypto.get());
+ std::shared_ptr<ComponentSession> createSession() {
+ std::shared_ptr<ComponentSession> session = ComponentSession::create(JID("service.foo.com"), "servicesecret", server, crypto.get());
session->onFinished.connect(boost::bind(&ComponentSessionTest::handleSessionFinished, this, _1));
return session;
}
- void handleSessionFinished(boost::shared_ptr<Error> error) {
+ void handleSessionFinished(std::shared_ptr<Error> error) {
sessionFinishedReceived = true;
sessionFinishedError = error;
}
@@ -88,11 +88,11 @@ class ComponentSessionTest : public CppUnit::TestFixture {
class MockSessionStream : public SessionStream {
public:
struct Event {
- Event(boost::shared_ptr<ToplevelElement> element) : element(element), footer(false) {}
+ Event(std::shared_ptr<ToplevelElement> element) : element(element), footer(false) {}
Event(const ProtocolHeader& header) : header(header), footer(false) {}
Event() : footer(true) {}
- boost::shared_ptr<ToplevelElement> element;
+ std::shared_ptr<ToplevelElement> element;
boost::optional<ProtocolHeader> header;
bool footer;
};
@@ -101,7 +101,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {
}
virtual void close() {
- onClosed(boost::shared_ptr<Error>());
+ onClosed(std::shared_ptr<Error>());
}
virtual bool isOpen() {
@@ -116,7 +116,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {
receivedEvents.push_back(Event());
}
- virtual void writeElement(boost::shared_ptr<ToplevelElement> element) {
+ virtual void writeElement(std::shared_ptr<ToplevelElement> element) {
receivedEvents.push_back(Event(element));
}
@@ -147,8 +147,8 @@ class ComponentSessionTest : public CppUnit::TestFixture {
return std::vector<Certificate::ref>();
}
- virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const {
- return boost::shared_ptr<CertificateVerificationError>();
+ virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const {
+ return std::shared_ptr<CertificateVerificationError>();
}
virtual bool supportsZLibCompression() {
@@ -168,7 +168,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {
}
void breakConnection() {
- onClosed(boost::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError));
+ onClosed(std::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError));
}
void sendStreamStart() {
@@ -194,7 +194,7 @@ class ComponentSessionTest : public CppUnit::TestFixture {
void receiveHandshake() {
Event event = popEvent();
CPPUNIT_ASSERT(event.element);
- ComponentHandshake::ref handshake(boost::dynamic_pointer_cast<ComponentHandshake>(event.element));
+ ComponentHandshake::ref handshake(std::dynamic_pointer_cast<ComponentHandshake>(event.element));
CPPUNIT_ASSERT(handshake);
CPPUNIT_ASSERT_EQUAL(std::string("4c4f8a41141722c8bbfbdd92d827f7b2fc0a542b"), handshake->getData());
}
@@ -213,10 +213,10 @@ class ComponentSessionTest : public CppUnit::TestFixture {
std::deque<Event> receivedEvents;
};
- boost::shared_ptr<MockSessionStream> server;
+ std::shared_ptr<MockSessionStream> server;
bool sessionFinishedReceived;
- boost::shared_ptr<Error> sessionFinishedError;
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<Error> sessionFinishedError;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ComponentSessionTest);