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/bodyPartAttachment.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/bodyPartAttachment.cpp') diff --git a/src/bodyPartAttachment.cpp b/src/bodyPartAttachment.cpp index 5ae433ad..c8361238 100644 --- a/src/bodyPartAttachment.cpp +++ b/src/bodyPartAttachment.cpp @@ -28,7 +28,7 @@ namespace vmime { -bodyPartAttachment::bodyPartAttachment(ref part) +bodyPartAttachment::bodyPartAttachment(shared_ptr part) : m_part(part) { } @@ -40,7 +40,7 @@ const mediaType bodyPartAttachment::getType() const try { - type = *getContentType()->getValue().dynamicCast (); + type = *getContentType()->getValue (); } catch (exceptions::no_such_field&) { @@ -76,7 +76,7 @@ const word bodyPartAttachment::getName() const { try { - ref prm = getContentType()->findParameter("name"); + shared_ptr prm = getContentType()->findParameter("name"); if (prm != NULL) name = prm->getValue(); @@ -101,10 +101,10 @@ const text bodyPartAttachment::getDescription() const try { - ref cd = + shared_ptr cd = getHeader()->findField(fields::CONTENT_DESCRIPTION); - description = *cd->getValue().dynamicCast (); + description = *cd->getValue (); } catch (exceptions::no_such_field&) { @@ -121,39 +121,37 @@ const encoding bodyPartAttachment::getEncoding() const } -const ref bodyPartAttachment::getData() const +const shared_ptr bodyPartAttachment::getData() const { return m_part->getBody()->getContents(); } -ref bodyPartAttachment::getPart() const +shared_ptr bodyPartAttachment::getPart() const { return m_part; } -ref bodyPartAttachment::getHeader() const +shared_ptr bodyPartAttachment::getHeader() const { return m_part->getHeader(); } -ref bodyPartAttachment::getContentDisposition() const +shared_ptr bodyPartAttachment::getContentDisposition() const { - return getHeader()->findField(fields::CONTENT_DISPOSITION). - dynamicCast (); + return getHeader()->findField (fields::CONTENT_DISPOSITION); } -ref bodyPartAttachment::getContentType() const +shared_ptr bodyPartAttachment::getContentType() const { - return getHeader()->findField(fields::CONTENT_TYPE). - dynamicCast (); + return getHeader()->findField (fields::CONTENT_TYPE); } -void bodyPartAttachment::generateIn(ref /* parent */) const +void bodyPartAttachment::generateIn(shared_ptr /* parent */) const { // Not used } -- cgit v1.2.3