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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 *
 * Copyright (C) 2016-2019  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-object.h>
#include <glib.h>
#include <string.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_NODE_ITERATOR_0_PROPERTY,
	GXML_NODE_ITERATOR_ROOT_PROPERTY,
	GXML_NODE_ITERATOR_REFERENCE_NODE_PROPERTY,
	GXML_NODE_ITERATOR_POINTER_BEFORE_REFERENCE_NODE_PROPERTY,
	GXML_NODE_ITERATOR_WHAT_TO_SHOW_PROPERTY,
	GXML_NODE_ITERATOR_NUM_PROPERTIES
};
static GParamSpec* gxml_node_iterator_properties[GXML_NODE_ITERATOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer gxml_node_iterator_parent_class = NULL;
static GXmlDomNodeIteratorIface * gxml_node_iterator_gxml_dom_node_iterator_parent_iface = NULL;

static GXmlDomNode* gxml_node_iterator_real_next_node (GXmlDomNodeIterator* base);
static GXmlDomNode* gxml_node_iterator_real_previous_node (GXmlDomNodeIterator* base);
static void gxml_node_iterator_real_detach (GXmlDomNodeIterator* base);
static void gxml_node_iterator_finalize (GObject * obj);
static GType gxml_node_iterator_get_type_once (void);
static void _vala_gxml_node_iterator_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

GXmlNodeIterator*
gxml_node_iterator_construct (GType object_type,
                              GXmlDomNode* n,
                              gint what_to_show)
{
	GXmlNodeIterator * self = NULL;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	g_return_val_if_fail (n != NULL, NULL);
	self = (GXmlNodeIterator*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (n);
	_g_object_unref0 (self->_root);
	self->_root = _tmp0_;
	_tmp1_ = self->_root;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->_reference_node);
	self->_reference_node = _tmp2_;
	self->_what_to_show = what_to_show;
	return self;
}

GXmlNodeIterator*
gxml_node_iterator_new (GXmlDomNode* n,
                        gint what_to_show)
{
	return gxml_node_iterator_construct (GXML_TYPE_NODE_ITERATOR, n, what_to_show);
}

static GXmlDomNode*
gxml_node_iterator_real_get_root (GXmlDomNodeIterator* base)
{
	GXmlDomNode* result;
	GXmlNodeIterator* self;
	GXmlDomNode* _tmp0_;
	self = (GXmlNodeIterator*) base;
	_tmp0_ = self->_root;
	result = _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_node_iterator_real_get_reference_node (GXmlDomNodeIterator* base)
{
	GXmlDomNode* result;
	GXmlNodeIterator* self;
	GXmlDomNode* _tmp0_;
	self = (GXmlNodeIterator*) base;
	_tmp0_ = self->_reference_node;
	result = _tmp0_;
	return result;
}

static gboolean
gxml_node_iterator_real_get_pointer_before_reference_node (GXmlDomNodeIterator* base)
{
	gboolean result;
	GXmlNodeIterator* self;
	self = (GXmlNodeIterator*) base;
	result = self->_pointer_before_reference_node;
	return result;
}

static gint
gxml_node_iterator_real_get_what_to_show (GXmlDomNodeIterator* base)
{
	gint result;
	GXmlNodeIterator* self;
	self = (GXmlNodeIterator*) base;
	result = self->_what_to_show;
	return result;
}

static GXmlDomNode*
gxml_node_iterator_real_next_node (GXmlDomNodeIterator* base)
{
	GXmlNodeIterator * self;
	GXmlDomNode* result;
	self = (GXmlNodeIterator*) base;
	result = NULL;
	return result;
}

static GXmlDomNode*
gxml_node_iterator_real_previous_node (GXmlDomNodeIterator* base)
{
	GXmlNodeIterator * self;
	GXmlDomNode* result;
	self = (GXmlNodeIterator*) base;
	result = NULL;
	return result;
}

static void
gxml_node_iterator_real_detach (GXmlDomNodeIterator* base)
{
	GXmlNodeIterator * self;
	self = (GXmlNodeIterator*) base;
	return;
}

static void
gxml_node_iterator_class_init (GXmlNodeIteratorClass * klass,
                               gpointer klass_data)
{
	gxml_node_iterator_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_node_iterator_get_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_node_iterator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_ITERATOR_ROOT_PROPERTY, gxml_node_iterator_properties[GXML_NODE_ITERATOR_ROOT_PROPERTY] = g_param_spec_object ("root", "root", "root", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_ITERATOR_REFERENCE_NODE_PROPERTY, gxml_node_iterator_properties[GXML_NODE_ITERATOR_REFERENCE_NODE_PROPERTY] = g_param_spec_object ("reference-node", "reference-node", "reference-node", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_ITERATOR_POINTER_BEFORE_REFERENCE_NODE_PROPERTY, gxml_node_iterator_properties[GXML_NODE_ITERATOR_POINTER_BEFORE_REFERENCE_NODE_PROPERTY] = g_param_spec_boolean ("pointer-before-reference-node", "pointer-before-reference-node", "pointer-before-reference-node", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_ITERATOR_WHAT_TO_SHOW_PROPERTY, gxml_node_iterator_properties[GXML_NODE_ITERATOR_WHAT_TO_SHOW_PROPERTY] = g_param_spec_int ("what-to-show", "what-to-show", "what-to-show", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_node_iterator_gxml_dom_node_iterator_interface_init (GXmlDomNodeIteratorIface * iface,
                                                          gpointer iface_data)
{
	gxml_node_iterator_gxml_dom_node_iterator_parent_iface = g_type_interface_peek_parent (iface);
	iface->next_node = (GXmlDomNode* (*) (GXmlDomNodeIterator*)) gxml_node_iterator_real_next_node;
	iface->previous_node = (GXmlDomNode* (*) (GXmlDomNodeIterator*)) gxml_node_iterator_real_previous_node;
	iface->detach = (void (*) (GXmlDomNodeIterator*)) gxml_node_iterator_real_detach;
	iface->get_root = gxml_node_iterator_real_get_root;
	iface->get_reference_node = gxml_node_iterator_real_get_reference_node;
	iface->get_pointer_before_reference_node = gxml_node_iterator_real_get_pointer_before_reference_node;
	iface->get_what_to_show = gxml_node_iterator_real_get_what_to_show;
}

static void
gxml_node_iterator_instance_init (GXmlNodeIterator * self,
                                  gpointer klass)
{
}

static void
gxml_node_iterator_finalize (GObject * obj)
{
	GXmlNodeIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_NODE_ITERATOR, GXmlNodeIterator);
	_g_object_unref0 (self->_root);
	_g_object_unref0 (self->_reference_node);
	G_OBJECT_CLASS (gxml_node_iterator_parent_class)->finalize (obj);
}

/**
 * Implementation of {@link DomNodeIterator}
 */
static GType
gxml_node_iterator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlNodeIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_node_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlNodeIterator), 0, (GInstanceInitFunc) gxml_node_iterator_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_node_iterator_info = { (GInterfaceInitFunc) gxml_node_iterator_gxml_dom_node_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_node_iterator_type_id;
	gxml_node_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlNodeIterator", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_node_iterator_type_id, GXML_TYPE_DOM_NODE_ITERATOR, &gxml_dom_node_iterator_info);
	return gxml_node_iterator_type_id;
}

GType
gxml_node_iterator_get_type (void)
{
	static volatile gsize gxml_node_iterator_type_id__once = 0;
	if (g_once_init_enter (&gxml_node_iterator_type_id__once)) {
		GType gxml_node_iterator_type_id;
		gxml_node_iterator_type_id = gxml_node_iterator_get_type_once ();
		g_once_init_leave (&gxml_node_iterator_type_id__once, gxml_node_iterator_type_id);
	}
	return gxml_node_iterator_type_id__once;
}

static void
_vala_gxml_node_iterator_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	GXmlNodeIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_NODE_ITERATOR, GXmlNodeIterator);
	switch (property_id) {
		case GXML_NODE_ITERATOR_ROOT_PROPERTY:
		g_value_set_object (value, gxml_dom_node_iterator_get_root ((GXmlDomNodeIterator*) self));
		break;
		case GXML_NODE_ITERATOR_REFERENCE_NODE_PROPERTY:
		g_value_set_object (value, gxml_dom_node_iterator_get_reference_node ((GXmlDomNodeIterator*) self));
		break;
		case GXML_NODE_ITERATOR_POINTER_BEFORE_REFERENCE_NODE_PROPERTY:
		g_value_set_boolean (value, gxml_dom_node_iterator_get_pointer_before_reference_node ((GXmlDomNodeIterator*) self));
		break;
		case GXML_NODE_ITERATOR_WHAT_TO_SHOW_PROPERTY:
		g_value_set_int (value, gxml_dom_node_iterator_get_what_to_show ((GXmlDomNodeIterator*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

