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