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 	 * Returns a negative number if @a comes before @b, 0 if they are equal,
64 	 * and a positive number if @a comes after @b.
65 	 *
66 	 * The @a and @b iterators must point into the same sequence.
67 	 *
68 	 * Params:
69 	 *     b = a #GSequenceIter
70 	 *
71 	 * Return: a negative number if @a comes before @b, 0 if they are
72 	 *     equal, and a positive number if @a comes after @b
73 	 *
74 	 * Since: 2.14
75 	 */
76 	public int compare(SequenceIter b)
77 	{
78 		return g_sequence_iter_compare(gSequenceIter, (b is null) ? null : b.getSequenceIterStruct());
79 	}
80 
81 	/**
82 	 * Returns the position of @iter
83 	 *
84 	 * Return: the position of @iter
85 	 *
86 	 * Since: 2.14
87 	 */
88 	public int getPosition()
89 	{
90 		return g_sequence_iter_get_position(gSequenceIter);
91 	}
92 
93 	/**
94 	 * Returns the #GSequence that @iter points into.
95 	 *
96 	 * Return: the #GSequence that @iter points into
97 	 *
98 	 * Since: 2.14
99 	 */
100 	public Sequence getSequence()
101 	{
102 		auto p = g_sequence_iter_get_sequence(gSequenceIter);
103 		
104 		if(p is null)
105 		{
106 			return null;
107 		}
108 		
109 		return new Sequence(cast(GSequence*) p);
110 	}
111 
112 	/**
113 	 * Returns whether @iter is the begin iterator
114 	 *
115 	 * Return: whether @iter is the begin iterator
116 	 *
117 	 * Since: 2.14
118 	 */
119 	public bool isBegin()
120 	{
121 		return g_sequence_iter_is_begin(gSequenceIter) != 0;
122 	}
123 
124 	/**
125 	 * Returns whether @iter is the end iterator
126 	 *
127 	 * Return: Whether @iter is the end iterator
128 	 *
129 	 * Since: 2.14
130 	 */
131 	public bool isEnd()
132 	{
133 		return g_sequence_iter_is_end(gSequenceIter) != 0;
134 	}
135 
136 	/**
137 	 * Returns the #GSequenceIter which is @delta positions away from @iter.
138 	 * If @iter is closer than -@delta positions to the beginning of the sequence,
139 	 * the begin iterator is returned. If @iter is closer than @delta positions
140 	 * to the end of the sequence, the end iterator is returned.
141 	 *
142 	 * Params:
143 	 *     delta = A positive or negative number indicating how many positions away
144 	 *         from @iter the returned #GSequenceIter will be
145 	 *
146 	 * Return: a #GSequenceIter which is @delta positions away from @iter
147 	 *
148 	 * Since: 2.14
149 	 */
150 	public SequenceIter move(int delta)
151 	{
152 		auto p = g_sequence_iter_move(gSequenceIter, delta);
153 		
154 		if(p is null)
155 		{
156 			return null;
157 		}
158 		
159 		return new SequenceIter(cast(GSequenceIter*) p);
160 	}
161 
162 	/**
163 	 * Returns an iterator pointing to the next position after @iter.
164 	 * If @iter is the end iterator, the end iterator is returned.
165 	 *
166 	 * Return: a #GSequenceIter pointing to the next position after @iter
167 	 *
168 	 * Since: 2.14
169 	 */
170 	public SequenceIter next()
171 	{
172 		auto p = g_sequence_iter_next(gSequenceIter);
173 		
174 		if(p is null)
175 		{
176 			return null;
177 		}
178 		
179 		return new SequenceIter(cast(GSequenceIter*) p);
180 	}
181 
182 	/**
183 	 * Returns an iterator pointing to the previous position before @iter.
184 	 * If @iter is the begin iterator, the begin iterator is returned.
185 	 *
186 	 * Return: a #GSequenceIter pointing to the previous position
187 	 *     before @iter
188 	 *
189 	 * Since: 2.14
190 	 */
191 	public SequenceIter prev()
192 	{
193 		auto p = g_sequence_iter_prev(gSequenceIter);
194 		
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 		
200 		return new SequenceIter(cast(GSequenceIter*) p);
201 	}
202 }