diff options
author | Vincent Richard <[email protected]> | 2005-07-12 22:28:02 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-07-12 22:28:02 +0000 |
commit | 681297e10b666e13cc463f6fbb16236f36c3266c (patch) | |
tree | 5d2392e2283232ed3475cd9c69e22897b03e8a97 /src/fileAttachment.cpp | |
parent | Added contentHandler::extractRaw(). (diff) | |
download | vmime-681297e10b666e13cc463f6fbb16236f36c3266c.tar.gz vmime-681297e10b666e13cc463f6fbb16236f36c3266c.zip |
Reference counting and smart pointers.
Diffstat (limited to 'src/fileAttachment.cpp')
-rw-r--r-- | src/fileAttachment.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp index 423020b2..de1a3ba3 100644 --- a/src/fileAttachment.cpp +++ b/src/fileAttachment.cpp @@ -37,7 +37,7 @@ fileAttachment::fileAttachment(const string& filename, const mediaType& type, co setData(filename); - m_encoding = encoding::decide(*m_data); + m_encoding = encoding::decide(m_data); } @@ -64,7 +64,9 @@ void fileAttachment::setData(const string& filename) throw exceptions::open_file_error(); } - m_data = new streamContentHandler(new utility::inputStreamPointerAdapter(file, true), 0, true); + ref <utility::inputStream> is = vmime::create <utility::inputStreamPointerAdapter>(file, true); + + m_data = vmime::create <streamContentHandler>(is, 0); } @@ -72,13 +74,13 @@ void fileAttachment::generatePart(bodyPart& part) const { defaultAttachment::generatePart(part); - contentDispositionField& cdf = part.getHeader()->ContentDisposition(); + ref <contentDispositionField> cdf = part.getHeader()->ContentDisposition(); - if (m_fileInfo.hasSize()) cdf.setSize(utility::stringUtils::toString(m_fileInfo.getSize())); - if (m_fileInfo.hasFilename()) cdf.setFilename(m_fileInfo.getFilename()); - if (m_fileInfo.hasCreationDate()) cdf.setCreationDate(m_fileInfo.getCreationDate()); - if (m_fileInfo.hasModificationDate()) cdf.setModificationDate(m_fileInfo.getModificationDate()); - if (m_fileInfo.hasReadDate()) cdf.setReadDate(m_fileInfo.getReadDate()); + if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize())); + if (m_fileInfo.hasFilename()) cdf->setFilename(m_fileInfo.getFilename()); + if (m_fileInfo.hasCreationDate()) cdf->setCreationDate(m_fileInfo.getCreationDate()); + if (m_fileInfo.hasModificationDate()) cdf->setModificationDate(m_fileInfo.getModificationDate()); + if (m_fileInfo.hasReadDate()) cdf->setReadDate(m_fileInfo.getReadDate()); } |