alternative to assert
[gtkD.git] / gtkD / src / pango / PgLanguage.d
blob1c1b3c5ae6d79b1d2ea88c29fd35225f4faaa01a
1 /*
2 * This file is part of gtkD.
4 * gtkD 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 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD 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.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile =
26 * outPack = pango
27 * outFile = PgLanguage
28 * strct = PangoLanguage
29 * realStrct=
30 * ctorStrct=
31 * clss = PgLanguage
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - pango_language_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - pango.PgContext
45 * - pango.PgItem
46 * - pango.PgLayout
47 * - pango.PgFontDescription
48 * - pango.PgFontMetrics
49 * - pango.PgFontFamily
50 * - pango.PgFontFace
51 * - pango.PgFontMap
52 * - pango.PgFontsetSimple
53 * - pango.PgAttribute
54 * - pango.PgAttributeList
55 * - pango.PgTabArray
56 * - pango.PgLayout
57 * - pango.PgLayoutIter
58 * - pango.PgScriptIter
59 * - glib.Str
60 * structWrap:
61 * - PangoAttribute* -> PgAttribute
62 * - PangoAttributeList* -> PgAttributeList
63 * - PangoContext* -> PgContext
64 * - PangoFontDescription* -> PgFontDescription
65 * - PangoFontFace* -> PgFontFace
66 * - PangoFontFamily* -> PgFontFamily
67 * - PangoFontMap* -> PgFontMap
68 * - PangoFontMetrics* -> PgFontMetrics
69 * - PangoFontsetSimple* -> PgFontsetSimple
70 * - PangoItem* -> PgItem
71 * - PangoLayout* -> PgLayout
72 * - PangoLayoutIter* -> PgLayoutIter
73 * - PangoScriptIter* -> PgScriptIter
74 * - PangoTabArray* -> PgTabArray
75 * module aliases:
76 * local aliases:
79 module pango.PgLanguage;
81 version(noAssert)
83 version(Tango)
85 import tango.io.Stdout; // use the tango loging?
89 private import gtkc.pangotypes;
91 private import gtkc.pango;
94 private import pango.PgContext;
95 private import pango.PgItem;
96 private import pango.PgLayout;
97 private import pango.PgFontDescription;
98 private import pango.PgFontMetrics;
99 private import pango.PgFontFamily;
100 private import pango.PgFontFace;
101 private import pango.PgFontMap;
102 private import pango.PgFontsetSimple;
103 private import pango.PgAttribute;
104 private import pango.PgAttributeList;
105 private import pango.PgTabArray;
106 private import pango.PgLayout;
107 private import pango.PgLayoutIter;
108 private import pango.PgScriptIter;
109 private import glib.Str;
115 * Description
116 * Attributed text is used in a number of places in Pango. It
117 * is used as the input to the itemization process and also when
118 * creating a PangoLayout. The data types and functions in
119 * this section are used to represent and manipulate sets
120 * of attributes applied to a portion of text.
122 public class PgLanguage
125 /** the main Gtk struct */
126 protected PangoLanguage* pangoLanguage;
129 public PangoLanguage* getPgLanguageStruct()
131 return pangoLanguage;
135 /** the main Gtk struct as a void* */
136 protected void* getStruct()
138 return cast(void*)pangoLanguage;
142 * Sets our main struct and passes it to the parent class
144 public this (PangoLanguage* pangoLanguage)
146 version(noAssert)
148 if ( pangoLanguage is null )
150 int zero = 0;
151 version(Tango)
153 Stdout("struct pangoLanguage is null on constructor").newline;
155 else
157 printf("struct pangoLanguage is null on constructor");
159 zero = zero / zero;
162 else
164 assert(pangoLanguage !is null, "struct pangoLanguage is null on constructor");
166 this.pangoLanguage = pangoLanguage;
231 * Take a RFC-3066 format language tag as a string and convert it to a
232 * PangoLanguage pointer that can be efficiently copied (copy the
233 * pointer) and compared with other language tags (compare the
234 * pointer.)
235 * This function first canonicalizes the string by converting it to
236 * lowercase, mapping '_' to '-', and stripping all characters other
237 * than letters and '-'.
238 * Use pango_language_get_default() if you want to get the PangoLanguage for
239 * the current locale of the process.
240 * language:
241 * a string representing a language tag
242 * Returns:
243 * an opaque pointer to a PangoLanguage structure.
244 * this will be valid forever after.
246 public static PangoLanguage* fromString(char[] language)
248 // PangoLanguage* pango_language_from_string (const char *language);
249 return pango_language_from_string(Str.toStringz(language));
254 * Checks if a language tag matches one of the elements in a list of
255 * language ranges. A language tag is considered to match a range
256 * in the list if the range is '*', the range is exactly the tag,
257 * or the range is a prefix of the tag, and the character after it
258 * in the tag is '-'.
259 * language:
260 * a language tag (see pango_language_from_string()),
261 * NULL is allowed and matches nothing but '*'
262 * range_list:
263 * a list of language ranges, separated by ';', ':',
264 * ',', or space characters.
265 * Each element must either be '*', or a RFC 3066 language range
266 * canonicalized as by pango_language_from_string()
267 * Returns:
268 * TRUE if a match was found.
270 public int matches(char[] rangeList)
272 // gboolean pango_language_matches (PangoLanguage *language, const char *range_list);
273 return pango_language_matches(pangoLanguage, Str.toStringz(rangeList));