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/Client/ClientSession.h
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/Client/ClientSession.h')
-rw-r--r--Swiften/Client/ClientSession.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index b1b6755..7309218 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.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>
@@ -26,7 +24,7 @@ namespace Swift {
class IDNConverter;
class CryptoProvider;
- class SWIFTEN_API ClientSession : public boost::enable_shared_from_this<ClientSession> {
+ class SWIFTEN_API ClientSession : public std::enable_shared_from_this<ClientSession> {
public:
enum State {
Initial,
@@ -58,7 +56,7 @@ namespace Swift {
TLSError,
StreamError
} type;
- boost::shared_ptr<boost::system::error_code> errorCode;
+ std::shared_ptr<boost::system::error_code> errorCode;
Error(Type type) : type(type) {}
};
@@ -70,8 +68,8 @@ namespace Swift {
~ClientSession();
- static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) {
- return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto));
+ static std::shared_ptr<ClientSession> create(const JID& jid, std::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) {
+ return std::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto));
}
State getState() const {
@@ -121,7 +119,7 @@ namespace Swift {
}
void sendCredentials(const SafeByteArray& password);
- void sendStanza(boost::shared_ptr<Stanza>);
+ void sendStanza(std::shared_ptr<Stanza>);
void setCertificateTrustChecker(CertificateTrustChecker* checker) {
certificateTrustChecker = checker;
@@ -142,19 +140,19 @@ namespace Swift {
public:
boost::signal<void ()> onNeedCredentials;
boost::signal<void ()> onInitialized;
- boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked;
+ boost::signal<void (std::shared_ptr<Swift::Error>)> onFinished;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaReceived;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked;
private:
ClientSession(
const JID& jid,
- boost::shared_ptr<SessionStream>,
+ std::shared_ptr<SessionStream>,
IDNConverter* idnConverter,
CryptoProvider* crypto);
void finishSession(Error::Type error);
- void finishSession(boost::shared_ptr<Swift::Error> error);
+ void finishSession(std::shared_ptr<Swift::Error> error);
JID getRemoteJID() const {
return JID("", localJID.getDomain());
@@ -162,9 +160,9 @@ namespace Swift {
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>);
void handleTLSEncrypted();
@@ -172,15 +170,15 @@ namespace Swift {
void continueSessionInitialization();
void requestAck();
- void handleStanzaAcked(boost::shared_ptr<Stanza> stanza);
+ void handleStanzaAcked(std::shared_ptr<Stanza> stanza);
void ack(unsigned int handledStanzasCount);
void continueAfterTLSEncrypted();
- void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, boost::shared_ptr<CertificateVerificationError> error);
+ void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, std::shared_ptr<CertificateVerificationError> error);
private:
JID localJID;
State state;
- boost::shared_ptr<SessionStream> stream;
+ std::shared_ptr<SessionStream> stream;
IDNConverter* idnConverter;
CryptoProvider* crypto;
bool allowPLAINOverNonTLS;
@@ -192,9 +190,9 @@ namespace Swift {
bool needAcking;
bool rosterVersioningSupported;
ClientAuthenticator* authenticator;
- boost::shared_ptr<StanzaAckRequester> stanzaAckRequester_;
- boost::shared_ptr<StanzaAckResponder> stanzaAckResponder_;
- boost::shared_ptr<Swift::Error> error_;
+ std::shared_ptr<StanzaAckRequester> stanzaAckRequester_;
+ std::shared_ptr<StanzaAckResponder> stanzaAckResponder_;
+ std::shared_ptr<Swift::Error> error_;
CertificateTrustChecker* certificateTrustChecker;
bool singleSignOn;
int authenticationPort;