From f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Nov 2013 22:16:57 +0100 Subject: Boost/C++11 shared pointers. --- src/net/pop3/POP3Store.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/net/pop3/POP3Store.cpp') diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp index 6ff404e2..e6e95b1b 100644 --- a/src/net/pop3/POP3Store.cpp +++ b/src/net/pop3/POP3Store.cpp @@ -42,7 +42,7 @@ namespace net { namespace pop3 { -POP3Store::POP3Store(ref sess, ref auth, const bool secured) +POP3Store::POP3Store(shared_ptr sess, shared_ptr auth, const bool secured) : store(sess, getInfosInstance(), auth), m_isPOP3S(secured) { } @@ -68,33 +68,34 @@ const string POP3Store::getProtocolName() const } -ref POP3Store::getDefaultFolder() +shared_ptr POP3Store::getDefaultFolder() { if (!isConnected()) throw exceptions::illegal_state("Not connected"); - return vmime::create (folder::path(folder::path::component("INBOX")), - thisRef().dynamicCast ()); + return make_shared + (folder::path(folder::path::component("INBOX")), + dynamicCast (shared_from_this())); } -ref POP3Store::getRootFolder() +shared_ptr POP3Store::getRootFolder() { if (!isConnected()) throw exceptions::illegal_state("Not connected"); - return vmime::create (folder::path(), - thisRef().dynamicCast ()); + return make_shared + (folder::path(), dynamicCast (shared_from_this())); } -ref POP3Store::getFolder(const folder::path& path) +shared_ptr POP3Store::getFolder(const folder::path& path) { if (!isConnected()) throw exceptions::illegal_state("Not connected"); - return vmime::create (path, - thisRef().dynamicCast ()); + return make_shared + (path, dynamicCast (shared_from_this())); } @@ -109,8 +110,8 @@ void POP3Store::connect() if (isConnected()) throw exceptions::already_connected(); - m_connection = vmime::create - (thisRef().dynamicCast (), getAuthenticator()); + m_connection = make_shared + (dynamicCast (shared_from_this()), getAuthenticator()); try { @@ -118,7 +119,7 @@ void POP3Store::connect() } catch (std::exception&) { - m_connection = NULL; + m_connection = null; throw; } } @@ -145,16 +146,16 @@ bool POP3Store::isSecuredConnection() const } -ref POP3Store::getConnectionInfos() const +shared_ptr POP3Store::getConnectionInfos() const { if (m_connection == NULL) - return NULL; + return null; return m_connection->getConnectionInfos(); } -ref POP3Store::getConnection() +shared_ptr POP3Store::getConnection() { return m_connection; } @@ -175,7 +176,7 @@ void POP3Store::disconnect() m_connection->disconnect(); - m_connection = NULL; + m_connection = null; } @@ -186,7 +187,7 @@ void POP3Store::noop() POP3Command::NOOP()->send(m_connection); - ref response = POP3Response::readResponse(m_connection); + shared_ptr response = POP3Response::readResponse(m_connection); if (!response->isSuccess()) throw exceptions::command_error("NOOP", response->getFirstLine()); -- cgit v1.2.3