GDBusMessage: fast-path encoding of fixed arrays
[platform/upstream/glib.git] / glib / gsequence.h
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
3  * Soeren Sandmann (sandmann@daimi.au.dk)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef __G_SEQUENCE_H__
20 #define __G_SEQUENCE_H__
21
22 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
23 #error "Only <glib.h> can be included directly."
24 #endif
25
26 #include <glib/gtypes.h>
27
28 G_BEGIN_DECLS
29
30 typedef struct _GSequence      GSequence;
31 typedef struct _GSequenceNode  GSequenceIter;
32
33 typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a,
34                                            GSequenceIter *b,
35                                            gpointer       data);
36
37
38 /* GSequence */
39 GLIB_AVAILABLE_IN_ALL
40 GSequence *    g_sequence_new                (GDestroyNotify            data_destroy);
41 GLIB_AVAILABLE_IN_ALL
42 void           g_sequence_free               (GSequence                *seq);
43 GLIB_AVAILABLE_IN_ALL
44 gint           g_sequence_get_length         (GSequence                *seq);
45 GLIB_AVAILABLE_IN_ALL
46 void           g_sequence_foreach            (GSequence                *seq,
47                                               GFunc                     func,
48                                               gpointer                  user_data);
49 GLIB_AVAILABLE_IN_ALL
50 void           g_sequence_foreach_range      (GSequenceIter            *begin,
51                                               GSequenceIter            *end,
52                                               GFunc                     func,
53                                               gpointer                  user_data);
54 GLIB_AVAILABLE_IN_ALL
55 void           g_sequence_sort               (GSequence                *seq,
56                                               GCompareDataFunc          cmp_func,
57                                               gpointer                  cmp_data);
58 GLIB_AVAILABLE_IN_ALL
59 void           g_sequence_sort_iter          (GSequence                *seq,
60                                               GSequenceIterCompareFunc  cmp_func,
61                                               gpointer                  cmp_data);
62
63
64 /* Getting iters */
65 GLIB_AVAILABLE_IN_ALL
66 GSequenceIter *g_sequence_get_begin_iter     (GSequence                *seq);
67 GLIB_AVAILABLE_IN_ALL
68 GSequenceIter *g_sequence_get_end_iter       (GSequence                *seq);
69 GLIB_AVAILABLE_IN_ALL
70 GSequenceIter *g_sequence_get_iter_at_pos    (GSequence                *seq,
71                                               gint                      pos);
72 GLIB_AVAILABLE_IN_ALL
73 GSequenceIter *g_sequence_append             (GSequence                *seq,
74                                               gpointer                  data);
75 GLIB_AVAILABLE_IN_ALL
76 GSequenceIter *g_sequence_prepend            (GSequence                *seq,
77                                               gpointer                  data);
78 GLIB_AVAILABLE_IN_ALL
79 GSequenceIter *g_sequence_insert_before      (GSequenceIter            *iter,
80                                               gpointer                  data);
81 GLIB_AVAILABLE_IN_ALL
82 void           g_sequence_move               (GSequenceIter            *src,
83                                               GSequenceIter            *dest);
84 GLIB_AVAILABLE_IN_ALL
85 void           g_sequence_swap               (GSequenceIter            *a,
86                                               GSequenceIter            *b);
87 GLIB_AVAILABLE_IN_ALL
88 GSequenceIter *g_sequence_insert_sorted      (GSequence                *seq,
89                                               gpointer                  data,
90                                               GCompareDataFunc          cmp_func,
91                                               gpointer                  cmp_data);
92 GLIB_AVAILABLE_IN_ALL
93 GSequenceIter *g_sequence_insert_sorted_iter (GSequence                *seq,
94                                               gpointer                  data,
95                                               GSequenceIterCompareFunc  iter_cmp,
96                                               gpointer                  cmp_data);
97 GLIB_AVAILABLE_IN_ALL
98 void           g_sequence_sort_changed       (GSequenceIter            *iter,
99                                               GCompareDataFunc          cmp_func,
100                                               gpointer                  cmp_data);
101 GLIB_AVAILABLE_IN_ALL
102 void           g_sequence_sort_changed_iter  (GSequenceIter            *iter,
103                                               GSequenceIterCompareFunc  iter_cmp,
104                                               gpointer                  cmp_data);
105 GLIB_AVAILABLE_IN_ALL
106 void           g_sequence_remove             (GSequenceIter            *iter);
107 GLIB_AVAILABLE_IN_ALL
108 void           g_sequence_remove_range       (GSequenceIter            *begin,
109                                               GSequenceIter            *end);
110 GLIB_AVAILABLE_IN_ALL
111 void           g_sequence_move_range         (GSequenceIter            *dest,
112                                               GSequenceIter            *begin,
113                                               GSequenceIter            *end);
114 GLIB_AVAILABLE_IN_ALL
115 GSequenceIter *g_sequence_search             (GSequence                *seq,
116                                               gpointer                  data,
117                                               GCompareDataFunc          cmp_func,
118                                               gpointer                  cmp_data);
119 GLIB_AVAILABLE_IN_ALL
120 GSequenceIter *g_sequence_search_iter        (GSequence                *seq,
121                                               gpointer                  data,
122                                               GSequenceIterCompareFunc  iter_cmp,
123                                               gpointer                  cmp_data);
124 GLIB_AVAILABLE_IN_ALL
125 GSequenceIter *g_sequence_lookup             (GSequence                *seq,
126                                               gpointer                  data,
127                                               GCompareDataFunc          cmp_func,
128                                               gpointer                  cmp_data);
129 GLIB_AVAILABLE_IN_ALL
130 GSequenceIter *g_sequence_lookup_iter        (GSequence                *seq,
131                                               gpointer                  data,
132                                               GSequenceIterCompareFunc  iter_cmp,
133                                               gpointer                  cmp_data);
134
135
136 /* Dereferencing */
137 GLIB_AVAILABLE_IN_ALL
138 gpointer       g_sequence_get                (GSequenceIter            *iter);
139 GLIB_AVAILABLE_IN_ALL
140 void           g_sequence_set                (GSequenceIter            *iter,
141                                               gpointer                  data);
142
143 /* Operations on GSequenceIter * */
144 GLIB_AVAILABLE_IN_ALL
145 gboolean       g_sequence_iter_is_begin      (GSequenceIter            *iter);
146 GLIB_AVAILABLE_IN_ALL
147 gboolean       g_sequence_iter_is_end        (GSequenceIter            *iter);
148 GLIB_AVAILABLE_IN_ALL
149 GSequenceIter *g_sequence_iter_next          (GSequenceIter            *iter);
150 GLIB_AVAILABLE_IN_ALL
151 GSequenceIter *g_sequence_iter_prev          (GSequenceIter            *iter);
152 GLIB_AVAILABLE_IN_ALL
153 gint           g_sequence_iter_get_position  (GSequenceIter            *iter);
154 GLIB_AVAILABLE_IN_ALL
155 GSequenceIter *g_sequence_iter_move          (GSequenceIter            *iter,
156                                               gint                      delta);
157 GLIB_AVAILABLE_IN_ALL
158 GSequence *    g_sequence_iter_get_sequence  (GSequenceIter            *iter);
159
160
161 /* Search */
162 GLIB_AVAILABLE_IN_ALL
163 gint           g_sequence_iter_compare       (GSequenceIter            *a,
164                                               GSequenceIter            *b);
165 GLIB_AVAILABLE_IN_ALL
166 GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter            *begin,
167                                               GSequenceIter            *end);
168
169 G_END_DECLS
170
171 #endif /* __G_SEQUENCE_H__ */