From 5242a01c775e85d360aca57e218855382fc0630e Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 24 Jun 2013 18:07:43 +0200 Subject: Renamed default encoder. --- SConstruct | 2 +- src/utility/encoder/defaultEncoder.cpp | 87 ------------------------------- src/utility/encoder/noopEncoder.cpp | 87 +++++++++++++++++++++++++++++++ vmime/utility/encoder/binaryEncoder.hpp | 4 +- vmime/utility/encoder/defaultEncoder.hpp | 58 --------------------- vmime/utility/encoder/eightBitEncoder.hpp | 4 +- vmime/utility/encoder/noopEncoder.hpp | 58 +++++++++++++++++++++ vmime/utility/encoder/sevenBitEncoder.hpp | 4 +- 8 files changed, 152 insertions(+), 152 deletions(-) delete mode 100644 src/utility/encoder/defaultEncoder.cpp create mode 100644 src/utility/encoder/noopEncoder.cpp delete mode 100644 vmime/utility/encoder/defaultEncoder.hpp create mode 100644 vmime/utility/encoder/noopEncoder.hpp diff --git a/SConstruct b/SConstruct index 27d708aa..9d048942 100644 --- a/SConstruct +++ b/SConstruct @@ -152,7 +152,7 @@ libvmime_sources = [ 'utility/encoder/eightBitEncoder.cpp', 'utility/encoder/eightBitEncoder.hpp', 'utility/encoder/b64Encoder.cpp', 'utility/encoder/b64Encoder.hpp', 'utility/encoder/binaryEncoder.cpp', 'utility/encoder/binaryEncoder.hpp', - 'utility/encoder/defaultEncoder.cpp', 'utility/encoder/defaultEncoder.hpp', + 'utility/encoder/noopEncoder.cpp', 'utility/encoder/noopEncoder.hpp', 'utility/encoder/encoderFactory.cpp', 'utility/encoder/encoderFactory.hpp', 'utility/encoder/qpEncoder.cpp', 'utility/encoder/qpEncoder.hpp', 'utility/encoder/uuEncoder.cpp', 'utility/encoder/uuEncoder.hpp', diff --git a/src/utility/encoder/defaultEncoder.cpp b/src/utility/encoder/defaultEncoder.cpp deleted file mode 100644 index 95e531cd..00000000 --- a/src/utility/encoder/defaultEncoder.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2013 Vincent Richard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 3 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Linking this library statically or dynamically with other modules is making -// a combined work based on this library. Thus, the terms and conditions of -// the GNU General Public License cover the whole combination. -// - -#include "vmime/utility/encoder/defaultEncoder.hpp" - -#include "vmime/utility/streamUtils.hpp" - - -namespace vmime { -namespace utility { -namespace encoder { - - -defaultEncoder::defaultEncoder() -{ -} - - -utility::stream::size_type defaultEncoder::encode(utility::inputStream& in, - utility::outputStream& out, utility::progressListener* progress) -{ - in.reset(); // may not work... - - // No encoding performed - utility::stream::size_type res = 0; - - if (progress) - res = utility::bufferedStreamCopy(in, out, 0, progress); - else - res = utility::bufferedStreamCopy(in, out); - - return res; -} - - -utility::stream::size_type defaultEncoder::decode(utility::inputStream& in, - utility::outputStream& out, utility::progressListener* progress) -{ - in.reset(); // may not work... - - // No decoding performed - utility::stream::size_type res = 0; - - if (progress) - res = utility::bufferedStreamCopy(in, out, 0, progress); - else - res = utility::bufferedStreamCopy(in, out); - - return res; -} - - -utility::stream::size_type defaultEncoder::getEncodedSize(const utility::stream::size_type n) const -{ - return n; -} - - -utility::stream::size_type defaultEncoder::getDecodedSize(const utility::stream::size_type n) const -{ - return n; -} - - -} // encoder -} // utility -} // vmime diff --git a/src/utility/encoder/noopEncoder.cpp b/src/utility/encoder/noopEncoder.cpp new file mode 100644 index 00000000..cf72a4f6 --- /dev/null +++ b/src/utility/encoder/noopEncoder.cpp @@ -0,0 +1,87 @@ +// +// VMime library (http://www.vmime.org) +// Copyright (C) 2002-2013 Vincent Richard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 3 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// Linking this library statically or dynamically with other modules is making +// a combined work based on this library. Thus, the terms and conditions of +// the GNU General Public License cover the whole combination. +// + +#include "vmime/utility/encoder/noopEncoder.hpp" + +#include "vmime/utility/streamUtils.hpp" + + +namespace vmime { +namespace utility { +namespace encoder { + + +noopEncoder::noopEncoder() +{ +} + + +utility::stream::size_type noopEncoder::encode(utility::inputStream& in, + utility::outputStream& out, utility::progressListener* progress) +{ + in.reset(); // may not work... + + // No encoding performed + utility::stream::size_type res = 0; + + if (progress) + res = utility::bufferedStreamCopy(in, out, 0, progress); + else + res = utility::bufferedStreamCopy(in, out); + + return res; +} + + +utility::stream::size_type noopEncoder::decode(utility::inputStream& in, + utility::outputStream& out, utility::progressListener* progress) +{ + in.reset(); // may not work... + + // No decoding performed + utility::stream::size_type res = 0; + + if (progress) + res = utility::bufferedStreamCopy(in, out, 0, progress); + else + res = utility::bufferedStreamCopy(in, out); + + return res; +} + + +utility::stream::size_type noopEncoder::getEncodedSize(const utility::stream::size_type n) const +{ + return n; +} + + +utility::stream::size_type noopEncoder::getDecodedSize(const utility::stream::size_type n) const +{ + return n; +} + + +} // encoder +} // utility +} // vmime diff --git a/vmime/utility/encoder/binaryEncoder.hpp b/vmime/utility/encoder/binaryEncoder.hpp index 8d032a25..1c831939 100644 --- a/vmime/utility/encoder/binaryEncoder.hpp +++ b/vmime/utility/encoder/binaryEncoder.hpp @@ -25,7 +25,7 @@ #define VMIME_UTILITY_ENCODER_BINARYENCODER_HPP_INCLUDED -#include "vmime/utility/encoder/defaultEncoder.hpp" +#include "vmime/utility/encoder/noopEncoder.hpp" namespace vmime { @@ -36,7 +36,7 @@ namespace encoder { /** Binary encoder. */ -class VMIME_EXPORT binaryEncoder : public defaultEncoder +class VMIME_EXPORT binaryEncoder : public noopEncoder { public: diff --git a/vmime/utility/encoder/defaultEncoder.hpp b/vmime/utility/encoder/defaultEncoder.hpp deleted file mode 100644 index 3f7d9111..00000000 --- a/vmime/utility/encoder/defaultEncoder.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2013 Vincent Richard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 3 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Linking this library statically or dynamically with other modules is making -// a combined work based on this library. Thus, the terms and conditions of -// the GNU General Public License cover the whole combination. -// - -#ifndef VMIME_UTILITY_ENCODER_DEFAULTENCODER_HPP_INCLUDED -#define VMIME_UTILITY_ENCODER_DEFAULTENCODER_HPP_INCLUDED - - -#include "vmime/utility/encoder/encoder.hpp" - - -namespace vmime { -namespace utility { -namespace encoder { - - -/** Default encoder (simple copy, no encoding/decoding is performed). - */ - -class VMIME_EXPORT defaultEncoder : public encoder -{ -public: - - defaultEncoder(); - - utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out, utility::progressListener* progress = NULL); - utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out, utility::progressListener* progress = NULL); - - utility::stream::size_type getEncodedSize(const utility::stream::size_type n) const; - utility::stream::size_type getDecodedSize(const utility::stream::size_type n) const; -}; - - -} // encoder -} // utility -} // vmime - - -#endif // VMIME_UTILITY_ENCODER_DEFAULTENCODER_HPP_INCLUDED diff --git a/vmime/utility/encoder/eightBitEncoder.hpp b/vmime/utility/encoder/eightBitEncoder.hpp index f9de5217..ee50ca95 100644 --- a/vmime/utility/encoder/eightBitEncoder.hpp +++ b/vmime/utility/encoder/eightBitEncoder.hpp @@ -25,7 +25,7 @@ #define VMIME_UTILITY_ENCODER_EIGHTBITENCODER_HPP_INCLUDED -#include "vmime/utility/encoder/defaultEncoder.hpp" +#include "vmime/utility/encoder/noopEncoder.hpp" namespace vmime { @@ -36,7 +36,7 @@ namespace encoder { /** 8-bit encoder. */ -class VMIME_EXPORT eightBitEncoder : public defaultEncoder +class VMIME_EXPORT eightBitEncoder : public noopEncoder { public: diff --git a/vmime/utility/encoder/noopEncoder.hpp b/vmime/utility/encoder/noopEncoder.hpp new file mode 100644 index 00000000..7e18e3f9 --- /dev/null +++ b/vmime/utility/encoder/noopEncoder.hpp @@ -0,0 +1,58 @@ +// +// VMime library (http://www.vmime.org) +// Copyright (C) 2002-2013 Vincent Richard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 3 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// Linking this library statically or dynamically with other modules is making +// a combined work based on this library. Thus, the terms and conditions of +// the GNU General Public License cover the whole combination. +// + +#ifndef VMIME_UTILITY_ENCODER_NOOPENCODER_HPP_INCLUDED +#define VMIME_UTILITY_ENCODER_NOOPENCODER_HPP_INCLUDED + + +#include "vmime/utility/encoder/encoder.hpp" + + +namespace vmime { +namespace utility { +namespace encoder { + + +/** Default, no-op encoder (simple copy, no encoding/decoding is performed). + */ + +class VMIME_EXPORT noopEncoder : public encoder +{ +public: + + noopEncoder(); + + utility::stream::size_type encode(utility::inputStream& in, utility::outputStream& out, utility::progressListener* progress = NULL); + utility::stream::size_type decode(utility::inputStream& in, utility::outputStream& out, utility::progressListener* progress = NULL); + + utility::stream::size_type getEncodedSize(const utility::stream::size_type n) const; + utility::stream::size_type getDecodedSize(const utility::stream::size_type n) const; +}; + + +} // encoder +} // utility +} // vmime + + +#endif // VMIME_UTILITY_ENCODER_NOOPENCODER_HPP_INCLUDED diff --git a/vmime/utility/encoder/sevenBitEncoder.hpp b/vmime/utility/encoder/sevenBitEncoder.hpp index 9f1660d1..d260cc7b 100644 --- a/vmime/utility/encoder/sevenBitEncoder.hpp +++ b/vmime/utility/encoder/sevenBitEncoder.hpp @@ -25,7 +25,7 @@ #define VMIME_UTILITY_ENCODER_SEVENBITENCODER_HPP_INCLUDED -#include "vmime/utility/encoder/defaultEncoder.hpp" +#include "vmime/utility/encoder/noopEncoder.hpp" namespace vmime { @@ -36,7 +36,7 @@ namespace encoder { /** 7-bit encoder. */ -class VMIME_EXPORT sevenBitEncoder : public defaultEncoder +class VMIME_EXPORT sevenBitEncoder : public noopEncoder { public: -- cgit v1.2.3