aboutsummaryrefslogtreecommitdiffstats
path: root/vmime
diff options
context:
space:
mode:
Diffstat (limited to 'vmime')
-rw-r--r--vmime/charsetConverter.hpp6
-rw-r--r--vmime/charsetConverter_iconv.hpp8
-rwxr-xr-xvmime/charsetConverter_icu.hpp84
3 files changed, 98 insertions, 0 deletions
diff --git a/vmime/charsetConverter.hpp b/vmime/charsetConverter.hpp
index b7292d66..dcf90e48 100644
--- a/vmime/charsetConverter.hpp
+++ b/vmime/charsetConverter.hpp
@@ -104,6 +104,12 @@ public:
* @return a filtered output stream, or NULL if not supported
*/
virtual ref <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os) = 0;
+
+private:
+
+ static ref <charsetConverter> createGenericConverter
+ (const charset& source, const charset& dest,
+ const charsetConverterOptions& opts);
};
diff --git a/vmime/charsetConverter_iconv.hpp b/vmime/charsetConverter_iconv.hpp
index 77a6651c..a590b320 100644
--- a/vmime/charsetConverter_iconv.hpp
+++ b/vmime/charsetConverter_iconv.hpp
@@ -25,6 +25,12 @@
#define VMIME_CHARSETCONVERTER_ICONV_HPP_INCLUDED
+#include "vmime/config.hpp"
+
+
+#if VMIME_CHARSETCONV_LIB_IS_ICONV
+
+
#include "vmime/charsetConverter.hpp"
@@ -121,4 +127,6 @@ private:
} // vmime
+#endif // VMIME_CHARSETCONV_LIB_IS_ICONV
+
#endif // VMIME_CHARSETCONVERTER_ICONV_HPP_INCLUDED
diff --git a/vmime/charsetConverter_icu.hpp b/vmime/charsetConverter_icu.hpp
new file mode 100755
index 00000000..ba0b82a9
--- /dev/null
+++ b/vmime/charsetConverter_icu.hpp
@@ -0,0 +1,84 @@
+//
+// VMime library (http://www.vmime.org)
+// Copyright (C) 2002-2013 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
+// 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_CHARSETCONVERTER_ICU_HPP_INCLUDED
+#define VMIME_CHARSETCONVERTER_ICU_HPP_INCLUDED
+
+
+#include "vmime/config.hpp"
+
+
+#if VMIME_CHARSETCONV_LIB_IS_ICU
+
+
+#include "vmime/charsetConverter.hpp"
+
+
+struct UConverter;
+
+
+namespace vmime
+{
+
+
+/** A generic charset converter which uses ICU library.
+ */
+
+class charsetConverter_icu : public charsetConverter
+{
+public:
+
+ /** Construct and initialize an ICU charset converter.
+ *
+ * @param source input charset
+ * @param dest output charset
+ * @param opts conversion options
+ */
+ charsetConverter_icu(const charset& source, const charset& dest,
+ const charsetConverterOptions& opts = charsetConverterOptions());
+
+ ~charsetConverter_icu();
+
+ void convert(const string& in, string& out);
+ void convert(utility::inputStream& in, utility::outputStream& out);
+
+ ref <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
+
+private:
+
+ UConverter* m_from;
+ UConverter* m_to;
+
+ charset m_source;
+ charset m_dest;
+
+ charsetConverterOptions m_options;
+};
+
+
+} // vmime
+
+
+#endif // VMIME_CHARSETCONV_LIB_IS_ICU
+
+#endif // VMIME_CHARSETCONVERTER_ICU_HPP_INCLUDED