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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 *
 * 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 "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_XCHARACTER_DATA_0_PROPERTY,
	GXML_XCHARACTER_DATA_STR_PROPERTY,
	GXML_XCHARACTER_DATA_DATA_PROPERTY,
	GXML_XCHARACTER_DATA_NUM_PROPERTIES
};
static GParamSpec* gxml_xcharacter_data_properties[GXML_XCHARACTER_DATA_NUM_PROPERTIES];

static gpointer gxml_xcharacter_data_parent_class = NULL;
static GXmlDomCharacterDataIface * gxml_xcharacter_data_gxml_dom_character_data_parent_iface = NULL;

static GType gxml_xcharacter_data_get_type_once (void);
static void _vala_gxml_xcharacter_data_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_gxml_xcharacter_data_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

gchar*
gxml_xcharacter_data_get_str (GXmlXCharacterData* self)
{
	gchar* result;
	gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = GXML_XNODE_CLASS (gxml_xcharacter_data_parent_class)->get_value ((GXmlXNode*) G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_XNON_DOCUMENT_CHILD_NODE, GXmlXNonDocumentChildNode));
	result = _tmp0_;
	return result;
}

void
gxml_xcharacter_data_set_str (GXmlXCharacterData* self,
                              const gchar* value)
{
	g_return_if_fail (self != NULL);
	GXML_XNODE_CLASS (gxml_xcharacter_data_parent_class)->set_value ((GXmlXNode*) G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_XNON_DOCUMENT_CHILD_NODE, GXmlXNonDocumentChildNode), value);
	g_object_notify_by_pspec ((GObject *) self, gxml_xcharacter_data_properties[GXML_XCHARACTER_DATA_STR_PROPERTY]);
}

static gchar*
gxml_xcharacter_data_real_get_data (GXmlDomCharacterData* base)
{
	gchar* result;
	GXmlXCharacterData* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlXCharacterData*) base;
	_tmp0_ = gxml_xcharacter_data_get_str (self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static void
gxml_xcharacter_data_real_set_data (GXmlDomCharacterData* base,
                                    const gchar* value)
{
	GXmlXCharacterData* self;
	self = (GXmlXCharacterData*) base;
	gxml_xcharacter_data_set_str (self, value);
	g_object_notify_by_pspec ((GObject *) self, gxml_xcharacter_data_properties[GXML_XCHARACTER_DATA_DATA_PROPERTY]);
}

GXmlXCharacterData*
gxml_xcharacter_data_construct (GType object_type)
{
	GXmlXCharacterData * self = NULL;
	self = (GXmlXCharacterData*) gxml_xnon_document_child_node_construct (object_type);
	return self;
}

GXmlXCharacterData*
gxml_xcharacter_data_new (void)
{
	return gxml_xcharacter_data_construct (GXML_TYPE_XCHARACTER_DATA);
}

static void
gxml_xcharacter_data_class_init (GXmlXCharacterDataClass * klass,
                                 gpointer klass_data)
{
	gxml_xcharacter_data_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_xcharacter_data_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_xcharacter_data_set_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XCHARACTER_DATA_STR_PROPERTY, gxml_xcharacter_data_properties[GXML_XCHARACTER_DATA_STR_PROPERTY] = g_param_spec_string ("str", "str", "str", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XCHARACTER_DATA_DATA_PROPERTY, gxml_xcharacter_data_properties[GXML_XCHARACTER_DATA_DATA_PROPERTY] = g_param_spec_string ("data", "data", "data", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
gxml_xcharacter_data_gxml_dom_character_data_interface_init (GXmlDomCharacterDataIface * iface,
                                                             gpointer iface_data)
{
	gxml_xcharacter_data_gxml_dom_character_data_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_data = gxml_xcharacter_data_real_get_data;
	iface->set_data = gxml_xcharacter_data_real_set_data;
}

static void
gxml_xcharacter_data_instance_init (GXmlXCharacterData * self,
                                    gpointer klass)
{
}

/**
 * DOM4 Base class for character data, powered by libxml2 library.
 */
static GType
gxml_xcharacter_data_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlXCharacterDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_xcharacter_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlXCharacterData), 0, (GInstanceInitFunc) gxml_xcharacter_data_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_character_data_info = { (GInterfaceInitFunc) gxml_xcharacter_data_gxml_dom_character_data_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_xcharacter_data_type_id;
	gxml_xcharacter_data_type_id = g_type_register_static (GXML_TYPE_XNON_DOCUMENT_CHILD_NODE, "GXmlXCharacterData", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_xcharacter_data_type_id, GXML_TYPE_DOM_CHARACTER_DATA, &gxml_dom_character_data_info);
	return gxml_xcharacter_data_type_id;
}

GType
gxml_xcharacter_data_get_type (void)
{
	static volatile gsize gxml_xcharacter_data_type_id__once = 0;
	if (g_once_init_enter (&gxml_xcharacter_data_type_id__once)) {
		GType gxml_xcharacter_data_type_id;
		gxml_xcharacter_data_type_id = gxml_xcharacter_data_get_type_once ();
		g_once_init_leave (&gxml_xcharacter_data_type_id__once, gxml_xcharacter_data_type_id);
	}
	return gxml_xcharacter_data_type_id__once;
}

static void
_vala_gxml_xcharacter_data_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	GXmlXCharacterData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_XCHARACTER_DATA, GXmlXCharacterData);
	switch (property_id) {
		case GXML_XCHARACTER_DATA_STR_PROPERTY:
		g_value_take_string (value, gxml_xcharacter_data_get_str (self));
		break;
		case GXML_XCHARACTER_DATA_DATA_PROPERTY:
		g_value_take_string (value, gxml_dom_character_data_get_data ((GXmlDomCharacterData*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_xcharacter_data_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	GXmlXCharacterData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_XCHARACTER_DATA, GXmlXCharacterData);
	switch (property_id) {
		case GXML_XCHARACTER_DATA_STR_PROPERTY:
		gxml_xcharacter_data_set_str (self, g_value_get_string (value));
		break;
		case GXML_XCHARACTER_DATA_DATA_PROPERTY:
		gxml_dom_character_data_set_data ((GXmlDomCharacterData*) self, g_value_get_string (value));
		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;
}

