2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 = glib-Double-ended-Queues.html
54 private import glib
.glibtypes
;
56 private import lib
.glib
;
58 private import glib
.ListG
;
59 private import glib
.ListG
;
63 * The GQueue structure and its associated functions provide a standard
64 * queue data structure. Internally, GQueue uses the same data structure as
65 * GList to store elements.
66 * The data contained in each element can be either integer values, by using one
68 * Type Conversion Macros,
69 * or simply pointers to any type of data.
70 * To create a new GQueue, use g_queue_new().
71 * To add elements, use g_queue_push_head(), g_queue_push_head_link(),
72 * g_queue_push_tail() and g_queue_push_tail_link().
73 * To remove elements, use g_queue_pop_head() and g_queue_pop_tail().
74 * To free the entire queue, use g_queue_free().
79 /** the main Gtk struct */
80 protected GQueue
* gQueue
;
83 public GQueue
* getQueueGStruct()
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)gQueue
;
96 * Sets our main struct and passes it to the parent class
98 public this (GQueue
* gQueue
)
100 this.gQueue
= gQueue
;
108 * Creates a new GQueue.
114 // GQueue* g_queue_new (void);
115 this(cast(GQueue
*)g_queue_new() );
119 * Frees the memory allocated for the GQueue.
125 // void g_queue_free (GQueue *queue);
126 g_queue_free(gQueue
);
130 * Returns TRUE if the queue is empty.
134 * TRUE if the queue is empty.
138 // gboolean g_queue_is_empty (GQueue *queue);
139 return g_queue_is_empty(gQueue
);
143 * Returns the number of items in queue.
147 * The number of items in queue.
150 public uint getLength()
152 // guint g_queue_get_length (GQueue *queue);
153 return g_queue_get_length(gQueue
);
157 * Reverses the order of the items in queue.
162 public void reverse()
164 // void g_queue_reverse (GQueue *queue);
165 g_queue_reverse(gQueue
);
169 * Copies a queue. Note that is a shallow copy. If the elements in the
170 * queue consist of pointers to data, the pointers are copied, but the
171 * actual data is not.
180 // GQueue* g_queue_copy (GQueue *queue);
181 return new QueueG( g_queue_copy(gQueue
) );
185 * Calls func for each element in the queue passing user_data to the
190 * the function to call for each element's data
192 * user data to pass to func
195 public void foreac(GFunc func
, void* userData
)
197 // void g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data);
198 g_queue_foreach(gQueue
, func
, userData
);
202 * Finds the first link in queue which contains data.
208 * The first link in queue which contains data.
211 public ListG
find(void* data
)
213 // GList* g_queue_find (GQueue *queue, gconstpointer data);
214 return new ListG( g_queue_find(gQueue
, data
) );
218 * Finds an element in a GQueue, using a supplied function to find the
219 * desired element. It iterates over the queue, calling the given function
220 * which should return 0 when the desired element is found. The function
221 * takes two gconstpointer arguments, the GQueue element's data as the
222 * first argument and the given user data as the second argument.
226 * user data passed to func
228 * a GCompareFunc to call for each element. It should return 0
229 * when the desired element is found
231 * The found link, or NULL if it wasn't found
234 public ListG
findCustom(void* data
, GCompareFunc func
)
236 // GList* g_queue_find_custom (GQueue *queue, gconstpointer data, GCompareFunc func);
237 return new ListG( g_queue_find_custom(gQueue
, data
, func
) );
241 * Sorts queue using compare_func.
245 * the GCompareDataFunc used to sort queue. This function
246 * is passed two elements of the queue and should return 0 if they are
247 * equal, a negative value if the first comes before the second, and
248 * a positive value if the second comes before the first.
250 * user data passed to compare_func
253 public void sort(GCompareDataFunc compareFunc
, void* userData
)
255 // void g_queue_sort (GQueue *queue, GCompareDataFunc compare_func, gpointer user_data);
256 g_queue_sort(gQueue
, compareFunc
, userData
);
260 * Adds a new element at the head of the queue.
264 * the data for the new element.
266 public void pushHead(void* data
)
268 // void g_queue_push_head (GQueue *queue, gpointer data);
269 g_queue_push_head(gQueue
, data
);
273 * Adds a new element at the tail of the queue.
277 * the data for the new element.
279 public void pushTail(void* data
)
281 // void g_queue_push_tail (GQueue *queue, gpointer data);
282 g_queue_push_tail(gQueue
, data
);
286 * Inserts a new element into queue at the given position
290 * the data for the new element
292 * the position to insert the new element. If n is negative or
293 * larger than the number of elements in the queue, the element is
294 * added to the end of the queue.
297 public void pushNth(void* data
, int n
)
299 // void g_queue_push_nth (GQueue *queue, gpointer data, gint n);
300 g_queue_push_nth(gQueue
, data
, n
);
304 * Removes the first element of the queue.
308 * the data of the first element in the queue, or NULL if the queue
311 public void* popHead()
313 // gpointer g_queue_pop_head (GQueue *queue);
314 return g_queue_pop_head(gQueue
);
318 * Removes the last element of the queue.
322 * the data of the last element in the queue, or NULL if the queue
325 public void* popTail()
327 // gpointer g_queue_pop_tail (GQueue *queue);
328 return g_queue_pop_tail(gQueue
);
332 * Removes the n'th element of queue.
336 * the position of the element.
338 * the element's data, or NULL if n is off the end of queue.
341 public void* popNth(uint n
)
343 // gpointer g_queue_pop_nth (GQueue *queue, guint n);
344 return g_queue_pop_nth(gQueue
, n
);
348 * Returns the first element of the queue.
352 * the data of the first element in the queue, or NULL if the queue
355 public void* peekHead()
357 // gpointer g_queue_peek_head (GQueue *queue);
358 return g_queue_peek_head(gQueue
);
362 * Returns the last element of the queue.
366 * the data of the last element in the queue, or NULL if the queue
369 public void* peekTail()
371 // gpointer g_queue_peek_tail (GQueue *queue);
372 return g_queue_peek_tail(gQueue
);
376 * Returns the n'th element of queue.
380 * the position of the element.
382 * The data for the n'th element of queue, or NULL if n is
383 * off the end of queue.
386 public void* peekNth(uint n
)
388 // gpointer g_queue_peek_nth (GQueue *queue, guint n);
389 return g_queue_peek_nth(gQueue
, n
);
393 * Returns the position of the first element in queue which contains data.
399 * The position of the first element in queue which contains data, or -1 if no element in queue contains data.
402 public int index(void* data
)
404 // gint g_queue_index (GQueue *queue, gconstpointer data);
405 return g_queue_index(gQueue
, data
);
409 * Removes the first element in queue that contains data.
416 public void remove(void* data
)
418 // void g_queue_remove (GQueue *queue, gconstpointer data);
419 g_queue_remove(gQueue
, data
);
423 * Remove all elemeents in queue which contains data.
430 public void removeAll(void* data
)
432 // void g_queue_remove_all (GQueue *queue, gconstpointer data);
433 g_queue_remove_all(gQueue
, data
);
437 * Inserts data into queue before sibling.
438 * sibling must be part of queue.
442 * a GList link that must be part of queue
447 public void insertBefore(ListG sibling
, void* data
)
449 // void g_queue_insert_before (GQueue *queue, GList *sibling, gpointer data);
450 g_queue_insert_before(gQueue
, (sibling
is null) ?
null : sibling
.getListGStruct(), data
);
454 * Inserts data into queue after sibling
455 * sibling must be part of queue
459 * a GList link that must be part of queue
464 public void insertAfter(ListG sibling
, void* data
)
466 // void g_queue_insert_after (GQueue *queue, GList *sibling, gpointer data);
467 g_queue_insert_after(gQueue
, (sibling
is null) ?
null : sibling
.getListGStruct(), data
);
471 * Inserts data into queue using func to determine the new position.
477 * the GCompareDataFunc used to compare elements in the queue. It is
478 * called with two elements of the queue and user_data. It should
479 * return 0 if the elements are equal, a negative value if the first
480 * element comes before the second, and a positive value if the second
481 * element comes before the first.
483 * user data passed to func.
486 public void insertSorted(void* data
, GCompareDataFunc func
, void* userData
)
488 // void g_queue_insert_sorted (GQueue *queue, gpointer data, GCompareDataFunc func, gpointer user_data);
489 g_queue_insert_sorted(gQueue
, data
, func
, userData
);
493 * Adds a new element at the head of the queue.
497 * a single GList element, not a list with
498 * more than one element.
500 public void pushHeadLink(ListG link
)
502 // void g_queue_push_head_link (GQueue *queue, GList *link_);
503 g_queue_push_head_link(gQueue
, (link
is null) ?
null : link
.getListGStruct());
507 * Adds a new element at the tail of the queue.
511 * a single GList element, not a list with
512 * more than one element.
514 public void pushTailLink(ListG link
)
516 // void g_queue_push_tail_link (GQueue *queue, GList *link_);
517 g_queue_push_tail_link(gQueue
, (link
is null) ?
null : link
.getListGStruct());
521 * Inserts link into queue at the given position.
525 * the position to insert the link. If this is negative or larger than
526 * the number of elements in queue, the link is added to the end of
529 * the link to add to queue
532 public void pushNthLink(int n
, ListG link
)
534 // void g_queue_push_nth_link (GQueue *queue, gint n, GList *link_);
535 g_queue_push_nth_link(gQueue
, n
, (link
is null) ?
null : link
.getListGStruct());
539 * Removes the first element of the queue.
543 * the GList element at the head of the queue, or NULL if the queue
546 public ListG
popHeadLink()
548 // GList* g_queue_pop_head_link (GQueue *queue);
549 return new ListG( g_queue_pop_head_link(gQueue
) );
553 * Removes the last element of the queue.
557 * the GList element at the tail of the queue, or NULL if the queue
560 public ListG
popTailLink()
562 // GList* g_queue_pop_tail_link (GQueue *queue);
563 return new ListG( g_queue_pop_tail_link(gQueue
) );
567 * Removes and returns the link at the given position.
571 * the link's position
573 * The n'th link, or NULL if n is off the end of queue.
576 public ListG
popNthLink(uint n
)
578 // GList* g_queue_pop_nth_link (GQueue *queue, guint n);
579 return new ListG( g_queue_pop_nth_link(gQueue
, n
) );
583 * Returns the first link in queue
587 * the first link in queue, or NULL if queue is empty
590 public ListG
peekHeadLink()
592 // GList* g_queue_peek_head_link (GQueue *queue);
593 return new ListG( g_queue_peek_head_link(gQueue
) );
597 * Returns the last link queue.
601 * the last link in queue, or NULL if queue is empty
604 public ListG
peekTailLink()
606 // GList* g_queue_peek_tail_link (GQueue *queue);
607 return new ListG( g_queue_peek_tail_link(gQueue
) );
611 * Returns the link at the given position
615 * the position of the link
617 * The link at the n'th position, or NULL if n is off the
621 public ListG
peekNthLink(uint n
)
623 // GList* g_queue_peek_nth_link (GQueue *queue, guint n);
624 return new ListG( g_queue_peek_nth_link(gQueue
, n
) );
628 * Returns the position of link_ in queue.
634 * The position of link_, or -1 if the link is
638 public int linkIndex(ListG link
)
640 // gint g_queue_link_index (GQueue *queue, GList *link_);
641 return g_queue_link_index(gQueue
, (link
is null) ?
null : link
.getListGStruct());
645 * Unlinks link_ so that it will no longer be part of queue. The link is
647 * link_ must be part of queue,
651 * a GList link that must be part of queue
654 public void unlink(ListG link
)
656 // void g_queue_unlink (GQueue *queue, GList *link_);
657 g_queue_unlink(gQueue
, (link
is null) ?
null : link
.getListGStruct());
661 * Removes link_ from queue and frees it.
662 * link_ must be part of queue.
666 * a GList link that must be part of queue
669 public void deleteLink(ListG link
)
671 // void g_queue_delete_link (GQueue *queue, GList *link_);
672 g_queue_delete_link(gQueue
, (link
is null) ?
null : link
.getListGStruct());