source: appstream-generator/build/girepo/gio/CharsetConverter.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.7 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.CharsetConverter;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.ConverterIF;
26private import gio.ConverterT;
27private import gio.InitableIF;
28private import gio.InitableT;
29private import glib.ConstructionException;
30private import glib.ErrorG;
31private import glib.GException;
32private import glib.Str;
33private import gobject.ObjectG;
34
35
36/**
37 * #GCharsetConverter is an implementation of #GConverter based on
38 * GIConv.
39 */
40public class CharsetConverter : ObjectG, ConverterIF, InitableIF
41{
42        /** the main Gtk struct */
43        protected GCharsetConverter* gCharsetConverter;
44
45        /** Get the main Gtk struct */
46        public GCharsetConverter* getCharsetConverterStruct()
47        {
48                return gCharsetConverter;
49        }
50
51        /** the main Gtk struct as a void* */
52        protected override void* getStruct()
53        {
54                return cast(void*)gCharsetConverter;
55        }
56
57        protected override void setStruct(GObject* obj)
58        {
59                gCharsetConverter = cast(GCharsetConverter*)obj;
60                super.setStruct(obj);
61        }
62
63        /**
64         * Sets our main struct and passes it to the parent class.
65         */
66        public this (GCharsetConverter* gCharsetConverter, bool ownedRef = false)
67        {
68                this.gCharsetConverter = gCharsetConverter;
69                super(cast(GObject*)gCharsetConverter, ownedRef);
70        }
71
72        // add the Converter capabilities
73        mixin ConverterT!(GCharsetConverter);
74
75        // add the Initable capabilities
76        mixin InitableT!(GCharsetConverter);
77
78
79        /** */
80        public static GType getType()
81        {
82                return g_charset_converter_get_type();
83        }
84
85        /**
86         * Creates a new #GCharsetConverter.
87         *
88         * Params:
89         *     toCharset = destination charset
90         *     fromCharset = source charset
91         *
92         * Returns: a new #GCharsetConverter or %NULL on error.
93         *
94         * Since: 2.24
95         *
96         * Throws: GException on failure.
97         * Throws: ConstructionException GTK+ fails to create the object.
98         */
99        public this(string toCharset, string fromCharset)
100        {
101                GError* err = null;
102               
103                auto p = g_charset_converter_new(Str.toStringz(toCharset), Str.toStringz(fromCharset), &err);
104               
105                if (err !is null)
106                {
107                        throw new GException( new ErrorG(err) );
108                }
109               
110                if(p is null)
111                {
112                        throw new ConstructionException("null returned by new");
113                }
114               
115                this(cast(GCharsetConverter*) p, true);
116        }
117
118        /**
119         * Gets the number of fallbacks that @converter has applied so far.
120         *
121         * Returns: the number of fallbacks that @converter has applied
122         *
123         * Since: 2.24
124         */
125        public uint getNumFallbacks()
126        {
127                return g_charset_converter_get_num_fallbacks(gCharsetConverter);
128        }
129
130        /**
131         * Gets the #GCharsetConverter:use-fallback property.
132         *
133         * Returns: %TRUE if fallbacks are used by @converter
134         *
135         * Since: 2.24
136         */
137        public bool getUseFallback()
138        {
139                return g_charset_converter_get_use_fallback(gCharsetConverter) != 0;
140        }
141
142        /**
143         * Sets the #GCharsetConverter:use-fallback property.
144         *
145         * Params:
146         *     useFallback = %TRUE to use fallbacks
147         *
148         * Since: 2.24
149         */
150        public void setUseFallback(bool useFallback)
151        {
152                g_charset_converter_set_use_fallback(gCharsetConverter, useFallback);
153        }
154}
Note: See TracBrowser for help on using the repository browser.