/* iterator.c generated by valac 0.11.0.112-6cec9, the Vala compiler
 * generated from iterator.vala, do not modify */

/* iterator.vala
 *
 * Copyright (C) 2007-2008  Jürg Billeter
 * Copyright (C) 2009  Didier Villevalois, 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:
 * 	Jürg Billeter <j@bitron.ch>
 * 	Maciej Piechotka <uzytkownik2@gmail.com>
 * 	Didier 'Ptitjes Villevalois <ptitjes@free.fr>
 */

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


#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_ITERATOR_TYPE_MAPPED_ITERATOR (gee_iterator_mapped_iterator_get_type ())
#define GEE_ITERATOR_MAPPED_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_ITERATOR_TYPE_MAPPED_ITERATOR, GeeIteratorMappedIterator))
#define GEE_ITERATOR_MAPPED_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_ITERATOR_TYPE_MAPPED_ITERATOR, GeeIteratorMappedIteratorClass))
#define GEE_ITERATOR_IS_MAPPED_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_ITERATOR_TYPE_MAPPED_ITERATOR))
#define GEE_ITERATOR_IS_MAPPED_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_ITERATOR_TYPE_MAPPED_ITERATOR))
#define GEE_ITERATOR_MAPPED_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_ITERATOR_TYPE_MAPPED_ITERATOR, GeeIteratorMappedIteratorClass))

typedef struct _GeeIteratorMappedIterator GeeIteratorMappedIterator;
typedef struct _GeeIteratorMappedIteratorClass GeeIteratorMappedIteratorClass;
typedef struct _GeeIteratorMappedIteratorPrivate GeeIteratorMappedIteratorPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _b_destroy_func0(var) (((var == NULL) || (b_destroy_func == NULL)) ? NULL : (var = (b_destroy_func (var), NULL)))
#define _a_destroy_func0(var) (((var == NULL) || (a_destroy_func == NULL)) ? NULL : (var = (a_destroy_func (var), NULL)))

typedef gpointer (*GeeFoldFunc) (gconstpointer g, gpointer a, void* user_data);
typedef gpointer (*GeeMapFunc) (gconstpointer a, 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);
	gpointer (*fold) (GeeIterator* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
	gpointer (*map) (GeeIterator* self, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeMapFunc func, void* func_target, GDestroyNotify func_target_destroy_notify);
	gboolean (*get_valid) (GeeIterator* self);
};

struct _GeeIteratorMappedIterator {
	GObject parent_instance;
	GeeIteratorMappedIteratorPrivate * priv;
};

struct _GeeIteratorMappedIteratorClass {
	GObjectClass parent_class;
};

struct _GeeIteratorMappedIteratorPrivate {
	GType a_type;
	GBoxedCopyFunc a_dup_func;
	GDestroyNotify a_destroy_func;
	GType b_type;
	GBoxedCopyFunc b_dup_func;
	GDestroyNotify b_destroy_func;
	GeeIterator* inner;
	gpointer current_result;
	GeeMapFunc map;
	gpointer map_target;
	GDestroyNotify map_target_destroy_notify;
};


static gpointer gee_iterator_mapped_iterator_parent_class = NULL;
static GeeIteratorIface* gee_iterator_mapped_iterator_gee_iterator_parent_iface = NULL;

GType gee_iterator_get_type (void) G_GNUC_CONST;
gboolean gee_iterator_next (GeeIterator* self);
gboolean gee_iterator_has_next (GeeIterator* self);
gpointer gee_iterator_get (GeeIterator* self);
void gee_iterator_remove (GeeIterator* self);
gpointer gee_iterator_fold (GeeIterator* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
static gpointer gee_iterator_real_fold (GeeIterator* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
gboolean gee_iterator_get_valid (GeeIterator* self);
gpointer gee_iterator_map (GeeIterator* self, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeMapFunc func, void* func_target, GDestroyNotify func_target_destroy_notify);
static gpointer gee_iterator_real_map (GeeIterator* self, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeMapFunc func, void* func_target, GDestroyNotify func_target_destroy_notify);
static GeeIteratorMappedIterator* gee_iterator_mapped_iterator_new (GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeIterator* inner, GeeMapFunc map, void* map_target, GDestroyNotify map_target_destroy_notify);
static GeeIteratorMappedIterator* gee_iterator_mapped_iterator_construct (GType object_type, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeIterator* inner, GeeMapFunc map, void* map_target, GDestroyNotify map_target_destroy_notify);
static GType gee_iterator_mapped_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
#define GEE_ITERATOR_MAPPED_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_ITERATOR_TYPE_MAPPED_ITERATOR, GeeIteratorMappedIteratorPrivate))
enum  {
	GEE_ITERATOR_MAPPED_ITERATOR_DUMMY_PROPERTY,
	GEE_ITERATOR_MAPPED_ITERATOR_A_TYPE,
	GEE_ITERATOR_MAPPED_ITERATOR_A_DUP_FUNC,
	GEE_ITERATOR_MAPPED_ITERATOR_A_DESTROY_FUNC,
	GEE_ITERATOR_MAPPED_ITERATOR_B_TYPE,
	GEE_ITERATOR_MAPPED_ITERATOR_B_DUP_FUNC,
	GEE_ITERATOR_MAPPED_ITERATOR_B_DESTROY_FUNC,
	GEE_ITERATOR_MAPPED_ITERATOR_VALID
};
static gboolean gee_iterator_mapped_iterator_real_next (GeeIterator* base);
static gboolean gee_iterator_mapped_iterator_real_has_next (GeeIterator* base);
static gpointer gee_iterator_mapped_iterator_real_get (GeeIterator* base);
static void gee_iterator_mapped_iterator_real_remove (GeeIterator* base);
static void gee_iterator_mapped_iterator_finalize (GObject* obj);
static void _vala_gee_iterator_mapped_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gee_iterator_mapped_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


/**
 * Advances to the next element in the iteration.
 *
 * @return `true` if the iterator has a next element
 */
gboolean gee_iterator_real_next (GeeIterator* self) {
	g_return_val_if_fail (self != NULL, FALSE);
	g_critical ("Type `%s' does not implement abstract method `gee_iterator_next'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return FALSE;
}


gboolean gee_iterator_next (GeeIterator* self) {
	return GEE_ITERATOR_GET_INTERFACE (self)->next (self);
}


/**
 * Checks whether there is a next element in the iteration.
 *
 * @return `true` if the iterator has a next element
 */
gboolean gee_iterator_real_has_next (GeeIterator* self) {
	g_return_val_if_fail (self != NULL, FALSE);
	g_critical ("Type `%s' does not implement abstract method `gee_iterator_has_next'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return FALSE;
}


gboolean gee_iterator_has_next (GeeIterator* self) {
	return GEE_ITERATOR_GET_INTERFACE (self)->has_next (self);
}


/**
 * Returns the current element in the iteration.
 *
 * @return the current element in the iteration
 */
gpointer gee_iterator_real_get (GeeIterator* self) {
	g_return_val_if_fail (self != NULL, NULL);
	g_critical ("Type `%s' does not implement abstract method `gee_iterator_get'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


gpointer gee_iterator_get (GeeIterator* self) {
	return GEE_ITERATOR_GET_INTERFACE (self)->get (self);
}


/**
 * Removes the current element in the iteration. The cursor is set in an
 * in-between state. Both {@link get} and {@link remove} will fail until
 * the next move of the cursor (calling {@link next}).
 */
void gee_iterator_real_remove (GeeIterator* self) {
	g_return_if_fail (self != NULL);
	g_critical ("Type `%s' does not implement abstract method `gee_iterator_remove'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void gee_iterator_remove (GeeIterator* self) {
	GEE_ITERATOR_GET_INTERFACE (self)->remove (self);
}


/**
 * Standard aggragation function.
 *
 * It takes a function, seed and first element, returns the new seed and
 * progress to next element when the operation repeats.
 *
 * Operation moves the iterator to last element in iteration. If iterator
 * points at some element it will be included in iteration
 */
static gpointer gee_iterator_real_fold (GeeIterator* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed) {
	gpointer result = NULL;
	gboolean _tmp0_;
	gpointer _tmp12_;
	_tmp0_ = gee_iterator_get_valid (self);
	if (_tmp0_) {
		gpointer _tmp1_ = NULL;
		gpointer _tmp2_;
		gpointer _tmp3_;
		gpointer _tmp4_ = NULL;
		gpointer _tmp5_;
		_tmp1_ = gee_iterator_get (self);
		_tmp2_ = _tmp1_;
		_tmp4_ = f (_tmp2_, (_tmp3_ = seed, seed = NULL, _tmp3_), f_target);
		_tmp5_ = _tmp4_;
		NULL;
		seed = _tmp5_;
		NULL;
	}
	while (TRUE) {
		gboolean _tmp6_;
		gpointer _tmp7_ = NULL;
		gpointer _tmp8_;
		gpointer _tmp9_;
		gpointer _tmp10_ = NULL;
		gpointer _tmp11_;
		_tmp6_ = gee_iterator_next (self);
		if (!_tmp6_) {
			break;
		}
		_tmp7_ = gee_iterator_get (self);
		_tmp8_ = _tmp7_;
		_tmp10_ = f (_tmp8_, (_tmp9_ = seed, seed = NULL, _tmp9_), f_target);
		_tmp11_ = _tmp10_;
		NULL;
		seed = _tmp11_;
		NULL;
	}
	result = (_tmp12_ = seed, seed = NULL, _tmp12_);
	NULL;
	return result;
}


gpointer gee_iterator_fold (GeeIterator* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed) {
	return GEE_ITERATOR_GET_INTERFACE (self)->fold (self, a_type, a_dup_func, a_destroy_func, f, f_target, seed);
}


static gpointer gee_iterator_real_map (GeeIterator* self, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeMapFunc func, void* func_target, GDestroyNotify func_target_destroy_notify) {
	gpointer result = NULL;
	GeeMapFunc _tmp0_;
	GeeIteratorMappedIterator* _tmp1_ = NULL;
	_tmp0_ = func;
	_tmp1_ = gee_iterator_mapped_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, NULL, b_type, (GBoxedCopyFunc) b_dup_func, NULL, self, _tmp0_, func_target, NULL);
	result = _tmp1_;
	(func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
	return result;
}


gpointer gee_iterator_map (GeeIterator* self, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeMapFunc func, void* func_target, GDestroyNotify func_target_destroy_notify) {
	return GEE_ITERATOR_GET_INTERFACE (self)->map (self, b_type, b_dup_func, b_destroy_func, func, func_target, func_target_destroy_notify);
}


gboolean gee_iterator_get_valid (GeeIterator* self) {
	return GEE_ITERATOR_GET_INTERFACE (self)->get_valid (self);
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static GeeIteratorMappedIterator* gee_iterator_mapped_iterator_construct (GType object_type, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeIterator* inner, GeeMapFunc map, void* map_target, GDestroyNotify map_target_destroy_notify) {
	GeeIteratorMappedIterator * self = NULL;
	GeeIterator* _tmp0_;
	GeeIterator* _tmp1_;
	GeeMapFunc _tmp2_;
	GeeMapFunc _tmp3_;
	gboolean _tmp4_;
	g_return_val_if_fail (inner != NULL, NULL);
	self = (GeeIteratorMappedIterator*) g_object_new (object_type, NULL);
	self->priv->a_type = a_type;
	self->priv->a_dup_func = a_dup_func;
	self->priv->a_destroy_func = a_destroy_func;
	self->priv->b_type = b_type;
	self->priv->b_dup_func = b_dup_func;
	self->priv->b_destroy_func = b_destroy_func;
	_tmp0_ = _g_object_ref0 (inner);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (self->priv->inner);
	self->priv->inner = _tmp1_;
	_tmp2_ = map;
	_tmp3_ = _tmp2_;
	(self->priv->map_target_destroy_notify == NULL) ? NULL : (self->priv->map_target_destroy_notify (self->priv->map_target), NULL);
	self->priv->map = NULL;
	self->priv->map_target = NULL;
	self->priv->map_target_destroy_notify = NULL;
	self->priv->map_target = map_target;
	self->priv->map_target_destroy_notify = NULL;
	self->priv->map = _tmp3_;
	_tmp4_ = gee_iterator_get_valid (inner);
	if (_tmp4_) {
		gpointer _tmp5_ = NULL;
		gpointer _tmp6_;
		gpointer _tmp7_ = NULL;
		gpointer _tmp8_;
		_tmp5_ = gee_iterator_get (self->priv->inner);
		_tmp6_ = _tmp5_;
		_tmp7_ = self->priv->map (_tmp6_, self->priv->map_target);
		_tmp8_ = _tmp7_;
		_b_destroy_func0 (self->priv->current_result);
		self->priv->current_result = _tmp8_;
		_a_destroy_func0 (_tmp6_);
	}
	(map_target_destroy_notify == NULL) ? NULL : (map_target_destroy_notify (map_target), NULL);
	map = NULL;
	map_target = NULL;
	map_target_destroy_notify = NULL;
	return self;
}


static GeeIteratorMappedIterator* gee_iterator_mapped_iterator_new (GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeIterator* inner, GeeMapFunc map, void* map_target, GDestroyNotify map_target_destroy_notify) {
	return gee_iterator_mapped_iterator_construct (GEE_ITERATOR_TYPE_MAPPED_ITERATOR, a_type, a_dup_func, a_destroy_func, b_type, b_dup_func, b_destroy_func, inner, map, map_target, map_target_destroy_notify);
}


static gboolean gee_iterator_mapped_iterator_real_next (GeeIterator* base) {
	GeeIteratorMappedIterator * self;
	gboolean result = FALSE;
	gboolean _tmp0_;
	self = (GeeIteratorMappedIterator*) base;
	_tmp0_ = gee_iterator_next (self->priv->inner);
	if (_tmp0_) {
		gpointer _tmp1_ = NULL;
		gpointer _tmp2_;
		gpointer _tmp3_ = NULL;
		gpointer _tmp4_;
		_tmp1_ = gee_iterator_get (self->priv->inner);
		_tmp2_ = _tmp1_;
		_tmp3_ = self->priv->map (_tmp2_, self->priv->map_target);
		_tmp4_ = _tmp3_;
		((self->priv->current_result == NULL) || (self->priv->b_destroy_func == NULL)) ? NULL : (self->priv->current_result = (self->priv->b_destroy_func (self->priv->current_result), NULL));
		self->priv->current_result = _tmp4_;
		((_tmp2_ == NULL) || (self->priv->a_destroy_func == NULL)) ? NULL : (_tmp2_ = (self->priv->a_destroy_func (_tmp2_), NULL));
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}


static gboolean gee_iterator_mapped_iterator_real_has_next (GeeIterator* base) {
	GeeIteratorMappedIterator * self;
	gboolean result = FALSE;
	gboolean _tmp0_;
	self = (GeeIteratorMappedIterator*) base;
	_tmp0_ = gee_iterator_has_next (self->priv->inner);
	result = _tmp0_;
	return result;
}


static gpointer gee_iterator_mapped_iterator_real_get (GeeIterator* base) {
	GeeIteratorMappedIterator * self;
	gpointer result = NULL;
	gboolean _tmp0_;
	gpointer _tmp1_;
	gconstpointer _tmp2_;
	self = (GeeIteratorMappedIterator*) base;
	_tmp0_ = gee_iterator_get_valid (self->priv->inner);
	g_assert (_tmp0_);
	_tmp1_ = (_tmp2_ = self->priv->current_result, ((_tmp2_ == NULL) || (self->priv->b_dup_func == NULL)) ? ((gpointer) _tmp2_) : self->priv->b_dup_func ((gpointer) _tmp2_));
	result = _tmp1_;
	return result;
}


static void gee_iterator_mapped_iterator_real_remove (GeeIterator* base) {
	GeeIteratorMappedIterator * self;
	self = (GeeIteratorMappedIterator*) base;
	g_assert_not_reached ();
}


static gboolean gee_iterator_mapped_iterator_real_get_valid (GeeIterator* base) {
	gboolean result;
	GeeIteratorMappedIterator* self;
	gboolean _tmp0_;
	self = (GeeIteratorMappedIterator*) base;
	_tmp0_ = gee_iterator_get_valid (self->priv->inner);
	result = _tmp0_;
	return result;
}


static void gee_iterator_mapped_iterator_class_init (GeeIteratorMappedIteratorClass * klass) {
	gee_iterator_mapped_iterator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GeeIteratorMappedIteratorPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gee_iterator_mapped_iterator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gee_iterator_mapped_iterator_set_property;
	G_OBJECT_CLASS (klass)->finalize = gee_iterator_mapped_iterator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ITERATOR_MAPPED_ITERATOR_A_TYPE, g_param_spec_gtype ("a-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_ITERATOR_MAPPED_ITERATOR_A_DUP_FUNC, g_param_spec_pointer ("a-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_ITERATOR_MAPPED_ITERATOR_A_DESTROY_FUNC, g_param_spec_pointer ("a-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_ITERATOR_MAPPED_ITERATOR_B_TYPE, g_param_spec_gtype ("b-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_ITERATOR_MAPPED_ITERATOR_B_DUP_FUNC, g_param_spec_pointer ("b-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_ITERATOR_MAPPED_ITERATOR_B_DESTROY_FUNC, g_param_spec_pointer ("b-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_override_property (G_OBJECT_CLASS (klass), GEE_ITERATOR_MAPPED_ITERATOR_VALID, "valid");
}


static void gee_iterator_mapped_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) {
	gee_iterator_mapped_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
	iface->next = (gboolean (*)(GeeIterator*)) gee_iterator_mapped_iterator_real_next;
	iface->has_next = (gboolean (*)(GeeIterator*)) gee_iterator_mapped_iterator_real_has_next;
	iface->get = (gpointer (*)(GeeIterator*)) gee_iterator_mapped_iterator_real_get;
	iface->remove = (void (*)(GeeIterator*)) gee_iterator_mapped_iterator_real_remove;
	iface->get_valid = gee_iterator_mapped_iterator_real_get_valid;
}


static void gee_iterator_mapped_iterator_instance_init (GeeIteratorMappedIterator * self) {
	self->priv = GEE_ITERATOR_MAPPED_ITERATOR_GET_PRIVATE (self);
}


static void gee_iterator_mapped_iterator_finalize (GObject* obj) {
	GeeIteratorMappedIterator * self;
	self = GEE_ITERATOR_MAPPED_ITERATOR (obj);
	_g_object_unref0 (self->priv->inner);
	((self->priv->current_result == NULL) || (self->priv->b_destroy_func == NULL)) ? NULL : (self->priv->current_result = (self->priv->b_destroy_func (self->priv->current_result), NULL));
	(self->priv->map_target_destroy_notify == NULL) ? NULL : (self->priv->map_target_destroy_notify (self->priv->map_target), NULL);
	self->priv->map = NULL;
	self->priv->map_target = NULL;
	self->priv->map_target_destroy_notify = NULL;
	G_OBJECT_CLASS (gee_iterator_mapped_iterator_parent_class)->finalize (obj);
}


static GType gee_iterator_mapped_iterator_get_type (void) {
	static volatile gsize gee_iterator_mapped_iterator_type_id__volatile = 0;
	if (g_once_init_enter (&gee_iterator_mapped_iterator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GeeIteratorMappedIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_iterator_mapped_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeIteratorMappedIterator), 0, (GInstanceInitFunc) gee_iterator_mapped_iterator_instance_init, NULL };
		static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_iterator_mapped_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gee_iterator_mapped_iterator_type_id;
		gee_iterator_mapped_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeIteratorMappedIterator", &g_define_type_info, 0);
		g_type_add_interface_static (gee_iterator_mapped_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
		g_once_init_leave (&gee_iterator_mapped_iterator_type_id__volatile, gee_iterator_mapped_iterator_type_id);
	}
	return gee_iterator_mapped_iterator_type_id__volatile;
}


static void _vala_gee_iterator_mapped_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GeeIteratorMappedIterator * self;
	self = GEE_ITERATOR_MAPPED_ITERATOR (object);
	switch (property_id) {
		case GEE_ITERATOR_MAPPED_ITERATOR_VALID:
		g_value_set_boolean (value, gee_iterator_get_valid ((GeeIterator*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gee_iterator_mapped_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GeeIteratorMappedIterator * self;
	self = GEE_ITERATOR_MAPPED_ITERATOR (object);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
		case GEE_ITERATOR_MAPPED_ITERATOR_A_TYPE:
		self->priv->a_type = g_value_get_gtype (value);
		break;
		case GEE_ITERATOR_MAPPED_ITERATOR_A_DUP_FUNC:
		self->priv->a_dup_func = g_value_get_pointer (value);
		break;
		case GEE_ITERATOR_MAPPED_ITERATOR_A_DESTROY_FUNC:
		self->priv->a_destroy_func = g_value_get_pointer (value);
		break;
		case GEE_ITERATOR_MAPPED_ITERATOR_B_TYPE:
		self->priv->b_type = g_value_get_gtype (value);
		break;
		case GEE_ITERATOR_MAPPED_ITERATOR_B_DUP_FUNC:
		self->priv->b_dup_func = g_value_get_pointer (value);
		break;
		case GEE_ITERATOR_MAPPED_ITERATOR_B_DESTROY_FUNC:
		self->priv->b_destroy_func = g_value_get_pointer (value);
		break;
	}
}


static void gee_iterator_base_init (GeeIteratorIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
		/**
		 * Determines wheather the call to {@link get} is legal. It is false at the
		 * beginning and after {@link remove} call and true otherwise.
		 */
		g_object_interface_install_property (iface, g_param_spec_boolean ("valid", "valid", "valid", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
		iface->fold = gee_iterator_real_fold;
		iface->map = gee_iterator_real_map;
	}
}


/**
 * An iterator over a collection.
 *
 * Gee's iterators are "on-track" iterators. They always point to an item
 * except before the first call to {@link next}, or, when an
 * item has been removed, until the next call to {@link next}.
 *
 * Please note that when the iterator is out of track, neither {@link get} nor
 * {@link remove} are defined and both will fail. After the next call to
 * {@link next}, they will be defined again.
 */
GType gee_iterator_get_type (void) {
	static volatile gsize gee_iterator_type_id__volatile = 0;
	if (g_once_init_enter (&gee_iterator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GeeIteratorIface), (GBaseInitFunc) gee_iterator_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType gee_iterator_type_id;
		gee_iterator_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeIterator", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (gee_iterator_type_id, G_TYPE_OBJECT);
		g_once_init_leave (&gee_iterator_type_id__volatile, gee_iterator_type_id);
	}
	return gee_iterator_type_id__volatile;
}



