1 /* list.c generated by valac 0.46.6, the Vala compiler
2  * generated from list.vala, do not modify */
3 
4 /* list.vala
5  *
6  * Copyright (C) 2007  Jürg Billeter
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12 
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Jürg Billeter <j@bitron.ch>
24  */
25 
26 #include <glib-object.h>
27 #include <glib.h>
28 
29 #define GEE_TYPE_LIST (gee_list_get_type ())
30 #define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList))
31 #define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST))
32 #define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface))
33 
34 typedef struct _GeeList GeeList;
35 typedef struct _GeeListIface GeeListIface;
36 
37 #define GEE_TYPE_COLLECTION (gee_collection_get_type ())
38 #define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection))
39 #define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION))
40 #define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface))
41 
42 typedef struct _GeeCollection GeeCollection;
43 typedef struct _GeeCollectionIface GeeCollectionIface;
44 
45 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
46 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
47 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
48 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
49 
50 typedef struct _GeeIterable GeeIterable;
51 typedef struct _GeeIterableIface GeeIterableIface;
52 
53 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
54 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
55 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
56 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
57 
58 typedef struct _GeeTraversable GeeTraversable;
59 typedef struct _GeeTraversableIface GeeTraversableIface;
60 typedef gboolean (*GeeForallFunc) (gpointer g, gpointer user_data);
61 typedef enum  {
62 	GEE_TRAVERSABLE_STREAM_YIELD,
63 	GEE_TRAVERSABLE_STREAM_CONTINUE,
64 	GEE_TRAVERSABLE_STREAM_END,
65 	GEE_TRAVERSABLE_STREAM_WAIT
66 } GeeTraversableStream;
67 
68 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
69 
70 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
71 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
72 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
73 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
74 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
75 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
76 
77 typedef struct _GeeLazy GeeLazy;
78 typedef struct _GeeLazyClass GeeLazyClass;
79 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy* * lazy, gpointer user_data);
80 
81 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
82 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
83 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
84 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
85 
86 typedef struct _GeeIterator GeeIterator;
87 typedef struct _GeeIteratorIface GeeIteratorIface;
88 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, gpointer user_data);
89 typedef gpointer (*GeeMapFunc) (gpointer g, gpointer user_data);
90 typedef gboolean (*GeePredicate) (gconstpointer g, gpointer user_data);
91 typedef GeeIterator* (*GeeFlatMapFunc) (gpointer g, gpointer user_data);
92 
93 #define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ())
94 #define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator))
95 #define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR))
96 #define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface))
97 
98 typedef struct _GeeListIterator GeeListIterator;
99 typedef struct _GeeListIteratorIface GeeListIteratorIface;
100 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
101 typedef gboolean (*GeeEqualDataFunc) (gconstpointer a, gconstpointer b, gpointer user_data);
102 
103 #define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ())
104 #define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection))
105 #define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
106 #define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION))
107 #define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION))
108 #define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
109 
110 typedef struct _GeeAbstractCollection GeeAbstractCollection;
111 typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass;
112 
113 #define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ())
114 #define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList))
115 #define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
116 #define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST))
117 #define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST))
118 #define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
119 
120 typedef struct _GeeAbstractList GeeAbstractList;
121 typedef struct _GeeAbstractListClass GeeAbstractListClass;
122 
123 #define GEE_TYPE_ABSTRACT_BIDIR_LIST (gee_abstract_bidir_list_get_type ())
124 #define GEE_ABSTRACT_BIDIR_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_BIDIR_LIST, GeeAbstractBidirList))
125 #define GEE_ABSTRACT_BIDIR_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_BIDIR_LIST, GeeAbstractBidirListClass))
126 #define GEE_IS_ABSTRACT_BIDIR_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_BIDIR_LIST))
127 #define GEE_IS_ABSTRACT_BIDIR_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_BIDIR_LIST))
128 #define GEE_ABSTRACT_BIDIR_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_BIDIR_LIST, GeeAbstractBidirListClass))
129 
130 typedef struct _GeeAbstractBidirList GeeAbstractBidirList;
131 typedef struct _GeeAbstractBidirListClass GeeAbstractBidirListClass;
132 
133 #define GEE_TYPE_LINKED_LIST (gee_linked_list_get_type ())
134 #define GEE_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedList))
135 #define GEE_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LINKED_LIST, GeeLinkedListClass))
136 #define GEE_IS_LINKED_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LINKED_LIST))
137 #define GEE_IS_LINKED_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LINKED_LIST))
138 #define GEE_LINKED_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LINKED_LIST, GeeLinkedListClass))
139 
140 typedef struct _GeeLinkedList GeeLinkedList;
141 typedef struct _GeeLinkedListClass GeeLinkedListClass;
142 
143 #define GEE_TYPE_BIDIR_LIST (gee_bidir_list_get_type ())
144 #define GEE_BIDIR_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_LIST, GeeBidirList))
145 #define GEE_IS_BIDIR_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_LIST))
146 #define GEE_BIDIR_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_LIST, GeeBidirListIface))
147 
148 typedef struct _GeeBidirList GeeBidirList;
149 typedef struct _GeeBidirListIface GeeBidirListIface;
150 
151 #define GEE_TYPE_BIDIR_LIST_ITERATOR (gee_bidir_list_iterator_get_type ())
152 #define GEE_BIDIR_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_LIST_ITERATOR, GeeBidirListIterator))
153 #define GEE_IS_BIDIR_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_LIST_ITERATOR))
154 #define GEE_BIDIR_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_LIST_ITERATOR, GeeBidirListIteratorIface))
155 
156 typedef struct _GeeBidirListIterator GeeBidirListIterator;
157 typedef struct _GeeBidirListIteratorIface GeeBidirListIteratorIface;
158 
159 #define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ())
160 #define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator))
161 #define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR))
162 #define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface))
163 
164 typedef struct _GeeBidirIterator GeeBidirIterator;
165 typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface;
166 
167 struct _GeeIteratorIface {
168 	GTypeInterface parent_iface;
169 	gboolean (*next) (GeeIterator* self);
170 	gboolean (*has_next) (GeeIterator* self);
171 	gpointer (*get) (GeeIterator* self);
172 	void (*remove) (GeeIterator* self);
173 	gboolean (*get_valid) (GeeIterator* self);
174 	gboolean (*get_read_only) (GeeIterator* self);
175 };
176 
177 struct _GeeTraversableIface {
178 	GTypeInterface parent_iface;
179 	GType (*get_g_type) (GeeTraversable* self);
180 	GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
181 	GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
182 	gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, gpointer f_target);
183 	GeeIterator* (*stream) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, gpointer f_target, GDestroyNotify f_target_destroy_notify);
184 	gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, gpointer f_target, gpointer seed);
185 	GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, gpointer f_target);
186 	GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, gpointer f_target, gpointer seed);
187 	GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
188 	GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
189 	GType (*get_element_type) (GeeTraversable* self);
190 	GeeIterator* (*flat_map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFlatMapFunc f, gpointer f_target, GDestroyNotify f_target_destroy_notify);
191 	GeeIterator** (*tee) (GeeTraversable* self, guint forks, gint* result_length1);
192 	gpointer (*first_match) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
193 	gboolean (*any_match) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
194 	gboolean (*all_match) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
195 	gpointer (*max) (GeeTraversable* self, GCompareDataFunc compare, gpointer compare_target, GDestroyNotify compare_target_destroy_notify);
196 	gpointer (*min) (GeeTraversable* self, GCompareDataFunc compare, gpointer compare_target, GDestroyNotify compare_target_destroy_notify);
197 	GeeIterator* (*order_by) (GeeTraversable* self, GCompareDataFunc compare, gpointer compare_target, GDestroyNotify compare_target_destroy_notify);
198 };
199 
200 struct _GeeIterableIface {
201 	GTypeInterface parent_iface;
202 	GType (*get_g_type) (GeeIterable* self);
203 	GBoxedCopyFunc (*get_g_dup_func) (GeeIterable* self);
204 	GDestroyNotify (*get_g_destroy_func) (GeeIterable* self);
205 	GeeIterator* (*iterator) (GeeIterable* self);
206 };
207 
208 struct _GeeCollectionIface {
209 	GTypeInterface parent_iface;
210 	GType (*get_g_type) (GeeCollection* self);
211 	GBoxedCopyFunc (*get_g_dup_func) (GeeCollection* self);
212 	GDestroyNotify (*get_g_destroy_func) (GeeCollection* self);
213 	gboolean (*contains) (GeeCollection* self, gconstpointer item);
214 	gboolean (*add) (GeeCollection* self, gconstpointer item);
215 	gboolean (*remove) (GeeCollection* self, gconstpointer item);
216 	void (*clear) (GeeCollection* self);
217 	gboolean (*add_all) (GeeCollection* self, GeeCollection* collection);
218 	gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection);
219 	gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection);
220 	gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection);
221 	gpointer* (*to_array) (GeeCollection* self, gint* result_length1);
222 	gint (*get_size) (GeeCollection* self);
223 	gboolean (*get_is_empty) (GeeCollection* self);
224 	gboolean (*get_read_only) (GeeCollection* self);
225 	GeeCollection* (*get_read_only_view) (GeeCollection* self);
226 	gboolean (*add_all_array) (GeeCollection* self, gpointer* array, gint array_length1);
227 	gboolean (*contains_all_array) (GeeCollection* self, gpointer* array, gint array_length1);
228 	gboolean (*remove_all_array) (GeeCollection* self, gpointer* array, gint array_length1);
229 	gboolean (*add_all_iterator) (GeeCollection* self, GeeIterator* iter);
230 	gboolean (*contains_all_iterator) (GeeCollection* self, GeeIterator* iter);
231 	gboolean (*remove_all_iterator) (GeeCollection* self, GeeIterator* iter);
232 };
233 
234 struct _GeeListIteratorIface {
235 	GTypeInterface parent_iface;
236 	void (*set) (GeeListIterator* self, gconstpointer item);
237 	void (*add) (GeeListIterator* self, gconstpointer item);
238 	gint (*index) (GeeListIterator* self);
239 };
240 
241 struct _GeeListIface {
242 	GTypeInterface parent_iface;
243 	GType (*get_g_type) (GeeList* self);
244 	GBoxedCopyFunc (*get_g_dup_func) (GeeList* self);
245 	GDestroyNotify (*get_g_destroy_func) (GeeList* self);
246 	GeeListIterator* (*list_iterator) (GeeList* self);
247 	gpointer (*get) (GeeList* self, gint index);
248 	void (*set) (GeeList* self, gint index, gconstpointer item);
249 	gint (*index_of) (GeeList* self, gconstpointer item);
250 	void (*insert) (GeeList* self, gint index, gconstpointer item);
251 	gpointer (*remove_at) (GeeList* self, gint index);
252 	GeeList* (*slice) (GeeList* self, gint start, gint stop);
253 	gpointer (*first) (GeeList* self);
254 	gpointer (*last) (GeeList* self);
255 	void (*insert_all) (GeeList* self, gint index, GeeCollection* collection);
256 	void (*sort) (GeeList* self, GCompareDataFunc compare_func, gpointer compare_func_target, GDestroyNotify compare_func_target_destroy_notify);
257 	GeeList* (*get_read_only_view) (GeeList* self);
258 };
259 
260 struct _GeeBidirIteratorIface {
261 	GTypeInterface parent_iface;
262 	GType (*get_g_type) (GeeBidirIterator* self);
263 	GBoxedCopyFunc (*get_g_dup_func) (GeeBidirIterator* self);
264 	GDestroyNotify (*get_g_destroy_func) (GeeBidirIterator* self);
265 	gboolean (*previous) (GeeBidirIterator* self);
266 	gboolean (*has_previous) (GeeBidirIterator* self);
267 	gboolean (*first) (GeeBidirIterator* self);
268 	gboolean (*last) (GeeBidirIterator* self);
269 };
270 
271 struct _GeeBidirListIteratorIface {
272 	GTypeInterface parent_iface;
273 	GType (*get_g_type) (GeeBidirListIterator* self);
274 	GBoxedCopyFunc (*get_g_dup_func) (GeeBidirListIterator* self);
275 	GDestroyNotify (*get_g_destroy_func) (GeeBidirListIterator* self);
276 	void (*insert) (GeeBidirListIterator* self, gconstpointer item);
277 };
278 
279 struct _GeeBidirListIface {
280 	GTypeInterface parent_iface;
281 	GType (*get_g_type) (GeeBidirList* self);
282 	GBoxedCopyFunc (*get_g_dup_func) (GeeBidirList* self);
283 	GDestroyNotify (*get_g_destroy_func) (GeeBidirList* self);
284 	GeeBidirListIterator* (*bidir_list_iterator) (GeeBidirList* self);
285 	GeeBidirList* (*get_read_only_view) (GeeBidirList* self);
286 };
287 
288 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
289 gpointer gee_lazy_ref (gpointer instance);
290 void gee_lazy_unref (gpointer instance);
291 GParamSpec* gee_param_spec_lazy (const gchar* name,
292                                  const gchar* nick,
293                                  const gchar* blurb,
294                                  GType object_type,
295                                  GParamFlags flags);
296 void gee_value_set_lazy (GValue* value,
297                          gpointer v_object);
298 void gee_value_take_lazy (GValue* value,
299                           gpointer v_object);
300 gpointer gee_value_get_lazy (const GValue* value);
301 GType gee_lazy_get_type (void) G_GNUC_CONST;
302 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeLazy, gee_lazy_unref)
303 GType gee_iterator_get_type (void) G_GNUC_CONST;
304 GType gee_traversable_get_type (void) G_GNUC_CONST;
305 GType gee_iterable_get_type (void) G_GNUC_CONST;
306 GType gee_collection_get_type (void) G_GNUC_CONST;
307 GType gee_list_iterator_get_type (void) G_GNUC_CONST;
308 GType gee_list_get_type (void) G_GNUC_CONST;
309 GeeListIterator* gee_list_list_iterator (GeeList* self);
310 gpointer gee_list_get (GeeList* self,
311                        gint index);
312 void gee_list_set (GeeList* self,
313                    gint index,
314                    gconstpointer item);
315 gint gee_list_index_of (GeeList* self,
316                         gconstpointer item);
317 void gee_list_insert (GeeList* self,
318                       gint index,
319                       gconstpointer item);
320 gpointer gee_list_remove_at (GeeList* self,
321                              gint index);
322 GeeList* gee_list_slice (GeeList* self,
323                          gint start,
324                          gint stop);
325 gpointer gee_list_first (GeeList* self);
326 static gpointer gee_list_real_first (GeeList* self);
327 gpointer gee_list_last (GeeList* self);
328 static gpointer gee_list_real_last (GeeList* self);
329 gint gee_collection_get_size (GeeCollection* self);
330 void gee_list_insert_all (GeeList* self,
331                           gint index,
332                           GeeCollection* collection);
333 static void gee_list_real_insert_all (GeeList* self,
334                                gint index,
335                                GeeCollection* collection);
336 GeeIterator* gee_iterable_iterator (GeeIterable* self);
337 gboolean gee_iterator_next (GeeIterator* self);
338 gpointer gee_iterator_get (GeeIterator* self);
339 void gee_list_sort (GeeList* self,
340                     GCompareDataFunc compare_func,
341                     gpointer compare_func_target,
342                     GDestroyNotify compare_func_target_destroy_notify);
343 static void gee_list_real_sort (GeeList* self,
344                          GCompareDataFunc compare_func,
345                          gpointer compare_func_target,
346                          GDestroyNotify compare_func_target_destroy_notify);
347 GCompareDataFunc gee_functions_get_compare_func_for (GType t,
348                                                      gpointer* result_target,
349                                                      GDestroyNotify* result_target_destroy_notify);
350 G_GNUC_INTERNAL void gee_tim_sort_sort (GType g_type,
351                         GBoxedCopyFunc g_dup_func,
352                         GDestroyNotify g_destroy_func,
353                         GeeList* list,
354                         GCompareDataFunc compare,
355                         gpointer compare_target);
356 GeeList* gee_list_empty (GType g_type,
357                          GBoxedCopyFunc g_dup_func,
358                          GDestroyNotify g_destroy_func);
359 GeeLinkedList* gee_linked_list_new (GType g_type,
360                                     GBoxedCopyFunc g_dup_func,
361                                     GDestroyNotify g_destroy_func,
362                                     GeeEqualDataFunc equal_func,
363                                     gpointer equal_func_target,
364                                     GDestroyNotify equal_func_target_destroy_notify);
365 GeeLinkedList* gee_linked_list_construct (GType object_type,
366                                           GType g_type,
367                                           GBoxedCopyFunc g_dup_func,
368                                           GDestroyNotify g_destroy_func,
369                                           GeeEqualDataFunc equal_func,
370                                           gpointer equal_func_target,
371                                           GDestroyNotify equal_func_target_destroy_notify);
372 GType gee_abstract_collection_get_type (void) G_GNUC_CONST;
373 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeAbstractCollection, g_object_unref)
374 GType gee_abstract_list_get_type (void) G_GNUC_CONST;
375 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeAbstractList, g_object_unref)
376 GType gee_abstract_bidir_list_get_type (void) G_GNUC_CONST;
377 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeAbstractBidirList, g_object_unref)
378 GType gee_linked_list_get_type (void) G_GNUC_CONST;
379 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeLinkedList, g_object_unref)
380 GType gee_bidir_iterator_get_type (void) G_GNUC_CONST;
381 GType gee_bidir_list_iterator_get_type (void) G_GNUC_CONST;
382 GType gee_bidir_list_get_type (void) G_GNUC_CONST;
383 GeeBidirList* gee_abstract_bidir_list_get_read_only_view (GeeAbstractBidirList* self);
384 GeeList* gee_list_get_read_only_view (GeeList* self);
385 
386 /**
387  * Returns a ListIterator that can be used for iteration over this list.
388  *
389  * @return a ListIterator that can be used for iteration over this list
390  */
391 GeeListIterator*
gee_list_list_iterator(GeeList * self)392 gee_list_list_iterator (GeeList* self)
393 {
394 	g_return_val_if_fail (self != NULL, NULL);
395 	return GEE_LIST_GET_INTERFACE (self)->list_iterator (self);
396 }
397 
398 /**
399  * Returns the item at the specified index in this list.
400  *
401  * @param index zero-based index of the item to be returned
402  *
403  * @return      the item at the specified index in the list
404  */
405 gpointer
gee_list_get(GeeList * self,gint index)406 gee_list_get (GeeList* self,
407               gint index)
408 {
409 	g_return_val_if_fail (self != NULL, NULL);
410 	return GEE_LIST_GET_INTERFACE (self)->get (self, index);
411 }
412 
413 /**
414  * Sets the item at the specified index in this list.
415  *
416  * @param index zero-based index of the item to be set
417  */
418 void
gee_list_set(GeeList * self,gint index,gconstpointer item)419 gee_list_set (GeeList* self,
420               gint index,
421               gconstpointer item)
422 {
423 	g_return_if_fail (self != NULL);
424 	GEE_LIST_GET_INTERFACE (self)->set (self, index, item);
425 }
426 
427 /**
428  * Returns the index of the first occurence of the specified item in
429  * this list.
430  *
431  * @return the index of the first occurence of the specified item, or
432  *         -1 if the item could not be found
433  */
434 gint
gee_list_index_of(GeeList * self,gconstpointer item)435 gee_list_index_of (GeeList* self,
436                    gconstpointer item)
437 {
438 	g_return_val_if_fail (self != NULL, 0);
439 	return GEE_LIST_GET_INTERFACE (self)->index_of (self, item);
440 }
441 
442 /**
443  * Inserts an item into this list at the specified position.
444  *
445  * @param index zero-based index at which item is inserted
446  * @param item  item to insert into the list
447  */
448 void
gee_list_insert(GeeList * self,gint index,gconstpointer item)449 gee_list_insert (GeeList* self,
450                  gint index,
451                  gconstpointer item)
452 {
453 	g_return_if_fail (self != NULL);
454 	GEE_LIST_GET_INTERFACE (self)->insert (self, index, item);
455 }
456 
457 /**
458  * Removes the item at the specified index of this list.
459  *
460  * @param index zero-based index of the item to be removed
461  *
462  * @return      the removed element
463  */
464 gpointer
gee_list_remove_at(GeeList * self,gint index)465 gee_list_remove_at (GeeList* self,
466                     gint index)
467 {
468 	g_return_val_if_fail (self != NULL, NULL);
469 	return GEE_LIST_GET_INTERFACE (self)->remove_at (self, index);
470 }
471 
472 /**
473  * Returns a slice of this list.
474  *
475  * @param start zero-based index of the begin of the slice
476  * @param stop  zero-based index after the end of the slice
477  *
478  * @return A list containing a slice of this list
479  */
480 GeeList*
gee_list_slice(GeeList * self,gint start,gint stop)481 gee_list_slice (GeeList* self,
482                 gint start,
483                 gint stop)
484 {
485 	g_return_val_if_fail (self != NULL, NULL);
486 	return GEE_LIST_GET_INTERFACE (self)->slice (self, start, stop);
487 }
488 
489 /**
490  * Returns the first item of the list. Fails if the list is empty.
491  *
492  * @return      first item in the list
493  */
494 static gpointer
gee_list_real_first(GeeList * self)495 gee_list_real_first (GeeList* self)
496 {
497 	gpointer _tmp0_;
498 	gpointer result = NULL;
499 	_tmp0_ = gee_list_get (self, 0);
500 	result = _tmp0_;
501 	return result;
502 }
503 
504 gpointer
gee_list_first(GeeList * self)505 gee_list_first (GeeList* self)
506 {
507 	g_return_val_if_fail (self != NULL, NULL);
508 	return GEE_LIST_GET_INTERFACE (self)->first (self);
509 }
510 
511 /**
512  * Returns the last item of the list. Fails if the list is empty.
513  *
514  * @return      last item in the list
515  */
516 static gpointer
gee_list_real_last(GeeList * self)517 gee_list_real_last (GeeList* self)
518 {
519 	gint _tmp0_;
520 	gint _tmp1_;
521 	gpointer _tmp2_;
522 	gpointer result = NULL;
523 	_tmp0_ = gee_collection_get_size ((GeeCollection*) self);
524 	_tmp1_ = _tmp0_;
525 	_tmp2_ = gee_list_get (self, _tmp1_ - 1);
526 	result = _tmp2_;
527 	return result;
528 }
529 
530 gpointer
gee_list_last(GeeList * self)531 gee_list_last (GeeList* self)
532 {
533 	g_return_val_if_fail (self != NULL, NULL);
534 	return GEE_LIST_GET_INTERFACE (self)->last (self);
535 }
536 
537 /**
538  * Inserts items into this list for the input collection at the
539  * specified position.
540  *
541  * @param index zero-based index of the items to be inserted
542  * @param collection collection of items to be inserted
543  */
544 static void
gee_list_real_insert_all(GeeList * self,gint index,GeeCollection * collection)545 gee_list_real_insert_all (GeeList* self,
546                           gint index,
547                           GeeCollection* collection)
548 {
549 	g_return_if_fail (collection != NULL);
550 	{
551 		GeeIterator* _item_it = NULL;
552 		GeeIterator* _tmp0_;
553 		_tmp0_ = gee_iterable_iterator ((GeeIterable*) collection);
554 		_item_it = _tmp0_;
555 		while (TRUE) {
556 			GeeIterator* _tmp1_;
557 			gpointer item = NULL;
558 			GeeIterator* _tmp2_;
559 			gpointer _tmp3_;
560 			gconstpointer _tmp4_;
561 			gint _tmp5_;
562 			_tmp1_ = _item_it;
563 			if (!gee_iterator_next (_tmp1_)) {
564 				break;
565 			}
566 			_tmp2_ = _item_it;
567 			_tmp3_ = gee_iterator_get (_tmp2_);
568 			item = _tmp3_;
569 			_tmp4_ = item;
570 			gee_list_insert (self, index, _tmp4_);
571 			_tmp5_ = index;
572 			index = _tmp5_ + 1;
573 			((item == NULL) || (GEE_LIST_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (item = (GEE_LIST_GET_INTERFACE (self)->get_g_destroy_func (self) (item), NULL));
574 		}
575 		_g_object_unref0 (_item_it);
576 	}
577 }
578 
579 void
gee_list_insert_all(GeeList * self,gint index,GeeCollection * collection)580 gee_list_insert_all (GeeList* self,
581                      gint index,
582                      GeeCollection* collection)
583 {
584 	g_return_if_fail (self != NULL);
585 	GEE_LIST_GET_INTERFACE (self)->insert_all (self, index, collection);
586 }
587 
588 /**
589  * Sorts items by comparing with the specified compare function.
590  *
591  * @param compare_func compare function to use to compare items
592  */
593 static void
gee_list_real_sort(GeeList * self,GCompareDataFunc compare_func,gpointer compare_func_target,GDestroyNotify compare_func_target_destroy_notify)594 gee_list_real_sort (GeeList* self,
595                     GCompareDataFunc compare_func,
596                     gpointer compare_func_target,
597                     GDestroyNotify compare_func_target_destroy_notify)
598 {
599 	if (compare_func == NULL) {
600 		void* _tmp0_ = NULL;
601 		GDestroyNotify _tmp1_ = NULL;
602 		GCompareDataFunc _tmp2_;
603 		_tmp2_ = gee_functions_get_compare_func_for (GEE_LIST_GET_INTERFACE (self)->get_g_type (self), &_tmp0_, &_tmp1_);
604 		(compare_func_target_destroy_notify == NULL) ? NULL : (compare_func_target_destroy_notify (compare_func_target), NULL);
605 		compare_func = NULL;
606 		compare_func_target = NULL;
607 		compare_func_target_destroy_notify = NULL;
608 		compare_func = _tmp2_;
609 		compare_func_target = _tmp0_;
610 		compare_func_target_destroy_notify = _tmp1_;
611 	}
612 	gee_tim_sort_sort (GEE_LIST_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_LIST_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_LIST_GET_INTERFACE (self)->get_g_destroy_func (self), self, compare_func, compare_func_target);
613 	(compare_func_target_destroy_notify == NULL) ? NULL : (compare_func_target_destroy_notify (compare_func_target), NULL);
614 	compare_func = NULL;
615 	compare_func_target = NULL;
616 	compare_func_target_destroy_notify = NULL;
617 }
618 
619 void
gee_list_sort(GeeList * self,GCompareDataFunc compare_func,gpointer compare_func_target,GDestroyNotify compare_func_target_destroy_notify)620 gee_list_sort (GeeList* self,
621                GCompareDataFunc compare_func,
622                gpointer compare_func_target,
623                GDestroyNotify compare_func_target_destroy_notify)
624 {
625 	g_return_if_fail (self != NULL);
626 	GEE_LIST_GET_INTERFACE (self)->sort (self, compare_func, compare_func_target, compare_func_target_destroy_notify);
627 }
628 
629 /**
630  * Returns an immutable empty list.
631  *
632  * @return an immutable empty list
633  */
634 GeeList*
gee_list_empty(GType g_type,GBoxedCopyFunc g_dup_func,GDestroyNotify g_destroy_func)635 gee_list_empty (GType g_type,
636                 GBoxedCopyFunc g_dup_func,
637                 GDestroyNotify g_destroy_func)
638 {
639 	GeeLinkedList* _tmp0_;
640 	GeeLinkedList* _tmp1_;
641 	GeeBidirList* _tmp2_;
642 	GeeBidirList* _tmp3_;
643 	GeeList* _tmp4_;
644 	GeeList* result = NULL;
645 	_tmp0_ = gee_linked_list_new (g_type, (GBoxedCopyFunc) g_dup_func, (GDestroyNotify) g_destroy_func, NULL, NULL, NULL);
646 	_tmp1_ = _tmp0_;
647 	_tmp2_ = gee_abstract_bidir_list_get_read_only_view ((GeeAbstractBidirList*) _tmp1_);
648 	_tmp3_ = _tmp2_;
649 	_tmp4_ = (GeeList*) _tmp3_;
650 	_g_object_unref0 (_tmp1_);
651 	result = _tmp4_;
652 	return result;
653 }
654 
655 GeeList*
gee_list_get_read_only_view(GeeList * self)656 gee_list_get_read_only_view (GeeList* self)
657 {
658 	g_return_val_if_fail (self != NULL, NULL);
659 	return GEE_LIST_GET_INTERFACE (self)->get_read_only_view (self);
660 }
661 
662 static void
gee_list_default_init(GeeListIface * iface,gpointer iface_data)663 gee_list_default_init (GeeListIface * iface,
664                        gpointer iface_data)
665 {
666 	/**
667 	 * The read-only view of this list.
668 	 */
669 	g_object_interface_install_property (iface, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
670 	iface->first = gee_list_real_first;
671 	iface->last = gee_list_real_last;
672 	iface->insert_all = gee_list_real_insert_all;
673 	iface->sort = gee_list_real_sort;
674 }
675 
676 /**
677  * An ordered collection.
678  */
679 GType
gee_list_get_type(void)680 gee_list_get_type (void)
681 {
682 	static volatile gsize gee_list_type_id__volatile = 0;
683 	if (g_once_init_enter (&gee_list_type_id__volatile)) {
684 		static const GTypeInfo g_define_type_info = { sizeof (GeeListIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_list_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
685 		GType gee_list_type_id;
686 		gee_list_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeList", &g_define_type_info, 0);
687 		g_type_interface_add_prerequisite (gee_list_type_id, GEE_TYPE_COLLECTION);
688 		g_once_init_leave (&gee_list_type_id__volatile, gee_list_type_id);
689 	}
690 	return gee_list_type_id__volatile;
691 }
692 
693