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 module glib.SequenceIter;
26 
27 private import glib.Sequence;
28 private import gtkc.glib;
29 public  import gtkc.glibtypes;
30 
31 
32 /**
33  * The #GSequenceIter struct is an opaque data type representing an
34  * iterator pointing into a #GSequence.
35  */
36 public class SequenceIter
37 {
38 	/** the main Gtk struct */
39 	protected GSequenceIter* gSequenceIter;
40 
41 	/** Get the main Gtk struct */
42 	public GSequenceIter* getSequenceIterStruct()
43 	{
44 		return gSequenceIter;
45 	}
46 
47 	/** the main Gtk struct as a void* */
48 	protected void* getStruct()
49 	{
50 		return cast(void*)gSequenceIter;
51 	}
52 
53 	/**
54 	 * Sets our main struct and passes it to the parent class.
55 	 */
56 	public this (GSequenceIter* gSequenceIter)
57 	{
58 		this.gSequenceIter = gSequenceIter;
59 	}
60 
61 	/**
62 	 */
63 
64 	/**
65 	 * Returns a negative number if @a comes before @b, 0 if they are equal,
66 	 * and a positive number if @a comes after @b.
67 	 *
68 	 * The @a and @b iterators must point into the same sequence.
69 	 *
70 	 * Params:
71 	 *     b = a #GSequenceIter
72 	 *
73 	 * Return: a negative number if @a comes before @b, 0 if they are
74 	 *     equal, and a positive number if @a comes after @b
75 	 *
76 	 * Since: 2.14
77 	 */
78 	public int compare(SequenceIter b)
79 	{
80 		return g_sequence_iter_compare(gSequenceIter, (b is null) ? null : b.getSequenceIterStruct());
81 	}
82 
83 	/**
84 	 * Returns the position of @iter
85 	 *
86 	 * Return: the position of @iter
87 	 *
88 	 * Since: 2.14
89 	 */
90 	public int getPosition()
91 	{
92 		return g_sequence_iter_get_position(gSequenceIter);
93 	}
94 
95 	/**
96 	 * Returns the #GSequence that @iter points into.
97 	 *
98 	 * Return: the #GSequence that @iter points into
99 	 *
100 	 * Since: 2.14
101 	 */
102 	public Sequence getSequence()
103 	{
104 		auto p = g_sequence_iter_get_sequence(gSequenceIter);
105 		
106 		if(p is null)
107 		{
108 			return null;
109 		}
110 		
111 		return new Sequence(cast(GSequence*) p);
112 	}
113 
114 	/**
115 	 * Returns whether @iter is the begin iterator
116 	 *
117 	 * Return: whether @iter is the begin iterator
118 	 *
119 	 * Since: 2.14
120 	 */
121 	public bool isBegin()
122 	{
123 		return g_sequence_iter_is_begin(gSequenceIter) != 0;
124 	}
125 
126 	/**
127 	 * Returns whether @iter is the end iterator
128 	 *
129 	 * Return: Whether @iter is the end iterator
130 	 *
131 	 * Since: 2.14
132 	 */
133 	public bool isEnd()
134 	{
135 		return g_sequence_iter_is_end(gSequenceIter) != 0;
136 	}
137 
138 	/**
139 	 * Returns the #GSequenceIter which is @delta positions away from @iter.
140 	 * If @iter is closer than -@delta positions to the beginning of the sequence,
141 	 * the begin iterator is returned. If @iter is closer than @delta positions
142 	 * to the end of the sequence, the end iterator is returned.
143 	 *
144 	 * Params:
145 	 *     delta = A positive or negative number indicating how many positions away
146 	 *         from @iter the returned #GSequenceIter will be
147 	 *
148 	 * Return: a #GSequenceIter which is @delta positions away from @iter
149 	 *
150 	 * Since: 2.14
151 	 */
152 	public SequenceIter move(int delta)
153 	{
154 		auto p = g_sequence_iter_move(gSequenceIter, delta);
155 		
156 		if(p is null)
157 		{
158 			return null;
159 		}
160 		
161 		return new SequenceIter(cast(GSequenceIter*) p);
162 	}
163 
164 	/**
165 	 * Returns an iterator pointing to the next position after @iter.
166 	 * If @iter is the end iterator, the end iterator is returned.
167 	 *
168 	 * Return: a #GSequenceIter pointing to the next position after @iter
169 	 *
170 	 * Since: 2.14
171 	 */
172 	public SequenceIter next()
173 	{
174 		auto p = g_sequence_iter_next(gSequenceIter);
175 		
176 		if(p is null)
177 		{
178 			return null;
179 		}
180 		
181 		return new SequenceIter(cast(GSequenceIter*) p);
182 	}
183 
184 	/**
185 	 * Returns an iterator pointing to the previous position before @iter.
186 	 * If @iter is the begin iterator, the begin iterator is returned.
187 	 *
188 	 * Return: a #GSequenceIter pointing to the previous position
189 	 *     before @iter
190 	 *
191 	 * Since: 2.14
192 	 */
193 	public SequenceIter prev()
194 	{
195 		auto p = g_sequence_iter_prev(gSequenceIter);
196 		
197 		if(p is null)
198 		{
199 			return null;
200 		}
201 		
202 		return new SequenceIter(cast(GSequenceIter*) p);
203 	}
204 }