root/trunk/src/gio/CharsetConverter.d

Revision 937, 4.7 kB (checked in by Mike Wey, 3 months ago)

Mention the exceptions to the LGPL in the source files.

Line 
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
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
74 private import gobject.ObjectG;
75
76 /**
77  * Description
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         if(gCharsetConverter is null)
106         {
107             this = null;
108             return;
109         }
110         //Check if there already is a D object for this gtk struct
111         void* ptr = getDObject(cast(GObject*)gCharsetConverter);
112         if( ptr !is null )
113         {
114             this = cast(CharsetConverter)ptr;
115             return;
116         }
117         super(cast(GObject*)gCharsetConverter);
118         this.gCharsetConverter = gCharsetConverter;
119     }
120    
121     protected override void setStruct(GObject* obj)
122     {
123         super.setStruct(obj);
124         gCharsetConverter = cast(GCharsetConverter*)obj;
125     }
126    
127     // add the Converter capabilities
128     mixin ConverterT!(GCharsetConverter);
129    
130     /**
131      */
132    
133     /**
134      * Creates a new GCharsetConverter.
135      * Since 2.24
136      * Params:
137      * toCharset = destination charset
138      * fromCharset = source charset
139      * Throws: GException on failure.
140      * Throws: ConstructionException GTK+ fails to create the object.
141      */
142     public this (string toCharset, string fromCharset)
143     {
144         // GCharsetConverter * g_charset_converter_new (const gchar *to_charset,  const gchar *from_charset,  GError **error);
145         GError* err = null;
146        
147         auto p = g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err);
148        
149         if (err !is null)
150         {
151             throw new GException( new ErrorG(err) );
152         }
153        
154         if(p is null)
155         {
156             throw new ConstructionException("null returned by g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err)");
157         }
158         this(cast(GCharsetConverter*) p);
159     }
160    
161     /**
162      * Sets the "use-fallback" property.
163      * Since 2.24
164      * Params:
165      * useFallback = TRUE to use fallbacks
166      */
167     public void setUseFallback(int useFallback)
168     {
169         // void g_charset_converter_set_use_fallback  (GCharsetConverter *converter,  gboolean use_fallback);
170         g_charset_converter_set_use_fallback(gCharsetConverter, useFallback);
171     }
172    
173     /**
174      * Gets the "use-fallback" property.
175      * Since 2.24
176      * Returns: TRUE if fallbacks are used by converter
177      */
178     public int getUseFallback()
179     {
180         // gboolean g_charset_converter_get_use_fallback  (GCharsetConverter *converter);
181         return g_charset_converter_get_use_fallback(gCharsetConverter);
182     }
183    
184     /**
185      * Gets the number of fallbacks that converter has applied so far.
186      * Since 2.24
187      * Returns: the number of fallbacks that converter has applied
188      */
189     public uint getNumFallbacks()
190     {
191         // guint g_charset_converter_get_num_fallbacks  (GCharsetConverter *converter);
192         return g_charset_converter_get_num_fallbacks(gCharsetConverter);
193     }
194 }
Note: See TracBrowser for help on using the browser.