aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/icu/Converter.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-06-26 16:43:27 +0200
committerMax Kellermann <max@duempel.org>2015-06-26 16:49:25 +0200
commit0756607e32ff7f8df3ad21368e00c7e4e60ba203 (patch)
tree6578f87a5350cb95fe1649f01758cbf5041cba00 /src/lib/icu/Converter.hxx
parenta03be5a8a60f50bf2133c1b9920f6ba6c7beef22 (diff)
downloadmpd-0756607e32ff7f8df3ad21368e00c7e4e60ba203.tar.gz
mpd-0756607e32ff7f8df3ad21368e00c7e4e60ba203.tar.xz
mpd-0756607e32ff7f8df3ad21368e00c7e4e60ba203.zip
lib/icu/Converter: add iconv() implementation
Diffstat (limited to '')
-rw-r--r--src/lib/icu/Converter.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/icu/Converter.hxx b/src/lib/icu/Converter.hxx
index fd5ea2132..d7a9a2113 100644
--- a/src/lib/icu/Converter.hxx
+++ b/src/lib/icu/Converter.hxx
@@ -26,6 +26,9 @@
#ifdef HAVE_ICU
#include "thread/Mutex.hxx"
#define HAVE_ICU_CONVERTER
+#elif defined(HAVE_ICONV)
+#include <iconv.h>
+#define HAVE_ICU_CONVERTER
#elif defined(HAVE_GLIB)
#include <glib.h>
#define HAVE_ICU_CONVERTER
@@ -56,6 +59,11 @@ class IcuConverter {
UConverter *const converter;
IcuConverter(UConverter *_converter):converter(_converter) {}
+#elif defined(HAVE_ICONV)
+ const iconv_t to_utf8, from_utf8;
+
+ IcuConverter(iconv_t _to, iconv_t _from)
+ :to_utf8(_to), from_utf8(_from) {}
#elif defined(HAVE_GLIB)
const GIConv to_utf8, from_utf8;
@@ -66,6 +74,11 @@ class IcuConverter {
public:
#ifdef HAVE_ICU
~IcuConverter();
+#elif defined(HAVE_ICONV)
+ ~IcuConverter() {
+ iconv_close(to_utf8);
+ iconv_close(from_utf8);
+ }
#elif defined(HAVE_GLIB)
~IcuConverter() {
g_iconv_close(to_utf8);