summaryrefslogtreecommitdiff
path: root/gee/unfolditerator.c
blob: 46c5ce9995745678c64022dca7cdc1566539260e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
/* unfolditerator.c generated by valac 0.18.0, the Vala compiler
 * generated from unfolditerator.vala, do not modify */

/* unfolditerator.vala
 *
 * Copyright (C) 2011  Maciej Piechotka
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Maciej Piechotka <uzytkownik2@gmail.com>
 */

#include <glib.h>
#include <glib-object.h>


#define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
#define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
#define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
#define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))

typedef struct _GeeTraversable GeeTraversable;
typedef struct _GeeTraversableIface GeeTraversableIface;

#define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())

#define GEE_TYPE_LAZY (gee_lazy_get_type ())
#define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
#define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
#define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
#define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
#define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))

typedef struct _GeeLazy GeeLazy;
typedef struct _GeeLazyClass GeeLazyClass;

#define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
#define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
#define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
#define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))

typedef struct _GeeIterator GeeIterator;
typedef struct _GeeIteratorIface GeeIteratorIface;

#define GEE_TYPE_UNFOLD_ITERATOR (gee_unfold_iterator_get_type ())
#define GEE_UNFOLD_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIterator))
#define GEE_UNFOLD_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIteratorClass))
#define GEE_IS_UNFOLD_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_UNFOLD_ITERATOR))
#define GEE_IS_UNFOLD_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_UNFOLD_ITERATOR))
#define GEE_UNFOLD_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIteratorClass))

typedef struct _GeeUnfoldIterator GeeUnfoldIterator;
typedef struct _GeeUnfoldIteratorClass GeeUnfoldIteratorClass;
typedef struct _GeeUnfoldIteratorPrivate GeeUnfoldIteratorPrivate;
#define _gee_lazy_unref0(var) ((var == NULL) ? NULL : (var = (gee_lazy_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
typedef enum  {
	GEE_TRAVERSABLE_STREAM_YIELD,
	GEE_TRAVERSABLE_STREAM_CONTINUE,
	GEE_TRAVERSABLE_STREAM_END
} GeeTraversableStream;

typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, void* user_data);
struct _GeeIteratorIface {
	GTypeInterface parent_iface;
	gboolean (*next) (GeeIterator* self);
	gboolean (*has_next) (GeeIterator* self);
	gpointer (*get) (GeeIterator* self);
	void (*remove) (GeeIterator* self);
	gboolean (*get_valid) (GeeIterator* self);
	gboolean (*get_read_only) (GeeIterator* self);
};

typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, void* user_data);
typedef gpointer (*GeeMapFunc) (gpointer g, void* user_data);
typedef gboolean (*GeePredicate) (gconstpointer g, void* user_data);
struct _GeeTraversableIface {
	GTypeInterface parent_iface;
	GType (*get_g_type) (GeeTraversable* self);
	GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
	GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
	gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, void* f_target);
	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);
	gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
	GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
	GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
	GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
	GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
	GType (*get_element_type) (GeeTraversable* self);
};

struct _GeeUnfoldIterator {
	GObject parent_instance;
	GeeUnfoldIteratorPrivate * priv;
};

struct _GeeUnfoldIteratorClass {
	GObjectClass parent_class;
};

typedef GeeLazy* (*GeeUnfoldFunc) (void* user_data);
struct _GeeUnfoldIteratorPrivate {
	GType g_type;
	GBoxedCopyFunc g_dup_func;
	GDestroyNotify g_destroy_func;
	GeeUnfoldFunc _func;
	gpointer _func_target;
	GDestroyNotify _func_target_destroy_notify;
	GeeLazy* _current;
	GeeLazy* _next;
	gboolean _end;
};


static gpointer gee_unfold_iterator_parent_class = NULL;
static GeeTraversableIface* gee_unfold_iterator_gee_traversable_parent_iface = NULL;
static GeeIteratorIface* gee_unfold_iterator_gee_iterator_parent_iface = NULL;

GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
gpointer gee_lazy_ref (gpointer instance);
void gee_lazy_unref (gpointer instance);
GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gee_value_set_lazy (GValue* value, gpointer v_object);
void gee_value_take_lazy (GValue* value, gpointer v_object);
gpointer gee_value_get_lazy (const GValue* value);
GType gee_lazy_get_type (void) G_GNUC_CONST;
GType gee_iterator_get_type (void) G_GNUC_CONST;
GType gee_traversable_get_type (void) G_GNUC_CONST;
GType gee_unfold_iterator_get_type (void) G_GNUC_CONST;
#define GEE_UNFOLD_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIteratorPrivate))
enum  {
	GEE_UNFOLD_ITERATOR_DUMMY_PROPERTY,
	GEE_UNFOLD_ITERATOR_G_TYPE,
	GEE_UNFOLD_ITERATOR_G_DUP_FUNC,
	GEE_UNFOLD_ITERATOR_G_DESTROY_FUNC,
	GEE_UNFOLD_ITERATOR_VALID,
	GEE_UNFOLD_ITERATOR_READ_ONLY
};
GeeUnfoldIterator* gee_unfold_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeUnfoldFunc func, void* func_target, GDestroyNotify func_target_destroy_notify, GeeLazy* current);
GeeUnfoldIterator* gee_unfold_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeUnfoldFunc func, void* func_target, GDestroyNotify func_target_destroy_notify, GeeLazy* current);
static gboolean gee_unfold_iterator_real_next (GeeIterator* base);
gboolean gee_iterator_has_next (GeeIterator* self);
void gee_lazy_eval (GeeLazy* self);
static gboolean gee_unfold_iterator_real_has_next (GeeIterator* base);
static gpointer gee_unfold_iterator_real_get (GeeIterator* base);
gconstpointer gee_lazy_get_value (GeeLazy* self);
static void gee_unfold_iterator_real_remove (GeeIterator* base);
static gboolean gee_unfold_iterator_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target);
static void gee_unfold_iterator_finalize (GObject* obj);
gboolean gee_iterator_get_valid (GeeIterator* self);
gboolean gee_iterator_get_read_only (GeeIterator* self);
static void _vala_gee_unfold_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gee_unfold_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GeeUnfoldIterator* gee_unfold_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeUnfoldFunc func, void* func_target, GDestroyNotify func_target_destroy_notify, GeeLazy* current) {
	GeeUnfoldIterator * self = NULL;
	GeeLazy* _tmp0_;
	GeeUnfoldFunc _tmp1_;
	void* _tmp1__target;
	GDestroyNotify _tmp1__target_destroy_notify;
	self = (GeeUnfoldIterator*) g_object_new (object_type, NULL);
	self->priv->g_type = g_type;
	self->priv->g_dup_func = g_dup_func;
	self->priv->g_destroy_func = g_destroy_func;
	_tmp0_ = current;
	current = NULL;
	_gee_lazy_unref0 (self->priv->_current);
	self->priv->_current = _tmp0_;
	_tmp1_ = func;
	_tmp1__target = func_target;
	_tmp1__target_destroy_notify = func_target_destroy_notify;
	func_target_destroy_notify = NULL;
	(self->priv->_func_target_destroy_notify == NULL) ? NULL : (self->priv->_func_target_destroy_notify (self->priv->_func_target), NULL);
	self->priv->_func = NULL;
	self->priv->_func_target = NULL;
	self->priv->_func_target_destroy_notify = NULL;
	self->priv->_func = _tmp1_;
	self->priv->_func_target = _tmp1__target;
	self->priv->_func_target_destroy_notify = _tmp1__target_destroy_notify;
	self->priv->_end = FALSE;
	(func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
	_gee_lazy_unref0 (current);
	return self;
}


GeeUnfoldIterator* gee_unfold_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeUnfoldFunc func, void* func_target, GDestroyNotify func_target_destroy_notify, GeeLazy* current) {
	return gee_unfold_iterator_construct (GEE_TYPE_UNFOLD_ITERATOR, g_type, g_dup_func, g_destroy_func, func, func_target, func_target_destroy_notify, current);
}


static gboolean gee_unfold_iterator_real_next (GeeIterator* base) {
	GeeUnfoldIterator * self;
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	self = (GeeUnfoldIterator*) base;
	_tmp0_ = gee_iterator_has_next ((GeeIterator*) self);
	if (_tmp0_) {
		GeeLazy* _tmp1_;
		GeeLazy* _tmp3_;
		_tmp1_ = self->priv->_current;
		if (_tmp1_ != NULL) {
			GeeLazy* _tmp2_;
			_tmp2_ = self->priv->_current;
			gee_lazy_eval (_tmp2_);
		}
		_tmp3_ = self->priv->_next;
		self->priv->_next = NULL;
		_gee_lazy_unref0 (self->priv->_current);
		self->priv->_current = _tmp3_;
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static gboolean gee_unfold_iterator_real_has_next (GeeIterator* base) {
	GeeUnfoldIterator * self;
	gboolean result = FALSE;
	gboolean _tmp0_;
	GeeLazy* _tmp1_;
	GeeUnfoldFunc _tmp2_;
	void* _tmp2__target;
	GeeLazy* _tmp3_ = NULL;
	GeeLazy* _tmp4_;
	GeeLazy* _tmp5_;
	self = (GeeUnfoldIterator*) base;
	_tmp0_ = self->priv->_end;
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->_next;
	if (_tmp1_ != NULL) {
		result = TRUE;
		return result;
	}
	_tmp2_ = self->priv->_func;
	_tmp2__target = self->priv->_func_target;
	_tmp3_ = _tmp2_ (_tmp2__target);
	_gee_lazy_unref0 (self->priv->_next);
	self->priv->_next = _tmp3_;
	_tmp4_ = self->priv->_next;
	if (_tmp4_ == NULL) {
		self->priv->_end = TRUE;
	}
	_tmp5_ = self->priv->_next;
	result = _tmp5_ != NULL;
	return result;
}


static gpointer gee_unfold_iterator_real_get (GeeIterator* base) {
	GeeUnfoldIterator * self;
	gpointer result = NULL;
	GeeLazy* _tmp0_;
	GeeLazy* _tmp1_;
	gconstpointer _tmp2_;
	gconstpointer _tmp3_;
	gpointer _tmp4_;
	self = (GeeUnfoldIterator*) base;
	_tmp0_ = self->priv->_current;
	_vala_assert (_tmp0_ != NULL, "_current != null");
	_tmp1_ = self->priv->_current;
	_tmp2_ = gee_lazy_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = ((_tmp3_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp3_) : ((gpointer) _tmp3_);
	result = _tmp4_;
	return result;
}


static void gee_unfold_iterator_real_remove (GeeIterator* base) {
	GeeUnfoldIterator * self;
	self = (GeeUnfoldIterator*) base;
	g_assert_not_reached ();
}


static gboolean gee_unfold_iterator_real_foreach (GeeTraversable* base, GeeForallFunc f, void* f_target) {
	GeeUnfoldIterator * self;
	gboolean result = FALSE;
	GeeLazy* _tmp0_;
	GeeLazy* _tmp5_;
	GeeLazy* _tmp12_;
	self = (GeeUnfoldIterator*) base;
	_tmp0_ = self->priv->_current;
	if (_tmp0_ != NULL) {
		GeeForallFunc _tmp1_;
		void* _tmp1__target;
		GeeLazy* _tmp2_;
		gpointer _tmp3_;
		gboolean _tmp4_ = FALSE;
		_tmp1_ = f;
		_tmp1__target = f_target;
		_tmp2_ = self->priv->_current;
		_tmp3_ = ((_tmp2_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_);
		_tmp4_ = _tmp1_ (_tmp3_, _tmp1__target);
		if (!_tmp4_) {
			result = FALSE;
			return result;
		}
	}
	_tmp5_ = self->priv->_next;
	if (_tmp5_ != NULL) {
		GeeLazy* _tmp6_;
		GeeForallFunc _tmp7_;
		void* _tmp7__target;
		GeeLazy* _tmp8_;
		gpointer _tmp9_;
		gboolean _tmp10_ = FALSE;
		_tmp6_ = self->priv->_next;
		self->priv->_next = NULL;
		_gee_lazy_unref0 (self->priv->_current);
		self->priv->_current = _tmp6_;
		_tmp7_ = f;
		_tmp7__target = f_target;
		_tmp8_ = self->priv->_current;
		_tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_);
		_tmp10_ = _tmp7_ (_tmp9_, _tmp7__target);
		if (!_tmp10_) {
			result = FALSE;
			return result;
		}
	} else {
		gboolean _tmp11_;
		_tmp11_ = self->priv->_end;
		if (_tmp11_) {
			result = TRUE;
			return result;
		}
	}
	_tmp12_ = self->priv->_current;
	if (_tmp12_ == NULL) {
		GeeUnfoldFunc _tmp13_;
		void* _tmp13__target;
		GeeLazy* _tmp14_ = NULL;
		GeeLazy* _tmp15_;
		_tmp13_ = self->priv->_func;
		_tmp13__target = self->priv->_func_target;
		_tmp14_ = _tmp13_ (_tmp13__target);
		_gee_lazy_unref0 (self->priv->_current);
		self->priv->_current = _tmp14_;
		_tmp15_ = self->priv->_current;
		if (_tmp15_ == NULL) {
			self->priv->_end = TRUE;
			result = TRUE;
			return result;
		} else {
			GeeForallFunc _tmp16_;
			void* _tmp16__target;
			GeeLazy* _tmp17_;
			gpointer _tmp18_;
			gboolean _tmp19_ = FALSE;
			_tmp16_ = f;
			_tmp16__target = f_target;
			_tmp17_ = self->priv->_current;
			_tmp18_ = ((_tmp17_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp17_) : ((gpointer) _tmp17_);
			_tmp19_ = _tmp16_ (_tmp18_, _tmp16__target);
			if (!_tmp19_) {
				result = FALSE;
				return result;
			}
		}
	}
	while (TRUE) {
		GeeUnfoldFunc _tmp20_;
		void* _tmp20__target;
		GeeLazy* _tmp21_ = NULL;
		GeeLazy* _tmp22_;
		GeeLazy* _tmp23_;
		GeeForallFunc _tmp24_;
		void* _tmp24__target;
		GeeLazy* _tmp25_;
		gpointer _tmp26_;
		gboolean _tmp27_ = FALSE;
		_tmp20_ = self->priv->_func;
		_tmp20__target = self->priv->_func_target;
		_tmp21_ = _tmp20_ (_tmp20__target);
		_gee_lazy_unref0 (self->priv->_next);
		self->priv->_next = _tmp21_;
		_tmp22_ = self->priv->_next;
		if (!(_tmp22_ != NULL)) {
			break;
		}
		_tmp23_ = self->priv->_next;
		self->priv->_next = NULL;
		_gee_lazy_unref0 (self->priv->_current);
		self->priv->_current = _tmp23_;
		_tmp24_ = f;
		_tmp24__target = f_target;
		_tmp25_ = self->priv->_current;
		_tmp26_ = ((_tmp25_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp25_) : ((gpointer) _tmp25_);
		_tmp27_ = _tmp24_ (_tmp26_, _tmp24__target);
		if (!_tmp27_) {
			result = FALSE;
			return result;
		}
	}
	self->priv->_end = TRUE;
	result = TRUE;
	return result;
}


static gboolean gee_unfold_iterator_real_get_valid (GeeIterator* base) {
	gboolean result;
	GeeUnfoldIterator* self;
	GeeLazy* _tmp0_;
	self = (GeeUnfoldIterator*) base;
	_tmp0_ = self->priv->_current;
	result = _tmp0_ != NULL;
	return result;
}


static gboolean gee_unfold_iterator_real_get_read_only (GeeIterator* base) {
	gboolean result;
	GeeUnfoldIterator* self;
	self = (GeeUnfoldIterator*) base;
	result = TRUE;
	return result;
}


static void gee_unfold_iterator_class_init (GeeUnfoldIteratorClass * klass) {
	gee_unfold_iterator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GeeUnfoldIteratorPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gee_unfold_iterator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gee_unfold_iterator_set_property;
	G_OBJECT_CLASS (klass)->finalize = gee_unfold_iterator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_UNFOLD_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_UNFOLD_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_UNFOLD_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_UNFOLD_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_UNFOLD_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));
}


static GType gee_unfold_iterator_gee_traversable_get_g_type (GeeUnfoldIterator* self) {
	return self->priv->g_type;
}


static GBoxedCopyFunc gee_unfold_iterator_gee_traversable_get_g_dup_func (GeeUnfoldIterator* self) {
	return self->priv->g_dup_func;
}


static GDestroyNotify gee_unfold_iterator_gee_traversable_get_g_destroy_func (GeeUnfoldIterator* self) {
	return self->priv->g_destroy_func;
}


static void gee_unfold_iterator_gee_traversable_interface_init (GeeTraversableIface * iface) {
	gee_unfold_iterator_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
	iface->foreach = (gboolean (*)(GeeTraversable*, GeeForallFunc, void*)) gee_unfold_iterator_real_foreach;
	iface->get_g_type = (GType(*)(GeeTraversable*)) gee_unfold_iterator_gee_traversable_get_g_type;
	iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeTraversable*)) gee_unfold_iterator_gee_traversable_get_g_dup_func;
	iface->get_g_destroy_func = (GDestroyNotify(*)(GeeTraversable*)) gee_unfold_iterator_gee_traversable_get_g_destroy_func;
}


static void gee_unfold_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) {
	gee_unfold_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
	iface->next = (gboolean (*)(GeeIterator*)) gee_unfold_iterator_real_next;
	iface->has_next = (gboolean (*)(GeeIterator*)) gee_unfold_iterator_real_has_next;
	iface->get = (gpointer (*)(GeeIterator*)) gee_unfold_iterator_real_get;
	iface->remove = (void (*)(GeeIterator*)) gee_unfold_iterator_real_remove;
	iface->get_valid = gee_unfold_iterator_real_get_valid;
	iface->get_read_only = gee_unfold_iterator_real_get_read_only;
}


static void gee_unfold_iterator_instance_init (GeeUnfoldIterator * self) {
	self->priv = GEE_UNFOLD_ITERATOR_GET_PRIVATE (self);
}


static void gee_unfold_iterator_finalize (GObject* obj) {
	GeeUnfoldIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIterator);
	(self->priv->_func_target_destroy_notify == NULL) ? NULL : (self->priv->_func_target_destroy_notify (self->priv->_func_target), NULL);
	self->priv->_func = NULL;
	self->priv->_func_target = NULL;
	self->priv->_func_target_destroy_notify = NULL;
	_gee_lazy_unref0 (self->priv->_current);
	_gee_lazy_unref0 (self->priv->_next);
	G_OBJECT_CLASS (gee_unfold_iterator_parent_class)->finalize (obj);
}


GType gee_unfold_iterator_get_type (void) {
	static volatile gsize gee_unfold_iterator_type_id__volatile = 0;
	if (g_once_init_enter (&gee_unfold_iterator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GeeUnfoldIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_unfold_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeUnfoldIterator), 0, (GInstanceInitFunc) gee_unfold_iterator_instance_init, NULL };
		static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gee_unfold_iterator_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_unfold_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gee_unfold_iterator_type_id;
		gee_unfold_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeUnfoldIterator", &g_define_type_info, 0);
		g_type_add_interface_static (gee_unfold_iterator_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
		g_type_add_interface_static (gee_unfold_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
		g_once_init_leave (&gee_unfold_iterator_type_id__volatile, gee_unfold_iterator_type_id);
	}
	return gee_unfold_iterator_type_id__volatile;
}


static void _vala_gee_unfold_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GeeUnfoldIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIterator);
	switch (property_id) {
		case GEE_UNFOLD_ITERATOR_VALID:
		g_value_set_boolean (value, gee_iterator_get_valid ((GeeIterator*) self));
		break;
		case GEE_UNFOLD_ITERATOR_READ_ONLY:
		g_value_set_boolean (value, gee_iterator_get_read_only ((GeeIterator*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gee_unfold_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GeeUnfoldIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_UNFOLD_ITERATOR, GeeUnfoldIterator);
	switch (property_id) {
		case GEE_UNFOLD_ITERATOR_G_TYPE:
		self->priv->g_type = g_value_get_gtype (value);
		break;
		case GEE_UNFOLD_ITERATOR_G_DUP_FUNC:
		self->priv->g_dup_func = g_value_get_pointer (value);
		break;
		case GEE_UNFOLD_ITERATOR_G_DESTROY_FUNC:
		self->priv->g_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}