/* resultitem.c generated by valac 0.12.1.1-323029-dirty, the Vala compiler
 * generated from resultitem.vala, do not modify */

/* resultitem.vala
 *
 * Copyright (C) 2009  Andrea Del Signore
 *
 * 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/>.
 *
 * Author:
 * 	Andrea Del Signore <sejerpz@tin.it>
 */

#include <glib.h>
#include <glib-object.h>
#include <valagee.h>
#include <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_RESULT_ITEM (afrodite_result_item_get_type ())
#define AFRODITE_RESULT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItem))
#define AFRODITE_RESULT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItemClass))
#define AFRODITE_IS_RESULT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_RESULT_ITEM))
#define AFRODITE_IS_RESULT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_RESULT_ITEM))
#define AFRODITE_RESULT_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItemClass))

typedef struct _AfroditeResultItem AfroditeResultItem;
typedef struct _AfroditeResultItemClass AfroditeResultItemClass;
typedef struct _AfroditeResultItemPrivate AfroditeResultItemPrivate;

#define AFRODITE_TYPE_SYMBOL (afrodite_symbol_get_type ())
#define AFRODITE_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SYMBOL, AfroditeSymbol))
#define AFRODITE_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SYMBOL, AfroditeSymbolClass))
#define AFRODITE_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SYMBOL))
#define AFRODITE_IS_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SYMBOL))
#define AFRODITE_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SYMBOL, AfroditeSymbolClass))

typedef struct _AfroditeSymbol AfroditeSymbol;
typedef struct _AfroditeSymbolClass AfroditeSymbolClass;
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
typedef struct _AfroditeParamSpecResultItem AfroditeParamSpecResultItem;

struct _AfroditeResultItem {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AfroditeResultItemPrivate * priv;
};

struct _AfroditeResultItemClass {
	GTypeClass parent_class;
	void (*finalize) (AfroditeResultItem *self);
};

struct _AfroditeResultItemPrivate {
	ValaList* _children;
	AfroditeSymbol* _symbol;
	AfroditeResultItem* _parent;
};

struct _AfroditeParamSpecResultItem {
	GParamSpec parent_instance;
};


static gpointer afrodite_result_item_parent_class = NULL;

gpointer afrodite_result_item_ref (gpointer instance);
void afrodite_result_item_unref (gpointer instance);
GParamSpec* afrodite_param_spec_result_item (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_result_item (GValue* value, gpointer v_object);
void afrodite_value_take_result_item (GValue* value, gpointer v_object);
gpointer afrodite_value_get_result_item (const GValue* value);
GType afrodite_result_item_get_type (void) G_GNUC_CONST;
GType afrodite_symbol_get_type (void) G_GNUC_CONST;
#define AFRODITE_RESULT_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItemPrivate))
enum  {
	AFRODITE_RESULT_ITEM_DUMMY_PROPERTY
};
void afrodite_result_item_set_children (AfroditeResultItem* self, ValaList* value);
void afrodite_result_item_set_symbol (AfroditeResultItem* self, AfroditeSymbol* value);
void afrodite_result_item_set_parent (AfroditeResultItem* self, AfroditeResultItem* value);
void afrodite_result_item_add_result_item (AfroditeResultItem* self, AfroditeResultItem* item);
AfroditeResultItem* afrodite_result_item_new (void);
AfroditeResultItem* afrodite_result_item_construct (GType object_type);
AfroditeSymbol* afrodite_result_item_get_symbol (AfroditeResultItem* self);
AfroditeResultItem* afrodite_result_item_get_parent (AfroditeResultItem* self);
ValaList* afrodite_result_item_get_children (AfroditeResultItem* self);
static void afrodite_result_item_finalize (AfroditeResultItem* obj);


void afrodite_result_item_add_result_item (AfroditeResultItem* self, AfroditeResultItem* item) {
	g_return_if_fail (self != NULL);
	vala_collection_add ((ValaCollection*) self->priv->_children, item);
}


AfroditeResultItem* afrodite_result_item_construct (GType object_type) {
	AfroditeResultItem* self = NULL;
	self = (AfroditeResultItem*) g_type_create_instance (object_type);
	return self;
}


AfroditeResultItem* afrodite_result_item_new (void) {
	return afrodite_result_item_construct (AFRODITE_TYPE_RESULT_ITEM);
}


AfroditeSymbol* afrodite_result_item_get_symbol (AfroditeResultItem* self) {
	AfroditeSymbol* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_symbol;
	return result;
}


void afrodite_result_item_set_symbol (AfroditeResultItem* self, AfroditeSymbol* value) {
	g_return_if_fail (self != NULL);
	self->priv->_symbol = value;
}


AfroditeResultItem* afrodite_result_item_get_parent (AfroditeResultItem* self) {
	AfroditeResultItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_parent;
	return result;
}


void afrodite_result_item_set_parent (AfroditeResultItem* self, AfroditeResultItem* value) {
	g_return_if_fail (self != NULL);
	self->priv->_parent = value;
}


ValaList* afrodite_result_item_get_children (AfroditeResultItem* self) {
	ValaList* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_children;
	return result;
}


static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


void afrodite_result_item_set_children (AfroditeResultItem* self, ValaList* value) {
	ValaList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _vala_iterable_ref0 (value);
	_vala_iterable_unref0 (self->priv->_children);
	self->priv->_children = _tmp0_;
}


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


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


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


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


static gchar* afrodite_value_result_item_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		AfroditeResultItem* 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 = afrodite_result_item_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* afrodite_value_result_item_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	AfroditeResultItem** 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 = afrodite_result_item_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* afrodite_param_spec_result_item (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	AfroditeParamSpecResultItem* spec;
	g_return_val_if_fail (g_type_is_a (object_type, AFRODITE_TYPE_RESULT_ITEM), 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 afrodite_value_get_result_item (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_RESULT_ITEM), NULL);
	return value->data[0].v_pointer;
}


void afrodite_value_set_result_item (GValue* value, gpointer v_object) {
	AfroditeResultItem* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_RESULT_ITEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_RESULT_ITEM));
		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;
		afrodite_result_item_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		afrodite_result_item_unref (old);
	}
}


void afrodite_value_take_result_item (GValue* value, gpointer v_object) {
	AfroditeResultItem* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_RESULT_ITEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_RESULT_ITEM));
		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) {
		afrodite_result_item_unref (old);
	}
}


static void afrodite_result_item_class_init (AfroditeResultItemClass * klass) {
	afrodite_result_item_parent_class = g_type_class_peek_parent (klass);
	AFRODITE_RESULT_ITEM_CLASS (klass)->finalize = afrodite_result_item_finalize;
	g_type_class_add_private (klass, sizeof (AfroditeResultItemPrivate));
}


static void afrodite_result_item_instance_init (AfroditeResultItem * self) {
	ValaArrayList* _tmp0_ = NULL;
	self->priv = AFRODITE_RESULT_ITEM_GET_PRIVATE (self);
	_tmp0_ = vala_array_list_new (AFRODITE_TYPE_RESULT_ITEM, (GBoxedCopyFunc) afrodite_result_item_ref, afrodite_result_item_unref, g_direct_equal);
	self->priv->_children = (ValaList*) _tmp0_;
	self->ref_count = 1;
}


static void afrodite_result_item_finalize (AfroditeResultItem* obj) {
	AfroditeResultItem * self;
	self = AFRODITE_RESULT_ITEM (obj);
	afrodite_result_item_set_children (self, NULL);
	afrodite_result_item_set_symbol (self, NULL);
	afrodite_result_item_set_parent (self, NULL);
	_vala_iterable_unref0 (self->priv->_children);
}


GType afrodite_result_item_get_type (void) {
	static volatile gsize afrodite_result_item_type_id__volatile = 0;
	if (g_once_init_enter (&afrodite_result_item_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { afrodite_value_result_item_init, afrodite_value_result_item_free_value, afrodite_value_result_item_copy_value, afrodite_value_result_item_peek_pointer, "p", afrodite_value_result_item_collect_value, "p", afrodite_value_result_item_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (AfroditeResultItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_result_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeResultItem), 0, (GInstanceInitFunc) afrodite_result_item_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 afrodite_result_item_type_id;
		afrodite_result_item_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeResultItem", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&afrodite_result_item_type_id__volatile, afrodite_result_item_type_id);
	}
	return afrodite_result_item_type_id__volatile;
}


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


void afrodite_result_item_unref (gpointer instance) {
	AfroditeResultItem* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		AFRODITE_RESULT_ITEM_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



