Removed unused ClassType variable from Task record class
[barry.git] / src / iconv.h
blobbdef4918319e4bff6e0bf9703d2e10eacd02595c
1 ///
2 /// \file iconv.h
3 /// iconv wrapper class, and pluggable interface for records
4 ///
6 /*
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__
25 #include "dll.h"
26 #include "data.h"
27 #include <iconv.h>
28 #include <string>
30 namespace Barry {
32 class BXEXPORT IConverter
34 iconv_t m_from;
35 iconv_t m_to;
37 // internal buffer for fast conversions
38 mutable Data m_buffer;
40 bool m_throw_on_conv_err;
42 private:
43 std::string Convert(iconv_t cd, const std::string &str) const;
45 public:
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);
50 ~IConverter();
52 std::string FromBB(const std::string &str) const;
53 std::string ToBB(const std::string &str) const;
56 } // namespace Barry
58 #endif