I've no idea here...
[gtkD.git] / src / glib / QueueG.d
blobb40486053bd4f5826b1a05aaf1577e5cb5144e03
1 /*
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
26 * outPack = glib
27 * outFile = QueueG
28 * strct = GQueue
29 * realStrct=
30 * ctorStrct=
31 * clss = QueueG
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_queue_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.ListG
45 * - glib.ListG
46 * structWrap:
47 * - GList* -> ListG
48 * - GQueue* -> QueueG
49 * local aliases:
52 module glib.QueueG;
54 private import glib.glibtypes;
56 private import lib.glib;
58 private import glib.ListG;
59 private import glib.ListG;
61 /**
62 * Description
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
67 * of the
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().
76 public class QueueG
79 /** the main Gtk struct */
80 protected GQueue* gQueue;
83 public GQueue* getQueueGStruct()
85 return gQueue;
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)gQueue;
95 /**
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.
109 * Returns:
110 * a new GQueue.
112 public this ()
114 // GQueue* g_queue_new (void);
115 this(cast(GQueue*)g_queue_new() );
119 * Frees the memory allocated for the GQueue.
120 * queue:
121 * a GQueue.
123 public void free()
125 // void g_queue_free (GQueue *queue);
126 g_queue_free(gQueue);
130 * Returns TRUE if the queue is empty.
131 * queue:
132 * a GQueue.
133 * Returns:
134 * TRUE if the queue is empty.
136 public int isEmpty()
138 // gboolean g_queue_is_empty (GQueue *queue);
139 return g_queue_is_empty(gQueue);
143 * Returns the number of items in queue.
144 * queue:
145 * a GQueue
146 * Returns:
147 * The number of items in queue.
148 * Since 2.4
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.
158 * queue:
159 * a GQueue
160 * Since 2.4
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.
172 * queue:
173 * a GQueue
174 * Returns:
175 * A copy of queue
176 * Since 2.4
178 public QueueG copy()
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
186 * function.
187 * queue:
188 * a GQueue
189 * func:
190 * the function to call for each element's data
191 * user_data:
192 * user data to pass to func
193 * Since 2.4
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.
203 * queue:
204 * a GQueue
205 * data:
206 * data to find
207 * Returns:
208 * The first link in queue which contains data.
209 * Since 2.4
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.
223 * queue:
224 * a GQueue
225 * data:
226 * user data passed to func
227 * func:
228 * a GCompareFunc to call for each element. It should return 0
229 * when the desired element is found
230 * Returns:
231 * The found link, or NULL if it wasn't found
232 * Since 2.4
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.
242 * queue:
243 * a GQueue
244 * 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.
249 * user_data:
250 * user data passed to compare_func
251 * Since 2.4
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.
261 * queue:
262 * a GQueue.
263 * data:
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.
274 * queue:
275 * a GQueue.
276 * data:
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
287 * queue:
288 * a GQueue
289 * data:
290 * the data for the new element
291 * n:
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.
295 * Since 2.4
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.
305 * queue:
306 * a GQueue.
307 * Returns:
308 * the data of the first element in the queue, or NULL if the queue
309 * is empty.
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.
319 * queue:
320 * a GQueue.
321 * Returns:
322 * the data of the last element in the queue, or NULL if the queue
323 * is empty.
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.
333 * queue:
334 * a GQueue
335 * n:
336 * the position of the element.
337 * Returns:
338 * the element's data, or NULL if n is off the end of queue.
339 * Since 2.4
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.
349 * queue:
350 * a GQueue.
351 * Returns:
352 * the data of the first element in the queue, or NULL if the queue
353 * is empty.
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.
363 * queue:
364 * a GQueue.
365 * Returns:
366 * the data of the last element in the queue, or NULL if the queue
367 * is empty.
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.
377 * queue:
378 * a GQueue
379 * n:
380 * the position of the element.
381 * Returns:
382 * The data for the n'th element of queue, or NULL if n is
383 * off the end of queue.
384 * Since 2.4
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.
394 * queue:
395 * a GQueue
396 * data:
397 * the data to find.
398 * Returns:
399 * The position of the first element in queue which contains data, or -1 if no element in queue contains data.
400 * Since 2.4
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.
410 * queue:
411 * a GQueue
412 * data:
413 * data to remove.
414 * Since 2.4
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.
424 * queue:
425 * a GQueue
426 * data:
427 * data to remove
428 * Since 2.4
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.
439 * queue:
440 * a GQueue
441 * sibling:
442 * a GList link that must be part of queue
443 * data:
444 * the data to insert
445 * Since 2.4
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
456 * queue:
457 * a GQueue
458 * sibling:
459 * a GList link that must be part of queue
460 * data:
461 * the data to insert
462 * Since 2.4
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.
472 * queue:
473 * a GQueue
474 * data:
475 * the data to insert
476 * func:
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.
482 * user_data:
483 * user data passed to func.
484 * Since 2.4
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.
494 * queue:
495 * a GQueue.
496 * link_:
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.
508 * queue:
509 * a GQueue.
510 * link_:
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.
522 * queue:
523 * a GQueue
524 * n:
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
527 * queue.
528 * link_:
529 * the link to add to queue
530 * Since 2.4
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.
540 * queue:
541 * a GQueue.
542 * Returns:
543 * the GList element at the head of the queue, or NULL if the queue
544 * is empty.
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.
554 * queue:
555 * a GQueue.
556 * Returns:
557 * the GList element at the tail of the queue, or NULL if the queue
558 * is empty.
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.
568 * queue:
569 * a GQueue
570 * n:
571 * the link's position
572 * Returns:
573 * The n'th link, or NULL if n is off the end of queue.
574 * Since 2.4
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
584 * queue:
585 * a GQueue
586 * Returns:
587 * the first link in queue, or NULL if queue is empty
588 * Since 2.4
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.
598 * queue:
599 * a GQueue
600 * Returns:
601 * the last link in queue, or NULL if queue is empty
602 * Since 2.4
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
612 * queue:
613 * a GQueue
614 * n:
615 * the position of the link
616 * Returns:
617 * The link at the n'th position, or NULL if n is off the
618 * end of the list
619 * Since 2.4
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.
629 * queue:
630 * a Gqueue
631 * link_:
632 * A GList link
633 * Returns:
634 * The position of link_, or -1 if the link is
635 * not part of queue
636 * Since 2.4
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
646 * not freed.
647 * link_ must be part of queue,
648 * queue:
649 * a GQueue
650 * link_:
651 * a GList link that must be part of queue
652 * Since 2.4
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.
663 * queue:
664 * a GQueue
665 * link_:
666 * a GList link that must be part of queue
667 * Since 2.4
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());