aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utility/encoder/encoderTestUtils.hpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2013-06-24 13:32:40 +0000
committerVincent Richard <[email protected]>2013-06-24 13:32:40 +0000
commit895b07cae9741f44a1272b2f3875f8dd94763222 (patch)
tree6532de59e01676c78b423b5de5ebc1411c7da111 /tests/utility/encoder/encoderTestUtils.hpp
parentReturn after sending message when sending is supported. (diff)
downloadvmime-895b07cae9741f44a1272b2f3875f8dd94763222.tar.gz
vmime-895b07cae9741f44a1272b2f3875f8dd94763222.zip
Added support for SIZE SMTP extension (RFC-1870).
Diffstat (limited to 'tests/utility/encoder/encoderTestUtils.hpp')
-rw-r--r--tests/utility/encoder/encoderTestUtils.hpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/utility/encoder/encoderTestUtils.hpp b/tests/utility/encoder/encoderTestUtils.hpp
index dd2484ed..0eb93871 100644
--- a/tests/utility/encoder/encoderTestUtils.hpp
+++ b/tests/utility/encoder/encoderTestUtils.hpp
@@ -22,9 +22,9 @@
//
-// Encoding helper function
-static const vmime::string encode(const vmime::string& name, const vmime::string& in,
- int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet())
+// Helper function to obtain an encoder given its name
+static vmime::ref <vmime::utility::encoder::encoder> getEncoder(const vmime::string& name,
+ int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet())
{
vmime::ref <vmime::utility::encoder::encoder> enc =
vmime::utility::encoder::encoderFactory::getInstance()->create(name);
@@ -34,6 +34,16 @@ static const vmime::string encode(const vmime::string& name, const vmime::string
if (maxLineLength != 0)
enc->getProperties()["maxlinelength"] = maxLineLength;
+ return enc;
+}
+
+
+// Encoding helper function
+static const vmime::string encode(const vmime::string& name, const vmime::string& in,
+ int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet())
+{
+ vmime::ref <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength, props);
+
vmime::utility::inputStreamStringAdapter vin(in);
std::ostringstream out;
@@ -48,11 +58,7 @@ static const vmime::string encode(const vmime::string& name, const vmime::string
// Decoding helper function
static const vmime::string decode(const vmime::string& name, const vmime::string& in, int maxLineLength = 0)
{
- vmime::ref <vmime::utility::encoder::encoder> enc =
- vmime::utility::encoder::encoderFactory::getInstance()->create(name);
-
- if (maxLineLength != 0)
- enc->getProperties()["maxlinelength"] = maxLineLength;
+ vmime::ref <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength);
vmime::utility::inputStreamStringAdapter vin(in);