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 = glib
28  * outFile = SequenceIter
29  * strct   = GSequenceIter
30  * realStrct=
31  * ctorStrct=
32  * clss    = SequenceIter
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_sequence_iter_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Sequence
47  * structWrap:
48  * 	- GSequence* -> Sequence
49  * 	- GSequenceIter* -> SequenceIter
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module glib.SequenceIter;
56 
57 public  import gtkc.glibtypes;
58 
59 private import gtkc.glib;
60 private import glib.ConstructionException;
61 
62 private import glib.Sequence;
63 
64 
65 
66 /**
67  * The GSequence data structure has the API of a list, but is
68  * implemented internally with a balanced binary tree. This means that
69  * it is possible to maintain a sorted list of n elements in time O(n
70  * log n). The data contained in each element can be either integer
71  * values, by using of the Type Conversion Macros,
72  * or simply pointers to any type of data.
73  *
74  * A GSequence is accessed through iterators,
75  * represented by a GSequenceIter. An iterator represents a position
76  * between two elements of the sequence. For example, the
77  * begin iterator represents the gap immediately
78  * before the first element of the sequence, and the
79  * end iterator represents the gap immediately
80  * after the last element. In an empty sequence, the begin and end
81  * iterators are the same.
82  *
83  * Some methods on GSequence operate on ranges of items. For example
84  * g_sequence_foreach_range() will call a user-specified function on
85  * each element with the given range. The range is delimited by the
86  * gaps represented by the passed-in iterators, so if you pass in the
87  * begin and end iterators, the range in question is the entire
88  * sequence.
89  *
90  * The function g_sequence_get() is used with an iterator to access the
91  * element immediately following the gap that the iterator represents.
92  * The iterator is said to point to that element.
93  *
94  * Iterators are stable across most operations on a GSequence. For
95  * example an iterator pointing to some element of a sequence will
96  * continue to point to that element even after the sequence is sorted.
97  * Even moving an element to another sequence using for example
98  * g_sequence_move_range() will not invalidate the iterators pointing
99  * to it. The only operation that will invalidate an iterator is when
100  * the element it points to is removed from any sequence.
101  */
102 public class SequenceIter
103 {
104 	
105 	/** the main Gtk struct */
106 	protected GSequenceIter* gSequenceIter;
107 	
108 	
109 	/** Get the main Gtk struct */
110 	public GSequenceIter* getSequenceIterStruct()
111 	{
112 		return gSequenceIter;
113 	}
114 	
115 	
116 	/** the main Gtk struct as a void* */
117 	protected void* getStruct()
118 	{
119 		return cast(void*)gSequenceIter;
120 	}
121 	
122 	/**
123 	 * Sets our main struct and passes it to the parent class
124 	 */
125 	public this (GSequenceIter* gSequenceIter)
126 	{
127 		this.gSequenceIter = gSequenceIter;
128 	}
129 	
130 	/**
131 	 */
132 	
133 	/**
134 	 * Returns whether iter is the begin iterator
135 	 * Since 2.14
136 	 * Returns: whether iter is the begin iterator
137 	 */
138 	public int isBegin()
139 	{
140 		// gboolean g_sequence_iter_is_begin (GSequenceIter *iter);
141 		return g_sequence_iter_is_begin(gSequenceIter);
142 	}
143 	
144 	/**
145 	 * Returns whether iter is the end iterator
146 	 * Since 2.14
147 	 * Returns: Whether iter is the end iterator.
148 	 */
149 	public int isEnd()
150 	{
151 		// gboolean g_sequence_iter_is_end (GSequenceIter *iter);
152 		return g_sequence_iter_is_end(gSequenceIter);
153 	}
154 	
155 	/**
156 	 * Returns an iterator pointing to the next position after iter. If
157 	 * iter is the end iterator, the end iterator is returned.
158 	 * Since 2.14
159 	 * Returns: a GSequenceIter pointing to the next position after iter.
160 	 */
161 	public SequenceIter next()
162 	{
163 		// GSequenceIter * g_sequence_iter_next (GSequenceIter *iter);
164 		auto p = g_sequence_iter_next(gSequenceIter);
165 		
166 		if(p is null)
167 		{
168 			return null;
169 		}
170 		
171 		return new SequenceIter(cast(GSequenceIter*) p);
172 	}
173 	
174 	/**
175 	 * Returns an iterator pointing to the previous position before iter. If
176 	 * iter is the begin iterator, the begin iterator is returned.
177 	 * Since 2.14
178 	 * Returns: a GSequenceIter pointing to the previous position before iter.
179 	 */
180 	public SequenceIter prev()
181 	{
182 		// GSequenceIter * g_sequence_iter_prev (GSequenceIter *iter);
183 		auto p = g_sequence_iter_prev(gSequenceIter);
184 		
185 		if(p is null)
186 		{
187 			return null;
188 		}
189 		
190 		return new SequenceIter(cast(GSequenceIter*) p);
191 	}
192 	
193 	/**
194 	 * Returns the position of iter
195 	 * Since 2.14
196 	 * Returns: the position of iter
197 	 */
198 	public int getPosition()
199 	{
200 		// gint g_sequence_iter_get_position (GSequenceIter *iter);
201 		return g_sequence_iter_get_position(gSequenceIter);
202 	}
203 	
204 	/**
205 	 * Returns the GSequenceIter which is delta positions away from iter.
206 	 * If iter is closer than -delta positions to the beginning of the sequence,
207 	 * the begin iterator is returned. If iter is closer than delta positions
208 	 * to the end of the sequence, the end iterator is returned.
209 	 * Since 2.14
210 	 * Params:
211 	 * delta = A positive or negative number indicating how many positions away
212 	 * from iter the returned GSequenceIter will be.
213 	 * Returns: a GSequenceIter which is delta positions away from iter.
214 	 */
215 	public SequenceIter move(int delta)
216 	{
217 		// GSequenceIter * g_sequence_iter_move (GSequenceIter *iter,  gint delta);
218 		auto p = g_sequence_iter_move(gSequenceIter, delta);
219 		
220 		if(p is null)
221 		{
222 			return null;
223 		}
224 		
225 		return new SequenceIter(cast(GSequenceIter*) p);
226 	}
227 	
228 	/**
229 	 * Returns the GSequence that iter points into.
230 	 * Since 2.14
231 	 * Returns: the GSequence that iter points into.
232 	 */
233 	public Sequence getSequence()
234 	{
235 		// GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter);
236 		auto p = g_sequence_iter_get_sequence(gSequenceIter);
237 		
238 		if(p is null)
239 		{
240 			return null;
241 		}
242 		
243 		return new Sequence(cast(GSequence*) p);
244 	}
245 	
246 	/**
247 	 * Returns a negative number if a comes before b, 0 if they are equal,
248 	 * and a positive number if a comes after b.
249 	 * The a and b iterators must point into the same sequence.
250 	 * Since 2.14
251 	 * Params:
252 	 * a = a GSequenceIter
253 	 * b = a GSequenceIter
254 	 * Returns: A negative number if a comes before b, 0 if they are equal, and a positive number if a comes after b.
255 	 */
256 	public int compare(SequenceIter b)
257 	{
258 		// gint g_sequence_iter_compare (GSequenceIter *a,  GSequenceIter *b);
259 		return g_sequence_iter_compare(gSequenceIter, (b is null) ? null : b.getSequenceIterStruct());
260 	}
261 }