iconv.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BARRY_ICONV_H__
00023 #define __BARRY_ICONV_H__
00024
00025 #include "dll.h"
00026 #include "data.h"
00027 #include <iconv.h>
00028 #include <string>
00029
00030 namespace Barry {
00031
00032 class BXEXPORT IConverter
00033 {
00034 iconv_t m_from;
00035 iconv_t m_to;
00036
00037
00038 mutable Data m_buffer;
00039
00040 bool m_throw_on_conv_err;
00041
00042 private:
00043 std::string Convert(iconv_t cd, const std::string &str) const;
00044
00045 public:
00046
00047
00048
00049 explicit IConverter(const char *tocode = "UTF-8", bool throw_on_conv_err = false);
00050 ~IConverter();
00051
00052 std::string FromBB(const std::string &str) const;
00053 std::string ToBB(const std::string &str) const;
00054 };
00055
00056 }
00057
00058 #endif
00059