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