/* BaseCollection.c generated by valac 0.56.19, the Vala compiler
 * generated from BaseCollection.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/* BaseCollection.vala
 *
 * Copyright (C) 2016  Daniel Espinosa <esodan@gmail.com>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */

#include "gxml/gxml.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <gee.h>
#include "gxml.h"

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	GXML_BASE_COLLECTION_0_PROPERTY,
	GXML_BASE_COLLECTION_ITEMS_NAME_PROPERTY,
	GXML_BASE_COLLECTION_ITEMS_TYPE_PROPERTY,
	GXML_BASE_COLLECTION_NODES_INDEX_PROPERTY,
	GXML_BASE_COLLECTION_ELEMENT_PROPERTY,
	GXML_BASE_COLLECTION_NUM_PROPERTIES
};
static GParamSpec* gxml_base_collection_properties[GXML_BASE_COLLECTION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR (gxml_base_collection_collection_iterator_get_type ())
#define GXML_BASE_COLLECTION_COLLECTION_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR, GXmlBaseCollectionCollectionIterator))
#define GXML_BASE_COLLECTION_COLLECTION_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR, GXmlBaseCollectionCollectionIteratorClass))
#define GXML_BASE_COLLECTION_IS_COLLECTION_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR))
#define GXML_BASE_COLLECTION_IS_COLLECTION_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR))
#define GXML_BASE_COLLECTION_COLLECTION_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR, GXmlBaseCollectionCollectionIteratorClass))

typedef struct _GXmlBaseCollectionCollectionIterator GXmlBaseCollectionCollectionIterator;
typedef struct _GXmlBaseCollectionCollectionIteratorClass GXmlBaseCollectionCollectionIteratorClass;
typedef struct _GXmlBaseCollectionCollectionIteratorPrivate GXmlBaseCollectionCollectionIteratorPrivate;
enum  {
	GXML_BASE_COLLECTION_COLLECTION_ITERATOR_0_PROPERTY,
	GXML_BASE_COLLECTION_COLLECTION_ITERATOR_READ_ONLY_PROPERTY,
	GXML_BASE_COLLECTION_COLLECTION_ITERATOR_VALID_PROPERTY,
	GXML_BASE_COLLECTION_COLLECTION_ITERATOR_NUM_PROPERTIES
};
static GParamSpec* gxml_base_collection_collection_iterator_properties[GXML_BASE_COLLECTION_COLLECTION_ITERATOR_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GXmlBaseCollectionCollectionIterator {
	GObject parent_instance;
	GXmlBaseCollectionCollectionIteratorPrivate * priv;
};

struct _GXmlBaseCollectionCollectionIteratorClass {
	GObjectClass parent_class;
};

struct _GXmlBaseCollectionCollectionIteratorPrivate {
	gint pos;
	GXmlCollection* _collection;
};

static gpointer gxml_base_collection_parent_class = NULL;
static gint GXmlBaseCollectionCollectionIterator_private_offset;
static gpointer gxml_base_collection_collection_iterator_parent_class = NULL;
static GeeTraversableIface * gxml_base_collection_collection_iterator_gee_traversable_parent_iface = NULL;
static GeeIteratorIface * gxml_base_collection_collection_iterator_gee_iterator_parent_iface = NULL;
static GeeTraversableIface * gxml_base_collection_gee_traversable_parent_iface = NULL;
static GeeIterableIface * gxml_base_collection_gee_iterable_parent_iface = NULL;
static GXmlCollectionIface * gxml_base_collection_gxml_collection_parent_iface = NULL;

static void gxml_base_collection_real_initialize (GXmlCollection* base,
                                           GType items_type,
                                           GError** error);
static void gxml_base_collection_real_append (GXmlCollection* base,
                                       GXmlDomElement* node,
                                       GError** error);
static void gxml_base_collection_real_search (GXmlCollection* base,
                                       GError** error);
static gboolean gxml_base_collection_real_validate_append (GXmlBaseCollection* self,
                                                    gint index,
                                                    GXmlDomElement* element,
                                                    GError** error);
static void gxml_base_collection_real_clear (GXmlBaseCollection* self,
                                      GError** error);
static gboolean gxml_base_collection_real_foreach (GeeTraversable* base,
                                            GeeForallFunc f,
                                            gpointer f_target);
static GeeIterator* gxml_base_collection_real_iterator (GeeIterable* base);
static GXmlBaseCollectionCollectionIterator* gxml_base_collection_collection_iterator_new (GXmlCollection* col);
static GXmlBaseCollectionCollectionIterator* gxml_base_collection_collection_iterator_construct (GType object_type,
                                                                                          GXmlCollection* col);
static GType gxml_base_collection_collection_iterator_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GXmlDomElement* gxml_base_collection_collection_iterator_real_get (GeeIterator* base);
static gboolean gxml_base_collection_collection_iterator_real_has_next (GeeIterator* base);
static gboolean gxml_base_collection_collection_iterator_real_next (GeeIterator* base);
static void gxml_base_collection_collection_iterator_real_remove (GeeIterator* base);
static gboolean gxml_base_collection_collection_iterator_real_foreach (GeeTraversable* base,
                                                                GeeForallFunc f,
                                                                gpointer f_target);
static void gxml_base_collection_collection_iterator_finalize (GObject * obj);
static GType gxml_base_collection_collection_iterator_get_type_once (void);
static void _vala_gxml_base_collection_collection_iterator_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec);
static void gxml_base_collection_finalize (GObject * obj);
static GType gxml_base_collection_get_type_once (void);
static void _vala_gxml_base_collection_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_gxml_base_collection_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static const gchar*
gxml_base_collection_real_get_items_name (GXmlCollection* base)
{
	const gchar* result;
	GXmlBaseCollection* self;
	const gchar* _tmp0_;
	self = (GXmlBaseCollection*) base;
	_tmp0_ = self->_items_name;
	result = _tmp0_;
	return result;
}

static GType
gxml_base_collection_real_get_items_type (GXmlCollection* base)
{
	GType result;
	GXmlBaseCollection* self;
	self = (GXmlBaseCollection*) base;
	result = self->_items_type;
	return result;
}

static void
gxml_base_collection_real_set_items_type (GXmlCollection* base,
                                          GType value)
{
	GXmlBaseCollection* self;
	self = (GXmlBaseCollection*) base;
	self->_items_type = value;
	g_object_notify_by_pspec ((GObject *) self, gxml_base_collection_properties[GXML_BASE_COLLECTION_ITEMS_TYPE_PROPERTY]);
}

static GQueue*
gxml_base_collection_real_get_nodes_index (GXmlCollection* base)
{
	GQueue* result;
	GXmlBaseCollection* self;
	GQueue* _tmp0_;
	self = (GXmlBaseCollection*) base;
	_tmp0_ = self->_nodes_index;
	result = _tmp0_;
	return result;
}

static GXmlDomElement*
gxml_base_collection_real_get_element (GXmlCollection* base)
{
	GXmlDomElement* result;
	GXmlBaseCollection* self;
	GXmlElement* _tmp0_;
	self = (GXmlBaseCollection*) base;
	_tmp0_ = self->_element;
	result = GXML_IS_DOM_ELEMENT (_tmp0_) ? ((GXmlDomElement*) _tmp0_) : NULL;
	return result;
}

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

static void
gxml_base_collection_real_set_element (GXmlCollection* base,
                                       GXmlDomElement* value)
{
	GXmlBaseCollection* self;
	self = (GXmlBaseCollection*) base;
	if (GXML_IS_ELEMENT (value)) {
		GXmlElement* _tmp0_;
		_tmp0_ = _g_object_ref0 (GXML_IS_ELEMENT (value) ? ((GXmlElement*) value) : NULL);
		_g_object_unref0 (self->_element);
		self->_element = _tmp0_;
	}
	g_object_notify_by_pspec ((GObject *) self, gxml_base_collection_properties[GXML_BASE_COLLECTION_ELEMENT_PROPERTY]);
}

/**
   * {@inheritDoc}
   */
static void
gxml_base_collection_real_initialize (GXmlCollection* base,
                                      GType items_type,
                                      GError** error)
{
	GXmlBaseCollection * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GError* _inner_error0_ = NULL;
	self = (GXmlBaseCollection*) base;
	if (!g_type_is_a (items_type, GXML_TYPE_DOM_ELEMENT)) {
		_tmp0_ = !g_type_is_a (items_type, GXML_TYPE_OBJECT);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GError* _tmp1_;
		_tmp1_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Invalid attempt to initialize a collection using an unsupported type. " \
"Only GXmlGXml.Element is supported"));
		_inner_error0_ = _tmp1_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	if (!G_TYPE_IS_ABSTRACT (items_type)) {
		_tmp2_ = G_TYPE_IS_INSTANTIATABLE (items_type);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		GXmlElement* o = NULL;
		GObject* _tmp3_;
		GObject* _tmp4_;
		GXmlElement* _tmp5_;
		GXmlElement* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp3_ = g_object_new (items_type, NULL);
		_tmp4_ = G_IS_INITIALLY_UNOWNED (_tmp3_) ? g_object_ref_sink (_tmp3_) : _tmp3_;
		_tmp5_ = GXML_IS_ELEMENT (_tmp4_) ? ((GXmlElement*) _tmp4_) : NULL;
		if (_tmp5_ == NULL) {
			_g_object_unref0 (_tmp4_);
		}
		o = _tmp5_;
		_tmp6_ = o;
		_tmp7_ = gxml_dom_element_get_local_name ((GXmlDomElement*) _tmp6_);
		_tmp8_ = _tmp7_;
		_g_free0 (self->_items_name);
		self->_items_name = _tmp8_;
		_g_object_unref0 (o);
	}
	self->_items_type = items_type;
}

/**
   * Initialize an {@link Collection} to use an element as children's parent.
   * Searches for all nodes, calling {@link Collection.search}
   * with {@link Collection.items_type}, using its
   * {@link DomElement.local_name} to find it.
   *
   * Implementation classes, should initialize collection to hold a {@link GXml.Element}
   * derived type using {@link Collection.initialize}.
   */
void
gxml_base_collection_initialize_element (GXmlBaseCollection* self,
                                         GXmlElement* e,
                                         GError** error)
{
	GXmlElement* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (e != NULL);
	_tmp0_ = _g_object_ref0 (e);
	_g_object_unref0 (self->_element);
	self->_element = _tmp0_;
}

/**
   * Adds an {@link DomElement} of type {@link GXml.Object} as a child of
   * {@link element}.
   *
   * Object is always added as a child of {@link element}
   * but just added to collection if {@link validate_append} returns true;
   */
static void
gxml_base_collection_real_append (GXmlCollection* base,
                                  GXmlDomElement* node,
                                  GError** error)
{
	GXmlBaseCollection * self;
	GXmlElement* _tmp0_;
	GXmlDomDocument* _tmp3_;
	GXmlDomDocument* _tmp4_;
	GXmlElement* _tmp5_;
	GXmlDomDocument* _tmp6_;
	GXmlDomDocument* _tmp7_;
	GXmlDomNode* _tmp9_;
	GXmlDomNode* _tmp10_;
	GXmlDomNode* _tmp11_;
	gboolean _tmp12_;
	GXmlElement* _tmp16_;
	GXmlDomNodeList* _tmp17_;
	GXmlDomNodeList* _tmp18_;
	GXmlDomNodeList* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	gboolean _tmp22_;
	gint index = 0;
	GXmlElement* _tmp24_;
	GXmlDomNodeList* _tmp25_;
	GXmlDomNodeList* _tmp26_;
	GXmlDomNodeList* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gboolean _tmp31_ = FALSE;
	GQueue* _tmp32_;
	GError* _inner_error0_ = NULL;
	self = (GXmlBaseCollection*) base;
	g_return_if_fail (node != NULL);
	_tmp0_ = self->_element;
	if (_tmp0_ == NULL) {
		GError* _tmp1_;
		_tmp1_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Parent Element is invalid. Set 'element' property at construction time"));
		_inner_error0_ = _tmp1_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	if (!GXML_IS_ELEMENT (node)) {
		GError* _tmp2_;
		_tmp2_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Invalid attempt to set unsupported type. Only GXmlGXml.Element is supp" \
"orted"));
		_inner_error0_ = _tmp2_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp3_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) node);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->_element;
	_tmp6_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) _tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp4_ != _tmp7_) {
		GError* _tmp8_;
		_tmp8_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to set a node with a different parent document"));
		_inner_error0_ = _tmp8_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp9_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) node);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	_tmp12_ = _tmp11_ == NULL;
	_g_object_unref0 (_tmp11_);
	if (_tmp12_) {
		GXmlElement* _tmp13_;
		GXmlDomNode* _tmp14_;
		GXmlDomNode* _tmp15_;
		_tmp13_ = self->_element;
		_tmp14_ = gxml_dom_node_append_child ((GXmlDomNode*) _tmp13_, (GXmlDomNode*) node, &_inner_error0_);
		_tmp15_ = _tmp14_;
		_g_object_unref0 (_tmp15_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			return;
		}
	}
	_tmp16_ = self->_element;
	_tmp17_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = _tmp18_;
	_tmp20_ = gee_collection_get_size ((GeeCollection*) _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_ == 0;
	_g_object_unref0 (_tmp19_);
	if (_tmp22_) {
		GError* _tmp23_;
		_tmp23_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_QUOTA_EXCEEDED_ERROR, _ ("Node element not appended as child of parent. No node added to collect" \
"ion"));
		_inner_error0_ = _tmp23_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp24_ = self->_element;
	_tmp25_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) _tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_;
	_tmp28_ = gee_collection_get_size ((GeeCollection*) _tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = _tmp29_ - 1;
	_g_object_unref0 (_tmp27_);
	index = _tmp30_;
	_tmp31_ = gxml_base_collection_validate_append (self, index, node, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	if (!_tmp31_) {
		return;
	}
	_tmp32_ = self->_nodes_index;
	g_queue_push_tail (_tmp32_, (gpointer) ((gintptr) index));
}

/**
   * Search for all child nodes in {@link element} of type {@link GXml.Element}
   * with a {@link GXml.Element.local_name} equal to {@link Collection.items_name},
   * to add it to collection. This method calls {@link clear} first.
   *
   * Implementations could add additional restrictions to add element to collection.
   */
static void
gxml_base_collection_real_search (GXmlCollection* base,
                                  GError** error)
{
	GXmlBaseCollection * self;
	GQueue* _tmp0_;
	GXmlElement* _tmp1_;
	GError* _inner_error0_ = NULL;
	self = (GXmlBaseCollection*) base;
	_tmp0_ = self->_nodes_index;
	g_queue_clear (_tmp0_);
	gxml_base_collection_clear (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp1_ = self->_element;
	if (_tmp1_ == NULL) {
		GError* _tmp2_;
		_tmp2_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Parent Element is invalid. Set 'element' property at construction time"));
		_inner_error0_ = _tmp2_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				GXmlElement* _tmp5_;
				GXmlDomNodeList* _tmp6_;
				GXmlDomNodeList* _tmp7_;
				GXmlDomNodeList* _tmp8_;
				gint _tmp9_;
				gint _tmp10_;
				gboolean _tmp11_;
				GXmlDomNode* n = NULL;
				GXmlElement* _tmp12_;
				GXmlDomNodeList* _tmp13_;
				GXmlDomNodeList* _tmp14_;
				GXmlDomNodeList* _tmp15_;
				gpointer _tmp16_;
				GXmlDomNode* _tmp17_;
				GXmlDomNode* _tmp18_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = self->_element;
				_tmp6_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) _tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = _tmp7_;
				_tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = !(i < _tmp10_);
				_g_object_unref0 (_tmp8_);
				if (_tmp11_) {
					break;
				}
				_tmp12_ = self->_element;
				_tmp13_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) _tmp12_);
				_tmp14_ = _tmp13_;
				_tmp15_ = _tmp14_;
				_tmp16_ = gee_list_get ((GeeList*) _tmp15_, i);
				_tmp17_ = (GXmlDomNode*) _tmp16_;
				_g_object_unref0 (_tmp15_);
				n = _tmp17_;
				_tmp18_ = n;
				if (GXML_IS_OBJECT (_tmp18_)) {
					GXmlDomNode* _tmp19_;
					gchar* _tmp20_;
					gchar* _tmp21_;
					gchar* _tmp22_;
					gchar* _tmp23_;
					gchar* _tmp24_;
					const gchar* _tmp25_;
					const gchar* _tmp26_;
					gchar* _tmp27_;
					gchar* _tmp28_;
					gboolean _tmp29_;
					_tmp19_ = n;
					_tmp20_ = gxml_dom_element_get_local_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
					_tmp21_ = _tmp20_;
					_tmp22_ = _tmp21_;
					_tmp23_ = g_utf8_strdown (_tmp22_, (gssize) -1);
					_tmp24_ = _tmp23_;
					_tmp25_ = gxml_collection_get_items_name ((GXmlCollection*) self);
					_tmp26_ = _tmp25_;
					_tmp27_ = g_utf8_strdown (_tmp26_, (gssize) -1);
					_tmp28_ = _tmp27_;
					_tmp29_ = g_strcmp0 (_tmp24_, _tmp28_) == 0;
					_g_free0 (_tmp28_);
					_g_free0 (_tmp24_);
					_g_free0 (_tmp22_);
					if (_tmp29_) {
						gboolean _tmp30_ = FALSE;
						GXmlDomNode* _tmp31_;
						_tmp31_ = n;
						_tmp30_ = gxml_base_collection_validate_append (self, i, GXML_IS_DOM_ELEMENT (_tmp31_) ? ((GXmlDomElement*) _tmp31_) : NULL, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							g_propagate_error (error, _inner_error0_);
							_g_object_unref0 (n);
							return;
						}
						if (_tmp30_) {
							GQueue* _tmp32_;
							_tmp32_ = self->_nodes_index;
							g_queue_push_tail (_tmp32_, (gpointer) ((gintptr) i));
						}
					}
				}
				_g_object_unref0 (n);
			}
		}
	}
}

/**
   * {@inheritDoc}
   */
static gboolean
gxml_base_collection_real_validate_append (GXmlBaseCollection* self,
                                           gint index,
                                           GXmlDomElement* element,
                                           GError** error)
{
	gboolean _tmp0_ = FALSE;
	g_critical ("Type `%s' does not implement abstract method `gxml_base_collection_validate_append'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return _tmp0_;
}

gboolean
gxml_base_collection_validate_append (GXmlBaseCollection* self,
                                      gint index,
                                      GXmlDomElement* element,
                                      GError** error)
{
	GXmlBaseCollectionClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = GXML_BASE_COLLECTION_GET_CLASS (self);
	if (_klass_->validate_append) {
		return _klass_->validate_append (self, index, element, error);
	}
	return FALSE;
}

/**
   * {@inheritDoc}
   */
static void
gxml_base_collection_real_clear (GXmlBaseCollection* self,
                                 GError** error)
{
}

void
gxml_base_collection_clear (GXmlBaseCollection* self,
                            GError** error)
{
	GXmlBaseCollectionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = GXML_BASE_COLLECTION_GET_CLASS (self);
	if (_klass_->clear) {
		_klass_->clear (self, error);
	}
}

static gboolean
gxml_base_collection_real_foreach (GeeTraversable* base,
                                   GeeForallFunc f,
                                   gpointer f_target)
{
	GXmlBaseCollection * self;
	GeeIterator* i = NULL;
	GeeIterator* _tmp0_;
	gboolean result;
	self = (GXmlBaseCollection*) base;
	_tmp0_ = gee_iterable_iterator ((GeeIterable*) self);
	i = _tmp0_;
	result = gee_traversable_foreach ((GeeTraversable*) i, f, f_target);
	_g_object_unref0 (i);
	return result;
}

static GeeIterator*
gxml_base_collection_real_iterator (GeeIterable* base)
{
	GXmlBaseCollection * self;
	GXmlBaseCollectionCollectionIterator* _tmp0_;
	GeeIterator* result;
	self = (GXmlBaseCollection*) base;
	_tmp0_ = gxml_base_collection_collection_iterator_new ((GXmlCollection*) self);
	result = (GeeIterator*) _tmp0_;
	return result;
}

GXmlBaseCollection*
gxml_base_collection_construct (GType object_type)
{
	GXmlBaseCollection * self = NULL;
	self = (GXmlBaseCollection*) g_object_new (object_type, NULL);
	return self;
}

static inline gpointer
gxml_base_collection_collection_iterator_get_instance_private (GXmlBaseCollectionCollectionIterator* self)
{
	return G_STRUCT_MEMBER_P (self, GXmlBaseCollectionCollectionIterator_private_offset);
}

static gboolean
gxml_base_collection_collection_iterator_real_get_read_only (GeeIterator* base)
{
	gboolean result;
	GXmlBaseCollectionCollectionIterator* self;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	result = FALSE;
	return result;
}

static gboolean
gxml_base_collection_collection_iterator_real_get_valid (GeeIterator* base)
{
	gboolean result;
	GXmlBaseCollectionCollectionIterator* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	if (self->priv->pos >= 0) {
		GXmlCollection* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		_tmp1_ = self->priv->_collection;
		_tmp2_ = gxml_collection_get_length (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp0_ = self->priv->pos < _tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static GXmlBaseCollectionCollectionIterator*
gxml_base_collection_collection_iterator_construct (GType object_type,
                                                    GXmlCollection* col)
{
	GXmlBaseCollectionCollectionIterator * self = NULL;
	GXmlCollection* _tmp0_;
	g_return_val_if_fail (col != NULL, NULL);
	self = (GXmlBaseCollectionCollectionIterator*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (col);
	_g_object_unref0 (self->priv->_collection);
	self->priv->_collection = _tmp0_;
	self->priv->pos = -1;
	return self;
}

static GXmlBaseCollectionCollectionIterator*
gxml_base_collection_collection_iterator_new (GXmlCollection* col)
{
	return gxml_base_collection_collection_iterator_construct (GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR, col);
}

static GXmlDomElement*
gxml_base_collection_collection_iterator_real_get (GeeIterator* base)
{
	GXmlBaseCollectionCollectionIterator * self;
	GXmlCollection* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GXmlDomElement* e = NULL;
	GError* _inner_error0_ = NULL;
	GXmlDomElement* result;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	_tmp0_ = self->priv->_collection;
	_tmp1_ = gxml_collection_get_length (_tmp0_);
	_tmp2_ = _tmp1_;
	_vala_return_val_if_fail ((self->priv->pos >= 0) && (self->priv->pos < _tmp2_), "pos >= 0 && pos < _collection.length", NULL);
	e = NULL;
	{
		GXmlDomElement* _tmp3_ = NULL;
		GXmlCollection* _tmp4_;
		GXmlDomElement* _tmp5_;
		GXmlDomElement* _tmp6_;
		_tmp4_ = self->priv->_collection;
		_tmp5_ = gxml_collection_get_item (_tmp4_, self->priv->pos, &_inner_error0_);
		_tmp3_ = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp6_ = _tmp3_;
		_tmp3_ = NULL;
		_g_object_unref0 (e);
		e = _tmp6_;
		_g_object_unref0 (_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		_tmp9_ = g_strdup_printf (_ ("Error: %s"), _tmp8_);
		_tmp10_ = _tmp9_;
		g_warning ("BaseCollection.vala:195: %s", _tmp10_);
		_g_free0 (_tmp10_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (e);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = e;
	return result;
}

static gboolean
gxml_base_collection_collection_iterator_real_has_next (GeeIterator* base)
{
	GXmlBaseCollectionCollectionIterator * self;
	GXmlCollection* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	_tmp0_ = self->priv->_collection;
	_tmp1_ = gxml_collection_get_length (_tmp0_);
	_tmp2_ = _tmp1_;
	result = (self->priv->pos + 1) < _tmp2_;
	return result;
}

static gboolean
gxml_base_collection_collection_iterator_real_next (GeeIterator* base)
{
	GXmlBaseCollectionCollectionIterator * self;
	gint _tmp0_;
	gboolean result;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	if (!gee_iterator_has_next ((GeeIterator*) self)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = self->priv->pos;
	self->priv->pos = _tmp0_ + 1;
	result = TRUE;
	return result;
}

static void
gxml_base_collection_collection_iterator_real_remove (GeeIterator* base)
{
	GXmlBaseCollectionCollectionIterator * self;
	GXmlDomElement* e = NULL;
	GError* _inner_error0_ = NULL;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	e = NULL;
	{
		GXmlDomElement* _tmp0_ = NULL;
		GXmlCollection* _tmp1_;
		GXmlDomElement* _tmp2_;
		GXmlDomElement* _tmp3_;
		GXmlDomElement* _tmp4_;
		GXmlDomElement* _tmp5_;
		GXmlCollection* _tmp6_;
		_tmp1_ = self->priv->_collection;
		_tmp2_ = gxml_collection_get_item (_tmp1_, self->priv->pos, &_inner_error0_);
		_tmp0_ = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (e);
		e = _tmp3_;
		_tmp4_ = e;
		if (_tmp4_ == NULL) {
			_g_object_unref0 (_tmp0_);
			_g_object_unref0 (e);
			return;
		}
		_tmp5_ = e;
		gxml_dom_child_node_remove ((GXmlDomChildNode*) _tmp5_);
		_tmp6_ = self->priv->_collection;
		gxml_collection_search (_tmp6_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (_tmp0_);
			goto __catch0_g_error;
		}
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		_tmp9_ = g_strdup_printf (_ ("Error: %s"), _tmp8_);
		_tmp10_ = _tmp9_;
		g_warning ("BaseCollection.vala:213: %s", _tmp10_);
		_g_free0 (_tmp10_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (e);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_object_unref0 (e);
}

static gboolean
gxml_base_collection_collection_iterator_real_foreach (GeeTraversable* base,
                                                       GeeForallFunc f,
                                                       gpointer f_target)
{
	GXmlBaseCollectionCollectionIterator * self;
	gboolean result;
	self = (GXmlBaseCollectionCollectionIterator*) base;
	while (TRUE) {
		gpointer _tmp0_;
		if (!gee_iterator_has_next ((GeeIterator*) self)) {
			break;
		}
		gee_iterator_next ((GeeIterator*) self);
		_tmp0_ = gee_iterator_get ((GeeIterator*) self);
		if (!f ((GXmlDomElement*) _tmp0_, f_target)) {
			result = FALSE;
			return result;
		}
	}
	result = TRUE;
	return result;
}

static void
gxml_base_collection_collection_iterator_class_init (GXmlBaseCollectionCollectionIteratorClass * klass,
                                                     gpointer klass_data)
{
	gxml_base_collection_collection_iterator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GXmlBaseCollectionCollectionIterator_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_base_collection_collection_iterator_get_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_base_collection_collection_iterator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_BASE_COLLECTION_COLLECTION_ITERATOR_READ_ONLY_PROPERTY, gxml_base_collection_collection_iterator_properties[GXML_BASE_COLLECTION_COLLECTION_ITERATOR_READ_ONLY_PROPERTY] = g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_BASE_COLLECTION_COLLECTION_ITERATOR_VALID_PROPERTY, gxml_base_collection_collection_iterator_properties[GXML_BASE_COLLECTION_COLLECTION_ITERATOR_VALID_PROPERTY] = g_param_spec_boolean ("valid", "valid", "valid", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static GType
gxml_base_collection_collection_iterator_gee_traversable_get_g_type (GXmlBaseCollectionCollectionIterator* self)
{
	return (GType) GXML_TYPE_DOM_ELEMENT;
}

static GBoxedCopyFunc
gxml_base_collection_collection_iterator_gee_traversable_get_g_dup_func (GXmlBaseCollectionCollectionIterator* self)
{
	return (GBoxedCopyFunc) g_object_ref;
}

static GDestroyNotify
gxml_base_collection_collection_iterator_gee_traversable_get_g_destroy_func (GXmlBaseCollectionCollectionIterator* self)
{
	return (GDestroyNotify) g_object_unref;
}

static void
gxml_base_collection_collection_iterator_gee_traversable_interface_init (GeeTraversableIface * iface,
                                                                         gpointer iface_data)
{
	gxml_base_collection_collection_iterator_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
	iface->foreach = (gboolean (*) (GeeTraversable*, GeeForallFunc, gpointer)) gxml_base_collection_collection_iterator_real_foreach;
	iface->get_g_type = (GType (*) (GeeTraversable *)) gxml_base_collection_collection_iterator_gee_traversable_get_g_type;
	iface->get_g_dup_func = (GBoxedCopyFunc (*) (GeeTraversable *)) gxml_base_collection_collection_iterator_gee_traversable_get_g_dup_func;
	iface->get_g_destroy_func = (GDestroyNotify (*) (GeeTraversable *)) gxml_base_collection_collection_iterator_gee_traversable_get_g_destroy_func;
}

static void
gxml_base_collection_collection_iterator_gee_iterator_interface_init (GeeIteratorIface * iface,
                                                                      gpointer iface_data)
{
	gxml_base_collection_collection_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
	iface->get = (gpointer (*) (GeeIterator*)) gxml_base_collection_collection_iterator_real_get;
	iface->has_next = (gboolean (*) (GeeIterator*)) gxml_base_collection_collection_iterator_real_has_next;
	iface->next = (gboolean (*) (GeeIterator*)) gxml_base_collection_collection_iterator_real_next;
	iface->remove = (void (*) (GeeIterator*)) gxml_base_collection_collection_iterator_real_remove;
	iface->get_read_only = gxml_base_collection_collection_iterator_real_get_read_only;
	iface->get_valid = gxml_base_collection_collection_iterator_real_get_valid;
}

static void
gxml_base_collection_collection_iterator_instance_init (GXmlBaseCollectionCollectionIterator * self,
                                                        gpointer klass)
{
	self->priv = gxml_base_collection_collection_iterator_get_instance_private (self);
}

static void
gxml_base_collection_collection_iterator_finalize (GObject * obj)
{
	GXmlBaseCollectionCollectionIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR, GXmlBaseCollectionCollectionIterator);
	_g_object_unref0 (self->priv->_collection);
	G_OBJECT_CLASS (gxml_base_collection_collection_iterator_parent_class)->finalize (obj);
}

static GType
gxml_base_collection_collection_iterator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlBaseCollectionCollectionIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_base_collection_collection_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlBaseCollectionCollectionIterator), 0, (GInstanceInitFunc) gxml_base_collection_collection_iterator_instance_init, NULL };
	static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gxml_base_collection_collection_iterator_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gxml_base_collection_collection_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_base_collection_collection_iterator_type_id;
	gxml_base_collection_collection_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlBaseCollectionCollectionIterator", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_base_collection_collection_iterator_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
	g_type_add_interface_static (gxml_base_collection_collection_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
	GXmlBaseCollectionCollectionIterator_private_offset = g_type_add_instance_private (gxml_base_collection_collection_iterator_type_id, sizeof (GXmlBaseCollectionCollectionIteratorPrivate));
	return gxml_base_collection_collection_iterator_type_id;
}

static GType
gxml_base_collection_collection_iterator_get_type (void)
{
	static volatile gsize gxml_base_collection_collection_iterator_type_id__once = 0;
	if (g_once_init_enter (&gxml_base_collection_collection_iterator_type_id__once)) {
		GType gxml_base_collection_collection_iterator_type_id;
		gxml_base_collection_collection_iterator_type_id = gxml_base_collection_collection_iterator_get_type_once ();
		g_once_init_leave (&gxml_base_collection_collection_iterator_type_id__once, gxml_base_collection_collection_iterator_type_id);
	}
	return gxml_base_collection_collection_iterator_type_id__once;
}

static void
_vala_gxml_base_collection_collection_iterator_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec)
{
	GXmlBaseCollectionCollectionIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_BASE_COLLECTION_TYPE_COLLECTION_ITERATOR, GXmlBaseCollectionCollectionIterator);
	switch (property_id) {
		case GXML_BASE_COLLECTION_COLLECTION_ITERATOR_READ_ONLY_PROPERTY:
		g_value_set_boolean (value, gee_iterator_get_read_only ((GeeIterator*) self));
		break;
		case GXML_BASE_COLLECTION_COLLECTION_ITERATOR_VALID_PROPERTY:
		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
gxml_base_collection_class_init (GXmlBaseCollectionClass * klass,
                                 gpointer klass_data)
{
	gxml_base_collection_parent_class = g_type_class_peek_parent (klass);
	((GXmlBaseCollectionClass *) klass)->validate_append = (gboolean (*) (GXmlBaseCollection*, gint, GXmlDomElement*, GError**)) gxml_base_collection_real_validate_append;
	((GXmlBaseCollectionClass *) klass)->clear = (void (*) (GXmlBaseCollection*, GError**)) gxml_base_collection_real_clear;
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_base_collection_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_base_collection_set_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_base_collection_finalize;
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_BASE_COLLECTION_ITEMS_NAME_PROPERTY, gxml_base_collection_properties[GXML_BASE_COLLECTION_ITEMS_NAME_PROPERTY] = g_param_spec_string ("items-name", "items-name", "items-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_BASE_COLLECTION_ITEMS_TYPE_PROPERTY, gxml_base_collection_properties[GXML_BASE_COLLECTION_ITEMS_TYPE_PROPERTY] = g_param_spec_gtype ("items-type", "items-type", "items-type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_BASE_COLLECTION_NODES_INDEX_PROPERTY, gxml_base_collection_properties[GXML_BASE_COLLECTION_NODES_INDEX_PROPERTY] = g_param_spec_pointer ("nodes-index", "nodes-index", "nodes-index", G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * {@inheritDoc}
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_BASE_COLLECTION_ELEMENT_PROPERTY, gxml_base_collection_properties[GXML_BASE_COLLECTION_ELEMENT_PROPERTY] = g_param_spec_object ("element", "element", "element", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static GType
gxml_base_collection_gee_traversable_get_g_type (GXmlBaseCollection* self)
{
	return (GType) GXML_TYPE_DOM_ELEMENT;
}

static GBoxedCopyFunc
gxml_base_collection_gee_traversable_get_g_dup_func (GXmlBaseCollection* self)
{
	return (GBoxedCopyFunc) g_object_ref;
}

static GDestroyNotify
gxml_base_collection_gee_traversable_get_g_destroy_func (GXmlBaseCollection* self)
{
	return (GDestroyNotify) g_object_unref;
}

static void
gxml_base_collection_gee_traversable_interface_init (GeeTraversableIface * iface,
                                                     gpointer iface_data)
{
	gxml_base_collection_gee_traversable_parent_iface = g_type_interface_peek_parent (iface);
	iface->foreach = (gboolean (*) (GeeTraversable*, GeeForallFunc, gpointer)) gxml_base_collection_real_foreach;
	iface->get_g_type = (GType (*) (GeeTraversable *)) gxml_base_collection_gee_traversable_get_g_type;
	iface->get_g_dup_func = (GBoxedCopyFunc (*) (GeeTraversable *)) gxml_base_collection_gee_traversable_get_g_dup_func;
	iface->get_g_destroy_func = (GDestroyNotify (*) (GeeTraversable *)) gxml_base_collection_gee_traversable_get_g_destroy_func;
}

static GType
gxml_base_collection_gee_iterable_get_g_type (GXmlBaseCollection* self)
{
	return (GType) GXML_TYPE_DOM_ELEMENT;
}

static GBoxedCopyFunc
gxml_base_collection_gee_iterable_get_g_dup_func (GXmlBaseCollection* self)
{
	return (GBoxedCopyFunc) g_object_ref;
}

static GDestroyNotify
gxml_base_collection_gee_iterable_get_g_destroy_func (GXmlBaseCollection* self)
{
	return (GDestroyNotify) g_object_unref;
}

static void
gxml_base_collection_gee_iterable_interface_init (GeeIterableIface * iface,
                                                  gpointer iface_data)
{
	gxml_base_collection_gee_iterable_parent_iface = g_type_interface_peek_parent (iface);
	iface->iterator = (GeeIterator* (*) (GeeIterable*)) gxml_base_collection_real_iterator;
	iface->get_g_type = (GType (*) (GeeIterable *)) gxml_base_collection_gee_iterable_get_g_type;
	iface->get_g_dup_func = (GBoxedCopyFunc (*) (GeeIterable *)) gxml_base_collection_gee_iterable_get_g_dup_func;
	iface->get_g_destroy_func = (GDestroyNotify (*) (GeeIterable *)) gxml_base_collection_gee_iterable_get_g_destroy_func;
}

static void
gxml_base_collection_gxml_collection_interface_init (GXmlCollectionIface * iface,
                                                     gpointer iface_data)
{
	gxml_base_collection_gxml_collection_parent_iface = g_type_interface_peek_parent (iface);
	iface->initialize = (void (*) (GXmlCollection*, GType, GError**)) gxml_base_collection_real_initialize;
	iface->append = (void (*) (GXmlCollection*, GXmlDomElement*, GError**)) gxml_base_collection_real_append;
	iface->search = (void (*) (GXmlCollection*, GError**)) gxml_base_collection_real_search;
	iface->validate_append = (gboolean (*) (GXmlCollection*, gint, GXmlDomElement*, GError**)) gxml_base_collection_validate_append;
	iface->clear = (void (*) (GXmlCollection*, GError**)) gxml_base_collection_clear;
	iface->get_items_name = gxml_base_collection_real_get_items_name;
	iface->get_items_type = gxml_base_collection_real_get_items_type;
	iface->set_items_type = gxml_base_collection_real_set_items_type;
	iface->get_nodes_index = gxml_base_collection_real_get_nodes_index;
	iface->get_element = gxml_base_collection_real_get_element;
	iface->set_element = gxml_base_collection_real_set_element;
}

static void
gxml_base_collection_instance_init (GXmlBaseCollection * self,
                                    gpointer klass)
{
	GQueue* _tmp0_;
	gchar* _tmp1_;
	_tmp0_ = g_queue_new ();
	self->_nodes_index = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->_items_name = _tmp1_;
	self->_items_type = G_TYPE_INVALID;
}

static void
gxml_base_collection_finalize (GObject * obj)
{
	GXmlBaseCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_BASE_COLLECTION, GXmlBaseCollection);
	(self->_nodes_index == NULL) ? NULL : (self->_nodes_index = (g_queue_free (self->_nodes_index), NULL));
	_g_object_unref0 (self->_element);
	_g_free0 (self->_items_name);
	G_OBJECT_CLASS (gxml_base_collection_parent_class)->finalize (obj);
}

/**
 * Base class for collections implementing {@link Collection}, providing basic
 * infrastructure.
 *
 * Collections properties should be initialized with current container element
 * in order to be able to add new references to elements. Use {@link initialize_element}
 * to set parent element and {@link search} to find elements for collection.
 */
static GType
gxml_base_collection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlBaseCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_base_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlBaseCollection), 0, (GInstanceInitFunc) gxml_base_collection_instance_init, NULL };
	static const GInterfaceInfo gee_traversable_info = { (GInterfaceInitFunc) gxml_base_collection_gee_traversable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gee_iterable_info = { (GInterfaceInitFunc) gxml_base_collection_gee_iterable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_collection_info = { (GInterfaceInitFunc) gxml_base_collection_gxml_collection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_base_collection_type_id;
	gxml_base_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlBaseCollection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	g_type_add_interface_static (gxml_base_collection_type_id, GEE_TYPE_TRAVERSABLE, &gee_traversable_info);
	g_type_add_interface_static (gxml_base_collection_type_id, GEE_TYPE_ITERABLE, &gee_iterable_info);
	g_type_add_interface_static (gxml_base_collection_type_id, GXML_TYPE_COLLECTION, &gxml_collection_info);
	return gxml_base_collection_type_id;
}

GType
gxml_base_collection_get_type (void)
{
	static volatile gsize gxml_base_collection_type_id__once = 0;
	if (g_once_init_enter (&gxml_base_collection_type_id__once)) {
		GType gxml_base_collection_type_id;
		gxml_base_collection_type_id = gxml_base_collection_get_type_once ();
		g_once_init_leave (&gxml_base_collection_type_id__once, gxml_base_collection_type_id);
	}
	return gxml_base_collection_type_id__once;
}

static void
_vala_gxml_base_collection_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	GXmlBaseCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_BASE_COLLECTION, GXmlBaseCollection);
	switch (property_id) {
		case GXML_BASE_COLLECTION_ITEMS_NAME_PROPERTY:
		g_value_set_string (value, gxml_collection_get_items_name ((GXmlCollection*) self));
		break;
		case GXML_BASE_COLLECTION_ITEMS_TYPE_PROPERTY:
		g_value_set_gtype (value, gxml_collection_get_items_type ((GXmlCollection*) self));
		break;
		case GXML_BASE_COLLECTION_NODES_INDEX_PROPERTY:
		g_value_set_pointer (value, gxml_collection_get_nodes_index ((GXmlCollection*) self));
		break;
		case GXML_BASE_COLLECTION_ELEMENT_PROPERTY:
		g_value_set_object (value, gxml_collection_get_element ((GXmlCollection*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_base_collection_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	GXmlBaseCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_BASE_COLLECTION, GXmlBaseCollection);
	switch (property_id) {
		case GXML_BASE_COLLECTION_ITEMS_TYPE_PROPERTY:
		gxml_collection_set_items_type ((GXmlCollection*) self, g_value_get_gtype (value));
		break;
		case GXML_BASE_COLLECTION_ELEMENT_PROPERTY:
		gxml_collection_set_element ((GXmlCollection*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

