1 /*
2  * Distributed under the Boost Software License, Version 1.0.
3  *    (See accompanying file LICENSE_1_0.txt or copy at
4  *          http://www.boost.org/LICENSE_1_0.txt)
5  */
6 module glib.gqueue;
7 
8 import glib.gtypes;
9 import glib.glist;
10 
11 
12 
13 struct GQueue
14 {
15     GList *head;
16     GList *tail;
17     guint  length;
18 }
19 
20 // #define G_QUEUE_INIT { NULL, NULL, 0 }
21 
22 
23 extern (C) {
24 
25     GQueue*  g_queue_new            ();
26 
27     void     g_queue_free           (GQueue           *queue);
28 
29     void     g_queue_free_full      (GQueue           *queue,
30                     GDestroyNotify    free_func);
31 
32     void     g_queue_init           (GQueue           *queue);
33 
34     void     g_queue_clear          (GQueue           *queue);
35 
36     gboolean g_queue_is_empty       (GQueue           *queue);
37 
38     guint    g_queue_get_length     (GQueue           *queue);
39 
40     void     g_queue_reverse        (GQueue           *queue);
41 
42     GQueue * g_queue_copy           (GQueue           *queue);
43 
44     void     g_queue_foreach        (GQueue           *queue,
45                                      GFunc             func,
46                                      gpointer          user_data);
47 
48     GList *  g_queue_find           (GQueue           *queue,
49                                      gconstpointer     data);
50 
51     GList *  g_queue_find_custom    (GQueue           *queue,
52                                      gconstpointer     data,
53                                      GCompareFunc      func);
54 
55     void     g_queue_sort           (GQueue           *queue,
56                                      GCompareDataFunc  compare_func,
57                                      gpointer          user_data);
58 
59 
60     void     g_queue_push_head      (GQueue           *queue,
61                                      gpointer          data);
62 
63     void     g_queue_push_tail      (GQueue           *queue,
64                                      gpointer          data);
65 
66     void     g_queue_push_nth       (GQueue           *queue,
67                                      gpointer          data,
68                                      gint              n);
69 
70     gpointer g_queue_pop_head       (GQueue           *queue);
71 
72     gpointer g_queue_pop_tail       (GQueue           *queue);
73 
74     gpointer g_queue_pop_nth        (GQueue           *queue,
75                                      guint             n);
76 
77     gpointer g_queue_peek_head      (GQueue           *queue);
78 
79     gpointer g_queue_peek_tail      (GQueue           *queue);
80 
81     gpointer g_queue_peek_nth       (GQueue           *queue,
82                                      guint             n);
83 
84     gint     g_queue_index          (GQueue           *queue,
85                                      gconstpointer     data);
86 
87     gboolean g_queue_remove         (GQueue           *queue,
88                                      gconstpointer     data);
89 
90     guint    g_queue_remove_all     (GQueue           *queue,
91                                      gconstpointer     data);
92 
93     void     g_queue_insert_before  (GQueue           *queue,
94                                      GList            *sibling,
95                                      gpointer          data);
96 
97     void     g_queue_insert_after   (GQueue           *queue,
98                                      GList            *sibling,
99                                      gpointer          data);
100 
101     void     g_queue_insert_sorted  (GQueue           *queue,
102                                      gpointer          data,
103                                      GCompareDataFunc  func,
104                                      gpointer          user_data);
105 
106 
107     void     g_queue_push_head_link (GQueue           *queue,
108                                      GList            *link_);
109 
110     void     g_queue_push_tail_link (GQueue           *queue,
111                                      GList            *link_);
112 
113     void     g_queue_push_nth_link  (GQueue           *queue,
114                                      gint              n,
115                                      GList            *link_);
116 
117     GList*   g_queue_pop_head_link  (GQueue           *queue);
118 
119     GList*   g_queue_pop_tail_link  (GQueue           *queue);
120 
121     GList*   g_queue_pop_nth_link   (GQueue           *queue,
122                                      guint             n);
123 
124     GList*   g_queue_peek_head_link (GQueue           *queue);
125 
126     GList*   g_queue_peek_tail_link (GQueue           *queue);
127 
128     GList*   g_queue_peek_nth_link  (GQueue           *queue,
129                                      guint             n);
130 
131     gint     g_queue_link_index     (GQueue           *queue,
132                                      GList            *link_);
133 
134     void     g_queue_unlink         (GQueue           *queue,
135                                      GList            *link_);
136 
137     void     g_queue_delete_link    (GQueue           *queue,
138                                      GList            *link_);
139 
140 }
141