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 * Description 79 * GCharsetConverter is an implementation of GConverter based on 80 * GIConv. 81 */ 82 public class CharsetConverter : ObjectG, ConverterIF 83 { 84 85 /** the main Gtk struct */ 86 protected GCharsetConverter* gCharsetConverter; 87 88 89 public GCharsetConverter* getCharsetConverterStruct() 90 { 91 return gCharsetConverter; 92 } 93 94 95 /** the main Gtk struct as a void* */ 96 protected override void* getStruct() 97 { 98 return cast(void*)gCharsetConverter; 99 } 100 101 /** 102 * Sets our main struct and passes it to the parent class 103 */ 104 public this (GCharsetConverter* gCharsetConverter) 105 { 106 super(cast(GObject*)gCharsetConverter); 107 this.gCharsetConverter = gCharsetConverter; 108 } 109 110 protected override void setStruct(GObject* obj) 111 { 112 super.setStruct(obj); 113 gCharsetConverter = cast(GCharsetConverter*)obj; 114 } 115 116 // add the Converter capabilities 117 mixin ConverterT!(GCharsetConverter); 118 119 /** 120 */ 121 122 /** 123 * Creates a new GCharsetConverter. 124 * Since 2.24 125 * Params: 126 * toCharset = destination charset 127 * fromCharset = source charset 128 * Throws: GException on failure. 129 * Throws: ConstructionException GTK+ fails to create the object. 130 */ 131 public this (string toCharset, string fromCharset) 132 { 133 // GCharsetConverter * g_charset_converter_new (const gchar *to_charset, const gchar *from_charset, GError **error); 134 GError* err = null; 135 136 auto p = g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err); 137 138 if (err !is null) 139 { 140 throw new GException( new ErrorG(err) ); 141 } 142 143 if(p is null) 144 { 145 throw new ConstructionException("null returned by g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err)"); 146 } 147 this(cast(GCharsetConverter*) p); 148 } 149 150 /** 151 * Sets the "use-fallback" property. 152 * Since 2.24 153 * Params: 154 * useFallback = TRUE to use fallbacks 155 */ 156 public void setUseFallback(int useFallback) 157 { 158 // void g_charset_converter_set_use_fallback (GCharsetConverter *converter, gboolean use_fallback); 159 g_charset_converter_set_use_fallback(gCharsetConverter, useFallback); 160 } 161 162 /** 163 * Gets the "use-fallback" property. 164 * Since 2.24 165 * Returns: TRUE if fallbacks are used by converter 166 */ 167 public int getUseFallback() 168 { 169 // gboolean g_charset_converter_get_use_fallback (GCharsetConverter *converter); 170 return g_charset_converter_get_use_fallback(gCharsetConverter); 171 } 172 173 /** 174 * Gets the number of fallbacks that converter has applied so far. 175 * Since 2.24 176 * Returns: the number of fallbacks that converter has applied 177 */ 178 public uint getNumFallbacks() 179 { 180 // guint g_charset_converter_get_num_fallbacks (GCharsetConverter *converter); 181 return g_charset_converter_get_num_fallbacks(gCharsetConverter); 182 } 183 }