3 /// iconv wrapper class, and pluggable interface for records
7 Copyright (C) 2008-2009, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_ICONV_H__
23 #define __BARRY_ICONV_H__
32 class BXEXPORT IConverter
37 // internal buffer for fast conversions
38 mutable Data m_buffer
;
40 bool m_throw_on_conv_err
;
43 std::string
Convert(iconv_t cd
, const std::string
&str
) const;
46 /// Always throws ErrnoError if unable to open iconv.
47 /// If throw_on_conv_err is true, then string conversion operations
48 /// that fail will also throw ErrnoError.
49 explicit IConverter(const char *tocode
= "UTF-8", bool throw_on_conv_err
= false);
52 std::string
FromBB(const std::string
&str
) const;
53 std::string
ToBB(const std::string
&str
) const;