1 /* readonlylist.c generated by valac 0.18.0, the Vala compiler
2 * generated from readonlylist.vala, do not modify */
6 * Copyright (C) 2007-2008 Jürg Billeter
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.
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.
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
23 * Jürg Billeter <j@bitron.ch>
27 #include <glib-object.h>
30 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
31 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
32 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
33 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
35 typedef struct _GeeTraversable GeeTraversable;
36 typedef struct _GeeTraversableIface GeeTraversableIface;
38 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
40 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
41 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
42 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
43 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
44 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
45 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
47 typedef struct _GeeLazy GeeLazy;
48 typedef struct _GeeLazyClass GeeLazyClass;
50 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
51 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
52 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
53 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
55 typedef struct _GeeIterator GeeIterator;
56 typedef struct _GeeIteratorIface GeeIteratorIface;
58 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
59 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
60 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
61 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
63 typedef struct _GeeIterable GeeIterable;
64 typedef struct _GeeIterableIface GeeIterableIface;
66 #define GEE_TYPE_COLLECTION (gee_collection_get_type ())
67 #define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection))
68 #define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION))
69 #define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface))
71 typedef struct _GeeCollection GeeCollection;
72 typedef struct _GeeCollectionIface GeeCollectionIface;
74 #define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ())
75 #define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection))
76 #define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass))
77 #define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION))
78 #define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION))
79 #define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass))
81 typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection;
82 typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass;
83 typedef struct _GeeReadOnlyCollectionPrivate GeeReadOnlyCollectionPrivate;
85 #define GEE_TYPE_LIST (gee_list_get_type ())
86 #define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList))
87 #define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST))
88 #define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface))
90 typedef struct _GeeList GeeList;
91 typedef struct _GeeListIface GeeListIface;
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))
98 typedef struct _GeeListIterator GeeListIterator;
99 typedef struct _GeeListIteratorIface GeeListIteratorIface;
101 #define GEE_TYPE_READ_ONLY_LIST (gee_read_only_list_get_type ())
102 #define GEE_READ_ONLY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList))
103 #define GEE_READ_ONLY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListClass))
104 #define GEE_IS_READ_ONLY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_LIST))
105 #define GEE_IS_READ_ONLY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_LIST))
106 #define GEE_READ_ONLY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListClass))
108 typedef struct _GeeReadOnlyList GeeReadOnlyList;
109 typedef struct _GeeReadOnlyListClass GeeReadOnlyListClass;
110 typedef struct _GeeReadOnlyListPrivate GeeReadOnlyListPrivate;
112 #define GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR (gee_read_only_collection_iterator_get_type ())
113 #define GEE_READ_ONLY_COLLECTION_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator))
114 #define GEE_READ_ONLY_COLLECTION_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass))
115 #define GEE_READ_ONLY_COLLECTION_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR))
116 #define GEE_READ_ONLY_COLLECTION_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR))
117 #define GEE_READ_ONLY_COLLECTION_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass))
119 typedef struct _GeeReadOnlyCollectionIterator GeeReadOnlyCollectionIterator;
120 typedef struct _GeeReadOnlyCollectionIteratorClass GeeReadOnlyCollectionIteratorClass;
122 #define GEE_READ_ONLY_LIST_TYPE_ITERATOR (gee_read_only_list_iterator_get_type ())
123 #define GEE_READ_ONLY_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIterator))
124 #define GEE_READ_ONLY_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIteratorClass))
125 #define GEE_READ_ONLY_LIST_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_LIST_TYPE_ITERATOR))
126 #define GEE_READ_ONLY_LIST_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_LIST_TYPE_ITERATOR))
127 #define GEE_READ_ONLY_LIST_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIteratorClass))
129 typedef struct _GeeReadOnlyListIterator GeeReadOnlyListIterator;
130 typedef struct _GeeReadOnlyListIteratorClass GeeReadOnlyListIteratorClass;
131 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
132 typedef struct _GeeReadOnlyCollectionIteratorPrivate GeeReadOnlyCollectionIteratorPrivate;
133 typedef struct _GeeReadOnlyListIteratorPrivate GeeReadOnlyListIteratorPrivate;
135 typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
137 GEE_TRAVERSABLE_STREAM_YIELD,
138 GEE_TRAVERSABLE_STREAM_CONTINUE,
139 GEE_TRAVERSABLE_STREAM_END
140 } GeeTraversableStream;
142 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, void* user_data);
143 struct _GeeIteratorIface {
144 GTypeInterface parent_iface;
145 gboolean (*next) (GeeIterator* self);
146 gboolean (*has_next) (GeeIterator* self);
147 gpointer (*get) (GeeIterator* self);
148 void (*remove) (GeeIterator* self);
149 gboolean (*get_valid) (GeeIterator* self);
150 gboolean (*get_read_only) (GeeIterator* self);
153 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, void* user_data);
154 typedef gpointer (*GeeMapFunc) (gpointer g, void* user_data);
155 typedef gboolean (*GeePredicate) (gconstpointer g, void* user_data);
156 struct _GeeTraversableIface {
157 GTypeInterface parent_iface;
158 GType (*get_g_type) (GeeTraversable* self);
159 GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
160 GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
161 gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, void* f_target);
162 GeeIterator* (*stream) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
163 gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
164 GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
165 GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
166 GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
167 GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
168 GType (*get_element_type) (GeeTraversable* self);
171 struct _GeeIterableIface {
172 GTypeInterface parent_iface;
173 GType (*get_g_type) (GeeIterable* self);
174 GBoxedCopyFunc (*get_g_dup_func) (GeeIterable* self);
175 GDestroyNotify (*get_g_destroy_func) (GeeIterable* self);
176 GeeIterator* (*iterator) (GeeIterable* self);
179 struct _GeeCollectionIface {
180 GTypeInterface parent_iface;
181 GType (*get_g_type) (GeeCollection* self);
182 GBoxedCopyFunc (*get_g_dup_func) (GeeCollection* self);
183 GDestroyNotify (*get_g_destroy_func) (GeeCollection* self);
184 gboolean (*contains) (GeeCollection* self, gconstpointer item);
185 gboolean (*add) (GeeCollection* self, gconstpointer item);
186 gboolean (*remove) (GeeCollection* self, gconstpointer item);
187 void (*clear) (GeeCollection* self);
188 gboolean (*add_all) (GeeCollection* self, GeeCollection* collection);
189 gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection);
190 gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection);
191 gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection);
192 gpointer* (*to_array) (GeeCollection* self, int* result_length1);
193 gint (*get_size) (GeeCollection* self);
194 gboolean (*get_is_empty) (GeeCollection* self);
195 gboolean (*get_read_only) (GeeCollection* self);
196 GeeCollection* (*get_read_only_view) (GeeCollection* self);
199 struct _GeeReadOnlyCollection {
200 GObject parent_instance;
201 GeeReadOnlyCollectionPrivate * priv;
202 GeeCollection* _collection;
205 struct _GeeReadOnlyCollectionClass {
206 GObjectClass parent_class;
207 GeeCollection* (*get_read_only_view) (GeeReadOnlyCollection* self);
210 struct _GeeListIteratorIface {
211 GTypeInterface parent_iface;
212 void (*set) (GeeListIterator* self, gconstpointer item);
213 void (*add) (GeeListIterator* self, gconstpointer item);
214 gint (*index) (GeeListIterator* self);
217 struct _GeeListIface {
218 GTypeInterface parent_iface;
219 GType (*get_g_type) (GeeList* self);
220 GBoxedCopyFunc (*get_g_dup_func) (GeeList* self);
221 GDestroyNotify (*get_g_destroy_func) (GeeList* self);
222 GeeListIterator* (*list_iterator) (GeeList* self);
223 gpointer (*get) (GeeList* self, gint index);
224 void (*set) (GeeList* self, gint index, gconstpointer item);
225 gint (*index_of) (GeeList* self, gconstpointer item);
226 void (*insert) (GeeList* self, gint index, gconstpointer item);
227 gpointer (*remove_at) (GeeList* self, gint index);
228 GeeList* (*slice) (GeeList* self, gint start, gint stop);
229 gpointer (*first) (GeeList* self);
230 gpointer (*last) (GeeList* self);
231 void (*insert_all) (GeeList* self, gint index, GeeCollection* collection);
232 void (*sort) (GeeList* self, GCompareDataFunc compare_func, void* compare_func_target, GDestroyNotify compare_func_target_destroy_notify);
233 GeeList* (*get_read_only_view) (GeeList* self);
236 struct _GeeReadOnlyList {
237 GeeReadOnlyCollection parent_instance;
238 GeeReadOnlyListPrivate * priv;
241 struct _GeeReadOnlyListClass {
242 GeeReadOnlyCollectionClass parent_class;
243 GeeList* (*get_read_only_view) (GeeReadOnlyList* self);
246 struct _GeeReadOnlyListPrivate {
248 GBoxedCopyFunc g_dup_func;
249 GDestroyNotify g_destroy_func;
252 struct _GeeReadOnlyCollectionIterator {
253 GObject parent_instance;
254 GeeReadOnlyCollectionIteratorPrivate * priv;
258 struct _GeeReadOnlyCollectionIteratorClass {
259 GObjectClass parent_class;
262 struct _GeeReadOnlyListIterator {
263 GeeReadOnlyCollectionIterator parent_instance;
264 GeeReadOnlyListIteratorPrivate * priv;
267 struct _GeeReadOnlyListIteratorClass {
268 GeeReadOnlyCollectionIteratorClass parent_class;
271 struct _GeeReadOnlyListIteratorPrivate {
273 GBoxedCopyFunc g_dup_func;
274 GDestroyNotify g_destroy_func;
278 static gpointer gee_read_only_list_parent_class = NULL;
279 static gpointer gee_read_only_list_iterator_parent_class = NULL;
280 static GeeListIteratorIface* gee_read_only_list_iterator_gee_list_iterator_parent_iface = NULL;
281 static GeeListIface* gee_read_only_list_gee_list_parent_iface = NULL;
283 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
284 gpointer gee_lazy_ref (gpointer instance);
285 void gee_lazy_unref (gpointer instance);
286 GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
287 void gee_value_set_lazy (GValue* value, gpointer v_object);
288 void gee_value_take_lazy (GValue* value, gpointer v_object);
289 gpointer gee_value_get_lazy (const GValue* value);
290 GType gee_lazy_get_type (void) G_GNUC_CONST;
291 GType gee_iterator_get_type (void) G_GNUC_CONST;
292 GType gee_traversable_get_type (void) G_GNUC_CONST;
293 GType gee_iterable_get_type (void) G_GNUC_CONST;
294 GType gee_collection_get_type (void) G_GNUC_CONST;
295 GType gee_read_only_collection_get_type (void) G_GNUC_CONST;
296 GType gee_list_iterator_get_type (void) G_GNUC_CONST;
297 GType gee_list_get_type (void) G_GNUC_CONST;
298 GType gee_read_only_list_get_type (void) G_GNUC_CONST;
299 #define GEE_READ_ONLY_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyListPrivate))
301 GEE_READ_ONLY_LIST_DUMMY_PROPERTY,
302 GEE_READ_ONLY_LIST_G_TYPE,
303 GEE_READ_ONLY_LIST_G_DUP_FUNC,
304 GEE_READ_ONLY_LIST_G_DESTROY_FUNC,
305 GEE_READ_ONLY_LIST_READ_ONLY_VIEW
307 GeeReadOnlyList* gee_read_only_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list);
308 GeeReadOnlyList* gee_read_only_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list);
309 GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection);
310 GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection);
311 static GeeListIterator* gee_read_only_list_real_list_iterator (GeeList* base);
312 GeeListIterator* gee_list_list_iterator (GeeList* self);
313 GeeReadOnlyListIterator* gee_read_only_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator);
314 GeeReadOnlyListIterator* gee_read_only_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator);
315 GType gee_read_only_collection_iterator_get_type (void) G_GNUC_CONST;
316 GType gee_read_only_list_iterator_get_type (void) G_GNUC_CONST;
317 static gint gee_read_only_list_real_index_of (GeeList* base, gconstpointer item);
318 gint gee_list_index_of (GeeList* self, gconstpointer item);
319 static void gee_read_only_list_real_insert (GeeList* base, gint index, gconstpointer item);
320 static gpointer gee_read_only_list_real_remove_at (GeeList* base, gint index);
321 static gpointer gee_read_only_list_real_get (GeeList* base, gint index);
322 gpointer gee_list_get (GeeList* self, gint index);
323 static void gee_read_only_list_real_set (GeeList* base, gint index, gconstpointer o);
324 static GeeList* gee_read_only_list_real_slice (GeeList* base, gint start, gint stop);
325 GeeList* gee_list_slice (GeeList* self, gint start, gint stop);
326 static gpointer gee_read_only_list_real_first (GeeList* base);
327 gpointer gee_list_first (GeeList* self);
328 static gpointer gee_read_only_list_real_last (GeeList* base);
329 gpointer gee_list_last (GeeList* self);
330 static void gee_read_only_list_real_insert_all (GeeList* base, gint index, GeeCollection* collection);
331 static void gee_read_only_list_real_sort (GeeList* base, GCompareDataFunc compare, void* compare_target, GDestroyNotify compare_target_destroy_notify);
332 GeeList* gee_read_only_list_get_read_only_view (GeeReadOnlyList* self);
333 #define GEE_READ_ONLY_LIST_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIteratorPrivate))
335 GEE_READ_ONLY_LIST_ITERATOR_DUMMY_PROPERTY,
336 GEE_READ_ONLY_LIST_ITERATOR_G_TYPE,
337 GEE_READ_ONLY_LIST_ITERATOR_G_DUP_FUNC,
338 GEE_READ_ONLY_LIST_ITERATOR_G_DESTROY_FUNC
340 GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator);
341 GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator);
342 static void gee_read_only_list_iterator_real_set (GeeListIterator* base, gconstpointer item);
343 static void gee_read_only_list_iterator_real_add (GeeListIterator* base, gconstpointer item);
344 static gint gee_read_only_list_iterator_real_index (GeeListIterator* base);
345 gint gee_list_iterator_index (GeeListIterator* self);
346 static void _vala_gee_read_only_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
347 static void _vala_gee_read_only_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
348 static void _vala_gee_read_only_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
349 static void _vala_gee_read_only_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
353 * Constructs a read-only list that mirrors the content of the specified
356 * @param list the list to decorate.
358 GeeReadOnlyList* gee_read_only_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list) {
359 GeeReadOnlyList * self = NULL;
361 g_return_val_if_fail (list != NULL, NULL);
363 self = (GeeReadOnlyList*) gee_read_only_collection_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeCollection*) _tmp0_);
364 self->priv->g_type = g_type;
365 self->priv->g_dup_func = g_dup_func;
366 self->priv->g_destroy_func = g_destroy_func;
371 GeeReadOnlyList* gee_read_only_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list) {
372 return gee_read_only_list_construct (GEE_TYPE_READ_ONLY_LIST, g_type, g_dup_func, g_destroy_func, list);
379 static GeeListIterator* gee_read_only_list_real_list_iterator (GeeList* base) {
380 GeeReadOnlyList * self;
381 GeeListIterator* result = NULL;
382 GeeCollection* _tmp0_;
383 GeeListIterator* _tmp1_ = NULL;
384 GeeListIterator* _tmp2_;
385 GeeReadOnlyListIterator* _tmp3_;
386 GeeListIterator* _tmp4_;
387 self = (GeeReadOnlyList*) base;
388 _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
389 _tmp1_ = gee_list_list_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList));
391 _tmp3_ = gee_read_only_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp2_);
392 _tmp4_ = (GeeListIterator*) _tmp3_;
393 _g_object_unref0 (_tmp2_);
402 static gint gee_read_only_list_real_index_of (GeeList* base, gconstpointer item) {
403 GeeReadOnlyList * self;
405 GeeCollection* _tmp0_;
406 gconstpointer _tmp1_;
408 self = (GeeReadOnlyList*) base;
409 _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
411 _tmp2_ = gee_list_index_of (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList), _tmp1_);
418 * Unimplemented method (read only list).
420 static void gee_read_only_list_real_insert (GeeList* base, gint index, gconstpointer item) {
421 GeeReadOnlyList * self;
422 self = (GeeReadOnlyList*) base;
423 g_assert_not_reached ();
428 * Unimplemented method (read only list).
430 static gpointer gee_read_only_list_real_remove_at (GeeList* base, gint index) {
431 GeeReadOnlyList * self;
432 gpointer result = NULL;
433 self = (GeeReadOnlyList*) base;
434 g_assert_not_reached ();
442 static gpointer gee_read_only_list_real_get (GeeList* base, gint index) {
443 GeeReadOnlyList * self;
444 gpointer result = NULL;
445 GeeCollection* _tmp0_;
447 gpointer _tmp2_ = NULL;
448 self = (GeeReadOnlyList*) base;
449 _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
451 _tmp2_ = gee_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList), _tmp1_);
458 * Unimplemented method (read only list).
460 static void gee_read_only_list_real_set (GeeList* base, gint index, gconstpointer o) {
461 GeeReadOnlyList * self;
462 self = (GeeReadOnlyList*) base;
463 g_assert_not_reached ();
470 static GeeList* gee_read_only_list_real_slice (GeeList* base, gint start, gint stop) {
471 GeeReadOnlyList * self;
472 GeeList* result = NULL;
473 GeeCollection* _tmp0_;
476 GeeList* _tmp3_ = NULL;
477 self = (GeeReadOnlyList*) base;
478 _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
481 _tmp3_ = gee_list_slice (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList), _tmp1_, _tmp2_);
490 static gpointer gee_read_only_list_real_first (GeeList* base) {
491 GeeReadOnlyList * self;
492 gpointer result = NULL;
493 GeeCollection* _tmp0_;
494 gpointer _tmp1_ = NULL;
495 self = (GeeReadOnlyList*) base;
496 _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
497 _tmp1_ = gee_list_first (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList));
506 static gpointer gee_read_only_list_real_last (GeeList* base) {
507 GeeReadOnlyList * self;
508 gpointer result = NULL;
509 GeeCollection* _tmp0_;
510 gpointer _tmp1_ = NULL;
511 self = (GeeReadOnlyList*) base;
512 _tmp0_ = ((GeeReadOnlyCollection*) self)->_collection;
513 _tmp1_ = gee_list_last (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList));
520 * Unimplemented method (read only list).
522 static void gee_read_only_list_real_insert_all (GeeList* base, gint index, GeeCollection* collection) {
523 GeeReadOnlyList * self;
524 self = (GeeReadOnlyList*) base;
525 g_return_if_fail (collection != NULL);
526 g_assert_not_reached ();
533 static void gee_read_only_list_real_sort (GeeList* base, GCompareDataFunc compare, void* compare_target, GDestroyNotify compare_target_destroy_notify) {
534 GeeReadOnlyList * self;
535 self = (GeeReadOnlyList*) base;
536 g_assert_not_reached ();
537 (compare_target_destroy_notify == NULL) ? NULL : (compare_target_destroy_notify (compare_target), NULL);
539 compare_target = NULL;
540 compare_target_destroy_notify = NULL;
544 GeeList* gee_read_only_list_get_read_only_view (GeeReadOnlyList* self) {
545 g_return_val_if_fail (self != NULL, NULL);
546 return GEE_READ_ONLY_LIST_GET_CLASS (self)->get_read_only_view (self);
550 static gpointer _g_object_ref0 (gpointer self) {
551 return self ? g_object_ref (self) : NULL;
555 static GeeList* gee_read_only_list_real_get_read_only_view (GeeReadOnlyList* base) {
557 GeeReadOnlyList* self;
560 _tmp0_ = _g_object_ref0 ((GeeList*) self);
566 GeeReadOnlyListIterator* gee_read_only_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator) {
567 GeeReadOnlyListIterator * self = NULL;
568 GeeListIterator* _tmp0_;
569 g_return_val_if_fail (iterator != NULL, NULL);
571 self = (GeeReadOnlyListIterator*) gee_read_only_collection_iterator_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, (GeeIterator*) _tmp0_);
572 self->priv->g_type = g_type;
573 self->priv->g_dup_func = g_dup_func;
574 self->priv->g_destroy_func = g_destroy_func;
579 GeeReadOnlyListIterator* gee_read_only_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeListIterator* iterator) {
580 return gee_read_only_list_iterator_construct (GEE_READ_ONLY_LIST_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, iterator);
584 static void gee_read_only_list_iterator_real_set (GeeListIterator* base, gconstpointer item) {
585 GeeReadOnlyListIterator * self;
586 self = (GeeReadOnlyListIterator*) base;
587 g_assert_not_reached ();
591 static void gee_read_only_list_iterator_real_add (GeeListIterator* base, gconstpointer item) {
592 GeeReadOnlyListIterator * self;
593 self = (GeeReadOnlyListIterator*) base;
594 g_assert_not_reached ();
598 static gint gee_read_only_list_iterator_real_index (GeeListIterator* base) {
599 GeeReadOnlyListIterator * self;
603 self = (GeeReadOnlyListIterator*) base;
604 _tmp0_ = ((GeeReadOnlyCollectionIterator*) self)->_iter;
605 _tmp1_ = gee_list_iterator_index (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST_ITERATOR, GeeListIterator));
611 static void gee_read_only_list_iterator_class_init (GeeReadOnlyListIteratorClass * klass) {
612 gee_read_only_list_iterator_parent_class = g_type_class_peek_parent (klass);
613 g_type_class_add_private (klass, sizeof (GeeReadOnlyListIteratorPrivate));
614 G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_list_iterator_get_property;
615 G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_list_iterator_set_property;
616 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
617 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
618 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
622 static void gee_read_only_list_iterator_gee_list_iterator_interface_init (GeeListIteratorIface * iface) {
623 gee_read_only_list_iterator_gee_list_iterator_parent_iface = g_type_interface_peek_parent (iface);
624 iface->set = (void (*)(GeeListIterator*, gconstpointer)) gee_read_only_list_iterator_real_set;
625 iface->add = (void (*)(GeeListIterator*, gconstpointer)) gee_read_only_list_iterator_real_add;
626 iface->index = (gint (*)(GeeListIterator*)) gee_read_only_list_iterator_real_index;
630 static void gee_read_only_list_iterator_instance_init (GeeReadOnlyListIterator * self) {
631 self->priv = GEE_READ_ONLY_LIST_ITERATOR_GET_PRIVATE (self);
635 GType gee_read_only_list_iterator_get_type (void) {
636 static volatile gsize gee_read_only_list_iterator_type_id__volatile = 0;
637 if (g_once_init_enter (&gee_read_only_list_iterator_type_id__volatile)) {
638 static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyListIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_list_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyListIterator), 0, (GInstanceInitFunc) gee_read_only_list_iterator_instance_init, NULL };
639 static const GInterfaceInfo gee_list_iterator_info = { (GInterfaceInitFunc) gee_read_only_list_iterator_gee_list_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
640 GType gee_read_only_list_iterator_type_id;
641 gee_read_only_list_iterator_type_id = g_type_register_static (GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, "GeeReadOnlyListIterator", &g_define_type_info, 0);
642 g_type_add_interface_static (gee_read_only_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR, &gee_list_iterator_info);
643 g_once_init_leave (&gee_read_only_list_iterator_type_id__volatile, gee_read_only_list_iterator_type_id);
645 return gee_read_only_list_iterator_type_id__volatile;
649 static void _vala_gee_read_only_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
650 GeeReadOnlyListIterator * self;
651 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIterator);
652 switch (property_id) {
654 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
660 static void _vala_gee_read_only_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
661 GeeReadOnlyListIterator * self;
662 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_LIST_TYPE_ITERATOR, GeeReadOnlyListIterator);
663 switch (property_id) {
664 case GEE_READ_ONLY_LIST_ITERATOR_G_TYPE:
665 self->priv->g_type = g_value_get_gtype (value);
667 case GEE_READ_ONLY_LIST_ITERATOR_G_DUP_FUNC:
668 self->priv->g_dup_func = g_value_get_pointer (value);
670 case GEE_READ_ONLY_LIST_ITERATOR_G_DESTROY_FUNC:
671 self->priv->g_destroy_func = g_value_get_pointer (value);
674 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
680 static void gee_read_only_list_class_init (GeeReadOnlyListClass * klass) {
681 gee_read_only_list_parent_class = g_type_class_peek_parent (klass);
682 g_type_class_add_private (klass, sizeof (GeeReadOnlyListPrivate));
683 GEE_READ_ONLY_LIST_CLASS (klass)->get_read_only_view = gee_read_only_list_real_get_read_only_view;
684 G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_list_get_property;
685 G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_list_set_property;
686 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
687 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
688 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
692 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_LIST_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
696 static GType gee_read_only_list_gee_list_get_g_type (GeeReadOnlyList* self) {
697 return self->priv->g_type;
701 static GBoxedCopyFunc gee_read_only_list_gee_list_get_g_dup_func (GeeReadOnlyList* self) {
702 return self->priv->g_dup_func;
706 static GDestroyNotify gee_read_only_list_gee_list_get_g_destroy_func (GeeReadOnlyList* self) {
707 return self->priv->g_destroy_func;
711 static void gee_read_only_list_gee_list_interface_init (GeeListIface * iface) {
712 gee_read_only_list_gee_list_parent_iface = g_type_interface_peek_parent (iface);
713 iface->list_iterator = (GeeListIterator* (*)(GeeList*)) gee_read_only_list_real_list_iterator;
714 iface->index_of = (gint (*)(GeeList*, gconstpointer)) gee_read_only_list_real_index_of;
715 iface->insert = (void (*)(GeeList*, gint, gconstpointer)) gee_read_only_list_real_insert;
716 iface->remove_at = (gpointer (*)(GeeList*, gint)) gee_read_only_list_real_remove_at;
717 iface->get = (gpointer (*)(GeeList*, gint)) gee_read_only_list_real_get;
718 iface->set = (void (*)(GeeList*, gint, gconstpointer)) gee_read_only_list_real_set;
719 iface->slice = (GeeList* (*)(GeeList*, gint, gint)) gee_read_only_list_real_slice;
720 iface->first = (gpointer (*)(GeeList*)) gee_read_only_list_real_first;
721 iface->last = (gpointer (*)(GeeList*)) gee_read_only_list_real_last;
722 iface->insert_all = (void (*)(GeeList*, gint, GeeCollection*)) gee_read_only_list_real_insert_all;
723 iface->sort = (void (*)(GeeList*, GCompareDataFunc, void*, GDestroyNotify)) gee_read_only_list_real_sort;
724 iface->get_g_type = (GType(*)(GeeList*)) gee_read_only_list_gee_list_get_g_type;
725 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeList*)) gee_read_only_list_gee_list_get_g_dup_func;
726 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeList*)) gee_read_only_list_gee_list_get_g_destroy_func;
727 iface->get_read_only_view = (GeeList* (*) (GeeList *)) gee_read_only_list_get_read_only_view;
731 static void gee_read_only_list_instance_init (GeeReadOnlyList * self) {
732 self->priv = GEE_READ_ONLY_LIST_GET_PRIVATE (self);
737 * Read-only view for {@link List} collections.
739 * This class decorates any class which implements the {@link List}
740 * interface by making it read only. Any method which normally modify data will
745 GType gee_read_only_list_get_type (void) {
746 static volatile gsize gee_read_only_list_type_id__volatile = 0;
747 if (g_once_init_enter (&gee_read_only_list_type_id__volatile)) {
748 static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyList), 0, (GInstanceInitFunc) gee_read_only_list_instance_init, NULL };
749 static const GInterfaceInfo gee_list_info = { (GInterfaceInitFunc) gee_read_only_list_gee_list_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
750 GType gee_read_only_list_type_id;
751 gee_read_only_list_type_id = g_type_register_static (GEE_TYPE_READ_ONLY_COLLECTION, "GeeReadOnlyList", &g_define_type_info, 0);
752 g_type_add_interface_static (gee_read_only_list_type_id, GEE_TYPE_LIST, &gee_list_info);
753 g_once_init_leave (&gee_read_only_list_type_id__volatile, gee_read_only_list_type_id);
755 return gee_read_only_list_type_id__volatile;
759 static void _vala_gee_read_only_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
760 GeeReadOnlyList * self;
761 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList);
762 switch (property_id) {
763 case GEE_READ_ONLY_LIST_READ_ONLY_VIEW:
764 g_value_take_object (value, gee_read_only_list_get_read_only_view (self));
767 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
773 static void _vala_gee_read_only_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
774 GeeReadOnlyList * self;
775 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_LIST, GeeReadOnlyList);
776 switch (property_id) {
777 case GEE_READ_ONLY_LIST_G_TYPE:
778 self->priv->g_type = g_value_get_gtype (value);
780 case GEE_READ_ONLY_LIST_G_DUP_FUNC:
781 self->priv->g_dup_func = g_value_get_pointer (value);
783 case GEE_READ_ONLY_LIST_G_DESTROY_FUNC:
784 self->priv->g_destroy_func = g_value_get_pointer (value);
787 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);