summaryrefslogtreecommitdiff
path: root/gio/src/charsetconverter.hg
blob: d5f8d87db8645537e5e093365662052dac18d6ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright (C) 2012 The giomm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>
#include <giomm/converter.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gio
{

/** CharsetConverter - Convert between charsets.
 * CharsetConverter is an implementation of Converter based on GIConv.
 * @newin{2,34}
 */
class CharsetConverter : public Glib::Object, public Converter
{
  _CLASS_GOBJECT(CharsetConverter, GCharsetConverter, G_CHARSET_CONVERTER, Glib::Object, GObject)
  _IMPLEMENTS_INTERFACE(Converter)

protected:
  // Handwritten to ignore the final GError** parameter in the *_new()
  // function.
  explicit CharsetConverter(const Glib::ustring& to_charset, const Glib::ustring& from_charset);
  _IGNORE(g_charset_converter_new)

public:
  /** Creates a new CharsetConverter.
   * 
   * @newin{2,24}
   *
   * @param to_charset Destination charset.
   * @param from_charset Source charset.
   * @return A new CharsetConverter, or <tt>0</tt> on error.
   */
  _WRAP_CREATE(const Glib::ustring& to_charset, const Glib::ustring& from_charset)

  _WRAP_METHOD(void set_use_fallback(bool use_fallback), g_charset_converter_set_use_fallback)
  _WRAP_METHOD(bool get_use_fallback() const, g_charset_converter_get_use_fallback)
  _WRAP_METHOD(guint get_num_fallbacks() const, g_charset_converter_get_num_fallbacks)

  _WRAP_PROPERTY("from-charset", Glib::ustring)
  _WRAP_PROPERTY("to-charset", Glib::ustring)
  _WRAP_PROPERTY("use-fallback", bool)
};

} // namespace Gio