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

/* valainterfacetype.vala
 *
 * Copyright (C) 2007-2008  Jürg Billeter
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */

#include "vala.h"
#include <glib.h>
#include <valagee.h>
#include <glib-object.h>

#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

static gpointer vala_interface_type_parent_class = NULL;

static ValaDataType* vala_interface_type_real_copy (ValaDataType* base);
static GType vala_interface_type_get_type_once (void);

ValaInterface*
vala_interface_type_get_interface_symbol (ValaInterfaceType* self)
{
	ValaInterface* result;
	ValaSymbol* _tmp0_;
	ValaSymbol* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = vala_data_type_get_symbol ((ValaDataType*) self);
	_tmp1_ = _tmp0_;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VALA_TYPE_INTERFACE, ValaInterface);
	return result;
}

ValaInterfaceType*
vala_interface_type_construct (GType object_type,
                               ValaInterface* interface_symbol,
                               ValaSourceReference* source_reference)
{
	ValaInterfaceType* self = NULL;
	g_return_val_if_fail (interface_symbol != NULL, NULL);
	self = (ValaInterfaceType*) vala_reference_type_construct (object_type, (ValaSymbol*) interface_symbol, source_reference);
	return self;
}

ValaInterfaceType*
vala_interface_type_new (ValaInterface* interface_symbol,
                         ValaSourceReference* source_reference)
{
	return vala_interface_type_construct (VALA_TYPE_INTERFACE_TYPE, interface_symbol, source_reference);
}

static ValaDataType*
vala_interface_type_real_copy (ValaDataType* base)
{
	ValaInterfaceType * self;
	ValaInterfaceType* _result_ = NULL;
	ValaInterface* _tmp0_;
	ValaInterface* _tmp1_;
	ValaSourceReference* _tmp2_;
	ValaSourceReference* _tmp3_;
	ValaInterfaceType* _tmp4_;
	ValaInterfaceType* _tmp5_;
	ValaSourceReference* _tmp6_;
	ValaSourceReference* _tmp7_;
	ValaInterfaceType* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	ValaInterfaceType* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	ValaInterfaceType* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	ValaInterfaceType* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	ValaDataType* result;
	self = (ValaInterfaceType*) base;
	_tmp0_ = vala_interface_type_get_interface_symbol (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = vala_interface_type_new (_tmp1_, _tmp3_);
	_result_ = _tmp4_;
	_tmp5_ = _result_;
	_tmp6_ = vala_code_node_get_source_reference ((ValaCodeNode*) self);
	_tmp7_ = _tmp6_;
	vala_code_node_set_source_reference ((ValaCodeNode*) _tmp5_, _tmp7_);
	_tmp8_ = _result_;
	_tmp9_ = vala_data_type_get_value_owned ((ValaDataType*) self);
	_tmp10_ = _tmp9_;
	vala_data_type_set_value_owned ((ValaDataType*) _tmp8_, _tmp10_);
	_tmp11_ = _result_;
	_tmp12_ = vala_data_type_get_nullable ((ValaDataType*) self);
	_tmp13_ = _tmp12_;
	vala_data_type_set_nullable ((ValaDataType*) _tmp11_, _tmp13_);
	_tmp14_ = _result_;
	_tmp15_ = vala_data_type_get_is_dynamic ((ValaDataType*) self);
	_tmp16_ = _tmp15_;
	vala_data_type_set_is_dynamic ((ValaDataType*) _tmp14_, _tmp16_);
	_tmp17_ = _result_;
	_tmp18_ = vala_data_type_get_floating_reference ((ValaDataType*) self);
	_tmp19_ = _tmp18_;
	vala_data_type_set_floating_reference ((ValaDataType*) _tmp17_, _tmp19_);
	{
		ValaList* _arg_list = NULL;
		ValaList* _tmp20_;
		gint _arg_size = 0;
		ValaList* _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		gint _arg_index = 0;
		_tmp20_ = vala_data_type_get_type_arguments ((ValaDataType*) self);
		_arg_list = _tmp20_;
		_tmp21_ = _arg_list;
		_tmp22_ = vala_collection_get_size ((ValaCollection*) _tmp21_);
		_tmp23_ = _tmp22_;
		_arg_size = _tmp23_;
		_arg_index = -1;
		while (TRUE) {
			gint _tmp24_;
			gint _tmp25_;
			ValaDataType* arg = NULL;
			ValaList* _tmp26_;
			gpointer _tmp27_;
			ValaInterfaceType* _tmp28_;
			ValaDataType* _tmp29_;
			ValaDataType* _tmp30_;
			ValaDataType* _tmp31_;
			_arg_index = _arg_index + 1;
			_tmp24_ = _arg_index;
			_tmp25_ = _arg_size;
			if (!(_tmp24_ < _tmp25_)) {
				break;
			}
			_tmp26_ = _arg_list;
			_tmp27_ = vala_list_get (_tmp26_, _arg_index);
			arg = (ValaDataType*) _tmp27_;
			_tmp28_ = _result_;
			_tmp29_ = arg;
			_tmp30_ = vala_data_type_copy (_tmp29_);
			_tmp31_ = _tmp30_;
			vala_data_type_add_type_argument ((ValaDataType*) _tmp28_, _tmp31_);
			_vala_code_node_unref0 (_tmp31_);
			_vala_code_node_unref0 (arg);
		}
	}
	result = (ValaDataType*) _result_;
	return result;
}

static void
vala_interface_type_class_init (ValaInterfaceTypeClass * klass,
                                gpointer klass_data)
{
	vala_interface_type_parent_class = g_type_class_peek_parent (klass);
	((ValaDataTypeClass *) klass)->copy = (ValaDataType* (*) (ValaDataType*)) vala_interface_type_real_copy;
}

static void
vala_interface_type_instance_init (ValaInterfaceType * self,
                                   gpointer klass)
{
}

/**
 * An interface type.
 */
static GType
vala_interface_type_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaInterfaceTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_interface_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaInterfaceType), 0, (GInstanceInitFunc) vala_interface_type_instance_init, NULL };
	GType vala_interface_type_type_id;
	vala_interface_type_type_id = g_type_register_static (VALA_TYPE_REFERENCE_TYPE, "ValaInterfaceType", &g_define_type_info, 0);
	return vala_interface_type_type_id;
}

GType
vala_interface_type_get_type (void)
{
	static volatile gsize vala_interface_type_type_id__once = 0;
	if (g_once_init_enter (&vala_interface_type_type_id__once)) {
		GType vala_interface_type_type_id;
		vala_interface_type_type_id = vala_interface_type_get_type_once ();
		g_once_init_leave (&vala_interface_type_type_id__once, vala_interface_type_type_id);
	}
	return vala_interface_type_type_id__once;
}

