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."
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
,
62 GLIB_AVAILABLE_IN_2_48
63 gboolean
g_sequence_is_empty (GSequence
*seq
);
68 GSequenceIter
*g_sequence_get_begin_iter (GSequence
*seq
);
70 GSequenceIter
*g_sequence_get_end_iter (GSequence
*seq
);
72 GSequenceIter
*g_sequence_get_iter_at_pos (GSequence
*seq
,
75 GSequenceIter
*g_sequence_append (GSequence
*seq
,
78 GSequenceIter
*g_sequence_prepend (GSequence
*seq
,
81 GSequenceIter
*g_sequence_insert_before (GSequenceIter
*iter
,
84 void g_sequence_move (GSequenceIter
*src
,
87 void g_sequence_swap (GSequenceIter
*a
,
90 GSequenceIter
*g_sequence_insert_sorted (GSequence
*seq
,
92 GCompareDataFunc cmp_func
,
95 GSequenceIter
*g_sequence_insert_sorted_iter (GSequence
*seq
,
97 GSequenceIterCompareFunc iter_cmp
,
100 void g_sequence_sort_changed (GSequenceIter
*iter
,
101 GCompareDataFunc cmp_func
,
103 GLIB_AVAILABLE_IN_ALL
104 void g_sequence_sort_changed_iter (GSequenceIter
*iter
,
105 GSequenceIterCompareFunc iter_cmp
,
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
,
112 GLIB_AVAILABLE_IN_ALL
113 void g_sequence_move_range (GSequenceIter
*dest
,
114 GSequenceIter
*begin
,
116 GLIB_AVAILABLE_IN_ALL
117 GSequenceIter
*g_sequence_search (GSequence
*seq
,
119 GCompareDataFunc cmp_func
,
121 GLIB_AVAILABLE_IN_ALL
122 GSequenceIter
*g_sequence_search_iter (GSequence
*seq
,
124 GSequenceIterCompareFunc iter_cmp
,
126 GLIB_AVAILABLE_IN_ALL
127 GSequenceIter
*g_sequence_lookup (GSequence
*seq
,
129 GCompareDataFunc cmp_func
,
131 GLIB_AVAILABLE_IN_ALL
132 GSequenceIter
*g_sequence_lookup_iter (GSequence
*seq
,
134 GSequenceIterCompareFunc iter_cmp
,
139 GLIB_AVAILABLE_IN_ALL
140 gpointer
g_sequence_get (GSequenceIter
*iter
);
141 GLIB_AVAILABLE_IN_ALL
142 void g_sequence_set (GSequenceIter
*iter
,
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
,
159 GLIB_AVAILABLE_IN_ALL
160 GSequence
* g_sequence_iter_get_sequence (GSequenceIter
*iter
);
164 GLIB_AVAILABLE_IN_ALL
165 gint
g_sequence_iter_compare (GSequenceIter
*a
,
167 GLIB_AVAILABLE_IN_ALL
168 GSequenceIter
*g_sequence_range_get_midpoint (GSequenceIter
*begin
,
173 #endif /* __G_SEQUENCE_H__ */