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/fileAttachment.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/fileAttachment.cpp') diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp index 4f4a87d3..1db1a1a8 100644 --- a/src/fileAttachment.cpp +++ b/src/fileAttachment.cpp @@ -79,7 +79,7 @@ fileAttachment::fileAttachment(const string& filepath, const mediaType& type, } -fileAttachment::fileAttachment(ref cts, const word& filename, const mediaType& type) +fileAttachment::fileAttachment(shared_ptr cts, const word& filename, const mediaType& type) { if (!filename.isEmpty()) m_fileInfo.setFilename(filename); @@ -92,7 +92,7 @@ fileAttachment::fileAttachment(ref cts, const word& filename, c } -fileAttachment::fileAttachment(ref cts, const word& filename, +fileAttachment::fileAttachment(shared_ptr cts, const word& filename, const mediaType& type, const text& desc) { if (!filename.isEmpty()) @@ -107,7 +107,7 @@ fileAttachment::fileAttachment(ref cts, const word& filename, } -fileAttachment::fileAttachment(ref cts, const word& filename, +fileAttachment::fileAttachment(shared_ptr cts, const word& filename, const mediaType& type, const text& desc, const encoding& enc) { if (!filename.isEmpty()) @@ -123,15 +123,15 @@ fileAttachment::fileAttachment(ref cts, const word& filename, void fileAttachment::setData(const string& filepath) { - ref fsf = platform::getHandler()->getFileSystemFactory(); + shared_ptr fsf = platform::getHandler()->getFileSystemFactory(); utility::file::path path = fsf->stringToPath(filepath); - ref file = fsf->create(path); + shared_ptr file = fsf->create(path); if (!file->isFile()) throw exceptions::open_file_error(); - m_data = vmime::create + m_data = make_shared (file->getFileReader()->getInputStream(), file->getLength()); m_fileInfo.setFilename(path.getLastComponent()); @@ -139,7 +139,7 @@ void fileAttachment::setData(const string& filepath) } -void fileAttachment::setData(ref cts) +void fileAttachment::setData(shared_ptr cts) { m_data = cts; @@ -147,12 +147,12 @@ void fileAttachment::setData(ref cts) } -void fileAttachment::generatePart(ref part) const +void fileAttachment::generatePart(shared_ptr part) const { defaultAttachment::generatePart(part); - ref cdf = part->getHeader()->ContentDisposition(). - dynamicCast (); + shared_ptr cdf = + dynamicCast (part->getHeader()->ContentDisposition()); if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize())); if (m_fileInfo.hasFilename() && !m_fileInfo.getFilename().isEmpty()) cdf->setFilename(m_fileInfo.getFilename()); -- cgit v1.2.3