1 /* collection.c generated by valac, the Vala compiler
2  * generated from collection.vala, do not modify */
3 
4 /* collection.vala
5  *
6  * Copyright (C) 2007  Jürg Billeter
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12 
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17 
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Jürg Billeter <j@bitron.ch>
24  */
25 
26 #include "valagee.h"
27 #include <glib-object.h>
28 #include <glib.h>
29 #include <float.h>
30 #include <math.h>
31 
32 #define _vala_iterator_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterator_unref (var), NULL)))
33 #define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
34 
35 struct _ValaCollectionPrivate {
36 	GType g_type;
37 	GBoxedCopyFunc g_dup_func;
38 	GDestroyNotify g_destroy_func;
39 };
40 
41 static gint ValaCollection_private_offset;
42 static gpointer vala_collection_parent_class = NULL;
43 
44 static gboolean vala_collection_real_contains (ValaCollection* self,
45                                         gconstpointer item);
46 static gboolean vala_collection_real_add (ValaCollection* self,
47                                    gconstpointer item);
48 static gboolean vala_collection_real_remove (ValaCollection* self,
49                                       gconstpointer item);
50 static void vala_collection_real_clear (ValaCollection* self);
51 static gboolean vala_collection_real_add_all (ValaCollection* self,
52                                        ValaCollection* collection);
53 static gpointer* vala_collection_real_to_array (ValaCollection* self,
54                                          gint* result_length1);
55 static gboolean* vala_collection_to_bool_array (ValaCollection* coll,
56                                          gint* result_length1);
57 static gchar* vala_collection_to_char_array (ValaCollection* coll,
58                                       gint* result_length1);
59 static guchar* vala_collection_to_uchar_array (ValaCollection* coll,
60                                         gint* result_length1);
61 static gint* vala_collection_to_int_array (ValaCollection* coll,
62                                     gint* result_length1);
63 static guint* vala_collection_to_uint_array (ValaCollection* coll,
64                                       gint* result_length1);
65 static gint64** vala_collection_to_int64_array (ValaCollection* coll,
66                                          gint* result_length1);
67 static guint64** vala_collection_to_uint64_array (ValaCollection* coll,
68                                            gint* result_length1);
69 static glong* vala_collection_to_long_array (ValaCollection* coll,
70                                       gint* result_length1);
71 static gulong* vala_collection_to_ulong_array (ValaCollection* coll,
72                                         gint* result_length1);
73 static gfloat** vala_collection_to_float_array (ValaCollection* coll,
74                                          gint* result_length1);
75 static gdouble** vala_collection_to_double_array (ValaCollection* coll,
76                                            gint* result_length1);
77 static GType vala_collection_get_type_once (void);
78 
79 static inline gpointer
vala_collection_get_instance_private(ValaCollection * self)80 vala_collection_get_instance_private (ValaCollection* self)
81 {
82 	return G_STRUCT_MEMBER_P (self, ValaCollection_private_offset);
83 }
84 
85 gint
vala_collection_get_size(ValaCollection * self)86 vala_collection_get_size (ValaCollection* self)
87 {
88 	g_return_val_if_fail (self != NULL, 0);
89 	return VALA_COLLECTION_GET_CLASS (self)->get_size (self);
90 }
91 
92 gboolean
vala_collection_get_is_empty(ValaCollection * self)93 vala_collection_get_is_empty (ValaCollection* self)
94 {
95 	g_return_val_if_fail (self != NULL, FALSE);
96 	return VALA_COLLECTION_GET_CLASS (self)->get_is_empty (self);
97 }
98 
99 static gboolean
vala_collection_real_get_is_empty(ValaCollection * base)100 vala_collection_real_get_is_empty (ValaCollection* base)
101 {
102 	gboolean result;
103 	ValaCollection* self;
104 	gint _tmp0_;
105 	gint _tmp1_;
106 	self = base;
107 	_tmp0_ = vala_collection_get_size (self);
108 	_tmp1_ = _tmp0_;
109 	result = _tmp1_ == 0;
110 	return result;
111 }
112 
113 /**
114  * Determines whether this collection contains the specified item.
115  *
116  * @param item the item to locate in the collection
117  *
118  * @return     true if item is found, false otherwise
119  */
120 static gboolean
vala_collection_real_contains(ValaCollection * self,gconstpointer item)121 vala_collection_real_contains (ValaCollection* self,
122                                gconstpointer item)
123 {
124 	gboolean _tmp0_ = FALSE;
125 	g_critical ("Type `%s' does not implement abstract method `vala_collection_contains'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
126 	return _tmp0_;
127 }
128 
129 gboolean
vala_collection_contains(ValaCollection * self,gconstpointer item)130 vala_collection_contains (ValaCollection* self,
131                           gconstpointer item)
132 {
133 	g_return_val_if_fail (self != NULL, FALSE);
134 	return VALA_COLLECTION_GET_CLASS (self)->contains (self, item);
135 }
136 
137 /**
138  * Adds an item to this collection. Must not be called on read-only
139  * collections.
140  *
141  * @param item the item to add to the collection
142  *
143  * @return     true if the collection has been changed, false otherwise
144  */
145 static gboolean
vala_collection_real_add(ValaCollection * self,gconstpointer item)146 vala_collection_real_add (ValaCollection* self,
147                           gconstpointer item)
148 {
149 	gboolean _tmp0_ = FALSE;
150 	g_critical ("Type `%s' does not implement abstract method `vala_collection_add'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
151 	return _tmp0_;
152 }
153 
154 gboolean
vala_collection_add(ValaCollection * self,gconstpointer item)155 vala_collection_add (ValaCollection* self,
156                      gconstpointer item)
157 {
158 	g_return_val_if_fail (self != NULL, FALSE);
159 	return VALA_COLLECTION_GET_CLASS (self)->add (self, item);
160 }
161 
162 /**
163  * Removes the first occurrence of an item from this collection. Must not
164  * be called on read-only collections.
165  *
166  * @param item the item to remove from the collection
167  *
168  * @return     true if the collection has been changed, false otherwise
169  */
170 static gboolean
vala_collection_real_remove(ValaCollection * self,gconstpointer item)171 vala_collection_real_remove (ValaCollection* self,
172                              gconstpointer item)
173 {
174 	gboolean _tmp0_ = FALSE;
175 	g_critical ("Type `%s' does not implement abstract method `vala_collection_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
176 	return _tmp0_;
177 }
178 
179 gboolean
vala_collection_remove(ValaCollection * self,gconstpointer item)180 vala_collection_remove (ValaCollection* self,
181                         gconstpointer item)
182 {
183 	g_return_val_if_fail (self != NULL, FALSE);
184 	return VALA_COLLECTION_GET_CLASS (self)->remove (self, item);
185 }
186 
187 /**
188  * Removes all items from this collection. Must not be called on
189  * read-only collections.
190  */
191 static void
vala_collection_real_clear(ValaCollection * self)192 vala_collection_real_clear (ValaCollection* self)
193 {
194 	g_critical ("Type `%s' does not implement abstract method `vala_collection_clear'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
195 	return;
196 }
197 
198 void
vala_collection_clear(ValaCollection * self)199 vala_collection_clear (ValaCollection* self)
200 {
201 	g_return_if_fail (self != NULL);
202 	VALA_COLLECTION_GET_CLASS (self)->clear (self);
203 }
204 
205 /**
206  * Adds all items in the input collection to this collection.
207  *
208  * @param collection the collection which items will be added to this
209  *                   collection.
210  *
211  * @return     ``true`` if the collection has been changed, ``false`` otherwise
212  */
213 static gboolean
vala_collection_real_add_all(ValaCollection * self,ValaCollection * collection)214 vala_collection_real_add_all (ValaCollection* self,
215                               ValaCollection* collection)
216 {
217 	gboolean changed = FALSE;
218 	gboolean result = FALSE;
219 	g_return_val_if_fail (collection != NULL, FALSE);
220 	changed = FALSE;
221 	{
222 		ValaIterator* iter = NULL;
223 		ValaIterator* _tmp0_;
224 		_tmp0_ = vala_iterable_iterator ((ValaIterable*) collection);
225 		iter = _tmp0_;
226 		{
227 			gboolean _tmp1_ = FALSE;
228 			_tmp1_ = TRUE;
229 			while (TRUE) {
230 				ValaIterator* _tmp2_;
231 				gpointer item = NULL;
232 				ValaIterator* _tmp3_;
233 				gpointer _tmp4_;
234 				gconstpointer _tmp5_;
235 				if (!_tmp1_) {
236 				}
237 				_tmp1_ = FALSE;
238 				_tmp2_ = iter;
239 				if (!vala_iterator_next (_tmp2_)) {
240 					break;
241 				}
242 				_tmp3_ = iter;
243 				_tmp4_ = vala_iterator_get (_tmp3_);
244 				item = _tmp4_;
245 				_tmp5_ = item;
246 				if (!vala_collection_contains (self, _tmp5_)) {
247 					gconstpointer _tmp6_;
248 					_tmp6_ = item;
249 					vala_collection_add (self, _tmp6_);
250 					changed = TRUE;
251 				}
252 				((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL));
253 			}
254 		}
255 		_vala_iterator_unref0 (iter);
256 	}
257 	result = changed;
258 	return result;
259 }
260 
261 gboolean
vala_collection_add_all(ValaCollection * self,ValaCollection * collection)262 vala_collection_add_all (ValaCollection* self,
263                          ValaCollection* collection)
264 {
265 	g_return_val_if_fail (self != NULL, FALSE);
266 	return VALA_COLLECTION_GET_CLASS (self)->add_all (self, collection);
267 }
268 
269 /**
270  * Returns an array containing all of items from this collection.
271  *
272  * @return an array containing all of items from this collection
273  */
274 static gpointer*
vala_collection_real_to_array(ValaCollection * self,gint * result_length1)275 vala_collection_real_to_array (ValaCollection* self,
276                                gint* result_length1)
277 {
278 	GType t = 0UL;
279 	gpointer* result = NULL;
280 	t = self->priv->g_type;
281 	if (t == G_TYPE_BOOLEAN) {
282 		gint _tmp0_ = 0;
283 		gboolean* _tmp1_;
284 		gpointer* _tmp2_;
285 		gint _tmp2__length1;
286 		_tmp1_ = vala_collection_to_bool_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp0_);
287 		_tmp2_ = (gpointer*) _tmp1_;
288 		_tmp2__length1 = _tmp0_;
289 		if (result_length1) {
290 			*result_length1 = _tmp2__length1;
291 		}
292 		result = _tmp2_;
293 		return result;
294 	} else {
295 		if (t == G_TYPE_CHAR) {
296 			gint _tmp3_ = 0;
297 			gchar* _tmp4_;
298 			gpointer* _tmp5_;
299 			gint _tmp5__length1;
300 			_tmp4_ = vala_collection_to_char_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp3_);
301 			_tmp5_ = (gpointer*) _tmp4_;
302 			_tmp5__length1 = _tmp3_;
303 			if (result_length1) {
304 				*result_length1 = _tmp5__length1;
305 			}
306 			result = _tmp5_;
307 			return result;
308 		} else {
309 			if (t == G_TYPE_UCHAR) {
310 				gint _tmp6_ = 0;
311 				guchar* _tmp7_;
312 				gpointer* _tmp8_;
313 				gint _tmp8__length1;
314 				_tmp7_ = vala_collection_to_uchar_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp6_);
315 				_tmp8_ = (gpointer*) _tmp7_;
316 				_tmp8__length1 = _tmp6_;
317 				if (result_length1) {
318 					*result_length1 = _tmp8__length1;
319 				}
320 				result = _tmp8_;
321 				return result;
322 			} else {
323 				if (t == G_TYPE_INT) {
324 					gint _tmp9_ = 0;
325 					gint* _tmp10_;
326 					gpointer* _tmp11_;
327 					gint _tmp11__length1;
328 					_tmp10_ = vala_collection_to_int_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp9_);
329 					_tmp11_ = (gpointer*) _tmp10_;
330 					_tmp11__length1 = _tmp9_;
331 					if (result_length1) {
332 						*result_length1 = _tmp11__length1;
333 					}
334 					result = _tmp11_;
335 					return result;
336 				} else {
337 					if (t == G_TYPE_UINT) {
338 						gint _tmp12_ = 0;
339 						guint* _tmp13_;
340 						gpointer* _tmp14_;
341 						gint _tmp14__length1;
342 						_tmp13_ = vala_collection_to_uint_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp12_);
343 						_tmp14_ = (gpointer*) _tmp13_;
344 						_tmp14__length1 = _tmp12_;
345 						if (result_length1) {
346 							*result_length1 = _tmp14__length1;
347 						}
348 						result = _tmp14_;
349 						return result;
350 					} else {
351 						if (t == G_TYPE_INT64) {
352 							gint _tmp15_ = 0;
353 							gint64** _tmp16_;
354 							gpointer* _tmp17_;
355 							gint _tmp17__length1;
356 							_tmp16_ = vala_collection_to_int64_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp15_);
357 							_tmp17_ = (gpointer*) _tmp16_;
358 							_tmp17__length1 = _tmp15_;
359 							if (result_length1) {
360 								*result_length1 = _tmp17__length1;
361 							}
362 							result = _tmp17_;
363 							return result;
364 						} else {
365 							if (t == G_TYPE_UINT64) {
366 								gint _tmp18_ = 0;
367 								guint64** _tmp19_;
368 								gpointer* _tmp20_;
369 								gint _tmp20__length1;
370 								_tmp19_ = vala_collection_to_uint64_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp18_);
371 								_tmp20_ = (gpointer*) _tmp19_;
372 								_tmp20__length1 = _tmp18_;
373 								if (result_length1) {
374 									*result_length1 = _tmp20__length1;
375 								}
376 								result = _tmp20_;
377 								return result;
378 							} else {
379 								if (t == G_TYPE_LONG) {
380 									gint _tmp21_ = 0;
381 									glong* _tmp22_;
382 									gpointer* _tmp23_;
383 									gint _tmp23__length1;
384 									_tmp22_ = vala_collection_to_long_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp21_);
385 									_tmp23_ = (gpointer*) _tmp22_;
386 									_tmp23__length1 = _tmp21_;
387 									if (result_length1) {
388 										*result_length1 = _tmp23__length1;
389 									}
390 									result = _tmp23_;
391 									return result;
392 								} else {
393 									if (t == G_TYPE_ULONG) {
394 										gint _tmp24_ = 0;
395 										gulong* _tmp25_;
396 										gpointer* _tmp26_;
397 										gint _tmp26__length1;
398 										_tmp25_ = vala_collection_to_ulong_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp24_);
399 										_tmp26_ = (gpointer*) _tmp25_;
400 										_tmp26__length1 = _tmp24_;
401 										if (result_length1) {
402 											*result_length1 = _tmp26__length1;
403 										}
404 										result = _tmp26_;
405 										return result;
406 									} else {
407 										if (t == G_TYPE_FLOAT) {
408 											gint _tmp27_ = 0;
409 											gfloat** _tmp28_;
410 											gpointer* _tmp29_;
411 											gint _tmp29__length1;
412 											_tmp28_ = vala_collection_to_float_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp27_);
413 											_tmp29_ = (gpointer*) _tmp28_;
414 											_tmp29__length1 = _tmp27_;
415 											if (result_length1) {
416 												*result_length1 = _tmp29__length1;
417 											}
418 											result = _tmp29_;
419 											return result;
420 										} else {
421 											if (t == G_TYPE_DOUBLE) {
422 												gint _tmp30_ = 0;
423 												gdouble** _tmp31_;
424 												gpointer* _tmp32_;
425 												gint _tmp32__length1;
426 												_tmp31_ = vala_collection_to_double_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp30_);
427 												_tmp32_ = (gpointer*) _tmp31_;
428 												_tmp32__length1 = _tmp30_;
429 												if (result_length1) {
430 													*result_length1 = _tmp32__length1;
431 												}
432 												result = _tmp32_;
433 												return result;
434 											} else {
435 												gboolean _tmp33_ = FALSE;
436 												if (G_TYPE_IS_ENUM (t)) {
437 													_tmp33_ = TRUE;
438 												} else {
439 													_tmp33_ = G_TYPE_IS_FLAGS (t);
440 												}
441 												if (_tmp33_) {
442 													gint _tmp34_ = 0;
443 													gint* _tmp35_;
444 													gpointer* _tmp36_;
445 													gint _tmp36__length1;
446 													_tmp35_ = vala_collection_to_int_array (G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_COLLECTION, ValaCollection), &_tmp34_);
447 													_tmp36_ = (gpointer*) _tmp35_;
448 													_tmp36__length1 = _tmp34_;
449 													if (result_length1) {
450 														*result_length1 = _tmp36__length1;
451 													}
452 													result = _tmp36_;
453 													return result;
454 												} else {
455 													gpointer* array = NULL;
456 													gint _tmp37_;
457 													gint _tmp38_;
458 													gpointer* _tmp39_;
459 													gint array_length1;
460 													gint _array_size_;
461 													gint index = 0;
462 													gpointer* _tmp47_;
463 													gint _tmp47__length1;
464 													_tmp37_ = vala_collection_get_size (self);
465 													_tmp38_ = _tmp37_;
466 													_tmp39_ = g_new0 (gpointer, _tmp38_);
467 													array = _tmp39_;
468 													array_length1 = _tmp38_;
469 													_array_size_ = array_length1;
470 													index = 0;
471 													{
472 														ValaIterator* _element_it = NULL;
473 														ValaIterator* _tmp40_;
474 														_tmp40_ = vala_iterable_iterator ((ValaIterable*) self);
475 														_element_it = _tmp40_;
476 														while (TRUE) {
477 															ValaIterator* _tmp41_;
478 															gpointer element = NULL;
479 															ValaIterator* _tmp42_;
480 															gpointer _tmp43_;
481 															gpointer* _tmp44_;
482 															gint _tmp44__length1;
483 															gint _tmp45_;
484 															gpointer _tmp46_;
485 															_tmp41_ = _element_it;
486 															if (!vala_iterator_next (_tmp41_)) {
487 																break;
488 															}
489 															_tmp42_ = _element_it;
490 															_tmp43_ = vala_iterator_get (_tmp42_);
491 															element = _tmp43_;
492 															_tmp44_ = array;
493 															_tmp44__length1 = array_length1;
494 															_tmp45_ = index;
495 															index = _tmp45_ + 1;
496 															_tmp46_ = element;
497 															element = NULL;
498 															((_tmp44_[_tmp45_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp44_[_tmp45_] = (self->priv->g_destroy_func (_tmp44_[_tmp45_]), NULL));
499 															_tmp44_[_tmp45_] = _tmp46_;
500 															((element == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (element = (self->priv->g_destroy_func (element), NULL));
501 														}
502 														_vala_iterator_unref0 (_element_it);
503 													}
504 													_tmp47_ = array;
505 													_tmp47__length1 = array_length1;
506 													if (result_length1) {
507 														*result_length1 = _tmp47__length1;
508 													}
509 													result = _tmp47_;
510 													return result;
511 												}
512 											}
513 										}
514 									}
515 								}
516 							}
517 						}
518 					}
519 				}
520 			}
521 		}
522 	}
523 }
524 
525 gpointer*
vala_collection_to_array(ValaCollection * self,gint * result_length1)526 vala_collection_to_array (ValaCollection* self,
527                           gint* result_length1)
528 {
529 	g_return_val_if_fail (self != NULL, NULL);
530 	return VALA_COLLECTION_GET_CLASS (self)->to_array (self, result_length1);
531 }
532 
533 static gboolean*
vala_collection_to_bool_array(ValaCollection * coll,gint * result_length1)534 vala_collection_to_bool_array (ValaCollection* coll,
535                                gint* result_length1)
536 {
537 	gboolean* array = NULL;
538 	gint _tmp0_;
539 	gint _tmp1_;
540 	gboolean* _tmp2_;
541 	gint array_length1;
542 	gint _array_size_;
543 	gint index = 0;
544 	gboolean* _tmp10_;
545 	gint _tmp10__length1;
546 	gboolean* result = NULL;
547 	g_return_val_if_fail (coll != NULL, NULL);
548 	_tmp0_ = vala_collection_get_size (coll);
549 	_tmp1_ = _tmp0_;
550 	_tmp2_ = g_new0 (gboolean, _tmp1_);
551 	array = _tmp2_;
552 	array_length1 = _tmp1_;
553 	_array_size_ = array_length1;
554 	index = 0;
555 	{
556 		ValaIterator* _element_it = NULL;
557 		ValaIterator* _tmp3_;
558 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
559 		_element_it = _tmp3_;
560 		while (TRUE) {
561 			ValaIterator* _tmp4_;
562 			gboolean element = FALSE;
563 			ValaIterator* _tmp5_;
564 			gpointer _tmp6_;
565 			gboolean* _tmp7_;
566 			gint _tmp7__length1;
567 			gint _tmp8_;
568 			gboolean _tmp9_;
569 			_tmp4_ = _element_it;
570 			if (!vala_iterator_next (_tmp4_)) {
571 				break;
572 			}
573 			_tmp5_ = _element_it;
574 			_tmp6_ = vala_iterator_get (_tmp5_);
575 			element = (gboolean) ((gintptr) _tmp6_);
576 			_tmp7_ = array;
577 			_tmp7__length1 = array_length1;
578 			_tmp8_ = index;
579 			index = _tmp8_ + 1;
580 			_tmp9_ = element;
581 			_tmp7_[_tmp8_] = _tmp9_;
582 		}
583 		_vala_iterator_unref0 (_element_it);
584 	}
585 	_tmp10_ = array;
586 	_tmp10__length1 = array_length1;
587 	if (result_length1) {
588 		*result_length1 = _tmp10__length1;
589 	}
590 	result = _tmp10_;
591 	return result;
592 }
593 
594 static gchar*
vala_collection_to_char_array(ValaCollection * coll,gint * result_length1)595 vala_collection_to_char_array (ValaCollection* coll,
596                                gint* result_length1)
597 {
598 	gchar* array = NULL;
599 	gint _tmp0_;
600 	gint _tmp1_;
601 	gchar* _tmp2_;
602 	gint array_length1;
603 	gint _array_size_;
604 	gint index = 0;
605 	gchar* _tmp10_;
606 	gint _tmp10__length1;
607 	gchar* result = NULL;
608 	g_return_val_if_fail (coll != NULL, NULL);
609 	_tmp0_ = vala_collection_get_size (coll);
610 	_tmp1_ = _tmp0_;
611 	_tmp2_ = g_new0 (gchar, _tmp1_);
612 	array = _tmp2_;
613 	array_length1 = _tmp1_;
614 	_array_size_ = array_length1;
615 	index = 0;
616 	{
617 		ValaIterator* _element_it = NULL;
618 		ValaIterator* _tmp3_;
619 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
620 		_element_it = _tmp3_;
621 		while (TRUE) {
622 			ValaIterator* _tmp4_;
623 			gchar element = '\0';
624 			ValaIterator* _tmp5_;
625 			gpointer _tmp6_;
626 			gchar* _tmp7_;
627 			gint _tmp7__length1;
628 			gint _tmp8_;
629 			gchar _tmp9_;
630 			_tmp4_ = _element_it;
631 			if (!vala_iterator_next (_tmp4_)) {
632 				break;
633 			}
634 			_tmp5_ = _element_it;
635 			_tmp6_ = vala_iterator_get (_tmp5_);
636 			element = (gchar) ((gintptr) _tmp6_);
637 			_tmp7_ = array;
638 			_tmp7__length1 = array_length1;
639 			_tmp8_ = index;
640 			index = _tmp8_ + 1;
641 			_tmp9_ = element;
642 			_tmp7_[_tmp8_] = _tmp9_;
643 		}
644 		_vala_iterator_unref0 (_element_it);
645 	}
646 	_tmp10_ = array;
647 	_tmp10__length1 = array_length1;
648 	if (result_length1) {
649 		*result_length1 = _tmp10__length1;
650 	}
651 	result = _tmp10_;
652 	return result;
653 }
654 
655 static guchar*
vala_collection_to_uchar_array(ValaCollection * coll,gint * result_length1)656 vala_collection_to_uchar_array (ValaCollection* coll,
657                                 gint* result_length1)
658 {
659 	guchar* array = NULL;
660 	gint _tmp0_;
661 	gint _tmp1_;
662 	guchar* _tmp2_;
663 	gint array_length1;
664 	gint _array_size_;
665 	gint index = 0;
666 	guchar* _tmp10_;
667 	gint _tmp10__length1;
668 	guchar* result = NULL;
669 	g_return_val_if_fail (coll != NULL, NULL);
670 	_tmp0_ = vala_collection_get_size (coll);
671 	_tmp1_ = _tmp0_;
672 	_tmp2_ = g_new0 (guchar, _tmp1_);
673 	array = _tmp2_;
674 	array_length1 = _tmp1_;
675 	_array_size_ = array_length1;
676 	index = 0;
677 	{
678 		ValaIterator* _element_it = NULL;
679 		ValaIterator* _tmp3_;
680 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
681 		_element_it = _tmp3_;
682 		while (TRUE) {
683 			ValaIterator* _tmp4_;
684 			guchar element = '\0';
685 			ValaIterator* _tmp5_;
686 			gpointer _tmp6_;
687 			guchar* _tmp7_;
688 			gint _tmp7__length1;
689 			gint _tmp8_;
690 			guchar _tmp9_;
691 			_tmp4_ = _element_it;
692 			if (!vala_iterator_next (_tmp4_)) {
693 				break;
694 			}
695 			_tmp5_ = _element_it;
696 			_tmp6_ = vala_iterator_get (_tmp5_);
697 			element = (guchar) ((guintptr) _tmp6_);
698 			_tmp7_ = array;
699 			_tmp7__length1 = array_length1;
700 			_tmp8_ = index;
701 			index = _tmp8_ + 1;
702 			_tmp9_ = element;
703 			_tmp7_[_tmp8_] = _tmp9_;
704 		}
705 		_vala_iterator_unref0 (_element_it);
706 	}
707 	_tmp10_ = array;
708 	_tmp10__length1 = array_length1;
709 	if (result_length1) {
710 		*result_length1 = _tmp10__length1;
711 	}
712 	result = _tmp10_;
713 	return result;
714 }
715 
716 static gint*
vala_collection_to_int_array(ValaCollection * coll,gint * result_length1)717 vala_collection_to_int_array (ValaCollection* coll,
718                               gint* result_length1)
719 {
720 	gint* array = NULL;
721 	gint _tmp0_;
722 	gint _tmp1_;
723 	gint* _tmp2_;
724 	gint array_length1;
725 	gint _array_size_;
726 	gint index = 0;
727 	gint* _tmp10_;
728 	gint _tmp10__length1;
729 	gint* result = NULL;
730 	g_return_val_if_fail (coll != NULL, NULL);
731 	_tmp0_ = vala_collection_get_size (coll);
732 	_tmp1_ = _tmp0_;
733 	_tmp2_ = g_new0 (gint, _tmp1_);
734 	array = _tmp2_;
735 	array_length1 = _tmp1_;
736 	_array_size_ = array_length1;
737 	index = 0;
738 	{
739 		ValaIterator* _element_it = NULL;
740 		ValaIterator* _tmp3_;
741 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
742 		_element_it = _tmp3_;
743 		while (TRUE) {
744 			ValaIterator* _tmp4_;
745 			gint element = 0;
746 			ValaIterator* _tmp5_;
747 			gpointer _tmp6_;
748 			gint* _tmp7_;
749 			gint _tmp7__length1;
750 			gint _tmp8_;
751 			gint _tmp9_;
752 			_tmp4_ = _element_it;
753 			if (!vala_iterator_next (_tmp4_)) {
754 				break;
755 			}
756 			_tmp5_ = _element_it;
757 			_tmp6_ = vala_iterator_get (_tmp5_);
758 			element = (gint) ((gintptr) _tmp6_);
759 			_tmp7_ = array;
760 			_tmp7__length1 = array_length1;
761 			_tmp8_ = index;
762 			index = _tmp8_ + 1;
763 			_tmp9_ = element;
764 			_tmp7_[_tmp8_] = _tmp9_;
765 		}
766 		_vala_iterator_unref0 (_element_it);
767 	}
768 	_tmp10_ = array;
769 	_tmp10__length1 = array_length1;
770 	if (result_length1) {
771 		*result_length1 = _tmp10__length1;
772 	}
773 	result = _tmp10_;
774 	return result;
775 }
776 
777 static guint*
vala_collection_to_uint_array(ValaCollection * coll,gint * result_length1)778 vala_collection_to_uint_array (ValaCollection* coll,
779                                gint* result_length1)
780 {
781 	guint* array = NULL;
782 	gint _tmp0_;
783 	gint _tmp1_;
784 	guint* _tmp2_;
785 	gint array_length1;
786 	gint _array_size_;
787 	gint index = 0;
788 	guint* _tmp10_;
789 	gint _tmp10__length1;
790 	guint* result = NULL;
791 	g_return_val_if_fail (coll != NULL, NULL);
792 	_tmp0_ = vala_collection_get_size (coll);
793 	_tmp1_ = _tmp0_;
794 	_tmp2_ = g_new0 (guint, _tmp1_);
795 	array = _tmp2_;
796 	array_length1 = _tmp1_;
797 	_array_size_ = array_length1;
798 	index = 0;
799 	{
800 		ValaIterator* _element_it = NULL;
801 		ValaIterator* _tmp3_;
802 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
803 		_element_it = _tmp3_;
804 		while (TRUE) {
805 			ValaIterator* _tmp4_;
806 			guint element = 0U;
807 			ValaIterator* _tmp5_;
808 			gpointer _tmp6_;
809 			guint* _tmp7_;
810 			gint _tmp7__length1;
811 			gint _tmp8_;
812 			guint _tmp9_;
813 			_tmp4_ = _element_it;
814 			if (!vala_iterator_next (_tmp4_)) {
815 				break;
816 			}
817 			_tmp5_ = _element_it;
818 			_tmp6_ = vala_iterator_get (_tmp5_);
819 			element = (guint) ((guintptr) _tmp6_);
820 			_tmp7_ = array;
821 			_tmp7__length1 = array_length1;
822 			_tmp8_ = index;
823 			index = _tmp8_ + 1;
824 			_tmp9_ = element;
825 			_tmp7_[_tmp8_] = _tmp9_;
826 		}
827 		_vala_iterator_unref0 (_element_it);
828 	}
829 	_tmp10_ = array;
830 	_tmp10__length1 = array_length1;
831 	if (result_length1) {
832 		*result_length1 = _tmp10__length1;
833 	}
834 	result = _tmp10_;
835 	return result;
836 }
837 
838 static gint64**
vala_collection_to_int64_array(ValaCollection * coll,gint * result_length1)839 vala_collection_to_int64_array (ValaCollection* coll,
840                                 gint* result_length1)
841 {
842 	gint64** array = NULL;
843 	gint _tmp0_;
844 	gint _tmp1_;
845 	gint64** _tmp2_;
846 	gint array_length1;
847 	gint _array_size_;
848 	gint index = 0;
849 	gint64** _tmp10_;
850 	gint _tmp10__length1;
851 	gint64** result = NULL;
852 	g_return_val_if_fail (coll != NULL, NULL);
853 	_tmp0_ = vala_collection_get_size (coll);
854 	_tmp1_ = _tmp0_;
855 	_tmp2_ = g_new0 (gint64*, _tmp1_);
856 	array = _tmp2_;
857 	array_length1 = _tmp1_;
858 	_array_size_ = array_length1;
859 	index = 0;
860 	{
861 		ValaIterator* _element_it = NULL;
862 		ValaIterator* _tmp3_;
863 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
864 		_element_it = _tmp3_;
865 		while (TRUE) {
866 			ValaIterator* _tmp4_;
867 			gint64* element = NULL;
868 			ValaIterator* _tmp5_;
869 			gpointer _tmp6_;
870 			gint64** _tmp7_;
871 			gint _tmp7__length1;
872 			gint _tmp8_;
873 			gint64* _tmp9_;
874 			_tmp4_ = _element_it;
875 			if (!vala_iterator_next (_tmp4_)) {
876 				break;
877 			}
878 			_tmp5_ = _element_it;
879 			_tmp6_ = vala_iterator_get (_tmp5_);
880 			element = (gint64*) _tmp6_;
881 			_tmp7_ = array;
882 			_tmp7__length1 = array_length1;
883 			_tmp8_ = index;
884 			index = _tmp8_ + 1;
885 			_tmp9_ = element;
886 			element = NULL;
887 			_g_free0 (_tmp7_[_tmp8_]);
888 			_tmp7_[_tmp8_] = _tmp9_;
889 			_g_free0 (element);
890 		}
891 		_vala_iterator_unref0 (_element_it);
892 	}
893 	_tmp10_ = array;
894 	_tmp10__length1 = array_length1;
895 	if (result_length1) {
896 		*result_length1 = _tmp10__length1;
897 	}
898 	result = _tmp10_;
899 	return result;
900 }
901 
902 static guint64**
vala_collection_to_uint64_array(ValaCollection * coll,gint * result_length1)903 vala_collection_to_uint64_array (ValaCollection* coll,
904                                  gint* result_length1)
905 {
906 	guint64** array = NULL;
907 	gint _tmp0_;
908 	gint _tmp1_;
909 	guint64** _tmp2_;
910 	gint array_length1;
911 	gint _array_size_;
912 	gint index = 0;
913 	guint64** _tmp10_;
914 	gint _tmp10__length1;
915 	guint64** result = NULL;
916 	g_return_val_if_fail (coll != NULL, NULL);
917 	_tmp0_ = vala_collection_get_size (coll);
918 	_tmp1_ = _tmp0_;
919 	_tmp2_ = g_new0 (guint64*, _tmp1_);
920 	array = _tmp2_;
921 	array_length1 = _tmp1_;
922 	_array_size_ = array_length1;
923 	index = 0;
924 	{
925 		ValaIterator* _element_it = NULL;
926 		ValaIterator* _tmp3_;
927 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
928 		_element_it = _tmp3_;
929 		while (TRUE) {
930 			ValaIterator* _tmp4_;
931 			guint64* element = NULL;
932 			ValaIterator* _tmp5_;
933 			gpointer _tmp6_;
934 			guint64** _tmp7_;
935 			gint _tmp7__length1;
936 			gint _tmp8_;
937 			guint64* _tmp9_;
938 			_tmp4_ = _element_it;
939 			if (!vala_iterator_next (_tmp4_)) {
940 				break;
941 			}
942 			_tmp5_ = _element_it;
943 			_tmp6_ = vala_iterator_get (_tmp5_);
944 			element = (guint64*) _tmp6_;
945 			_tmp7_ = array;
946 			_tmp7__length1 = array_length1;
947 			_tmp8_ = index;
948 			index = _tmp8_ + 1;
949 			_tmp9_ = element;
950 			element = NULL;
951 			_g_free0 (_tmp7_[_tmp8_]);
952 			_tmp7_[_tmp8_] = _tmp9_;
953 			_g_free0 (element);
954 		}
955 		_vala_iterator_unref0 (_element_it);
956 	}
957 	_tmp10_ = array;
958 	_tmp10__length1 = array_length1;
959 	if (result_length1) {
960 		*result_length1 = _tmp10__length1;
961 	}
962 	result = _tmp10_;
963 	return result;
964 }
965 
966 static glong*
vala_collection_to_long_array(ValaCollection * coll,gint * result_length1)967 vala_collection_to_long_array (ValaCollection* coll,
968                                gint* result_length1)
969 {
970 	glong* array = NULL;
971 	gint _tmp0_;
972 	gint _tmp1_;
973 	glong* _tmp2_;
974 	gint array_length1;
975 	gint _array_size_;
976 	gint index = 0;
977 	glong* _tmp10_;
978 	gint _tmp10__length1;
979 	glong* result = NULL;
980 	g_return_val_if_fail (coll != NULL, NULL);
981 	_tmp0_ = vala_collection_get_size (coll);
982 	_tmp1_ = _tmp0_;
983 	_tmp2_ = g_new0 (glong, _tmp1_);
984 	array = _tmp2_;
985 	array_length1 = _tmp1_;
986 	_array_size_ = array_length1;
987 	index = 0;
988 	{
989 		ValaIterator* _element_it = NULL;
990 		ValaIterator* _tmp3_;
991 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
992 		_element_it = _tmp3_;
993 		while (TRUE) {
994 			ValaIterator* _tmp4_;
995 			glong element = 0L;
996 			ValaIterator* _tmp5_;
997 			gpointer _tmp6_;
998 			glong* _tmp7_;
999 			gint _tmp7__length1;
1000 			gint _tmp8_;
1001 			glong _tmp9_;
1002 			_tmp4_ = _element_it;
1003 			if (!vala_iterator_next (_tmp4_)) {
1004 				break;
1005 			}
1006 			_tmp5_ = _element_it;
1007 			_tmp6_ = vala_iterator_get (_tmp5_);
1008 			element = (glong) ((gintptr) _tmp6_);
1009 			_tmp7_ = array;
1010 			_tmp7__length1 = array_length1;
1011 			_tmp8_ = index;
1012 			index = _tmp8_ + 1;
1013 			_tmp9_ = element;
1014 			_tmp7_[_tmp8_] = _tmp9_;
1015 		}
1016 		_vala_iterator_unref0 (_element_it);
1017 	}
1018 	_tmp10_ = array;
1019 	_tmp10__length1 = array_length1;
1020 	if (result_length1) {
1021 		*result_length1 = _tmp10__length1;
1022 	}
1023 	result = _tmp10_;
1024 	return result;
1025 }
1026 
1027 static gulong*
vala_collection_to_ulong_array(ValaCollection * coll,gint * result_length1)1028 vala_collection_to_ulong_array (ValaCollection* coll,
1029                                 gint* result_length1)
1030 {
1031 	gulong* array = NULL;
1032 	gint _tmp0_;
1033 	gint _tmp1_;
1034 	gulong* _tmp2_;
1035 	gint array_length1;
1036 	gint _array_size_;
1037 	gint index = 0;
1038 	gulong* _tmp10_;
1039 	gint _tmp10__length1;
1040 	gulong* result = NULL;
1041 	g_return_val_if_fail (coll != NULL, NULL);
1042 	_tmp0_ = vala_collection_get_size (coll);
1043 	_tmp1_ = _tmp0_;
1044 	_tmp2_ = g_new0 (gulong, _tmp1_);
1045 	array = _tmp2_;
1046 	array_length1 = _tmp1_;
1047 	_array_size_ = array_length1;
1048 	index = 0;
1049 	{
1050 		ValaIterator* _element_it = NULL;
1051 		ValaIterator* _tmp3_;
1052 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
1053 		_element_it = _tmp3_;
1054 		while (TRUE) {
1055 			ValaIterator* _tmp4_;
1056 			gulong element = 0UL;
1057 			ValaIterator* _tmp5_;
1058 			gpointer _tmp6_;
1059 			gulong* _tmp7_;
1060 			gint _tmp7__length1;
1061 			gint _tmp8_;
1062 			gulong _tmp9_;
1063 			_tmp4_ = _element_it;
1064 			if (!vala_iterator_next (_tmp4_)) {
1065 				break;
1066 			}
1067 			_tmp5_ = _element_it;
1068 			_tmp6_ = vala_iterator_get (_tmp5_);
1069 			element = (gulong) ((guintptr) _tmp6_);
1070 			_tmp7_ = array;
1071 			_tmp7__length1 = array_length1;
1072 			_tmp8_ = index;
1073 			index = _tmp8_ + 1;
1074 			_tmp9_ = element;
1075 			_tmp7_[_tmp8_] = _tmp9_;
1076 		}
1077 		_vala_iterator_unref0 (_element_it);
1078 	}
1079 	_tmp10_ = array;
1080 	_tmp10__length1 = array_length1;
1081 	if (result_length1) {
1082 		*result_length1 = _tmp10__length1;
1083 	}
1084 	result = _tmp10_;
1085 	return result;
1086 }
1087 
1088 static gfloat**
vala_collection_to_float_array(ValaCollection * coll,gint * result_length1)1089 vala_collection_to_float_array (ValaCollection* coll,
1090                                 gint* result_length1)
1091 {
1092 	gfloat** array = NULL;
1093 	gint _tmp0_;
1094 	gint _tmp1_;
1095 	gfloat** _tmp2_;
1096 	gint array_length1;
1097 	gint _array_size_;
1098 	gint index = 0;
1099 	gfloat** _tmp10_;
1100 	gint _tmp10__length1;
1101 	gfloat** result = NULL;
1102 	g_return_val_if_fail (coll != NULL, NULL);
1103 	_tmp0_ = vala_collection_get_size (coll);
1104 	_tmp1_ = _tmp0_;
1105 	_tmp2_ = g_new0 (gfloat*, _tmp1_);
1106 	array = _tmp2_;
1107 	array_length1 = _tmp1_;
1108 	_array_size_ = array_length1;
1109 	index = 0;
1110 	{
1111 		ValaIterator* _element_it = NULL;
1112 		ValaIterator* _tmp3_;
1113 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
1114 		_element_it = _tmp3_;
1115 		while (TRUE) {
1116 			ValaIterator* _tmp4_;
1117 			gfloat* element = NULL;
1118 			ValaIterator* _tmp5_;
1119 			gpointer _tmp6_;
1120 			gfloat** _tmp7_;
1121 			gint _tmp7__length1;
1122 			gint _tmp8_;
1123 			gfloat* _tmp9_;
1124 			_tmp4_ = _element_it;
1125 			if (!vala_iterator_next (_tmp4_)) {
1126 				break;
1127 			}
1128 			_tmp5_ = _element_it;
1129 			_tmp6_ = vala_iterator_get (_tmp5_);
1130 			element = (gfloat*) _tmp6_;
1131 			_tmp7_ = array;
1132 			_tmp7__length1 = array_length1;
1133 			_tmp8_ = index;
1134 			index = _tmp8_ + 1;
1135 			_tmp9_ = element;
1136 			element = NULL;
1137 			_g_free0 (_tmp7_[_tmp8_]);
1138 			_tmp7_[_tmp8_] = _tmp9_;
1139 			_g_free0 (element);
1140 		}
1141 		_vala_iterator_unref0 (_element_it);
1142 	}
1143 	_tmp10_ = array;
1144 	_tmp10__length1 = array_length1;
1145 	if (result_length1) {
1146 		*result_length1 = _tmp10__length1;
1147 	}
1148 	result = _tmp10_;
1149 	return result;
1150 }
1151 
1152 static gdouble**
vala_collection_to_double_array(ValaCollection * coll,gint * result_length1)1153 vala_collection_to_double_array (ValaCollection* coll,
1154                                  gint* result_length1)
1155 {
1156 	gdouble** array = NULL;
1157 	gint _tmp0_;
1158 	gint _tmp1_;
1159 	gdouble** _tmp2_;
1160 	gint array_length1;
1161 	gint _array_size_;
1162 	gint index = 0;
1163 	gdouble** _tmp10_;
1164 	gint _tmp10__length1;
1165 	gdouble** result = NULL;
1166 	g_return_val_if_fail (coll != NULL, NULL);
1167 	_tmp0_ = vala_collection_get_size (coll);
1168 	_tmp1_ = _tmp0_;
1169 	_tmp2_ = g_new0 (gdouble*, _tmp1_);
1170 	array = _tmp2_;
1171 	array_length1 = _tmp1_;
1172 	_array_size_ = array_length1;
1173 	index = 0;
1174 	{
1175 		ValaIterator* _element_it = NULL;
1176 		ValaIterator* _tmp3_;
1177 		_tmp3_ = vala_iterable_iterator ((ValaIterable*) coll);
1178 		_element_it = _tmp3_;
1179 		while (TRUE) {
1180 			ValaIterator* _tmp4_;
1181 			gdouble* element = NULL;
1182 			ValaIterator* _tmp5_;
1183 			gpointer _tmp6_;
1184 			gdouble** _tmp7_;
1185 			gint _tmp7__length1;
1186 			gint _tmp8_;
1187 			gdouble* _tmp9_;
1188 			_tmp4_ = _element_it;
1189 			if (!vala_iterator_next (_tmp4_)) {
1190 				break;
1191 			}
1192 			_tmp5_ = _element_it;
1193 			_tmp6_ = vala_iterator_get (_tmp5_);
1194 			element = (gdouble*) _tmp6_;
1195 			_tmp7_ = array;
1196 			_tmp7__length1 = array_length1;
1197 			_tmp8_ = index;
1198 			index = _tmp8_ + 1;
1199 			_tmp9_ = element;
1200 			element = NULL;
1201 			_g_free0 (_tmp7_[_tmp8_]);
1202 			_tmp7_[_tmp8_] = _tmp9_;
1203 			_g_free0 (element);
1204 		}
1205 		_vala_iterator_unref0 (_element_it);
1206 	}
1207 	_tmp10_ = array;
1208 	_tmp10__length1 = array_length1;
1209 	if (result_length1) {
1210 		*result_length1 = _tmp10__length1;
1211 	}
1212 	result = _tmp10_;
1213 	return result;
1214 }
1215 
1216 ValaCollection*
vala_collection_construct(GType object_type,GType g_type,GBoxedCopyFunc g_dup_func,GDestroyNotify g_destroy_func)1217 vala_collection_construct (GType object_type,
1218                            GType g_type,
1219                            GBoxedCopyFunc g_dup_func,
1220                            GDestroyNotify g_destroy_func)
1221 {
1222 	ValaCollection* self = NULL;
1223 	self = (ValaCollection*) vala_iterable_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, (GDestroyNotify) g_destroy_func);
1224 	self->priv->g_type = g_type;
1225 	self->priv->g_dup_func = g_dup_func;
1226 	self->priv->g_destroy_func = g_destroy_func;
1227 	return self;
1228 }
1229 
1230 static void
vala_collection_class_init(ValaCollectionClass * klass,gpointer klass_data)1231 vala_collection_class_init (ValaCollectionClass * klass,
1232                             gpointer klass_data)
1233 {
1234 	vala_collection_parent_class = g_type_class_peek_parent (klass);
1235 	g_type_class_adjust_private_offset (klass, &ValaCollection_private_offset);
1236 	((ValaCollectionClass *) klass)->contains = (gboolean (*) (ValaCollection*, gconstpointer)) vala_collection_real_contains;
1237 	((ValaCollectionClass *) klass)->add = (gboolean (*) (ValaCollection*, gconstpointer)) vala_collection_real_add;
1238 	((ValaCollectionClass *) klass)->remove = (gboolean (*) (ValaCollection*, gconstpointer)) vala_collection_real_remove;
1239 	((ValaCollectionClass *) klass)->clear = (void (*) (ValaCollection*)) vala_collection_real_clear;
1240 	((ValaCollectionClass *) klass)->add_all = (gboolean (*) (ValaCollection*, ValaCollection*)) vala_collection_real_add_all;
1241 	((ValaCollectionClass *) klass)->to_array = (gpointer* (*) (ValaCollection*, gint*)) vala_collection_real_to_array;
1242 	VALA_COLLECTION_CLASS (klass)->get_is_empty = vala_collection_real_get_is_empty;
1243 }
1244 
1245 static void
vala_collection_instance_init(ValaCollection * self,gpointer klass)1246 vala_collection_instance_init (ValaCollection * self,
1247                                gpointer klass)
1248 {
1249 	self->priv = vala_collection_get_instance_private (self);
1250 }
1251 
1252 /**
1253  * Serves as the base interface for implementing collection classes. Defines
1254  * size, iteration, and modification methods.
1255  */
1256 static GType
vala_collection_get_type_once(void)1257 vala_collection_get_type_once (void)
1258 {
1259 	static const GTypeInfo g_define_type_info = { sizeof (ValaCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCollection), 0, (GInstanceInitFunc) vala_collection_instance_init, NULL };
1260 	GType vala_collection_type_id;
1261 	vala_collection_type_id = g_type_register_static (VALA_TYPE_ITERABLE, "ValaCollection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
1262 	ValaCollection_private_offset = g_type_add_instance_private (vala_collection_type_id, sizeof (ValaCollectionPrivate));
1263 	return vala_collection_type_id;
1264 }
1265 
1266 GType
vala_collection_get_type(void)1267 vala_collection_get_type (void)
1268 {
1269 	static volatile gsize vala_collection_type_id__volatile = 0;
1270 	if (g_once_init_enter (&vala_collection_type_id__volatile)) {
1271 		GType vala_collection_type_id;
1272 		vala_collection_type_id = vala_collection_get_type_once ();
1273 		g_once_init_leave (&vala_collection_type_id__volatile, vala_collection_type_id);
1274 	}
1275 	return vala_collection_type_id__volatile;
1276 }
1277 
1278