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