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 module gsv.SourceEncoding;
26 
27 private import glib.ListSG;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gsvc.gsv;
31 public  import gsvc.gsvtypes;
32 
33 
34 public class SourceEncoding
35 {
36 	/** the main Gtk struct */
37 	protected GtkSourceEncoding* gtkSourceEncoding;
38 
39 	/** Get the main Gtk struct */
40 	public GtkSourceEncoding* getSourceEncodingStruct()
41 	{
42 		return gtkSourceEncoding;
43 	}
44 
45 	/** the main Gtk struct as a void* */
46 	protected void* getStruct()
47 	{
48 		return cast(void*)gtkSourceEncoding;
49 	}
50 
51 	/**
52 	 * Sets our main struct and passes it to the parent class.
53 	 */
54 	public this (GtkSourceEncoding* gtkSourceEncoding)
55 	{
56 		this.gtkSourceEncoding = gtkSourceEncoding;
57 	}
58 
59 	/**
60 	 */
61 
62 	public static GType getType()
63 	{
64 		return gtk_source_encoding_get_type();
65 	}
66 
67 	/**
68 	 * Used by language bindings.
69 	 *
70 	 * Return: a copy of @enc.
71 	 *
72 	 * Since: 3.14
73 	 */
74 	public SourceEncoding copy()
75 	{
76 		auto p = gtk_source_encoding_copy(gtkSourceEncoding);
77 		
78 		if(p is null)
79 		{
80 			return null;
81 		}
82 		
83 		return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p);
84 	}
85 
86 	/**
87 	 * Used by language bindings.
88 	 *
89 	 * Since: 3.14
90 	 */
91 	public void free()
92 	{
93 		gtk_source_encoding_free(gtkSourceEncoding);
94 	}
95 
96 	/**
97 	 * Gets the character set of the #GtkSourceEncoding, such as "UTF-8" or
98 	 * "ISO-8859-1".
99 	 *
100 	 * Return: the character set of the #GtkSourceEncoding.
101 	 *
102 	 * Since: 3.14
103 	 */
104 	public string getCharset()
105 	{
106 		return Str.toString(gtk_source_encoding_get_charset(gtkSourceEncoding));
107 	}
108 
109 	/**
110 	 * Gets the name of the #GtkSourceEncoding such as "Unicode" or "Western".
111 	 *
112 	 * Return: the name of the #GtkSourceEncoding.
113 	 *
114 	 * Since: 3.14
115 	 */
116 	public string getName()
117 	{
118 		return Str.toString(gtk_source_encoding_get_name(gtkSourceEncoding));
119 	}
120 
121 	/**
122 	 * Return: a string representation. Free with g_free() when no longer needed.
123 	 *
124 	 * Since: 3.14
125 	 */
126 	public override string toString()
127 	{
128 		return Str.toString(gtk_source_encoding_to_string(gtkSourceEncoding));
129 	}
130 
131 	/**
132 	 * Gets all encodings.
133 	 *
134 	 * Return: a list of
135 	 *     all #GtkSourceEncoding's. Free with g_slist_free().
136 	 *
137 	 * Since: 3.14
138 	 */
139 	public static ListSG getAll()
140 	{
141 		auto p = gtk_source_encoding_get_all();
142 		
143 		if(p is null)
144 		{
145 			return null;
146 		}
147 		
148 		return new ListSG(cast(GSList*) p);
149 	}
150 
151 	/**
152 	 * Gets the #GtkSourceEncoding for the current locale. See also g_get_charset().
153 	 *
154 	 * Return: the current locale encoding.
155 	 *
156 	 * Since: 3.14
157 	 */
158 	public static SourceEncoding getCurrent()
159 	{
160 		auto p = gtk_source_encoding_get_current();
161 		
162 		if(p is null)
163 		{
164 			return null;
165 		}
166 		
167 		return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p);
168 	}
169 
170 	/**
171 	 * Gets a #GtkSourceEncoding from a character set such as "UTF-8" or
172 	 * "ISO-8859-1".
173 	 *
174 	 * Params:
175 	 *     charset = a character set.
176 	 *
177 	 * Return: the corresponding #GtkSourceEncoding, or %NULL
178 	 *     if not found.
179 	 *
180 	 * Since: 3.14
181 	 */
182 	public static SourceEncoding getFromCharset(string charset)
183 	{
184 		auto p = gtk_source_encoding_get_from_charset(Str.toStringz(charset));
185 		
186 		if(p is null)
187 		{
188 			return null;
189 		}
190 		
191 		return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p);
192 	}
193 
194 	/**
195 	 * Return: the UTF-8 encoding.
196 	 *
197 	 * Since: 3.14
198 	 */
199 	public static SourceEncoding getUtf8()
200 	{
201 		auto p = gtk_source_encoding_get_utf8();
202 		
203 		if(p is null)
204 		{
205 			return null;
206 		}
207 		
208 		return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p);
209 	}
210 }