aboutsummaryrefslogtreecommitdiffstats
path: root/src/contentTypeField.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2013-11-23 08:25:38 +0000
committerVincent Richard <[email protected]>2013-11-23 08:25:38 +0000
commit7aebeeb2e2ad13c89c202d0bfa8c634ab27b91b4 (patch)
tree591c6558daf2773bb0ce913e39189b295d9406c9 /src/contentTypeField.cpp
parentDo not throw exception for normal code flow (exceptions::no_such_field). (diff)
downloadvmime-7aebeeb2e2ad13c89c202d0bfa8c634ab27b91b4.tar.gz
vmime-7aebeeb2e2ad13c89c202d0bfa8c634ab27b91b4.zip
Do not throw exception for normal code flow (exceptions::no_such_parameter).
Diffstat (limited to 'src/contentTypeField.cpp')
-rw-r--r--src/contentTypeField.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/contentTypeField.cpp b/src/contentTypeField.cpp
index c67654a5..9f38294a 100644
--- a/src/contentTypeField.cpp
+++ b/src/contentTypeField.cpp
@@ -40,9 +40,20 @@ contentTypeField::contentTypeField(contentTypeField&)
}
+bool contentTypeField::hasBoundary() const
+{
+ return findParameter("boundary");
+}
+
+
const string contentTypeField::getBoundary() const
{
- return findParameter("boundary")->getValue().getBuffer();
+ shared_ptr <parameter> param = findParameter("boundary");
+
+ if (param)
+ return param->getValue().getBuffer();
+ else
+ return "";
}
@@ -52,9 +63,20 @@ void contentTypeField::setBoundary(const string& boundary)
}
+bool contentTypeField::hasCharset() const
+{
+ return findParameter("charset");
+}
+
+
const charset contentTypeField::getCharset() const
{
- return findParameter("charset")->getValueAs <charset>();
+ shared_ptr <parameter> param = findParameter("charset");
+
+ if (param)
+ return param->getValueAs <charset>();
+ else
+ return charset();
}
@@ -64,9 +86,20 @@ void contentTypeField::setCharset(const charset& ch)
}
+bool contentTypeField::hasReportType() const
+{
+ return findParameter("report-type");
+}
+
+
const string contentTypeField::getReportType() const
{
- return findParameter("report-type")->getValue().getBuffer();
+ shared_ptr <parameter> param = findParameter("report-type");
+
+ if (param)
+ return param->getValue().getBuffer();
+ else
+ return "";
}