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 /** */ 35 public class SourceEncoding 36 { 37 /** the main Gtk struct */ 38 protected GtkSourceEncoding* gtkSourceEncoding; 39 40 /** Get the main Gtk struct */ 41 public GtkSourceEncoding* getSourceEncodingStruct() 42 { 43 return gtkSourceEncoding; 44 } 45 46 /** the main Gtk struct as a void* */ 47 protected void* getStruct() 48 { 49 return cast(void*)gtkSourceEncoding; 50 } 51 52 /** 53 * Sets our main struct and passes it to the parent class. 54 */ 55 public this (GtkSourceEncoding* gtkSourceEncoding) 56 { 57 this.gtkSourceEncoding = gtkSourceEncoding; 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 the list of default candidate encodings to try when loading a file. See 172 * gtk_source_file_loader_set_candidate_encodings(). 173 * 174 * This function returns a different list depending on the current locale (i.e. 175 * language, country and default encoding). The UTF-8 encoding and the current 176 * locale encoding are guaranteed to be present in the returned list. 177 * 178 * Return: the list of 179 * default candidate encodings. Free with g_slist_free(). 180 * 181 * Since: 3.18 182 */ 183 public static ListSG getDefaultCandidates() 184 { 185 auto p = gtk_source_encoding_get_default_candidates(); 186 187 if(p is null) 188 { 189 return null; 190 } 191 192 return new ListSG(cast(GSList*) p); 193 } 194 195 /** 196 * Gets a #GtkSourceEncoding from a character set such as "UTF-8" or 197 * "ISO-8859-1". 198 * 199 * Params: 200 * charset = a character set. 201 * 202 * Return: the corresponding #GtkSourceEncoding, or %NULL 203 * if not found. 204 * 205 * Since: 3.14 206 */ 207 public static SourceEncoding getFromCharset(string charset) 208 { 209 auto p = gtk_source_encoding_get_from_charset(Str.toStringz(charset)); 210 211 if(p is null) 212 { 213 return null; 214 } 215 216 return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p); 217 } 218 219 /** 220 * Return: the UTF-8 encoding. 221 * 222 * Since: 3.14 223 */ 224 public static SourceEncoding getUtf8() 225 { 226 auto p = gtk_source_encoding_get_utf8(); 227 228 if(p is null) 229 { 230 return null; 231 } 232 233 return ObjectG.getDObject!(SourceEncoding)(cast(GtkSourceEncoding*) p); 234 } 235 }