1 /* readonlycollection.c generated by valac 0.18.0, the Vala compiler
2 * generated from readonlycollection.vala, do not modify */
4 /* readonlycollection.vala
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;
84 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
86 #define GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR (gee_read_only_collection_iterator_get_type ())
87 #define GEE_READ_ONLY_COLLECTION_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator))
88 #define GEE_READ_ONLY_COLLECTION_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass))
89 #define GEE_READ_ONLY_COLLECTION_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR))
90 #define GEE_READ_ONLY_COLLECTION_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR))
91 #define GEE_READ_ONLY_COLLECTION_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorClass))
93 typedef struct _GeeReadOnlyCollectionIterator GeeReadOnlyCollectionIterator;
94 typedef struct _GeeReadOnlyCollectionIteratorClass GeeReadOnlyCollectionIteratorClass;
95 typedef struct _GeeReadOnlyCollectionIteratorPrivate GeeReadOnlyCollectionIteratorPrivate;
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 _GeeReadOnlyCollection {
162 GObject parent_instance;
163 GeeReadOnlyCollectionPrivate * priv;
164 GeeCollection* _collection;
167 struct _GeeReadOnlyCollectionClass {
168 GObjectClass parent_class;
169 GeeCollection* (*get_read_only_view) (GeeReadOnlyCollection* self);
172 struct _GeeReadOnlyCollectionPrivate {
174 GBoxedCopyFunc g_dup_func;
175 GDestroyNotify g_destroy_func;
178 struct _GeeReadOnlyCollectionIterator {
179 GObject parent_instance;
180 GeeReadOnlyCollectionIteratorPrivate * priv;
184 struct _GeeReadOnlyCollectionIteratorClass {
185 GObjectClass parent_class;
188 struct _GeeReadOnlyCollectionIteratorPrivate {
190 GBoxedCopyFunc g_dup_func;
191 GDestroyNotify g_destroy_func;
195 static gpointer gee_read_only_collection_parent_class = NULL;
196 static gpointer gee_read_only_collection_iterator_parent_class = NULL;
197 static GeeTraversableIface* gee_read_only_collection_iterator_gee_traversable_parent_iface = NULL;
198 static GeeIteratorIface* gee_read_only_collection_iterator_gee_iterator_parent_iface = NULL;
199 static GeeTraversableIface* gee_read_only_collection_gee_traversable_parent_iface = NULL;
200 static GeeIterableIface* gee_read_only_collection_gee_iterable_parent_iface = NULL;
201 static GeeCollectionIface* gee_read_only_collection_gee_collection_parent_iface = NULL;
203 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
204 gpointer gee_lazy_ref (gpointer instance);
205 void gee_lazy_unref (gpointer instance);
206 GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
207 void gee_value_set_lazy (GValue* value, gpointer v_object);
208 void gee_value_take_lazy (GValue* value, gpointer v_object);
209 gpointer gee_value_get_lazy (const GValue* value);
210 GType gee_lazy_get_type (void) G_GNUC_CONST;
211 GType gee_iterator_get_type (void) G_GNUC_CONST;
212 GType gee_traversable_get_type (void) G_GNUC_CONST;
213 GType gee_iterable_get_type (void) G_GNUC_CONST;
214 GType gee_collection_get_type (void) G_GNUC_CONST;
215 GType gee_read_only_collection_get_type (void) G_GNUC_CONST;
216 #define GEE_READ_ONLY_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollectionPrivate))
218 GEE_READ_ONLY_COLLECTION_DUMMY_PROPERTY,
219 GEE_READ_ONLY_COLLECTION_G_TYPE,
220 GEE_READ_ONLY_COLLECTION_G_DUP_FUNC,
221 GEE_READ_ONLY_COLLECTION_G_DESTROY_FUNC,
222 GEE_READ_ONLY_COLLECTION_SIZE,
223 GEE_READ_ONLY_COLLECTION_READ_ONLY,
224 GEE_READ_ONLY_COLLECTION_READ_ONLY_VIEW
226 GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection);
227 GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection);
228 static gboolean gee_read_only_collection_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target);
229 gboolean gee_traversable_foreach (GeeTraversable* self, GeeForallFunc f, void* f_target);
230 static GeeIterator* gee_read_only_collection_real_stream (GeeTraversable* base, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
231 GeeIterator* gee_traversable_stream (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
232 static GeeIterator* gee_read_only_collection_real_filter (GeeTraversable* base, GeePredicate f, void* f_target, GDestroyNotify f_target_destroy_notify);
233 GeeIterator* gee_traversable_filter (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
234 static GeeIterator* gee_read_only_collection_real_chop (GeeTraversable* base, gint offset, gint length);
235 GeeIterator* gee_traversable_chop (GeeTraversable* self, gint offset, gint length);
236 static GeeIterator* gee_read_only_collection_real_iterator (GeeIterable* base);
237 GeeIterator* gee_iterable_iterator (GeeIterable* self);
238 GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator);
239 GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator);
240 GType gee_read_only_collection_iterator_get_type (void) G_GNUC_CONST;
241 static gboolean gee_read_only_collection_real_contains (GeeCollection* base, gconstpointer item);
242 gboolean gee_collection_contains (GeeCollection* self, gconstpointer item);
243 static gboolean gee_read_only_collection_real_add (GeeCollection* base, gconstpointer item);
244 static gboolean gee_read_only_collection_real_remove (GeeCollection* base, gconstpointer item);
245 static void gee_read_only_collection_real_clear (GeeCollection* base);
246 static gboolean gee_read_only_collection_real_add_all (GeeCollection* base, GeeCollection* collection);
247 static gboolean gee_read_only_collection_real_contains_all (GeeCollection* base, GeeCollection* collection);
248 gboolean gee_collection_contains_all (GeeCollection* self, GeeCollection* collection);
249 static gboolean gee_read_only_collection_real_remove_all (GeeCollection* base, GeeCollection* collection);
250 static gboolean gee_read_only_collection_real_retain_all (GeeCollection* base, GeeCollection* collection);
251 static gpointer* gee_read_only_collection_real_to_array (GeeCollection* base, int* result_length1);
252 gpointer* gee_collection_to_array (GeeCollection* self, int* result_length1);
253 gint gee_collection_get_size (GeeCollection* self);
254 gboolean gee_collection_get_is_empty (GeeCollection* self);
255 GeeCollection* gee_read_only_collection_get_read_only_view (GeeReadOnlyCollection* self);
256 #define GEE_READ_ONLY_COLLECTION_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIteratorPrivate))
258 GEE_READ_ONLY_COLLECTION_ITERATOR_DUMMY_PROPERTY,
259 GEE_READ_ONLY_COLLECTION_ITERATOR_G_TYPE,
260 GEE_READ_ONLY_COLLECTION_ITERATOR_G_DUP_FUNC,
261 GEE_READ_ONLY_COLLECTION_ITERATOR_G_DESTROY_FUNC,
262 GEE_READ_ONLY_COLLECTION_ITERATOR_VALID,
263 GEE_READ_ONLY_COLLECTION_ITERATOR_READ_ONLY
265 static gboolean gee_read_only_collection_iterator_real_next (GeeIterator* base);
266 gboolean gee_iterator_next (GeeIterator* self);
267 static gboolean gee_read_only_collection_iterator_real_has_next (GeeIterator* base);
268 gboolean gee_iterator_has_next (GeeIterator* self);
269 static gpointer gee_read_only_collection_iterator_real_get (GeeIterator* base);
270 gpointer gee_iterator_get (GeeIterator* self);
271 static void gee_read_only_collection_iterator_real_remove (GeeIterator* base);
272 static gboolean gee_read_only_collection_iterator_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target);
273 static GeeIterator* gee_read_only_collection_iterator_real_stream (GeeTraversable* base, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
274 static GeeIterator* gee_read_only_collection_iterator_real_filter (GeeTraversable* base, GeePredicate f, void* f_target, GDestroyNotify f_target_destroy_notify);
275 static GeeIterator* gee_read_only_collection_iterator_real_chop (GeeTraversable* base, gint offset, gint length);
276 gboolean gee_iterator_get_valid (GeeIterator* self);
277 static void gee_read_only_collection_iterator_finalize (GObject* obj);
278 gboolean gee_iterator_get_read_only (GeeIterator* self);
279 static void _vala_gee_read_only_collection_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
280 static void _vala_gee_read_only_collection_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
281 static void gee_read_only_collection_finalize (GObject* obj);
282 gboolean gee_collection_get_read_only (GeeCollection* self);
283 static void _vala_gee_read_only_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
284 static void _vala_gee_read_only_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
288 * Constructs a read-only collection that mirrors the content of the
289 * specified collection.
291 * @param collection the collection to decorate.
293 static gpointer _g_object_ref0 (gpointer self) {
294 return self ? g_object_ref (self) : NULL;
298 GeeReadOnlyCollection* gee_read_only_collection_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection) {
299 GeeReadOnlyCollection * self = NULL;
300 GeeCollection* _tmp0_;
301 GeeCollection* _tmp1_;
302 g_return_val_if_fail (collection != NULL, NULL);
303 self = (GeeReadOnlyCollection*) g_object_new (object_type, NULL);
304 self->priv->g_type = g_type;
305 self->priv->g_dup_func = g_dup_func;
306 self->priv->g_destroy_func = g_destroy_func;
308 _tmp1_ = _g_object_ref0 (_tmp0_);
309 _g_object_unref0 (self->_collection);
310 self->_collection = _tmp1_;
315 GeeReadOnlyCollection* gee_read_only_collection_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeCollection* collection) {
316 return gee_read_only_collection_construct (GEE_TYPE_READ_ONLY_COLLECTION, g_type, g_dup_func, g_destroy_func, collection);
323 static gboolean gee_read_only_collection_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target) {
324 GeeReadOnlyCollection * self;
325 gboolean result = FALSE;
326 GeeCollection* _tmp0_;
327 GeeForallFunc _tmp1_;
329 gboolean _tmp2_ = FALSE;
330 self = (GeeReadOnlyCollection*) base;
331 _tmp0_ = self->_collection;
333 _tmp1__target = f_target;
334 _tmp2_ = gee_traversable_foreach ((GeeTraversable*) _tmp0_, _tmp1_, _tmp1__target);
343 static GeeIterator* gee_read_only_collection_real_stream (GeeTraversable* base, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify) {
344 GeeReadOnlyCollection * self;
345 GeeIterator* result = NULL;
346 GeeCollection* _tmp0_;
347 GeeStreamFunc _tmp1_;
349 GDestroyNotify _tmp1__target_destroy_notify;
350 GeeIterator* _tmp2_ = NULL;
351 self = (GeeReadOnlyCollection*) base;
352 _tmp0_ = self->_collection;
354 _tmp1__target = f_target;
355 _tmp1__target_destroy_notify = f_target_destroy_notify;
356 f_target_destroy_notify = NULL;
357 _tmp2_ = gee_traversable_stream ((GeeTraversable*) _tmp0_, a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, _tmp1_, _tmp1__target, _tmp1__target_destroy_notify);
359 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
362 f_target_destroy_notify = NULL;
370 static GeeIterator* gee_read_only_collection_real_filter (GeeTraversable* base, GeePredicate f, void* f_target, GDestroyNotify f_target_destroy_notify) {
371 GeeReadOnlyCollection * self;
372 GeeIterator* result = NULL;
373 GeeCollection* _tmp0_;
376 GDestroyNotify _tmp1__target_destroy_notify;
377 GeeIterator* _tmp2_ = NULL;
378 self = (GeeReadOnlyCollection*) base;
379 _tmp0_ = self->_collection;
381 _tmp1__target = f_target;
382 _tmp1__target_destroy_notify = f_target_destroy_notify;
383 f_target_destroy_notify = NULL;
384 _tmp2_ = gee_traversable_filter ((GeeTraversable*) _tmp0_, _tmp1_, _tmp1__target, _tmp1__target_destroy_notify);
386 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
389 f_target_destroy_notify = NULL;
397 static GeeIterator* gee_read_only_collection_real_chop (GeeTraversable* base, gint offset, gint length) {
398 GeeReadOnlyCollection * self;
399 GeeIterator* result = NULL;
400 GeeCollection* _tmp0_;
403 GeeIterator* _tmp3_ = NULL;
404 self = (GeeReadOnlyCollection*) base;
405 _tmp0_ = self->_collection;
408 _tmp3_ = gee_traversable_chop ((GeeTraversable*) _tmp0_, _tmp1_, _tmp2_);
417 static GeeIterator* gee_read_only_collection_real_iterator (GeeIterable* base) {
418 GeeReadOnlyCollection * self;
419 GeeIterator* result = NULL;
420 GeeCollection* _tmp0_;
421 GeeIterator* _tmp1_ = NULL;
423 GeeReadOnlyCollectionIterator* _tmp3_;
425 self = (GeeReadOnlyCollection*) base;
426 _tmp0_ = self->_collection;
427 _tmp1_ = gee_iterable_iterator ((GeeIterable*) _tmp0_);
429 _tmp3_ = gee_read_only_collection_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp2_);
430 _tmp4_ = (GeeIterator*) _tmp3_;
431 _g_object_unref0 (_tmp2_);
440 static gboolean gee_read_only_collection_real_contains (GeeCollection* base, gconstpointer item) {
441 GeeReadOnlyCollection * self;
442 gboolean result = FALSE;
443 GeeCollection* _tmp0_;
444 gconstpointer _tmp1_;
445 gboolean _tmp2_ = FALSE;
446 self = (GeeReadOnlyCollection*) base;
447 _tmp0_ = self->_collection;
449 _tmp2_ = gee_collection_contains (_tmp0_, _tmp1_);
456 * Unimplemented method (read only collection).
458 static gboolean gee_read_only_collection_real_add (GeeCollection* base, gconstpointer item) {
459 GeeReadOnlyCollection * self;
460 gboolean result = FALSE;
461 self = (GeeReadOnlyCollection*) base;
462 g_assert_not_reached ();
468 * Unimplemented method (read only collection).
470 static gboolean gee_read_only_collection_real_remove (GeeCollection* base, gconstpointer item) {
471 GeeReadOnlyCollection * self;
472 gboolean result = FALSE;
473 self = (GeeReadOnlyCollection*) base;
474 g_assert_not_reached ();
480 * Unimplemented method (read only collection).
482 static void gee_read_only_collection_real_clear (GeeCollection* base) {
483 GeeReadOnlyCollection * self;
484 self = (GeeReadOnlyCollection*) base;
485 g_assert_not_reached ();
490 * Unimplemented method (read only collection).
492 static gboolean gee_read_only_collection_real_add_all (GeeCollection* base, GeeCollection* collection) {
493 GeeReadOnlyCollection * self;
494 gboolean result = FALSE;
495 self = (GeeReadOnlyCollection*) base;
496 g_return_val_if_fail (collection != NULL, FALSE);
497 g_assert_not_reached ();
505 static gboolean gee_read_only_collection_real_contains_all (GeeCollection* base, GeeCollection* collection) {
506 GeeReadOnlyCollection * self;
507 gboolean result = FALSE;
508 GeeCollection* _tmp0_;
509 GeeCollection* _tmp1_;
510 gboolean _tmp2_ = FALSE;
511 self = (GeeReadOnlyCollection*) base;
512 g_return_val_if_fail (collection != NULL, FALSE);
513 _tmp0_ = self->_collection;
515 _tmp2_ = gee_collection_contains_all (_tmp0_, _tmp1_);
522 * Unimplemented method (read only collection).
524 static gboolean gee_read_only_collection_real_remove_all (GeeCollection* base, GeeCollection* collection) {
525 GeeReadOnlyCollection * self;
526 gboolean result = FALSE;
527 self = (GeeReadOnlyCollection*) base;
528 g_return_val_if_fail (collection != NULL, FALSE);
529 g_assert_not_reached ();
535 * Unimplemented method (read only collection).
537 static gboolean gee_read_only_collection_real_retain_all (GeeCollection* base, GeeCollection* collection) {
538 GeeReadOnlyCollection * self;
539 gboolean result = FALSE;
540 self = (GeeReadOnlyCollection*) base;
541 g_return_val_if_fail (collection != NULL, FALSE);
542 g_assert_not_reached ();
550 static gpointer* gee_read_only_collection_real_to_array (GeeCollection* base, int* result_length1) {
551 GeeReadOnlyCollection * self;
552 gpointer* result = NULL;
553 GeeCollection* _tmp0_;
555 gpointer* _tmp2_ = NULL;
558 self = (GeeReadOnlyCollection*) base;
559 _tmp0_ = self->_collection;
560 _tmp2_ = gee_collection_to_array (_tmp0_, &_tmp1_);
562 _tmp3__length1 = _tmp1_;
563 if (result_length1) {
564 *result_length1 = _tmp3__length1;
571 static gint gee_read_only_collection_real_get_size (GeeCollection* base) {
573 GeeReadOnlyCollection* self;
574 GeeCollection* _tmp0_;
577 self = (GeeReadOnlyCollection*) base;
578 _tmp0_ = self->_collection;
579 _tmp1_ = gee_collection_get_size (_tmp0_);
586 static gboolean gee_read_only_collection_real_get_is_empty (GeeCollection* base) {
588 GeeReadOnlyCollection* self;
589 GeeCollection* _tmp0_;
592 self = (GeeReadOnlyCollection*) base;
593 _tmp0_ = self->_collection;
594 _tmp1_ = gee_collection_get_is_empty (_tmp0_);
601 static gboolean gee_read_only_collection_real_get_read_only (GeeCollection* base) {
603 GeeReadOnlyCollection* self;
604 self = (GeeReadOnlyCollection*) base;
610 static GType gee_read_only_collection_real_get_element_type (GeeTraversable* base) {
612 GeeReadOnlyCollection* self;
613 self = (GeeReadOnlyCollection*) base;
614 result = self->priv->g_type;
619 GeeCollection* gee_read_only_collection_get_read_only_view (GeeReadOnlyCollection* self) {
620 g_return_val_if_fail (self != NULL, NULL);
621 return GEE_READ_ONLY_COLLECTION_GET_CLASS (self)->get_read_only_view (self);
625 static GeeCollection* gee_read_only_collection_real_get_read_only_view (GeeReadOnlyCollection* base) {
626 GeeCollection* result;
627 GeeReadOnlyCollection* self;
628 GeeCollection* _tmp0_;
630 _tmp0_ = _g_object_ref0 ((GeeCollection*) self);
636 GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator) {
637 GeeReadOnlyCollectionIterator * self = NULL;
640 g_return_val_if_fail (iterator != NULL, NULL);
641 self = (GeeReadOnlyCollectionIterator*) g_object_new (object_type, NULL);
642 self->priv->g_type = g_type;
643 self->priv->g_dup_func = g_dup_func;
644 self->priv->g_destroy_func = g_destroy_func;
646 _tmp1_ = _g_object_ref0 (_tmp0_);
647 _g_object_unref0 (self->_iter);
648 self->_iter = _tmp1_;
653 GeeReadOnlyCollectionIterator* gee_read_only_collection_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeIterator* iterator) {
654 return gee_read_only_collection_iterator_construct (GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, iterator);
658 static gboolean gee_read_only_collection_iterator_real_next (GeeIterator* base) {
659 GeeReadOnlyCollectionIterator * self;
660 gboolean result = FALSE;
662 gboolean _tmp1_ = FALSE;
663 self = (GeeReadOnlyCollectionIterator*) base;
664 _tmp0_ = self->_iter;
665 _tmp1_ = gee_iterator_next (_tmp0_);
671 static gboolean gee_read_only_collection_iterator_real_has_next (GeeIterator* base) {
672 GeeReadOnlyCollectionIterator * self;
673 gboolean result = FALSE;
675 gboolean _tmp1_ = FALSE;
676 self = (GeeReadOnlyCollectionIterator*) base;
677 _tmp0_ = self->_iter;
678 _tmp1_ = gee_iterator_has_next (_tmp0_);
684 static gpointer gee_read_only_collection_iterator_real_get (GeeIterator* base) {
685 GeeReadOnlyCollectionIterator * self;
686 gpointer result = NULL;
688 gpointer _tmp1_ = NULL;
689 self = (GeeReadOnlyCollectionIterator*) base;
690 _tmp0_ = self->_iter;
691 _tmp1_ = gee_iterator_get (_tmp0_);
697 static void gee_read_only_collection_iterator_real_remove (GeeIterator* base) {
698 GeeReadOnlyCollectionIterator * self;
699 self = (GeeReadOnlyCollectionIterator*) base;
700 g_assert_not_reached ();
704 static gboolean gee_read_only_collection_iterator_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target) {
705 GeeReadOnlyCollectionIterator * self;
706 gboolean result = FALSE;
708 GeeForallFunc _tmp1_;
710 gboolean _tmp2_ = FALSE;
711 self = (GeeReadOnlyCollectionIterator*) base;
712 _tmp0_ = self->_iter;
714 _tmp1__target = f_target;
715 _tmp2_ = gee_traversable_foreach ((GeeTraversable*) _tmp0_, _tmp1_, _tmp1__target);
721 static GeeIterator* gee_read_only_collection_iterator_real_stream (GeeTraversable* base, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify) {
722 GeeReadOnlyCollectionIterator * self;
723 GeeIterator* result = NULL;
725 GeeStreamFunc _tmp1_;
727 GDestroyNotify _tmp1__target_destroy_notify;
728 GeeIterator* _tmp2_ = NULL;
729 self = (GeeReadOnlyCollectionIterator*) base;
730 _tmp0_ = self->_iter;
732 _tmp1__target = f_target;
733 _tmp1__target_destroy_notify = f_target_destroy_notify;
734 f_target_destroy_notify = NULL;
735 _tmp2_ = gee_traversable_stream ((GeeTraversable*) _tmp0_, a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, _tmp1_, _tmp1__target, _tmp1__target_destroy_notify);
737 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
740 f_target_destroy_notify = NULL;
745 static GeeIterator* gee_read_only_collection_iterator_real_filter (GeeTraversable* base, GeePredicate f, void* f_target, GDestroyNotify f_target_destroy_notify) {
746 GeeReadOnlyCollectionIterator * self;
747 GeeIterator* result = NULL;
751 GDestroyNotify _tmp1__target_destroy_notify;
752 GeeIterator* _tmp2_ = NULL;
753 self = (GeeReadOnlyCollectionIterator*) base;
754 _tmp0_ = self->_iter;
756 _tmp1__target = f_target;
757 _tmp1__target_destroy_notify = f_target_destroy_notify;
758 f_target_destroy_notify = NULL;
759 _tmp2_ = gee_traversable_filter ((GeeTraversable*) _tmp0_, _tmp1_, _tmp1__target, _tmp1__target_destroy_notify);
761 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
764 f_target_destroy_notify = NULL;
769 static GeeIterator* gee_read_only_collection_iterator_real_chop (GeeTraversable* base, gint offset, gint length) {
770 GeeReadOnlyCollectionIterator * self;
771 GeeIterator* result = NULL;
775 GeeIterator* _tmp3_ = NULL;
776 self = (GeeReadOnlyCollectionIterator*) base;
777 _tmp0_ = self->_iter;
780 _tmp3_ = gee_traversable_chop ((GeeTraversable*) _tmp0_, _tmp1_, _tmp2_);
786 static gboolean gee_read_only_collection_iterator_real_get_valid (GeeIterator* base) {
788 GeeReadOnlyCollectionIterator* self;
792 self = (GeeReadOnlyCollectionIterator*) base;
793 _tmp0_ = self->_iter;
794 _tmp1_ = gee_iterator_get_valid (_tmp0_);
801 static gboolean gee_read_only_collection_iterator_real_get_read_only (GeeIterator* base) {
803 GeeReadOnlyCollectionIterator* self;
804 self = (GeeReadOnlyCollectionIterator*) base;
810 static GType gee_read_only_collection_iterator_real_get_element_type (GeeTraversable* base) {
812 GeeReadOnlyCollectionIterator* self;
813 self = (GeeReadOnlyCollectionIterator*) base;
814 result = self->priv->g_type;
819 static void gee_read_only_collection_iterator_class_init (GeeReadOnlyCollectionIteratorClass * klass) {
820 gee_read_only_collection_iterator_parent_class = g_type_class_peek_parent (klass);
821 g_type_class_add_private (klass, sizeof (GeeReadOnlyCollectionIteratorPrivate));
822 G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_collection_iterator_get_property;
823 G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_collection_iterator_set_property;
824 G_OBJECT_CLASS (klass)->finalize = gee_read_only_collection_iterator_finalize;
825 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_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));
826 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_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));
827 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_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));
828 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_ITERATOR_VALID, g_param_spec_boolean ("valid", "valid", "valid", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
829 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_COLLECTION_ITERATOR_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));
833 static GType gee_read_only_collection_iterator_gee_traversable_get_g_type (GeeReadOnlyCollectionIterator* self) {
834 return self->priv->g_type;
838 static GBoxedCopyFunc gee_read_only_collection_iterator_gee_traversable_get_g_dup_func (GeeReadOnlyCollectionIterator* self) {
839 return self->priv->g_dup_func;
843 static GDestroyNotify gee_read_only_collection_iterator_gee_traversable_get_g_destroy_func (GeeReadOnlyCollectionIterator* self) {
844 return self->priv->g_destroy_func;
848 static void gee_read_only_collection_iterator_gee_traversable_interface_init (GeeTraversableIface * iface) {
849 gee_read_only_collection_iterator_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
850 iface->foreach = (gboolean (*)(GeeTraversable*, GeeForallFunc, void*)) gee_read_only_collection_iterator_real_foreach;
851 iface->stream = (GeeIterator* (*)(GeeTraversable*, GType, GBoxedCopyFunc, GDestroyNotify, GeeStreamFunc, void*, GDestroyNotify)) gee_read_only_collection_iterator_real_stream;
852 iface->filter = (GeeIterator* (*)(GeeTraversable*, GeePredicate, void*, GDestroyNotify)) gee_read_only_collection_iterator_real_filter;
853 iface->chop = (GeeIterator* (*)(GeeTraversable*, gint, gint)) gee_read_only_collection_iterator_real_chop;
854 iface->get_g_type = (GType(*)(GeeTraversable*)) gee_read_only_collection_iterator_gee_traversable_get_g_type;
855 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeTraversable*)) gee_read_only_collection_iterator_gee_traversable_get_g_dup_func;
856 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeTraversable*)) gee_read_only_collection_iterator_gee_traversable_get_g_destroy_func;
857 iface->get_element_type = gee_read_only_collection_iterator_real_get_element_type;
861 static void gee_read_only_collection_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) {
862 gee_read_only_collection_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
863 iface->next = (gboolean (*)(GeeIterator*)) gee_read_only_collection_iterator_real_next;
864 iface->has_next = (gboolean (*)(GeeIterator*)) gee_read_only_collection_iterator_real_has_next;
865 iface->get = (gpointer (*)(GeeIterator*)) gee_read_only_collection_iterator_real_get;
866 iface->remove = (void (*)(GeeIterator*)) gee_read_only_collection_iterator_real_remove;
867 iface->get_valid = gee_read_only_collection_iterator_real_get_valid;
868 iface->get_read_only = gee_read_only_collection_iterator_real_get_read_only;
872 static void gee_read_only_collection_iterator_instance_init (GeeReadOnlyCollectionIterator * self) {
873 self->priv = GEE_READ_ONLY_COLLECTION_ITERATOR_GET_PRIVATE (self);
877 static void gee_read_only_collection_iterator_finalize (GObject* obj) {
878 GeeReadOnlyCollectionIterator * self;
879 self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator);
880 _g_object_unref0 (self->_iter);
881 G_OBJECT_CLASS (gee_read_only_collection_iterator_parent_class)->finalize (obj);
885 GType gee_read_only_collection_iterator_get_type (void) {
886 static volatile gsize gee_read_only_collection_iterator_type_id__volatile = 0;
887 if (g_once_init_enter (&gee_read_only_collection_iterator_type_id__volatile)) {
888 static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyCollectionIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_collection_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyCollectionIterator), 0, (GInstanceInitFunc) gee_read_only_collection_iterator_instance_init, NULL };
889 static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gee_read_only_collection_iterator_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
890 static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_read_only_collection_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
891 GType gee_read_only_collection_iterator_type_id;
892 gee_read_only_collection_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeReadOnlyCollectionIterator", &g_define_type_info, 0);
893 g_type_add_interface_static (gee_read_only_collection_iterator_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
894 g_type_add_interface_static (gee_read_only_collection_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
895 g_once_init_leave (&gee_read_only_collection_iterator_type_id__volatile, gee_read_only_collection_iterator_type_id);
897 return gee_read_only_collection_iterator_type_id__volatile;
901 static void _vala_gee_read_only_collection_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
902 GeeReadOnlyCollectionIterator * self;
903 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator);
904 switch (property_id) {
905 case GEE_READ_ONLY_COLLECTION_ITERATOR_VALID:
906 g_value_set_boolean (value, gee_iterator_get_valid ((GeeIterator*) self));
908 case GEE_READ_ONLY_COLLECTION_ITERATOR_READ_ONLY:
909 g_value_set_boolean (value, gee_iterator_get_read_only ((GeeIterator*) self));
912 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
918 static void _vala_gee_read_only_collection_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
919 GeeReadOnlyCollectionIterator * self;
920 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_READ_ONLY_COLLECTION_TYPE_ITERATOR, GeeReadOnlyCollectionIterator);
921 switch (property_id) {
922 case GEE_READ_ONLY_COLLECTION_ITERATOR_G_TYPE:
923 self->priv->g_type = g_value_get_gtype (value);
925 case GEE_READ_ONLY_COLLECTION_ITERATOR_G_DUP_FUNC:
926 self->priv->g_dup_func = g_value_get_pointer (value);
928 case GEE_READ_ONLY_COLLECTION_ITERATOR_G_DESTROY_FUNC:
929 self->priv->g_destroy_func = g_value_get_pointer (value);
932 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
938 static void gee_read_only_collection_class_init (GeeReadOnlyCollectionClass * klass) {
939 gee_read_only_collection_parent_class = g_type_class_peek_parent (klass);
940 g_type_class_add_private (klass, sizeof (GeeReadOnlyCollectionPrivate));
941 GEE_READ_ONLY_COLLECTION_CLASS (klass)->get_read_only_view = gee_read_only_collection_real_get_read_only_view;
942 G_OBJECT_CLASS (klass)->get_property = _vala_gee_read_only_collection_get_property;
943 G_OBJECT_CLASS (klass)->set_property = _vala_gee_read_only_collection_set_property;
944 G_OBJECT_CLASS (klass)->finalize = gee_read_only_collection_finalize;
945 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_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));
946 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_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));
947 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_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));
951 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_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));
955 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_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));
956 g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_READ_ONLY_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));
960 static GType gee_read_only_collection_gee_traversable_get_g_type (GeeReadOnlyCollection* self) {
961 return self->priv->g_type;
965 static GBoxedCopyFunc gee_read_only_collection_gee_traversable_get_g_dup_func (GeeReadOnlyCollection* self) {
966 return self->priv->g_dup_func;
970 static GDestroyNotify gee_read_only_collection_gee_traversable_get_g_destroy_func (GeeReadOnlyCollection* self) {
971 return self->priv->g_destroy_func;
975 static void gee_read_only_collection_gee_traversable_interface_init (GeeTraversableIface * iface) {
976 gee_read_only_collection_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
977 iface->foreach = (gboolean (*)(GeeTraversable*, GeeForallFunc, void*)) gee_read_only_collection_real_foreach;
978 iface->stream = (GeeIterator* (*)(GeeTraversable*, GType, GBoxedCopyFunc, GDestroyNotify, GeeStreamFunc, void*, GDestroyNotify)) gee_read_only_collection_real_stream;
979 iface->filter = (GeeIterator* (*)(GeeTraversable*, GeePredicate, void*, GDestroyNotify)) gee_read_only_collection_real_filter;
980 iface->chop = (GeeIterator* (*)(GeeTraversable*, gint, gint)) gee_read_only_collection_real_chop;
981 iface->get_g_type = (GType(*)(GeeTraversable*)) gee_read_only_collection_gee_traversable_get_g_type;
982 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeTraversable*)) gee_read_only_collection_gee_traversable_get_g_dup_func;
983 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeTraversable*)) gee_read_only_collection_gee_traversable_get_g_destroy_func;
984 iface->get_element_type = gee_read_only_collection_real_get_element_type;
988 static GType gee_read_only_collection_gee_iterable_get_g_type (GeeReadOnlyCollection* self) {
989 return self->priv->g_type;
993 static GBoxedCopyFunc gee_read_only_collection_gee_iterable_get_g_dup_func (GeeReadOnlyCollection* self) {
994 return self->priv->g_dup_func;
998 static GDestroyNotify gee_read_only_collection_gee_iterable_get_g_destroy_func (GeeReadOnlyCollection* self) {
999 return self->priv->g_destroy_func;
1003 static void gee_read_only_collection_gee_iterable_interface_init (GeeIterableIface * iface) {
1004 gee_read_only_collection_gee_iterable_parent_iface = g_type_interface_peek_parent (iface);
1005 iface->iterator = (GeeIterator* (*)(GeeIterable*)) gee_read_only_collection_real_iterator;
1006 iface->get_g_type = (GType(*)(GeeIterable*)) gee_read_only_collection_gee_iterable_get_g_type;
1007 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeIterable*)) gee_read_only_collection_gee_iterable_get_g_dup_func;
1008 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeIterable*)) gee_read_only_collection_gee_iterable_get_g_destroy_func;
1012 static GType gee_read_only_collection_gee_collection_get_g_type (GeeReadOnlyCollection* self) {
1013 return self->priv->g_type;
1017 static GBoxedCopyFunc gee_read_only_collection_gee_collection_get_g_dup_func (GeeReadOnlyCollection* self) {
1018 return self->priv->g_dup_func;
1022 static GDestroyNotify gee_read_only_collection_gee_collection_get_g_destroy_func (GeeReadOnlyCollection* self) {
1023 return self->priv->g_destroy_func;
1027 static void gee_read_only_collection_gee_collection_interface_init (GeeCollectionIface * iface) {
1028 gee_read_only_collection_gee_collection_parent_iface = g_type_interface_peek_parent (iface);
1029 iface->contains = (gboolean (*)(GeeCollection*, gconstpointer)) gee_read_only_collection_real_contains;
1030 iface->add = (gboolean (*)(GeeCollection*, gconstpointer)) gee_read_only_collection_real_add;
1031 iface->remove = (gboolean (*)(GeeCollection*, gconstpointer)) gee_read_only_collection_real_remove;
1032 iface->clear = (void (*)(GeeCollection*)) gee_read_only_collection_real_clear;
1033 iface->add_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_add_all;
1034 iface->contains_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_contains_all;
1035 iface->remove_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_remove_all;
1036 iface->retain_all = (gboolean (*)(GeeCollection*, GeeCollection*)) gee_read_only_collection_real_retain_all;
1037 iface->to_array = (gpointer* (*)(GeeCollection*, int*)) gee_read_only_collection_real_to_array;
1038 iface->get_g_type = (GType(*)(GeeCollection*)) gee_read_only_collection_gee_collection_get_g_type;
1039 iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeCollection*)) gee_read_only_collection_gee_collection_get_g_dup_func;
1040 iface->get_g_destroy_func = (GDestroyNotify(*)(GeeCollection*)) gee_read_only_collection_gee_collection_get_g_destroy_func;
1041 iface->get_size = gee_read_only_collection_real_get_size;
1042 iface->get_is_empty = gee_read_only_collection_real_get_is_empty;
1043 iface->get_read_only = gee_read_only_collection_real_get_read_only;
1044 iface->get_read_only_view = (GeeCollection* (*) (GeeCollection *)) gee_read_only_collection_get_read_only_view;
1048 static void gee_read_only_collection_instance_init (GeeReadOnlyCollection * self) {
1049 self->priv = GEE_READ_ONLY_COLLECTION_GET_PRIVATE (self);
1053 static void gee_read_only_collection_finalize (GObject* obj) {
1054 GeeReadOnlyCollection * self;
1055 self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection);
1056 _g_object_unref0 (self->_collection);
1057 G_OBJECT_CLASS (gee_read_only_collection_parent_class)->finalize (obj);
1062 * Read-only view for {@link Collection} collections.
1064 * This class decorates any class which implements the {@link Collection}
1065 * interface by making it read only. Any method which normally modify data will
1070 GType gee_read_only_collection_get_type (void) {
1071 static volatile gsize gee_read_only_collection_type_id__volatile = 0;
1072 if (g_once_init_enter (&gee_read_only_collection_type_id__volatile)) {
1073 static const GTypeInfo g_define_type_info = { sizeof (GeeReadOnlyCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_read_only_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeReadOnlyCollection), 0, (GInstanceInitFunc) gee_read_only_collection_instance_init, NULL };
1074 static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gee_read_only_collection_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1075 static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gee_read_only_collection_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1076 static const GInterfaceInfo gee_collection_info = { (GInterfaceInitFunc) gee_read_only_collection_gee_collection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1077 GType gee_read_only_collection_type_id;
1078 gee_read_only_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeReadOnlyCollection", &g_define_type_info, 0);
1079 g_type_add_interface_static (gee_read_only_collection_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
1080 g_type_add_interface_static (gee_read_only_collection_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info);
1081 g_type_add_interface_static (gee_read_only_collection_type_id, GEE_TYPE_COLLECTION, &gee_collection_info);
1082 g_once_init_leave (&gee_read_only_collection_type_id__volatile, gee_read_only_collection_type_id);
1084 return gee_read_only_collection_type_id__volatile;
1088 static void _vala_gee_read_only_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
1089 GeeReadOnlyCollection * self;
1090 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection);
1091 switch (property_id) {
1092 case GEE_READ_ONLY_COLLECTION_SIZE:
1093 g_value_set_int (value, gee_collection_get_size ((GeeCollection*) self));
1095 case GEE_READ_ONLY_COLLECTION_READ_ONLY:
1096 g_value_set_boolean (value, gee_collection_get_read_only ((GeeCollection*) self));
1098 case GEE_READ_ONLY_COLLECTION_READ_ONLY_VIEW:
1099 g_value_take_object (value, gee_read_only_collection_get_read_only_view (self));
1102 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1108 static void _vala_gee_read_only_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
1109 GeeReadOnlyCollection * self;
1110 self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_READ_ONLY_COLLECTION, GeeReadOnlyCollection);
1111 switch (property_id) {
1112 case GEE_READ_ONLY_COLLECTION_G_TYPE:
1113 self->priv->g_type = g_value_get_gtype (value);
1115 case GEE_READ_ONLY_COLLECTION_G_DUP_FUNC:
1116 self->priv->g_dup_func = g_value_get_pointer (value);
1118 case GEE_READ_ONLY_COLLECTION_G_DESTROY_FUNC:
1119 self->priv->g_destroy_func = g_value_get_pointer (value);
1122 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);