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 * Conversion parameters: 26 * inFile = 27 * outPack = pango 28 * outFile = PgScriptIter 29 * strct = PangoScriptIter 30 * realStrct= 31 * ctorStrct= 32 * clss = PgScriptIter 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - pango_script_iter_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * structWrap: 48 * - PangoScriptIter* -> PgScriptIter 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module pango.PgScriptIter; 55 56 public import gtkc.pangotypes; 57 58 private import gtkc.pango; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 private import glib.Str; 63 64 65 66 /** 67 * The functions in this section are used to identify the writing 68 * system, or script of individual characters 69 * and of ranges within a larger text string. 70 */ 71 public class PgScriptIter 72 { 73 74 /** the main Gtk struct */ 75 protected PangoScriptIter* pangoScriptIter; 76 77 78 /** Get the main Gtk struct */ 79 public PangoScriptIter* getPgScriptIterStruct() 80 { 81 return pangoScriptIter; 82 } 83 84 85 /** the main Gtk struct as a void* */ 86 protected void* getStruct() 87 { 88 return cast(void*)pangoScriptIter; 89 } 90 91 /** 92 * Sets our main struct and passes it to the parent class 93 */ 94 public this (PangoScriptIter* pangoScriptIter) 95 { 96 this.pangoScriptIter = pangoScriptIter; 97 } 98 99 /** 100 */ 101 102 /** 103 * Create a new PangoScriptIter, used to break a string of 104 * Unicode into runs by text. No copy is made of text, so 105 * the caller needs to make sure it remains valid until 106 * the iterator is freed with pango_script_iter_free(). 107 * Since 1.4 108 * Params: 109 * text = a UTF-8 string 110 * length = length of text, or -1 if text is nul-terminated. 111 * Throws: ConstructionException GTK+ fails to create the object. 112 */ 113 public this (string text, int length) 114 { 115 // PangoScriptIter * pango_script_iter_new (const char *text, int length); 116 auto p = pango_script_iter_new(Str.toStringz(text), length); 117 if(p is null) 118 { 119 throw new ConstructionException("null returned by pango_script_iter_new(Str.toStringz(text), length)"); 120 } 121 this(cast(PangoScriptIter*) p); 122 } 123 124 /** 125 * Gets information about the range to which iter currently points. 126 * The range is the set of locations p where *start <= p < *end. 127 * (That is, it doesn't include the character stored at *end) 128 * Since 1.4 129 * Params: 130 * start = location to store start position of the range, or NULL. [out][allow-none] 131 * end = location to store end position of the range, or NULL. [out][allow-none] 132 * script = location to store script for range, or NULL. [out][allow-none] 133 */ 134 public void getRange(out string start, out string end, out PangoScript script) 135 { 136 // void pango_script_iter_get_range (PangoScriptIter *iter, const char **start, const char **end, PangoScript *script); 137 char* outstart = null; 138 char* outend = null; 139 140 pango_script_iter_get_range(pangoScriptIter, &outstart, &outend, &script); 141 142 start = Str.toString(outstart); 143 end = Str.toString(outend); 144 } 145 146 /** 147 * Advances a PangoScriptIter to the next range. If iter 148 * is already at the end, it is left unchanged and FALSE 149 * is returned. 150 * Since 1.4 151 * Returns: TRUE if iter was successfully advanced. 152 */ 153 public int next() 154 { 155 // gboolean pango_script_iter_next (PangoScriptIter *iter); 156 return pango_script_iter_next(pangoScriptIter); 157 } 158 159 /** 160 * Frees a PangoScriptIter created with pango_script_iter_new(). 161 * Since 1.4 162 */ 163 public void free() 164 { 165 // void pango_script_iter_free (PangoScriptIter *iter); 166 pango_script_iter_free(pangoScriptIter); 167 } 168 }