alternative to assert
[gtkD.git] / gtkD / src / pango / PgScriptIter.d
blobcebc2a8e0a130ae0d01a12c50b69ad2872e3f551
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 = pango-Scripts.html
26 * outPack = pango
27 * outFile = PgScriptIter
28 * strct = PangoScriptIter
29 * realStrct=
30 * ctorStrct=
31 * clss = PgScriptIter
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - pango_script_iter_
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.PgLanguage
56 * - pango.PgTabArray
57 * - pango.PgLayout
58 * - pango.PgLayoutIter
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 * - PangoLanguage* -> PgLanguage
72 * - PangoLayout* -> PgLayout
73 * - PangoLayoutIter* -> PgLayoutIter
74 * - PangoTabArray* -> PgTabArray
75 * module aliases:
76 * local aliases:
79 module pango.PgScriptIter;
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.PgLanguage;
106 private import pango.PgTabArray;
107 private import pango.PgLayout;
108 private import pango.PgLayoutIter;
109 private import glib.Str;
115 * Description
116 * The functions in this section are used to identify the writing
117 * system, or script of individual characters
118 * and of ranges within a larger text string.
120 public class PgScriptIter
123 /** the main Gtk struct */
124 protected PangoScriptIter* pangoScriptIter;
127 public PangoScriptIter* getPgScriptIterStruct()
129 return pangoScriptIter;
133 /** the main Gtk struct as a void* */
134 protected void* getStruct()
136 return cast(void*)pangoScriptIter;
140 * Sets our main struct and passes it to the parent class
142 public this (PangoScriptIter* pangoScriptIter)
144 version(noAssert)
146 if ( pangoScriptIter is null )
148 int zero = 0;
149 version(Tango)
151 Stdout("struct pangoScriptIter is null on constructor").newline;
153 else
155 printf("struct pangoScriptIter is null on constructor");
157 zero = zero / zero;
160 else
162 assert(pangoScriptIter !is null, "struct pangoScriptIter is null on constructor");
164 this.pangoScriptIter = pangoScriptIter;
174 * Looks up the PangoScript for a particular character (as defined by
175 * Unicode Standard Annex 24). No check is made for ch being a
176 * valid Unicode character; if you pass in invalid character, the
177 * result is undefined.
178 * ch:
179 * a Unicode character
180 * Returns:
181 * the PangoScript for the character.
182 * Since 1.4
184 public static PangoScript pangoScriptForUnichar(gunichar ch)
186 // PangoScript pango_script_for_unichar (gunichar ch);
187 return pango_script_for_unichar(ch);
191 * Given a script, finds a language tag that is reasonably
192 * representative of that script. This will usually be the
193 * most widely spoken or used language written in that script:
194 * for instance, the sample language for PANGO_SCRIPT_CYRILLIC
195 * is ru (Russian), the sample language
196 * for PANGO_SCRIPT_ARABIC is ar.
197 * For some
198 * scripts, no sample language will be returned because there
199 * is no language that is sufficiently representative. The best
200 * example of this is PANGO_SCRIPT_HAN, where various different
201 * variants of written Chinese, Japanese, and Korean all use
202 * significantly different sets of Han characters and forms
203 * of shared characters. No sample language can be provided
204 * for many historical scripts as well.
205 * script:
206 * a PangoScript
207 * Returns:
208 * a PangoLanguage that is representative
209 * of the script, or NULL if no such language exists.
210 * Since 1.4
212 public static PgLanguage pangoScriptGetSampleLanguage(PangoScript script)
214 // PangoLanguage* pango_script_get_sample_language (PangoScript script);
215 return new PgLanguage( pango_script_get_sample_language(script) );
219 * Determines if script is one of the scripts used to
220 * write language. The returned value is conservative;
221 * if nothing is known about the language tag language,
222 * TRUE will be returned, since, as far as Pango knows,
223 * script might be used to write language.
224 * This routine is used in Pango's itemization process when
225 * determining if a supplied language tag is relevant to
226 * a particular section of text. It probably is not useful for
227 * applications in most circumstances.
228 * language:
229 * a PangoLanguage
230 * script:
231 * a PangoScript
232 * Returns:
233 * TRUE if script is one of the scripts used
234 * to write language, or if nothing is known about language.
235 * Since 1.4
237 public static int pangoLanguageIncludesScript(PgLanguage language, PangoScript script)
239 // gboolean pango_language_includes_script (PangoLanguage *language, PangoScript script);
240 return pango_language_includes_script((language is null) ? null : language.getPgLanguageStruct(), script);
244 * Create a new PangoScriptIter, used to break a string of
245 * Unicode into runs by text. No copy is made of text, so
246 * the caller needs to make sure it remains valid until
247 * the iterator is freed with pango_script_iter_free().x
248 * text:
249 * a UTF-8 string
250 * length:
251 * length of text, or -1 if text is nul-terminated.
252 * Returns:
253 * the new script iterator, initialized
254 * to point at the first range in the text, which should be
255 * freed with pango_script_iter_free(). If the string is
256 * empty, it will point at an empty range.
257 * Since 1.4
259 public this (char[] text, int length)
261 // PangoScriptIter* pango_script_iter_new (const char *text, int length);
262 this(cast(PangoScriptIter*)pango_script_iter_new(Str.toStringz(text), length) );
266 * Gets information about the range to which iter currently points.
267 * The range is the set of locations p where *start <= p < *end.
268 * (That is, it doesn't include the character stored at *end)
269 * iter:
270 * a PangoScriptIter
271 * start:
272 * location to store start position of the range, or NULL
273 * end:
274 * location to store end position of the range, or NULL
275 * script:
276 * location to store script for range, or NULL
277 * Since 1.4
279 public void getRange(char** start, char** end, PangoScript* script)
281 // void pango_script_iter_get_range (PangoScriptIter *iter, G_CONST_RETURN char **start, G_CONST_RETURN char **end, PangoScript *script);
282 pango_script_iter_get_range(pangoScriptIter, start, end, script);
286 * Advances a PangoScriptIter to the next range. If iter
287 * is already at the end, it is left unchanged and FALSE
288 * is returned.
289 * iter:
290 * a PangoScriptIter
291 * Returns:
292 * TRUE if iter was successfully advanced.
293 * Since 1.4
295 public int next()
297 // gboolean pango_script_iter_next (PangoScriptIter *iter);
298 return pango_script_iter_next(pangoScriptIter);
302 * Frees a PangoScriptIter created with pango_script_iter_new().
303 * iter:
304 * a PangoScriptIter
305 * Since 1.4
307 public void free()
309 // void pango_script_iter_free (PangoScriptIter *iter);
310 pango_script_iter_free(pangoScriptIter);