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 63 private import glib.Str; 64 65 66 67 68 /** 69 * The functions in this section are used to identify the writing 70 * system, or script of individual characters 71 * and of ranges within a larger text string. 72 */ 73 public class PgScriptIter 74 { 75 76 /** the main Gtk struct */ 77 protected PangoScriptIter* pangoScriptIter; 78 79 80 public PangoScriptIter* getPgScriptIterStruct() 81 { 82 return pangoScriptIter; 83 } 84 85 86 /** the main Gtk struct as a void* */ 87 protected void* getStruct() 88 { 89 return cast(void*)pangoScriptIter; 90 } 91 92 /** 93 * Sets our main struct and passes it to the parent class 94 */ 95 public this (PangoScriptIter* pangoScriptIter) 96 { 97 this.pangoScriptIter = pangoScriptIter; 98 } 99 100 /** 101 */ 102 103 /** 104 * Create a new PangoScriptIter, used to break a string of 105 * Unicode into runs by text. No copy is made of text, so 106 * the caller needs to make sure it remains valid until 107 * the iterator is freed with pango_script_iter_free(). 108 * Since 1.4 109 * Params: 110 * text = a UTF-8 string 111 * length = length of text, or -1 if text is nul-terminated. 112 * Throws: ConstructionException GTK+ fails to create the object. 113 */ 114 public this (string text, int length) 115 { 116 // PangoScriptIter * pango_script_iter_new (const char *text, int length); 117 auto p = pango_script_iter_new(Str.toStringz(text), length); 118 if(p is null) 119 { 120 throw new ConstructionException("null returned by pango_script_iter_new(Str.toStringz(text), length)"); 121 } 122 this(cast(PangoScriptIter*) p); 123 } 124 125 /** 126 * Gets information about the range to which iter currently points. 127 * The range is the set of locations p where *start <= p < *end. 128 * (That is, it doesn't include the character stored at *end) 129 * Since 1.4 130 * Params: 131 * start = location to store start position of the range, or NULL. [out][allow-none] 132 * end = location to store end position of the range, or NULL. [out][allow-none] 133 * script = location to store script for range, or NULL. [out][allow-none] 134 */ 135 public void getRange(out string start, out string end, out PangoScript script) 136 { 137 // void pango_script_iter_get_range (PangoScriptIter *iter, const char **start, const char **end, PangoScript *script); 138 char* outstart = null; 139 char* outend = null; 140 141 pango_script_iter_get_range(pangoScriptIter, &outstart, &outend, &script); 142 143 start = Str.toString(outstart); 144 end = Str.toString(outend); 145 } 146 147 /** 148 * Advances a PangoScriptIter to the next range. If iter 149 * is already at the end, it is left unchanged and FALSE 150 * is returned. 151 * Since 1.4 152 * Returns: TRUE if iter was successfully advanced. 153 */ 154 public int next() 155 { 156 // gboolean pango_script_iter_next (PangoScriptIter *iter); 157 return pango_script_iter_next(pangoScriptIter); 158 } 159 160 /** 161 * Frees a PangoScriptIter created with pango_script_iter_new(). 162 * Since 1.4 163 */ 164 public void free() 165 { 166 // void pango_script_iter_free (PangoScriptIter *iter); 167 pango_script_iter_free(pangoScriptIter); 168 } 169 }