1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GCharsetConverter.html 27 * outPack = gio 28 * outFile = CharsetConverter 29 * strct = GCharsetConverter 30 * realStrct= 31 * ctorStrct= 32 * clss = CharsetConverter 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - ConverterIF 40 * prefixes: 41 * - g_charset_converter_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.ErrorG 49 * - glib.GException 50 * - gio.ConverterT 51 * - gio.ConverterIF 52 * structWrap: 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gio.CharsetConverter; 59 60 public import gtkc.giotypes; 61 62 private import gtkc.gio; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 67 private import glib.Str; 68 private import glib.ErrorG; 69 private import glib.GException; 70 private import gio.ConverterT; 71 private import gio.ConverterIF; 72 73 74 75 private import gobject.ObjectG; 76 77 /** 78 * GCharsetConverter is an implementation of GConverter based on 79 * GIConv. 80 */ 81 public class CharsetConverter : ObjectG, ConverterIF 82 { 83 84 /** the main Gtk struct */ 85 protected GCharsetConverter* gCharsetConverter; 86 87 88 public GCharsetConverter* getCharsetConverterStruct() 89 { 90 return gCharsetConverter; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gCharsetConverter; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GCharsetConverter* gCharsetConverter) 104 { 105 super(cast(GObject*)gCharsetConverter); 106 this.gCharsetConverter = gCharsetConverter; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gCharsetConverter = cast(GCharsetConverter*)obj; 113 } 114 115 // add the Converter capabilities 116 mixin ConverterT!(GCharsetConverter); 117 118 /** 119 */ 120 121 /** 122 * Creates a new GCharsetConverter. 123 * Since 2.24 124 * Params: 125 * toCharset = destination charset 126 * fromCharset = source charset 127 * Throws: GException on failure. 128 * Throws: ConstructionException GTK+ fails to create the object. 129 */ 130 public this (string toCharset, string fromCharset) 131 { 132 // GCharsetConverter * g_charset_converter_new (const gchar *to_charset, const gchar *from_charset, GError **error); 133 GError* err = null; 134 135 auto p = g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err); 136 137 if (err !is null) 138 { 139 throw new GException( new ErrorG(err) ); 140 } 141 142 if(p is null) 143 { 144 throw new ConstructionException("null returned by g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err)"); 145 } 146 this(cast(GCharsetConverter*) p); 147 } 148 149 /** 150 * Sets the "use-fallback" property. 151 * Since 2.24 152 * Params: 153 * useFallback = TRUE to use fallbacks 154 */ 155 public void setUseFallback(int useFallback) 156 { 157 // void g_charset_converter_set_use_fallback (GCharsetConverter *converter, gboolean use_fallback); 158 g_charset_converter_set_use_fallback(gCharsetConverter, useFallback); 159 } 160 161 /** 162 * Gets the "use-fallback" property. 163 * Since 2.24 164 * Returns: TRUE if fallbacks are used by converter 165 */ 166 public int getUseFallback() 167 { 168 // gboolean g_charset_converter_get_use_fallback (GCharsetConverter *converter); 169 return g_charset_converter_get_use_fallback(gCharsetConverter); 170 } 171 172 /** 173 * Gets the number of fallbacks that converter has applied so far. 174 * Since 2.24 175 * Returns: the number of fallbacks that converter has applied 176 */ 177 public uint getNumFallbacks() 178 { 179 // guint g_charset_converter_get_num_fallbacks (GCharsetConverter *converter); 180 return g_charset_converter_get_num_fallbacks(gCharsetConverter); 181 } 182 }