diff options
author | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
commit | f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 (patch) | |
tree | 2bdc90e361a8f6e0a81164cf67afec9f78f9b959 /src/mailboxGroup.cpp | |
parent | Per-protocol include files. (diff) | |
download | vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.tar.gz vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.zip |
Boost/C++11 shared pointers.
Diffstat (limited to 'src/mailboxGroup.cpp')
-rw-r--r-- | src/mailboxGroup.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp index 9da16653..559d8778 100644 --- a/src/mailboxGroup.cpp +++ b/src/mailboxGroup.cpp @@ -82,24 +82,24 @@ void mailboxGroup::parseImpl while (pos < end && !isLastAddressOfGroup) { - ref <address> parsedAddress = address::parseNext(ctx, buffer, pos, end, &pos, &isLastAddressOfGroup); + shared_ptr <address> parsedAddress = address::parseNext(ctx, buffer, pos, end, &pos, &isLastAddressOfGroup); if (parsedAddress) { if (parsedAddress->isGroup()) { - ref <mailboxGroup> group = parsedAddress.staticCast <mailboxGroup>(); + shared_ptr <mailboxGroup> group = dynamicCast <mailboxGroup>(parsedAddress); // Sub-groups are not allowed in mailbox groups: so, we add all // the contents of the sub-group into this group... for (size_t i = 0 ; i < group->getMailboxCount() ; ++i) { - m_list.push_back(group->getMailboxAt(i)->clone().staticCast <mailbox>()); + m_list.push_back(vmime::clone(group->getMailboxAt(i))); } } else { - m_list.push_back(parsedAddress.staticCast <mailbox>()); + m_list.push_back(dynamicCast <mailbox>(parsedAddress)); } } } @@ -168,7 +168,7 @@ void mailboxGroup::generateImpl os << ":"; ++pos; - for (std::vector <ref <mailbox> >::const_iterator it = m_list.begin() ; + for (std::vector <shared_ptr <mailbox> >::const_iterator it = m_list.begin() ; it != m_list.end() ; ++it) { if (it != m_list.begin()) @@ -201,17 +201,17 @@ void mailboxGroup::copyFrom(const component& other) removeAllMailboxes(); - for (std::vector <ref <mailbox> >::const_iterator it = source.m_list.begin() ; + for (std::vector <shared_ptr <mailbox> >::const_iterator it = source.m_list.begin() ; it != source.m_list.end() ; ++it) { - m_list.push_back((*it)->clone().staticCast <mailbox>()); + m_list.push_back(vmime::clone(*it)); } } -ref <component> mailboxGroup::clone() const +shared_ptr <component> mailboxGroup::clone() const { - return vmime::create <mailboxGroup>(*this); + return make_shared <mailboxGroup>(*this); } @@ -246,15 +246,15 @@ bool mailboxGroup::isEmpty() const } -void mailboxGroup::appendMailbox(ref <mailbox> mbox) +void mailboxGroup::appendMailbox(shared_ptr <mailbox> mbox) { m_list.push_back(mbox); } -void mailboxGroup::insertMailboxBefore(ref <mailbox> beforeMailbox, ref <mailbox> mbox) +void mailboxGroup::insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox) { - const std::vector <ref <mailbox> >::iterator it = std::find + const std::vector <shared_ptr <mailbox> >::iterator it = std::find (m_list.begin(), m_list.end(), beforeMailbox); if (it == m_list.end()) @@ -264,15 +264,15 @@ void mailboxGroup::insertMailboxBefore(ref <mailbox> beforeMailbox, ref <mailbox } -void mailboxGroup::insertMailboxBefore(const size_t pos, ref <mailbox> mbox) +void mailboxGroup::insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox) { m_list.insert(m_list.begin() + pos, mbox); } -void mailboxGroup::insertMailboxAfter(ref <mailbox> afterMailbox, ref <mailbox> mbox) +void mailboxGroup::insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox) { - const std::vector <ref <mailbox> >::iterator it = std::find + const std::vector <shared_ptr <mailbox> >::iterator it = std::find (m_list.begin(), m_list.end(), afterMailbox); if (it == m_list.end()) @@ -282,15 +282,15 @@ void mailboxGroup::insertMailboxAfter(ref <mailbox> afterMailbox, ref <mailbox> } -void mailboxGroup::insertMailboxAfter(const size_t pos, ref <mailbox> mbox) +void mailboxGroup::insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox) { m_list.insert(m_list.begin() + pos + 1, mbox); } -void mailboxGroup::removeMailbox(ref <mailbox> mbox) +void mailboxGroup::removeMailbox(shared_ptr <mailbox> mbox) { - const std::vector <ref <mailbox> >::iterator it = std::find + const std::vector <shared_ptr <mailbox> >::iterator it = std::find (m_list.begin(), m_list.end(), mbox); if (it == m_list.end()) @@ -302,7 +302,7 @@ void mailboxGroup::removeMailbox(ref <mailbox> mbox) void mailboxGroup::removeMailbox(const size_t pos) { - const std::vector <ref <mailbox> >::iterator it = m_list.begin() + pos; + const std::vector <shared_ptr <mailbox> >::iterator it = m_list.begin() + pos; m_list.erase(it); } @@ -320,25 +320,25 @@ size_t mailboxGroup::getMailboxCount() const } -ref <mailbox> mailboxGroup::getMailboxAt(const size_t pos) +shared_ptr <mailbox> mailboxGroup::getMailboxAt(const size_t pos) { return (m_list[pos]); } -const ref <const mailbox> mailboxGroup::getMailboxAt(const size_t pos) const +const shared_ptr <const mailbox> mailboxGroup::getMailboxAt(const size_t pos) const { return (m_list[pos]); } -const std::vector <ref <const mailbox> > mailboxGroup::getMailboxList() const +const std::vector <shared_ptr <const mailbox> > mailboxGroup::getMailboxList() const { - std::vector <ref <const mailbox> > list; + std::vector <shared_ptr <const mailbox> > list; list.reserve(m_list.size()); - for (std::vector <ref <mailbox> >::const_iterator it = m_list.begin() ; + for (std::vector <shared_ptr <mailbox> >::const_iterator it = m_list.begin() ; it != m_list.end() ; ++it) { list.push_back(*it); @@ -348,15 +348,15 @@ const std::vector <ref <const mailbox> > mailboxGroup::getMailboxList() const } -const std::vector <ref <mailbox> > mailboxGroup::getMailboxList() +const std::vector <shared_ptr <mailbox> > mailboxGroup::getMailboxList() { return (m_list); } -const std::vector <ref <component> > mailboxGroup::getChildComponents() +const std::vector <shared_ptr <component> > mailboxGroup::getChildComponents() { - std::vector <ref <component> > list; + std::vector <shared_ptr <component> > list; copy_vector(m_list, list); |