From 4ae97ddb0957c626a01682e24c68710e608bcc43 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 28 Jan 2005 17:50:53 +0000 Subject: Splitted 'contentHandler' into three classes: 'emptyContentHandler', 'stringContentHandler' and 'streamContentHandler'. --- src/plainTextPart.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/plainTextPart.cpp') diff --git a/src/plainTextPart.cpp b/src/plainTextPart.cpp index a1902bb6..cfaf35a4 100644 --- a/src/plainTextPart.cpp +++ b/src/plainTextPart.cpp @@ -21,11 +21,25 @@ #include "vmime/header.hpp" #include "vmime/exception.hpp" +#include "vmime/emptyContentHandler.hpp" + namespace vmime { +plainTextPart::plainTextPart() + : m_text(new emptyContentHandler) +{ +} + + +plainTextPart::~plainTextPart() +{ + delete (m_text); +} + + const mediaType plainTextPart::getType() const { return (mediaType(mediaTypes::TEXT, mediaTypes::TEXT_PLAIN)); @@ -50,14 +64,15 @@ void plainTextPart::generateIn(bodyPart& /* message */, bodyPart& parent) const part->getHeader()->ContentTransferEncoding().setValue(encoding(encodingTypes::QUOTED_PRINTABLE)); // Set contents - part->getBody()->setContents(m_text); + part->getBody()->setContents(*m_text); } void plainTextPart::parse(const bodyPart& /* message */, const bodyPart& /* parent */, const bodyPart& textPart) { - m_text = textPart.getBody()->getContents(); + delete (m_text); + m_text = textPart.getBody()->getContents().clone(); try { @@ -91,13 +106,14 @@ void plainTextPart::setCharset(const charset& ch) const contentHandler& plainTextPart::getText() const { - return (m_text); + return (*m_text); } void plainTextPart::setText(const contentHandler& text) { - m_text = text; + delete (m_text); + m_text = text.clone(); } -- cgit v1.2.3