1 /* abstractcollection.c generated by valac 0.18.0, the Vala compiler
2 * generated from abstractcollection.vala, do not modify */
4 /* abstractcollection.vala
6 * Copyright (C) 2007 Jürg Billeter
7 * Copyright (C) 2009 Didier Villevalois
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * Didier 'Ptitjes' Villevalois <ptitjes@free.fr>
28 #include <glib-object.h>
31 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
32 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
33 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
34 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
36 typedef struct _GeeTraversable GeeTraversable;
37 typedef struct _GeeTraversableIface GeeTraversableIface;
39 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
41 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
42 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
43 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
44 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
45 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
46 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
48 typedef struct _GeeLazy GeeLazy;
49 typedef struct _GeeLazyClass GeeLazyClass;
51 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
52 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
53 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
54 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
56 typedef struct _GeeIterator GeeIterator;
57 typedef struct _GeeIteratorIface GeeIteratorIface;
59 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
60 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
61 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
62 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
64 typedef struct _GeeIterable GeeIterable;
65 typedef struct _GeeIterableIface GeeIterableIface;
67 #define GEE_TYPE_COLLECTION (gee_collection_get_type ())
68 #define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection))
69 #define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION))
70 #define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface))
72 typedef struct _GeeCollection GeeCollection;
73 typedef struct _GeeCollectionIface GeeCollectionIface;
75 #define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ())
76 #define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection))
77 #define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
78 #define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION))
79 #define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION))
80 #define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
82 typedef struct _GeeAbstractCollection GeeAbstractCollection;
83 typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass;
84 typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate;
85 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
87 #define GEE_TYPE_READ_ONLY_COLLECTION (gee_read_only_collection_get_type ())
88 #define GEE_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection))
89 #define GEE_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass))
90 #define GEE_IS_READ_ONLY_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_READ_ONLY_COLLECTION))
91 #define GEE_IS_READ_ONLY_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_READ_ONLY_COLLECTION))
92 #define GEE_READ_ONLY_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionClass))
94 typedef struct _GeeReadOnlyCollection GeeReadOnlyCollection;
95 typedef struct _GeeReadOnlyCollectionClass GeeReadOnlyCollectionClass;
97 typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
99 GEE_TRAVERSABLE_STREAM_YIELD,
100 GEE_TRAVERSABLE_STREAM_CONTINUE,
101 GEE_TRAVERSABLE_STREAM_END
102 } GeeTraversableStream;
104 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, void* user_data);
105 struct _GeeIteratorIface {
106 GTypeInterface parent_iface;
107 gboolean (*next) (GeeIterator* self);
108 gboolean (*has_next) (GeeIterator* self);
109 gpointer (*get) (GeeIterator* self);
110 void (*remove) (GeeIterator* self);
111 gboolean (*get_valid) (GeeIterator* self);
112 gboolean (*get_read_only) (GeeIterator* self);
115 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, void* user_data);
116 typedef gpointer (*GeeMapFunc) (gpointer g, void* user_data);
117 typedef gboolean (*GeePredicate) (gconstpointer g, void* user_data);
118 struct _GeeTraversableIface {
119 GTypeInterface parent_iface;
120 GType (*get_g_type) (GeeTraversable* self);
121 GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
122 GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
123 gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, void* f_target);
124 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);
125 gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
126 GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
127 GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
128 GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
129 GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
130 GType (*get_element_type) (GeeTraversable* self);
133 struct _GeeIterableIface {
134 GTypeInterface parent_iface;
135 GType (*get_g_type) (GeeIterable* self);
136 GBoxedCopyFunc (*get_g_dup_func) (GeeIterable* self);
137 GDestroyNotify (*get_g_destroy_func) (GeeIterable* self);
138 GeeIterator* (*iterator) (GeeIterable* self);
141 struct _GeeCollectionIface {
142 GTypeInterface parent_iface;
143 GType (*get_g_type) (GeeCollection* self);
144 GBoxedCopyFunc (*get_g_dup_func) (GeeCollection* self);
145 GDestroyNotify (*get_g_destroy_func) (GeeCollection* self);
146 gboolean (*contains) (GeeCollection* self, gconstpointer item);
147 gboolean (*add) (GeeCollection* self, gconstpointer item);
148 gboolean (*remove) (GeeCollection* self, gconstpointer item);
149 void (*clear) (GeeCollection* self);
150 gboolean (*add_all) (GeeCollection* self, GeeCollection* collection);
151 gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection);
152 gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection);
153 gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection);
154 gpointer* (*to_array) (GeeCollection* self, int* result_length1);
155 gint (*get_size) (GeeCollection* self);
156 gboolean (*get_is_empty) (GeeCollection* self);
157 gboolean (*get_read_only) (GeeCollection* self);
158 GeeCollection* (*get_read_only_view) (GeeCollection* self);
161 struct _GeeAbstractCollection {
162 GObject parent_instance;
163 GeeAbstractCollectionPrivate * priv;
166 struct _GeeAbstractCollectionClass {
167 GObjectClass parent_class;
168 gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item);
169 gboolean (*add) (GeeAbstractCollection* self, gconstpointer item);
170 gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item);
171 void (*clear) (GeeAbstractCollection* self);
172 GeeIterator* (*iterator) (GeeAbstractCollection* self);
173 gboolean (*foreach) (GeeAbstractCollection* self, GeeForallFunc f, void* f_target);
174 void (*reserved0) (GeeAbstractCollection* self);
175 void (*reserved1) (GeeAbstractCollection* self);
176 void (*reserved2) (GeeAbstractCollection* self);
177 void (*reserved3) (GeeAbstractCollection* self);
178 void (*reserved4) (GeeAbstractCollection* self);
179 void (*reserved5) (GeeAbstractCollection* self);
180 void (*reserved6) (GeeAbstractCollection* self);
181 void (*reserved7) (GeeAbstractCollection* self);
182 void (*reserved8) (GeeAbstractCollection* self);
183 void (*reserved9) (GeeAbstractCollection* self);
184 gint (*get_size) (GeeAbstractCollection* self);
185 gboolean (*get_read_only) (GeeAbstractCollection* self);
186 GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self);
189 struct _GeeAbstractCollectionPrivate {
191 GBoxedCopyFunc g_dup_func;
192 GDestroyNotify g_destroy_func;
193 GeeCollection* _read_only_view;
197 static gpointer gee_abstract_collection_parent_class = NULL;
198 static GeeTraversableIface* gee_abstract_collection_gee_traversable_parent_iface = NULL;
199 static GeeIterableIface* gee_abstract_collection_gee_iterable_parent_iface = NULL;
200 static GeeCollectionIface* gee_abstract_collection_gee_collection_parent_iface = NULL;
202 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
203 gpointer gee_lazy_ref (gpointer instance);
204 void gee_lazy_unref (gpointer instance);
205 GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
206 void gee_value_set_lazy (GValue* value, gpointer v_object);
207 void gee_value_take_lazy (GValue* value, gpointer v_object);
208 gpointer gee_value_get_lazy (const GValue* value);
209 GType gee_lazy_get_type (void) G_GNUC_CONST;
210 GType gee_iterator_get_type (void) G_GNUC_CONST;
211 GType gee_traversable_get_type (void) G_GNUC_CONST;
212 GType gee_iterable_get_type (void) G_GNUC_CONST;
213 GType gee_collection_get_type (void) G_GNUC_CONST;
214 GType gee_abstract_collection_get_type (void) G_GNUC_CONST;
215 #define GEE_ABSTRACT_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionPrivate))
217 GEE_ABSTRACT_COLLECTION_DUMMY_PROPERTY,
218 GEE_ABSTRACT_COLLECTION_G_TYPE,
219 GEE_ABSTRACT_COLLECTION_G_DUP_FUNC,
220 GEE_ABSTRACT_COLLECTION_G_DESTROY_FUNC,
221 GEE_ABSTRACT_COLLECTION_SIZE,
222 GEE_ABSTRACT_COLLECTION_READ_ONLY,
223 GEE_ABSTRACT_COLLECTION_READ_ONLY_VIEW
225 gboolean gee_abstract_collection_contains (GeeAbstractCollection* self, gconstpointer item);
226 static gboolean gee_abstract_collection_real_contains (GeeAbstractCollection* self, gconstpointer item);
227 gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item);
228 static gboolean gee_abstract_collection_real_add (GeeAbstractCollection* self, gconstpointer item);
229 gboolean gee_abstract_collection_remove (GeeAbstractCollection* self, gconstpointer item);
230 static gboolean gee_abstract_collection_real_remove (GeeAbstractCollection* self, gconstpointer item);
231 void gee_abstract_collection_clear (GeeAbstractCollection* self);
232 static void gee_abstract_collection_real_clear (GeeAbstractCollection* self);
233 GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self);
234 static GeeIterator* gee_abstract_collection_real_iterator (GeeAbstractCollection* self);
235 gboolean gee_abstract_collection_foreach (GeeAbstractCollection* self, GeeForallFunc f, void* f_target);
236 static gboolean gee_abstract_collection_real_foreach (GeeAbstractCollection* self, GeeForallFunc f, void* f_target);
237 gboolean gee_traversable_foreach (GeeTraversable* self, GeeForallFunc f, void* f_target);
238 void gee_abstract_collection_reserved0 (GeeAbstractCollection* self);
239 static void gee_abstract_collection_real_reserved0 (GeeAbstractCollection* self);
240 void gee_abstract_collection_reserved1 (GeeAbstractCollection* self);
241 static void gee_abstract_collection_real_reserved1 (GeeAbstractCollection* self);
242 void gee_abstract_collection_reserved2 (GeeAbstractCollection* self);
243 static void gee_abstract_collection_real_reserved2 (GeeAbstractCollection* self);
244 void gee_abstract_collection_reserved3 (GeeAbstractCollection* self);
245 static void gee_abstract_collection_real_reserved3 (GeeAbstractCollection* self);
246 void gee_abstract_collection_reserved4 (GeeAbstractCollection* self);
247 static void gee_abstract_collection_real_reserved4 (GeeAbstractCollection* self);
248 void gee_abstract_collection_reserved5 (GeeAbstractCollection* self);
249 static void gee_abstract_collection_real_reserved5 (GeeAbstractCollection* self);
250 void gee_abstract_collection_reserved6 (GeeAbstractCollection* self);
251 static void gee_abstract_collection_real_reserved6 (GeeAbstractCollection* self);
252 void gee_abstract_collection_reserved7 (GeeAbstractCollection* self);
253 static void gee_abstract_collection_real_reserved7 (GeeAbstractCollection* self);
254 void gee_abstract_collection_reserved8 (GeeAbstractCollection* self);
255 static void gee_abstract_collection_real_reserved8 (GeeAbstractCollection* self);
256 void gee_abstract_collection_reserved9 (GeeAbstractCollection* self);
257 static void gee_abstract_collection_real_reserved9 (GeeAbstractCollection* self);
258 GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
259 gint gee_abstract_collection_get_size (GeeAbstractCollection* self);
260 gboolean gee_abstract_collection_get_read_only (GeeAbstractCollection* self);
261 GeeCollection* gee_abstract_collection_get_read_only_view (GeeAbstractCollection* self);
262 GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection);
263 GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection);
264 GType gee_read_only_collection_get_type (void) G_GNUC_CONST;
265 static void gee_abstract_collection_finalize (GObject* obj);
266 static void _vala_gee_abstract_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
267 static void _vala_gee_abstract_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
273 static gboolean gee_abstract_collection_real_contains (GeeAbstractCollection* self, gconstpointer item) {
274 g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_contains'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
279 gboolean gee_abstract_collection_contains (GeeAbstractCollection* self, gconstpointer item) {
280 g_return_val_if_fail (self != NULL, FALSE);
281 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->contains (self, item);
288 static gboolean gee_abstract_collection_real_add (GeeAbstractCollection* self, gconstpointer item) {
289 g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_add'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
294 gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item) {
295 g_return_val_if_fail (self != NULL, FALSE);
296 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->add (self, item);
303 static gboolean gee_abstract_collection_real_remove (GeeAbstractCollection* self, gconstpointer item) {
304 g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
309 gboolean gee_abstract_collection_remove (GeeAbstractCollection* self, gconstpointer item) {
310 g_return_val_if_fail (self != NULL, FALSE);
311 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->remove (self, item);
318 static void gee_abstract_collection_real_clear (GeeAbstractCollection* self) {
319 g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_clear'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
324 void gee_abstract_collection_clear (GeeAbstractCollection* self) {
325 g_return_if_fail (self != NULL);
326 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->clear (self);
333 static GeeIterator* gee_abstract_collection_real_iterator (GeeAbstractCollection* self) {
334 g_critical ("Type `%s' does not implement abstract method `gee_abstract_collection_iterator'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
339 GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self) {
340 g_return_val_if_fail (self != NULL, NULL);
341 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->iterator (self);
345 static gboolean gee_abstract_collection_real_foreach (GeeAbstractCollection* self, GeeForallFunc f, void* f_target) {
346 gboolean result = FALSE;
347 GeeIterator* _tmp0_ = NULL;
349 GeeForallFunc _tmp2_;
351 gboolean _tmp3_ = FALSE;
353 _tmp0_ = gee_abstract_collection_iterator (self);
356 _tmp2__target = f_target;
357 _tmp3_ = gee_traversable_foreach ((GeeTraversable*) _tmp1_, _tmp2_, _tmp2__target);
359 _g_object_unref0 (_tmp1_);
365 gboolean gee_abstract_collection_foreach (GeeAbstractCollection* self, GeeForallFunc f, void* f_target) {
366 g_return_val_if_fail (self != NULL, FALSE);
367 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->foreach (self, f, f_target);
371 static void gee_abstract_collection_real_reserved0 (GeeAbstractCollection* self) {
375 void gee_abstract_collection_reserved0 (GeeAbstractCollection* self) {
376 g_return_if_fail (self != NULL);
377 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved0 (self);
381 static void gee_abstract_collection_real_reserved1 (GeeAbstractCollection* self) {
385 void gee_abstract_collection_reserved1 (GeeAbstractCollection* self) {
386 g_return_if_fail (self != NULL);
387 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved1 (self);
391 static void gee_abstract_collection_real_reserved2 (GeeAbstractCollection* self) {
395 void gee_abstract_collection_reserved2 (GeeAbstractCollection* self) {
396 g_return_if_fail (self != NULL);
397 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved2 (self);
401 static void gee_abstract_collection_real_reserved3 (GeeAbstractCollection* self) {
405 void gee_abstract_collection_reserved3 (GeeAbstractCollection* self) {
406 g_return_if_fail (self != NULL);
407 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved3 (self);
411 static void gee_abstract_collection_real_reserved4 (GeeAbstractCollection* self) {
415 void gee_abstract_collection_reserved4 (GeeAbstractCollection* self) {
416 g_return_if_fail (self != NULL);
417 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved4 (self);
421 static void gee_abstract_collection_real_reserved5 (GeeAbstractCollection* self) {
425 void gee_abstract_collection_reserved5 (GeeAbstractCollection* self) {
426 g_return_if_fail (self != NULL);
427 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved5 (self);
431 static void gee_abstract_collection_real_reserved6 (GeeAbstractCollection* self) {
435 void gee_abstract_collection_reserved6 (GeeAbstractCollection* self) {
436 g_return_if_fail (self != NULL);
437 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved6 (self);
441 static void gee_abstract_collection_real_reserved7 (GeeAbstractCollection* self) {
445 void gee_abstract_collection_reserved7 (GeeAbstractCollection* self) {
446 g_return_if_fail (self != NULL);
447 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved7 (self);
451 static void gee_abstract_collection_real_reserved8 (GeeAbstractCollection* self) {
455 void gee_abstract_collection_reserved8 (GeeAbstractCollection* self) {
456 g_return_if_fail (self != NULL);
457 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved8 (self);
461 static void gee_abstract_collection_real_reserved9 (GeeAbstractCollection* self) {
465 void gee_abstract_collection_reserved9 (GeeAbstractCollection* self) {
466 g_return_if_fail (self != NULL);
467 GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->reserved9 (self);
471 GeeAbstractCollection* gee_abstract_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
472 GeeAbstractCollection * self = NULL;
473 self = (GeeAbstractCollection*) g_object_new (object_type, NULL);
474 self->priv->g_type = g_type;
475 self->priv->g_dup_func = g_dup_func;
476 self->priv->g_destroy_func = g_destroy_func;
481 gint gee_abstract_collection_get_size (GeeAbstractCollection* self) {
482 g_return_val_if_fail (self != NULL, 0);
483 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->get_size (self);
487 gboolean gee_abstract_collection_get_read_only (GeeAbstractCollection* self) {
488 g_return_val_if_fail (self != NULL, FALSE);
489 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->get_read_only (self);
493 GeeCollection* gee_abstract_collection_get_read_only_view (GeeAbstractCollection* self) {
494 g_return_val_if_fail (self != NULL, NULL);
495 return GEE_ABSTRACT_COLLECTION_GET_CLASS (self)->get_read_only_view (self);
499 static gpointer _g_object_ref0 (gpointer self) {
500 return self ? g_object_ref (self) : NULL;
504 static GeeCollection* gee_abstract_collection_real_get_read_only_view (GeeAbstractCollection* base) {
505 GeeCollection* result;
506 GeeAbstractCollection* self;
507 GeeCollection* _tmp0_;
508 GeeCollection* _tmp1_;
509 GeeCollection* instance;
510 GeeCollection* _tmp2_;
512 _tmp0_ = self->priv->_read_only_view;
513 _tmp1_ = _g_object_ref0 (_tmp0_);
515 _tmp2_ = self->priv->_read_only_view;
516 if (_tmp2_ == NULL) {
517 GeeReadOnlyCollection* _tmp3_;
518 GeeCollection* _tmp4_;
519 GeeCollection* _tmp5_;
520 _tmp3_ = gee_read_only_collection_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeCollection*) self);
521 _g_object_unref0 (instance);
522 instance = (GeeCollection*) _tmp3_;
524 self->priv->_read_only_view = _tmp4_;
526 g_object_add_weak_pointer ((GObject*) _tmp5_, (void**) (&self->priv->_read_only_view));
533 static void gee_abstract_collection_class_init (GeeAbstractCollectionClass * klass) {
534 gee_abstract_collection_parent_class = g_type_class_peek_parent (klass);
535 g_type_class_add_private (klass, sizeof (GeeAbstractCollectionPrivate));
536 GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_abstract_collection_real_contains;
537 GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_abstract_collection_real_add;
538 GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_abstract_collection_real_remove;
539 GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_abstract_collection_real_clear;
540 GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_abstract_collection_real_iterator;
541 GEE_ABSTRACT_COLLECTION_CLASS (klass)->foreach = gee_abstract_collection_real_foreach;
542 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved0 = gee_abstract_collection_real_reserved0;
543 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved1 = gee_abstract_collection_real_reserved1;
544 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved2 = gee_abstract_collection_real_reserved2;
545 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved3 = gee_abstract_collection_real_reserved3;
546 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved4 = gee_abstract_collection_real_reserved4;
547 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved5 = gee_abstract_collection_real_reserved5;
548 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved6 = gee_abstract_collection_real_reserved6;
549 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved7 = gee_abstract_collection_real_reserved7;
550 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved8 = gee_abstract_collection_real_reserved8;
551 GEE_ABSTRACT_COLLECTION_CLASS (klass)->reserved9 = gee_abstract_collection_real_reserved9;
552 GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_read_only_view = gee_abstract_collection_real_get_read_only_view;
553 G_OBJECT_CLASS (klass)->get_property = _vala_gee_abstract_collection_get_property;
554 G_OBJECT_CLASS (klass)->set_property = _vala_gee_abstract_collection_set_property;
555 G_OBJECT_CLASS (klass)->finalize = gee_abstract_collection_finalize;
556 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_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));
557 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_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));
558 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_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));
562 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
566 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_READ_ONLY, g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
570 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ABSTRACT_COLLECTION_READ_ONLY_VIEW, g_param_spec_object ("read-only-view", "read-only-view", "read-only-view", GEE_TYPE_COLLECTION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
574 static GType gee_abstract_collection_gee_traversable_get_g_type (GeeAbstractCollection* self) {
575 return self->priv->g_type;
579 static GBoxedCopyFunc gee_abstract_collection_gee_traversable_get_g_dup_func (GeeAbstractCollection* self) {
580 return self->priv->g_dup_func;
584 static GDestroyNotify gee_abstract_collection_gee_traversable_get_g_destroy_func (GeeAbstractCollection* self) {
585 return self->priv->g_destroy_func;
589 static void gee_abstract_collection_gee_traversable_interface_init (GeeTraversableIface * iface) {
590 gee_abstract_collection_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
591 iface->foreach = (gboolean (*)(GeeTraversable*, GeeForallFunc, void*)) gee_abstract_collection_foreach;
592 iface->get_g_type = (GType(*)(GeeTraversable*)) gee_abstract_collection_gee_traversable_get_g_type;
593 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeTraversable*)) gee_abstract_collection_gee_traversable_get_g_dup_func;
594 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeTraversable*)) gee_abstract_collection_gee_traversable_get_g_destroy_func;
598 static GType gee_abstract_collection_gee_iterable_get_g_type (GeeAbstractCollection* self) {
599 return self->priv->g_type;
603 static GBoxedCopyFunc gee_abstract_collection_gee_iterable_get_g_dup_func (GeeAbstractCollection* self) {
604 return self->priv->g_dup_func;
608 static GDestroyNotify gee_abstract_collection_gee_iterable_get_g_destroy_func (GeeAbstractCollection* self) {
609 return self->priv->g_destroy_func;
613 static void gee_abstract_collection_gee_iterable_interface_init (GeeIterableIface * iface) {
614 gee_abstract_collection_gee_iterable_parent_iface = g_type_interface_peek_parent (iface);
615 iface->iterator = (GeeIterator* (*)(GeeIterable*)) gee_abstract_collection_iterator;
616 iface->get_g_type = (GType(*)(GeeIterable*)) gee_abstract_collection_gee_iterable_get_g_type;
617 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeIterable*)) gee_abstract_collection_gee_iterable_get_g_dup_func;
618 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeIterable*)) gee_abstract_collection_gee_iterable_get_g_destroy_func;
622 static GType gee_abstract_collection_gee_collection_get_g_type (GeeAbstractCollection* self) {
623 return self->priv->g_type;
627 static GBoxedCopyFunc gee_abstract_collection_gee_collection_get_g_dup_func (GeeAbstractCollection* self) {
628 return self->priv->g_dup_func;
632 static GDestroyNotify gee_abstract_collection_gee_collection_get_g_destroy_func (GeeAbstractCollection* self) {
633 return self->priv->g_destroy_func;
637 static void gee_abstract_collection_gee_collection_interface_init (GeeCollectionIface * iface) {
638 gee_abstract_collection_gee_collection_parent_iface = g_type_interface_peek_parent (iface);
639 iface->contains = (gboolean (*)(GeeCollection*, gconstpointer)) gee_abstract_collection_contains;
640 iface->add = (gboolean (*)(GeeCollection*, gconstpointer)) gee_abstract_collection_add;
641 iface->remove = (gboolean (*)(GeeCollection*, gconstpointer)) gee_abstract_collection_remove;
642 iface->clear = (void (*)(GeeCollection*)) gee_abstract_collection_clear;
643 iface->get_g_type = (GType(*)(GeeCollection*)) gee_abstract_collection_gee_collection_get_g_type;
644 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeCollection*)) gee_abstract_collection_gee_collection_get_g_dup_func;
645 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeCollection*)) gee_abstract_collection_gee_collection_get_g_destroy_func;
646 iface->get_size = (gint (*) (GeeCollection *)) gee_abstract_collection_get_size;
647 iface->get_read_only = (gboolean (*) (GeeCollection *)) gee_abstract_collection_get_read_only;
648 iface->get_read_only_view = (GeeCollection* (*) (GeeCollection *)) gee_abstract_collection_get_read_only_view;
652 static void gee_abstract_collection_instance_init (GeeAbstractCollection * self) {
653 self->priv = GEE_ABSTRACT_COLLECTION_GET_PRIVATE (self);
657 static void gee_abstract_collection_finalize (GObject* obj) {
658 GeeAbstractCollection * self;
659 self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection);
660 G_OBJECT_CLASS (gee_abstract_collection_parent_class)->finalize (obj);
665 * Skeletal implementation of the {@link Collection} interface.
667 * Contains common code shared by all collection implementations.
671 * @see AbstractMultiSet
673 GType gee_abstract_collection_get_type (void) {
674 static volatile gsize gee_abstract_collection_type_id__volatile = 0;
675 if (g_once_init_enter (&gee_abstract_collection_type_id__volatile)) {
676 static const GTypeInfo g_define_type_info = { sizeof (GeeAbstractCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_abstract_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeAbstractCollection), 0, (GInstanceInitFunc) gee_abstract_collection_instance_init, NULL };
677 static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gee_abstract_collection_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
678 static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gee_abstract_collection_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
679 static const GInterfaceInfo gee_collection_info = { (GInterfaceInitFunc) gee_abstract_collection_gee_collection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
680 GType gee_abstract_collection_type_id;
681 gee_abstract_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeAbstractCollection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
682 g_type_add_interface_static (gee_abstract_collection_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
683 g_type_add_interface_static (gee_abstract_collection_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info);
684 g_type_add_interface_static (gee_abstract_collection_type_id, GEE_TYPE_COLLECTION, &gee_collection_info);
685 g_once_init_leave (&gee_abstract_collection_type_id__volatile, gee_abstract_collection_type_id);
687 return gee_abstract_collection_type_id__volatile;
691 static void _vala_gee_abstract_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
692 GeeAbstractCollection * self;
693 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection);
694 switch (property_id) {
695 case GEE_ABSTRACT_COLLECTION_READ_ONLY_VIEW:
696 g_value_take_object (value, gee_abstract_collection_get_read_only_view (self));
699 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
705 static void _vala_gee_abstract_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
706 GeeAbstractCollection * self;
707 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection);
708 switch (property_id) {
709 case GEE_ABSTRACT_COLLECTION_G_TYPE:
710 self->priv->g_type = g_value_get_gtype (value);
712 case GEE_ABSTRACT_COLLECTION_G_DUP_FUNC:
713 self->priv->g_dup_func = g_value_get_pointer (value);
715 case GEE_ABSTRACT_COLLECTION_G_DESTROY_FUNC:
716 self->priv->g_destroy_func = g_value_get_pointer (value);
719 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);