diff options
author | Vincent Richard <[email protected]> | 2018-09-05 21:54:48 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2018-09-05 21:54:48 +0000 |
commit | b55bdc9c0bb68236aa2de0a8eaec9f4c80cc2769 (patch) | |
tree | efa18d623d3bc67c41d643aae145c16aa8f1006d /tests/utility/encoder/encoderTestUtils.hpp | |
parent | Merge pull request #198 from xguerin/master (diff) | |
download | vmime-b55bdc9c0bb68236aa2de0a8eaec9f4c80cc2769.tar.gz vmime-b55bdc9c0bb68236aa2de0a8eaec9f4c80cc2769.zip |
Code style and clarity.
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); |