diff options
Diffstat (limited to 'tests/utility/encoder/encoderTestUtils.hpp')
-rw-r--r-- | tests/utility/encoder/encoderTestUtils.hpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tests/utility/encoder/encoderTestUtils.hpp b/tests/utility/encoder/encoderTestUtils.hpp index d74c4709..cc1141c7 100644 --- a/tests/utility/encoder/encoderTestUtils.hpp +++ b/tests/utility/encoder/encoderTestUtils.hpp @@ -1,6 +1,6 @@ // // VMime library (http://www.vmime.org) -// Copyright (C) 2002-2013 Vincent Richard <[email protected]> +// Copyright (C) 2002 Vincent Richard <[email protected]> // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -23,25 +23,32 @@ // Helper function to obtain an encoder given its name -static vmime::shared_ptr <vmime::utility::encoder::encoder> getEncoder(const vmime::string& name, - int maxLineLength = 0, const vmime::propertySet props = vmime::propertySet()) -{ +static vmime::shared_ptr <vmime::utility::encoder::encoder> getEncoder( + const vmime::string& name, + int maxLineLength = 0, + const vmime::propertySet props = vmime::propertySet() +) { + vmime::shared_ptr <vmime::utility::encoder::encoder> enc = vmime::utility::encoder::encoderFactory::getInstance()->create(name); enc->getProperties() = props; - if (maxLineLength != 0) + 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()) -{ +static const vmime::string encode( + const vmime::string& name, const vmime::string& in, + int maxLineLength = 0, + const vmime::propertySet props = vmime::propertySet() +) { + vmime::shared_ptr <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength, props); vmime::utility::inputStreamStringAdapter vin(in); @@ -56,8 +63,12 @@ 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) -{ +static const vmime::string decode( + const vmime::string& name, + const vmime::string& in, + int maxLineLength = 0 +) { + vmime::shared_ptr <vmime::utility::encoder::encoder> enc = getEncoder(name, maxLineLength); vmime::utility::inputStreamStringAdapter vin(in); |