2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gstreamer-GstIterator.html
47 * - GstIterator* -> Iterator
52 module gstreamer
.Iterator
;
54 private import gstreamerc
.gstreamertypes
;
56 private import gstreamerc
.gstreamer
;
58 private import glib
.Str
;
64 * A GstIterator is used to retrieve multiple objects from another object in
66 * Various GStreamer objects provide access to their internal structures using
68 * The basic use pattern of an iterator is as follows:
69 * Example10.Using an iterator
70 * it = _get_iterator(object);
73 * switch (gst_iterator_next (it, item)) {
74 * case GST_ITERATOR_OK:
75 * ... use/change item here...
76 * gst_object_unref (item);
78 * case GST_ITERATOR_RESYNC:
79 * ...rollback changes to items...
80 * gst_iterator_resync (it);
82 * case GST_ITERATOR_ERROR:
83 * ...wrong parameter were given...
86 * case GST_ITERATOR_DONE:
91 * gst_iterator_free (it);
92 * Last reviewed on 2005-11-09 (0.9.4)
97 /** the main Gtk struct */
98 protected GstIterator
* gstIterator
;
101 public GstIterator
* getIteratorStruct()
107 /** the main Gtk struct as a void* */
108 protected void* getStruct()
110 return cast(void*)gstIterator
;
114 * Sets our main struct and passes it to the parent class
116 public this (GstIterator
* gstIterator
)
118 this.gstIterator
= gstIterator
;
138 * Create a new iterator. This function is mainly used for objects
139 * implementing the next/resync/free function to iterate a data structure.
140 * For each item retrieved, the item function is called with the lock
141 * held. The free function is called when the iterator is freed.
143 * the size of the iterator structure
147 * pointer to a GMutex.
149 * pointer to a guint32 to protect the iterated object.
151 * function to get next item
153 * function to call on each item retrieved
155 * function to resync the iterator
157 * function to free the iterator
159 * the new GstIterator.
162 public this (uint size
, GType type
, GMutex
* lock, uint* masterCookie
, GstIteratorNextFunction next
, GstIteratorItemFunction item
, GstIteratorResyncFunction resync
, GstIteratorFreeFunction free
)
164 // GstIterator* gst_iterator_new (guint size, GType type, GMutex *lock, guint32 *master_cookie, GstIteratorNextFunction next, GstIteratorItemFunction item, GstIteratorResyncFunction resync, GstIteratorFreeFunction free);
165 this(cast(GstIterator
*)gst_iterator_new(size
, type
, lock, masterCookie
, next
, item
, resync
, free
) );
169 * Create a new iterator designed for iterating list.
173 * pointer to a GMutex protecting the list.
175 * pointer to a guint32 to protect the list.
177 * pointer to the list
179 * object owning the list
181 * function to call for each item
183 * function to call when the iterator is freed
185 * the new GstIterator for list.
188 public this (GType type
, GMutex
* lock, uint* masterCookie
, GList
** list
, void* owner
, GstIteratorItemFunction item
, GstIteratorDisposeFunction free
)
190 // GstIterator* gst_iterator_new_list (GType type, GMutex *lock, guint32 *master_cookie, GList **list, gpointer owner, GstIteratorItemFunction item, GstIteratorDisposeFunction free);
191 this(cast(GstIterator
*)gst_iterator_new_list(type
, lock, masterCookie
, list
, owner
, item
, free
) );
195 * Get the next item from the iterator. For iterators that return
196 * refcounted objects, the returned object will have its refcount
197 * increased and should therefore be unreffed after usage.
199 * The GstIterator to iterate
201 * pointer to hold next element
203 * The result of the iteration. Unref after usage if this is
204 * a refcounted object.
207 public GstIteratorResult
next(void** elem
)
209 // GstIteratorResult gst_iterator_next (GstIterator *it, gpointer *elem);
210 return gst_iterator_next(gstIterator
, elem
);
214 * Resync the iterator. this function is mostly called
215 * after gst_iterator_next() returned GST_ITERATOR_RESYNC.
218 * The GstIterator to resync
222 // void gst_iterator_resync (GstIterator *it);
223 gst_iterator_resync(gstIterator
);
230 * The GstIterator to free
234 // void gst_iterator_free (GstIterator *it);
235 gst_iterator_free(gstIterator
);
239 * Pushes other iterator onto it. All calls performed on it are
240 * forwarded tot other. If other returns GST_ITERATOR_DONE, it is
241 * popped again and calls are handled by it again.
242 * This function is mainly used by objects implementing the iterator
243 * next function to recurse into substructures.
246 * The GstIterator to use
248 * The GstIterator to push
250 public void push(Iterator other
)
252 // void gst_iterator_push (GstIterator *it, GstIterator *other);
253 gst_iterator_push(gstIterator
, (other
is null) ?
null : other
.getIteratorStruct());
257 * Create a new iterator from an existing iterator. The new iterator
258 * will only return those elements that match the given compare function func.
259 * func should return 0 for elements that should be included
261 * When this iterator is freed, it will also be freed.
263 * The GstIterator to filter
265 * the compare function to select elements
267 * user data passed to the compare function
272 public Iterator
filter(GCompareFunc func
, void* userData
)
274 // GstIterator* gst_iterator_filter (GstIterator *it, GCompareFunc func, gpointer user_data);
275 return new Iterator( gst_iterator_filter(gstIterator
, func
, userData
) );
279 * Folds func over the elements of iter. That is to say, proc will be called
280 * as proc (object, ret, user_data) for each object in iter. The normal use
281 * of this procedure is to accumulate the results of operating on the objects in
283 * This procedure can be used (and is used internally) to implement the foreach
284 * and find_custom operations.
285 * The fold will proceed as long as func returns TRUE. When the iterator has no
286 * more arguments, GST_ITERATOR_DONE will be returned. If func returns FALSE,
287 * the fold will stop, and GST_ITERATOR_OK will be returned. Errors or resyncs
288 * will cause fold to return GST_ITERATOR_ERROR or GST_ITERATOR_RESYNC as
290 * The iterator will not be freed.
292 * The GstIterator to fold over
296 * the seed value passed to the fold function
298 * user data passed to the fold function
300 * A GstIteratorResult, as described above.
303 public GstIteratorResult
fold(GstIteratorFoldFunction func
, GValue
* ret, void* userData
)
305 // GstIteratorResult gst_iterator_fold (GstIterator *it, GstIteratorFoldFunction func, GValue *ret, gpointer user_data);
306 return gst_iterator_fold(gstIterator
, func
, ret, userData
);
310 * Iterate over all element of it and call the given function func for
313 * The GstIterator to iterate
315 * the function to call for each element.
317 * user data passed to the function
319 * the result call to gst_iterator_fold(). The iterator will not be
323 public GstIteratorResult
foreac(GFunc func
, void* userData
)
325 // GstIteratorResult gst_iterator_foreach (GstIterator *it, GFunc func, gpointer user_data);
326 return gst_iterator_foreach(gstIterator
, func
, userData
);
330 * Find the first element in it that matches the compare function func.
331 * func should return 0 when the element is found.
332 * The iterator will not be freed.
333 * This function will return NULL if an error or resync happened to
336 * The GstIterator to iterate
338 * the compare function to use
340 * user data passed to the compare function
342 * The element in the iterator that matches the compare
343 * function or NULL when no element matched.
348 public void* findCustom(GCompareFunc func
, void* userData
)
350 // gpointer gst_iterator_find_custom (GstIterator *it, GCompareFunc func, gpointer user_data);
351 return gst_iterator_find_custom(gstIterator
, func
, userData
);