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