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

/* GXmlNamespace.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 <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/tree.h>


#define GXML_TYPE_NAMESPACE (gxml_namespace_get_type ())
#define GXML_NAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_NAMESPACE, GXmlNamespace))
#define GXML_IS_NAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_NAMESPACE))
#define GXML_NAMESPACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_NAMESPACE, GXmlNamespaceIface))

typedef struct _GXmlNamespace GXmlNamespace;
typedef struct _GXmlNamespaceIface GXmlNamespaceIface;

#define GXML_TYPE_GNAMESPACE (gxml_gnamespace_get_type ())
#define GXML_GNAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GNAMESPACE, GXmlGNamespace))
#define GXML_GNAMESPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GNAMESPACE, GXmlGNamespaceClass))
#define GXML_IS_GNAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GNAMESPACE))
#define GXML_IS_GNAMESPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GNAMESPACE))
#define GXML_GNAMESPACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GNAMESPACE, GXmlGNamespaceClass))

typedef struct _GXmlGNamespace GXmlGNamespace;
typedef struct _GXmlGNamespaceClass GXmlGNamespaceClass;
typedef struct _GXmlGNamespacePrivate GXmlGNamespacePrivate;

struct _GXmlNamespaceIface {
	GTypeInterface parent_iface;
	gchar* (*get_uri) (GXmlNamespace* self);
	gchar* (*get_prefix) (GXmlNamespace* self);
};

struct _GXmlGNamespace {
	GObject parent_instance;
	GXmlGNamespacePrivate * priv;
};

struct _GXmlGNamespaceClass {
	GObjectClass parent_class;
};

struct _GXmlGNamespacePrivate {
	xmlNs* _ns;
};


static gpointer gxml_gnamespace_parent_class = NULL;
static GXmlNamespaceIface* gxml_gnamespace_gxml_namespace_parent_iface = NULL;

GType gxml_namespace_get_type (void) G_GNUC_CONST;
GType gxml_gnamespace_get_type (void) G_GNUC_CONST;
#define GXML_GNAMESPACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GXML_TYPE_GNAMESPACE, GXmlGNamespacePrivate))
enum  {
	GXML_GNAMESPACE_DUMMY_PROPERTY,
	GXML_GNAMESPACE_URI,
	GXML_GNAMESPACE_PREFIX
};
GXmlGNamespace* gxml_gnamespace_new (xmlNs* ns);
GXmlGNamespace* gxml_gnamespace_construct (GType object_type, xmlNs* ns);
xmlNs* gxml_gnamespace_get_internal_ns (GXmlGNamespace* self);
static void gxml_gnamespace_finalize (GObject* obj);
gchar* gxml_namespace_get_uri (GXmlNamespace* self);
gchar* gxml_namespace_get_prefix (GXmlNamespace* self);
static void _vala_gxml_gnamespace_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);


GXmlGNamespace* gxml_gnamespace_construct (GType object_type, xmlNs* ns) {
	GXmlGNamespace * self = NULL;
	xmlNs* _tmp0_ = NULL;
	self = (GXmlGNamespace*) g_object_new (object_type, NULL);
	_tmp0_ = ns;
	self->priv->_ns = _tmp0_;
	return self;
}


GXmlGNamespace* gxml_gnamespace_new (xmlNs* ns) {
	return gxml_gnamespace_construct (GXML_TYPE_GNAMESPACE, ns);
}


xmlNs* gxml_gnamespace_get_internal_ns (GXmlGNamespace* self) {
	xmlNs* result = NULL;
	xmlNs* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_ns;
	result = _tmp0_;
	return result;
}


static gchar* gxml_gnamespace_real_get_uri (GXmlNamespace* base) {
	gchar* result;
	GXmlGNamespace* self;
	xmlNs* _tmp0_ = NULL;
	xmlNs* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	self = (GXmlGNamespace*) base;
	_tmp0_ = self->priv->_ns;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_ns;
	_tmp2_ = _tmp1_->href;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}


static gchar* gxml_gnamespace_real_get_prefix (GXmlNamespace* base) {
	gchar* result;
	GXmlGNamespace* self;
	xmlNs* _tmp0_ = NULL;
	xmlNs* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	self = (GXmlGNamespace*) base;
	_tmp0_ = self->priv->_ns;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_ns;
	_tmp2_ = _tmp1_->prefix;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}


static void gxml_gnamespace_class_init (GXmlGNamespaceClass * klass) {
	gxml_gnamespace_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GXmlGNamespacePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_gnamespace_get_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_gnamespace_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GNAMESPACE_URI, g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GNAMESPACE_PREFIX, g_param_spec_string ("prefix", "prefix", "prefix", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gxml_gnamespace_gxml_namespace_interface_init (GXmlNamespaceIface * iface) {
	gxml_gnamespace_gxml_namespace_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_uri = gxml_gnamespace_real_get_uri;
	iface->get_prefix = gxml_gnamespace_real_get_prefix;
}


static void gxml_gnamespace_instance_init (GXmlGNamespace * self) {
	self->priv = GXML_GNAMESPACE_GET_PRIVATE (self);
}


static void gxml_gnamespace_finalize (GObject* obj) {
	GXmlGNamespace * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_GNAMESPACE, GXmlGNamespace);
	G_OBJECT_CLASS (gxml_gnamespace_parent_class)->finalize (obj);
}


/**
 * Class implemeting {@link GXml.Namespace}
 */
GType gxml_gnamespace_get_type (void) {
	static volatile gsize gxml_gnamespace_type_id__volatile = 0;
	if (g_once_init_enter (&gxml_gnamespace_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GXmlGNamespaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_gnamespace_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlGNamespace), 0, (GInstanceInitFunc) gxml_gnamespace_instance_init, NULL };
		static const GInterfaceInfo gxml_namespace_info = { (GInterfaceInitFunc) gxml_gnamespace_gxml_namespace_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gxml_gnamespace_type_id;
		gxml_gnamespace_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlGNamespace", &g_define_type_info, 0);
		g_type_add_interface_static (gxml_gnamespace_type_id, GXML_TYPE_NAMESPACE, &gxml_namespace_info);
		g_once_init_leave (&gxml_gnamespace_type_id__volatile, gxml_gnamespace_type_id);
	}
	return gxml_gnamespace_type_id__volatile;
}


static void _vala_gxml_gnamespace_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GXmlGNamespace * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_GNAMESPACE, GXmlGNamespace);
	switch (property_id) {
		case GXML_GNAMESPACE_URI:
		g_value_take_string (value, gxml_namespace_get_uri ((GXmlNamespace*) self));
		break;
		case GXML_GNAMESPACE_PREFIX:
		g_value_take_string (value, gxml_namespace_get_prefix ((GXmlNamespace*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



