diff options
author | Vincent Richard <[email protected]> | 2005-11-04 23:21:22 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-11-04 23:21:22 +0000 |
commit | acfa9ffc64f56de42049bf5049810c15477729ed (patch) | |
tree | 3bb84a7319fb209c00f656927c83965f03bd5329 /src/body.cpp | |
parent | Fixed typo for 'ac_cv_sizeof_long'. (diff) | |
download | vmime-acfa9ffc64f56de42049bf5049810c15477729ed.tar.gz vmime-acfa9ffc64f56de42049bf5049810c15477729ed.zip |
Refactored header field values and parameters.
Diffstat (limited to 'src/body.cpp')
-rw-r--r-- | src/body.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
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 <const contentTypeField> ctf = m_header->findField(fields::CONTENT_TYPE).dynamicCast <contentTypeField>(); - if (ctf->getValue().getType() == mediaTypes::MULTIPART) + const mediaType type = *ctf->getValue().dynamicCast <const mediaType>(); + + if (type.getType() == mediaTypes::MULTIPART) { isMultipart = true; @@ -388,7 +391,7 @@ const mediaType body::getContentType() const ref <const contentTypeField> ctf = m_header->findField(fields::CONTENT_TYPE).dynamicCast <const contentTypeField>(); - return (ctf->getValue()); + return (*ctf->getValue().dynamicCast <const mediaType>()); } catch (exceptions::no_such_field&) { @@ -424,10 +427,10 @@ const encoding body::getEncoding() const { try { - const ref <const contentEncodingField> cef = - m_header->findField(fields::CONTENT_TRANSFER_ENCODING).dynamicCast <contentEncodingField>(); + const ref <const headerField> cef = + m_header->findField(fields::CONTENT_TRANSFER_ENCODING); - return (cef->getValue()); + return (*cef->getValue().dynamicCast <const encoding>()); } catch (exceptions::no_such_field&) { @@ -550,7 +553,7 @@ void body::initNewPart(ref <bodyPart> part) ctf->setBoundary(generateRandomBoundaryString()); } - if (ctf->getValue().getType() != mediaTypes::MULTIPART) + if (ctf->getValue().dynamicCast <const mediaType>()->getType() != mediaTypes::MULTIPART) { // Warning: multi-part body but the Content-Type is // not specified as "multipart/..." |