From acfa9ffc64f56de42049bf5049810c15477729ed Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 4 Nov 2005 23:21:22 +0000 Subject: Refactored header field values and parameters. --- src/body.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/body.cpp') diff --git a/src/body.cpp b/src/body.cpp index e2fcf0ad..cee72d0a 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -27,6 +27,7 @@ #include "vmime/options.hpp" #include "vmime/contentTypeField.hpp" +#include "vmime/text.hpp" #include "vmime/utility/random.hpp" @@ -65,7 +66,9 @@ void body::parse(const string& buffer, const string::size_type position, const ref ctf = m_header->findField(fields::CONTENT_TYPE).dynamicCast (); - if (ctf->getValue().getType() == mediaTypes::MULTIPART) + const mediaType type = *ctf->getValue().dynamicCast (); + + if (type.getType() == mediaTypes::MULTIPART) { isMultipart = true; @@ -388,7 +391,7 @@ const mediaType body::getContentType() const ref ctf = m_header->findField(fields::CONTENT_TYPE).dynamicCast (); - return (ctf->getValue()); + return (*ctf->getValue().dynamicCast ()); } catch (exceptions::no_such_field&) { @@ -424,10 +427,10 @@ const encoding body::getEncoding() const { try { - const ref cef = - m_header->findField(fields::CONTENT_TRANSFER_ENCODING).dynamicCast (); + const ref cef = + m_header->findField(fields::CONTENT_TRANSFER_ENCODING); - return (cef->getValue()); + return (*cef->getValue().dynamicCast ()); } catch (exceptions::no_such_field&) { @@ -550,7 +553,7 @@ void body::initNewPart(ref part) ctf->setBoundary(generateRandomBoundaryString()); } - if (ctf->getValue().getType() != mediaTypes::MULTIPART) + if (ctf->getValue().dynamicCast ()->getType() != mediaTypes::MULTIPART) { // Warning: multi-part body but the Content-Type is // not specified as "multipart/..." -- cgit v1.2.3