/* gxml-init.c generated by valac 0.34.7, the Vala compiler
 * generated from gxml-init.vala, do not modify */

/*
 *  GXml
 *
 *  Authors:
 *
 *       Daniel Espinosa <esodan@gmail.com>
 *
 *
 *  Copyright (c) 2015 Daniel Espinosa
 *  
 *  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 3 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include "config.h"
#include <gobject/gvaluecollector.h>


#define GXML_TYPE_INIT (gxml_init_get_type ())
#define GXML_INIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_INIT, GXmlInit))
#define GXML_INIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_INIT, GXmlInitClass))
#define GXML_IS_INIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_INIT))
#define GXML_IS_INIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_INIT))
#define GXML_INIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_INIT, GXmlInitClass))

typedef struct _GXmlInit GXmlInit;
typedef struct _GXmlInitClass GXmlInitClass;
typedef struct _GXmlInitPrivate GXmlInitPrivate;
typedef struct _GXmlParamSpecInit GXmlParamSpecInit;

struct _GXmlInit {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GXmlInitPrivate * priv;
};

struct _GXmlInitClass {
	GTypeClass parent_class;
	void (*finalize) (GXmlInit *self);
};

struct _GXmlParamSpecInit {
	GParamSpec parent_instance;
};


static gpointer gxml_init_parent_class = NULL;
static gboolean gxml_init_initialized;
static gboolean gxml_init_initialized = FALSE;

gpointer gxml_init_ref (gpointer instance);
void gxml_init_unref (gpointer instance);
GParamSpec* gxml_param_spec_init (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gxml_value_set_init (GValue* value, gpointer v_object);
void gxml_value_take_init (GValue* value, gpointer v_object);
gpointer gxml_value_get_init (const GValue* value);
GType gxml_init_get_type (void) G_GNUC_CONST;
enum  {
	GXML_INIT_DUMMY_PROPERTY
};
void gxml_init_init (void);
GXmlInit* gxml_init_new (void);
GXmlInit* gxml_init_construct (GType object_type);
static void gxml_init_finalize (GXmlInit* obj);


void gxml_init_init (void) {
	gboolean _tmp0_ = FALSE;
	_tmp0_ = gxml_init_initialized;
	if (!_tmp0_) {
		textdomain (GETTEXT_PACKAGE);
		bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
		gxml_init_initialized = TRUE;
	}
}


GXmlInit* gxml_init_construct (GType object_type) {
	GXmlInit* self = NULL;
	self = (GXmlInit*) g_type_create_instance (object_type);
	return self;
}


GXmlInit* gxml_init_new (void) {
	return gxml_init_construct (GXML_TYPE_INIT);
}


static void gxml_value_init_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void gxml_value_init_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		gxml_init_unref (value->data[0].v_pointer);
	}
}


static void gxml_value_init_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = gxml_init_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer gxml_value_init_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* gxml_value_init_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		GXmlInit* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = gxml_init_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* gxml_value_init_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	GXmlInit** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = gxml_init_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* gxml_param_spec_init (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	GXmlParamSpecInit* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GXML_TYPE_INIT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer gxml_value_get_init (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GXML_TYPE_INIT), NULL);
	return value->data[0].v_pointer;
}


void gxml_value_set_init (GValue* value, gpointer v_object) {
	GXmlInit* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GXML_TYPE_INIT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GXML_TYPE_INIT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		gxml_init_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gxml_init_unref (old);
	}
}


void gxml_value_take_init (GValue* value, gpointer v_object) {
	GXmlInit* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GXML_TYPE_INIT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GXML_TYPE_INIT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gxml_init_unref (old);
	}
}


static void gxml_init_class_init (GXmlInitClass * klass) {
	gxml_init_parent_class = g_type_class_peek_parent (klass);
	((GXmlInitClass *) klass)->finalize = gxml_init_finalize;
}


static void gxml_init_instance_init (GXmlInit * self) {
	self->ref_count = 1;
}


static void gxml_init_finalize (GXmlInit* obj) {
	GXmlInit * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_INIT, GXmlInit);
	g_signal_handlers_destroy (self);
}


GType gxml_init_get_type (void) {
	static volatile gsize gxml_init_type_id__volatile = 0;
	if (g_once_init_enter (&gxml_init_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { gxml_value_init_init, gxml_value_init_free_value, gxml_value_init_copy_value, gxml_value_init_peek_pointer, "p", gxml_value_init_collect_value, "p", gxml_value_init_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (GXmlInitClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_init_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlInit), 0, (GInstanceInitFunc) gxml_init_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType gxml_init_type_id;
		gxml_init_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GXmlInit", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&gxml_init_type_id__volatile, gxml_init_type_id);
	}
	return gxml_init_type_id__volatile;
}


gpointer gxml_init_ref (gpointer instance) {
	GXmlInit* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void gxml_init_unref (gpointer instance) {
	GXmlInit* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GXML_INIT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



