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/mailboxList.cpp | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/mailboxList.cpp') diff --git a/src/mailboxList.cpp b/src/mailboxList.cpp index f0f40ca8..0a76c52a 100644 --- a/src/mailboxList.cpp +++ b/src/mailboxList.cpp @@ -41,13 +41,13 @@ mailboxList::mailboxList(const mailboxList& mboxList) } -void mailboxList::appendMailbox(ref mbox) +void mailboxList::appendMailbox(shared_ptr mbox) { m_list.appendAddress(mbox); } -void mailboxList::insertMailboxBefore(ref beforeMailbox, ref mbox) +void mailboxList::insertMailboxBefore(shared_ptr beforeMailbox, shared_ptr mbox) { try { @@ -60,13 +60,13 @@ void mailboxList::insertMailboxBefore(ref beforeMailbox, ref } -void mailboxList::insertMailboxBefore(const size_t pos, ref mbox) +void mailboxList::insertMailboxBefore(const size_t pos, shared_ptr mbox) { m_list.insertAddressBefore(pos, mbox); } -void mailboxList::insertMailboxAfter(ref afterMailbox, ref mbox) +void mailboxList::insertMailboxAfter(shared_ptr afterMailbox, shared_ptr mbox) { try { @@ -79,13 +79,13 @@ void mailboxList::insertMailboxAfter(ref afterMailbox, ref m } -void mailboxList::insertMailboxAfter(const size_t pos, ref mbox) +void mailboxList::insertMailboxAfter(const size_t pos, shared_ptr mbox) { m_list.insertAddressAfter(pos, mbox); } -void mailboxList::removeMailbox(ref mbox) +void mailboxList::removeMailbox(shared_ptr mbox) { try { @@ -122,27 +122,27 @@ bool mailboxList::isEmpty() const } -ref mailboxList::getMailboxAt(const size_t pos) +shared_ptr mailboxList::getMailboxAt(const size_t pos) { - return m_list.getAddressAt(pos).staticCast (); + return dynamicCast (m_list.getAddressAt(pos)); } -const ref mailboxList::getMailboxAt(const size_t pos) const +const shared_ptr mailboxList::getMailboxAt(const size_t pos) const { - return m_list.getAddressAt(pos).staticCast (); + return dynamicCast (m_list.getAddressAt(pos)); } -const std::vector > mailboxList::getMailboxList() const +const std::vector > mailboxList::getMailboxList() const { - const std::vector > addrList = m_list.getAddressList(); - std::vector > res; + const std::vector > addrList = m_list.getAddressList(); + std::vector > res; - for (std::vector >::const_iterator it = addrList.begin() ; + for (std::vector >::const_iterator it = addrList.begin() ; it != addrList.end() ; ++it) { - const ref mbox = (*it).dynamicCast (); + const shared_ptr mbox = dynamicCast (*it); if (mbox != NULL) res.push_back(mbox); @@ -152,15 +152,15 @@ const std::vector > mailboxList::getMailboxList() const } -const std::vector > mailboxList::getMailboxList() +const std::vector > mailboxList::getMailboxList() { - const std::vector > addrList = m_list.getAddressList(); - std::vector > res; + const std::vector > addrList = m_list.getAddressList(); + std::vector > res; - for (std::vector >::const_iterator it = addrList.begin() ; + for (std::vector >::const_iterator it = addrList.begin() ; it != addrList.end() ; ++it) { - const ref mbox = (*it).dynamicCast (); + const shared_ptr mbox = dynamicCast (*it); if (mbox != NULL) res.push_back(mbox); @@ -170,9 +170,9 @@ const std::vector > mailboxList::getMailboxList() } -ref mailboxList::clone() const +shared_ptr mailboxList::clone() const { - return vmime::create (*this); + return make_shared (*this); } @@ -191,7 +191,7 @@ mailboxList& mailboxList::operator=(const mailboxList& other) } -const std::vector > mailboxList::getChildComponents() +const std::vector > mailboxList::getChildComponents() { return (m_list.getChildComponents()); } @@ -207,13 +207,13 @@ void mailboxList::parseImpl while (pos < end) { - ref
parsedAddress = address::parseNext(ctx, buffer, pos, end, &pos, NULL); + shared_ptr
parsedAddress = address::parseNext(ctx, buffer, pos, end, &pos, NULL); if (parsedAddress != NULL) { if (parsedAddress->isGroup()) { - ref group = parsedAddress.staticCast (); + shared_ptr group = dynamicCast (parsedAddress); for (size_t i = 0 ; i < group->getMailboxCount() ; ++i) { @@ -241,9 +241,9 @@ void mailboxList::generateImpl(const generationContext& ctx, utility::outputStre } -ref mailboxList::toAddressList() const +shared_ptr mailboxList::toAddressList() const { - return m_list.clone().dynamicCast (); + return vmime::clone(m_list); } -- cgit v1.2.3