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 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."
26 #include <glib/gtypes.h>
30 typedef struct _GSequence GSequence;
31 typedef struct _GSequenceNode GSequenceIter;
33 typedef gint (* GSequenceIterCompareFunc) (GSequenceIter *a,
40 GSequence * g_sequence_new (GDestroyNotify data_destroy);
42 void g_sequence_free (GSequence *seq);
44 gint g_sequence_get_length (GSequence *seq);
46 void g_sequence_foreach (GSequence *seq,
50 void g_sequence_foreach_range (GSequenceIter *begin,
55 void g_sequence_sort (GSequence *seq,
56 GCompareDataFunc cmp_func,
59 void g_sequence_sort_iter (GSequence *seq,
60 GSequenceIterCompareFunc cmp_func,
66 GSequenceIter *g_sequence_get_begin_iter (GSequence *seq);
68 GSequenceIter *g_sequence_get_end_iter (GSequence *seq);
70 GSequenceIter *g_sequence_get_iter_at_pos (GSequence *seq,
73 GSequenceIter *g_sequence_append (GSequence *seq,
76 GSequenceIter *g_sequence_prepend (GSequence *seq,
79 GSequenceIter *g_sequence_insert_before (GSequenceIter *iter,
82 void g_sequence_move (GSequenceIter *src,
85 void g_sequence_swap (GSequenceIter *a,
88 GSequenceIter *g_sequence_insert_sorted (GSequence *seq,
90 GCompareDataFunc cmp_func,
93 GSequenceIter *g_sequence_insert_sorted_iter (GSequence *seq,
95 GSequenceIterCompareFunc iter_cmp,
98 void g_sequence_sort_changed (GSequenceIter *iter,
99 GCompareDataFunc cmp_func,
101 GLIB_AVAILABLE_IN_ALL
102 void g_sequence_sort_changed_iter (GSequenceIter *iter,
103 GSequenceIterCompareFunc iter_cmp,
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,
110 GLIB_AVAILABLE_IN_ALL
111 void g_sequence_move_range (GSequenceIter *dest,
112 GSequenceIter *begin,
114 GLIB_AVAILABLE_IN_ALL
115 GSequenceIter *g_sequence_search (GSequence *seq,
117 GCompareDataFunc cmp_func,
119 GLIB_AVAILABLE_IN_ALL
120 GSequenceIter *g_sequence_search_iter (GSequence *seq,
122 GSequenceIterCompareFunc iter_cmp,
124 GLIB_AVAILABLE_IN_ALL
125 GSequenceIter *g_sequence_lookup (GSequence *seq,
127 GCompareDataFunc cmp_func,
129 GLIB_AVAILABLE_IN_ALL
130 GSequenceIter *g_sequence_lookup_iter (GSequence *seq,
132 GSequenceIterCompareFunc iter_cmp,
137 GLIB_AVAILABLE_IN_ALL
138 gpointer g_sequence_get (GSequenceIter *iter);
139 GLIB_AVAILABLE_IN_ALL
140 void g_sequence_set (GSequenceIter *iter,
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,
157 GLIB_AVAILABLE_IN_ALL
158 GSequence * g_sequence_iter_get_sequence (GSequenceIter *iter);
162 GLIB_AVAILABLE_IN_ALL
163 gint g_sequence_iter_compare (GSequenceIter *a,
165 GLIB_AVAILABLE_IN_ALL
166 GSequenceIter *g_sequence_range_get_midpoint (GSequenceIter *begin,
171 #endif /* __G_SEQUENCE_H__ */