docs: Small improvements to glib-mkenums man page
[glib.git] / glib / gsequence.h
blob6dce2f4fbac6bcf216554ca405f757621959a203
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)
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.1 of the License, or (at your option) any later version.
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.
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/>.
19 #ifndef __G_SEQUENCE_H__
20 #define __G_SEQUENCE_H__
22 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
23 #error "Only <glib.h> can be included directly."
24 #endif
26 #include <glib/gtypes.h>
28 G_BEGIN_DECLS
30 typedef struct _GSequence GSequence;
31 typedef struct _GSequenceNode GSequenceIter;
33 typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a,
34 GSequenceIter *b,
35 gpointer data);
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 GLIB_AVAILABLE_IN_2_48
63 gboolean g_sequence_is_empty (GSequence *seq);
66 /* Getting iters */
67 GLIB_AVAILABLE_IN_ALL
68 GSequenceIter *g_sequence_get_begin_iter (GSequence *seq);
69 GLIB_AVAILABLE_IN_ALL
70 GSequenceIter *g_sequence_get_end_iter (GSequence *seq);
71 GLIB_AVAILABLE_IN_ALL
72 GSequenceIter *g_sequence_get_iter_at_pos (GSequence *seq,
73 gint pos);
74 GLIB_AVAILABLE_IN_ALL
75 GSequenceIter *g_sequence_append (GSequence *seq,
76 gpointer data);
77 GLIB_AVAILABLE_IN_ALL
78 GSequenceIter *g_sequence_prepend (GSequence *seq,
79 gpointer data);
80 GLIB_AVAILABLE_IN_ALL
81 GSequenceIter *g_sequence_insert_before (GSequenceIter *iter,
82 gpointer data);
83 GLIB_AVAILABLE_IN_ALL
84 void g_sequence_move (GSequenceIter *src,
85 GSequenceIter *dest);
86 GLIB_AVAILABLE_IN_ALL
87 void g_sequence_swap (GSequenceIter *a,
88 GSequenceIter *b);
89 GLIB_AVAILABLE_IN_ALL
90 GSequenceIter *g_sequence_insert_sorted (GSequence *seq,
91 gpointer data,
92 GCompareDataFunc cmp_func,
93 gpointer cmp_data);
94 GLIB_AVAILABLE_IN_ALL
95 GSequenceIter *g_sequence_insert_sorted_iter (GSequence *seq,
96 gpointer data,
97 GSequenceIterCompareFunc iter_cmp,
98 gpointer cmp_data);
99 GLIB_AVAILABLE_IN_ALL
100 void g_sequence_sort_changed (GSequenceIter *iter,
101 GCompareDataFunc cmp_func,
102 gpointer cmp_data);
103 GLIB_AVAILABLE_IN_ALL
104 void g_sequence_sort_changed_iter (GSequenceIter *iter,
105 GSequenceIterCompareFunc iter_cmp,
106 gpointer cmp_data);
107 GLIB_AVAILABLE_IN_ALL
108 void g_sequence_remove (GSequenceIter *iter);
109 GLIB_AVAILABLE_IN_ALL
110 void g_sequence_remove_range (GSequenceIter *begin,
111 GSequenceIter *end);
112 GLIB_AVAILABLE_IN_ALL
113 void g_sequence_move_range (GSequenceIter *dest,
114 GSequenceIter *begin,
115 GSequenceIter *end);
116 GLIB_AVAILABLE_IN_ALL
117 GSequenceIter *g_sequence_search (GSequence *seq,
118 gpointer data,
119 GCompareDataFunc cmp_func,
120 gpointer cmp_data);
121 GLIB_AVAILABLE_IN_ALL
122 GSequenceIter *g_sequence_search_iter (GSequence *seq,
123 gpointer data,
124 GSequenceIterCompareFunc iter_cmp,
125 gpointer cmp_data);
126 GLIB_AVAILABLE_IN_ALL
127 GSequenceIter *g_sequence_lookup (GSequence *seq,
128 gpointer data,
129 GCompareDataFunc cmp_func,
130 gpointer cmp_data);
131 GLIB_AVAILABLE_IN_ALL
132 GSequenceIter *g_sequence_lookup_iter (GSequence *seq,
133 gpointer data,
134 GSequenceIterCompareFunc iter_cmp,
135 gpointer cmp_data);
138 /* Dereferencing */
139 GLIB_AVAILABLE_IN_ALL
140 gpointer g_sequence_get (GSequenceIter *iter);
141 GLIB_AVAILABLE_IN_ALL
142 void g_sequence_set (GSequenceIter *iter,
143 gpointer data);
145 /* Operations on GSequenceIter * */
146 GLIB_AVAILABLE_IN_ALL
147 gboolean g_sequence_iter_is_begin (GSequenceIter *iter);
148 GLIB_AVAILABLE_IN_ALL
149 gboolean g_sequence_iter_is_end (GSequenceIter *iter);
150 GLIB_AVAILABLE_IN_ALL
151 GSequenceIter *g_sequence_iter_next (GSequenceIter *iter);
152 GLIB_AVAILABLE_IN_ALL
153 GSequenceIter *g_sequence_iter_prev (GSequenceIter *iter);
154 GLIB_AVAILABLE_IN_ALL
155 gint g_sequence_iter_get_position (GSequenceIter *iter);
156 GLIB_AVAILABLE_IN_ALL
157 GSequenceIter *g_sequence_iter_move (GSequenceIter *iter,
158 gint delta);
159 GLIB_AVAILABLE_IN_ALL
160 GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter);
163 /* Search */
164 GLIB_AVAILABLE_IN_ALL
165 gint g_sequence_iter_compare (GSequenceIter *a,
166 GSequenceIter *b);
167 GLIB_AVAILABLE_IN_ALL
168 GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter *begin,
169 GSequenceIter *end);
171 G_END_DECLS
173 #endif /* __G_SEQUENCE_H__ */