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.gsequence;
7 
8 import glib.gtypes;
9 
10 
11 struct GSequence;
12 struct GSequenceIter;
13 
14 
15 extern (C) {
16 
17     alias GSequenceIterCompareFunc = gint function (GSequenceIter *a,
18                                            GSequenceIter *b,
19                                            gpointer       data);
20 
21 
22     /* GSequence */
23 
24     GSequence *    g_sequence_new                (GDestroyNotify            data_destroy);
25 
26     void           g_sequence_free               (GSequence                *seq);
27 
28     gint           g_sequence_get_length         (GSequence                *seq);
29 
30     void           g_sequence_foreach            (GSequence                *seq,
31                                                   GFunc                     func,
32                                                   gpointer                  user_data);
33 
34     void           g_sequence_foreach_range      (GSequenceIter            *begin,
35                                                   GSequenceIter            *end,
36                                                   GFunc                     func,
37                                                   gpointer                  user_data);
38 
39     void           g_sequence_sort               (GSequence                *seq,
40                                                   GCompareDataFunc          cmp_func,
41                                                   gpointer                  cmp_data);
42 
43     void           g_sequence_sort_iter          (GSequence                *seq,
44                                                   GSequenceIterCompareFunc  cmp_func,
45                                                   gpointer                  cmp_data);
46 
47 
48     /* Getting iters */
49 
50     GSequenceIter *g_sequence_get_begin_iter     (GSequence                *seq);
51 
52     GSequenceIter *g_sequence_get_end_iter       (GSequence                *seq);
53 
54     GSequenceIter *g_sequence_get_iter_at_pos    (GSequence                *seq,
55                                                   gint                      pos);
56 
57     GSequenceIter *g_sequence_append             (GSequence                *seq,
58                                                   gpointer                  data);
59 
60     GSequenceIter *g_sequence_prepend            (GSequence                *seq,
61                                                   gpointer                  data);
62 
63     GSequenceIter *g_sequence_insert_before      (GSequenceIter            *iter,
64                                                   gpointer                  data);
65 
66     void           g_sequence_move               (GSequenceIter            *src,
67                                                   GSequenceIter            *dest);
68 
69     void           g_sequence_swap               (GSequenceIter            *a,
70                                                   GSequenceIter            *b);
71 
72     GSequenceIter *g_sequence_insert_sorted      (GSequence                *seq,
73                                                   gpointer                  data,
74                                                   GCompareDataFunc          cmp_func,
75                                                   gpointer                  cmp_data);
76 
77     GSequenceIter *g_sequence_insert_sorted_iter (GSequence                *seq,
78                                                   gpointer                  data,
79                                                   GSequenceIterCompareFunc  iter_cmp,
80                                                   gpointer                  cmp_data);
81 
82     void           g_sequence_sort_changed       (GSequenceIter            *iter,
83                                                   GCompareDataFunc          cmp_func,
84                                                   gpointer                  cmp_data);
85 
86     void           g_sequence_sort_changed_iter  (GSequenceIter            *iter,
87                                                   GSequenceIterCompareFunc  iter_cmp,
88                                                   gpointer                  cmp_data);
89 
90     void           g_sequence_remove             (GSequenceIter            *iter);
91 
92     void           g_sequence_remove_range       (GSequenceIter            *begin,
93                                                   GSequenceIter            *end);
94 
95     void           g_sequence_move_range         (GSequenceIter            *dest,
96                                                   GSequenceIter            *begin,
97                                                   GSequenceIter            *end);
98 
99     GSequenceIter *g_sequence_search             (GSequence                *seq,
100                                                   gpointer                  data,
101                                                   GCompareDataFunc          cmp_func,
102                                                   gpointer                  cmp_data);
103 
104     GSequenceIter *g_sequence_search_iter        (GSequence                *seq,
105                                                   gpointer                  data,
106                                                   GSequenceIterCompareFunc  iter_cmp,
107                                                   gpointer                  cmp_data);
108 
109     GSequenceIter *g_sequence_lookup             (GSequence                *seq,
110                                                   gpointer                  data,
111                                                   GCompareDataFunc          cmp_func,
112                                                   gpointer                  cmp_data);
113 
114     GSequenceIter *g_sequence_lookup_iter        (GSequence                *seq,
115                                                   gpointer                  data,
116                                                   GSequenceIterCompareFunc  iter_cmp,
117                                                   gpointer                  cmp_data);
118 
119 
120     /* Dereferencing */
121 
122     gpointer       g_sequence_get                (GSequenceIter            *iter);
123 
124     void           g_sequence_set                (GSequenceIter            *iter,
125                                                   gpointer                  data);
126 
127     /* Operations on GSequenceIter * */
128 
129     gboolean       g_sequence_iter_is_begin      (GSequenceIter            *iter);
130 
131     gboolean       g_sequence_iter_is_end        (GSequenceIter            *iter);
132 
133     GSequenceIter *g_sequence_iter_next          (GSequenceIter            *iter);
134 
135     GSequenceIter *g_sequence_iter_prev          (GSequenceIter            *iter);
136 
137     gint           g_sequence_iter_get_position  (GSequenceIter            *iter);
138 
139     GSequenceIter *g_sequence_iter_move          (GSequenceIter            *iter,
140                                                   gint                      delta);
141 
142     GSequence *    g_sequence_iter_get_sequence  (GSequenceIter            *iter);
143 
144 
145     /* Search */
146 
147     gint           g_sequence_iter_compare       (GSequenceIter            *a,
148                                                   GSequenceIter            *b);
149 
150     GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter            *begin,
151                                                   GSequenceIter            *end);
152 
153 }
154