1/* Copyright (C) 2012 The giomm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <glibmm/object.h>
18#include <giomm/converter.h>
19
20_DEFS(giomm,gio)
21_PINCLUDE(glibmm/private/object_p.h)
22
23namespace Gio
24{
25
26/** CharsetConverter - Convert between charsets.
27 * CharsetConverter is an implementation of Converter based on GIConv.
28 * @newin{2,34}
29 */
30class GIOMM_API CharsetConverter : public Glib::Object, public Converter
31{
32  _CLASS_GOBJECT(CharsetConverter, GCharsetConverter, G_CHARSET_CONVERTER, Glib::Object, GObject, , , GIOMM_API)
33  _IMPLEMENTS_INTERFACE(Converter)
34
35protected:
36  // Handwritten to ignore the final GError** parameter in the *_new()
37  // function.
38  explicit CharsetConverter(const Glib::ustring& to_charset, const Glib::ustring& from_charset);
39  _IGNORE(g_charset_converter_new)
40
41public:
42  /** Creates a new CharsetConverter.
43   *
44   * @newin{2,24}
45   *
46   * @param to_charset Destination charset.
47   * @param from_charset Source charset.
48   * @return A new CharsetConverter, or <tt>0</tt> on error.
49   */
50  _WRAP_CREATE(const Glib::ustring& to_charset, const Glib::ustring& from_charset)
51
52  _WRAP_METHOD(void set_use_fallback(bool use_fallback), g_charset_converter_set_use_fallback)
53  _WRAP_METHOD(bool get_use_fallback() const, g_charset_converter_get_use_fallback)
54  _WRAP_METHOD(guint get_num_fallbacks() const, g_charset_converter_get_num_fallbacks)
55
56  _WRAP_PROPERTY("from-charset", Glib::ustring)
57  _WRAP_PROPERTY("to-charset", Glib::ustring)
58  _WRAP_PROPERTY("use-fallback", bool)
59};
60
61} // namespace Gio
62