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

/* valausingdirective.vala
 *
 * Copyright (C) 2006-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 <glib.h>
#include <glib-object.h>
#include "vala.h"

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

struct _ValaUsingDirectivePrivate {
	ValaSymbol* _namespace_symbol;
};


static gpointer vala_using_directive_parent_class = NULL;

#define VALA_USING_DIRECTIVE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_USING_DIRECTIVE, ValaUsingDirectivePrivate))
static void vala_using_directive_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor);
static void vala_using_directive_finalize (ValaCodeNode * obj);


/**
 * Creates a new using directive.
 *
 * @param namespace_symbol namespace symbol
 * @return                 newly created using directive
 */
ValaUsingDirective* vala_using_directive_construct (GType object_type, ValaSymbol* namespace_symbol, ValaSourceReference* source_reference) {
	ValaUsingDirective* self = NULL;
	ValaSymbol* _tmp0_;
	ValaSourceReference* _tmp1_;
	g_return_val_if_fail (namespace_symbol != NULL, NULL);
	self = (ValaUsingDirective*) vala_code_node_construct (object_type);
	_tmp0_ = namespace_symbol;
	vala_using_directive_set_namespace_symbol (self, _tmp0_);
	_tmp1_ = source_reference;
	vala_code_node_set_source_reference ((ValaCodeNode*) self, _tmp1_);
	return self;
}


ValaUsingDirective* vala_using_directive_new (ValaSymbol* namespace_symbol, ValaSourceReference* source_reference) {
	return vala_using_directive_construct (VALA_TYPE_USING_DIRECTIVE, namespace_symbol, source_reference);
}


static void vala_using_directive_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor) {
	ValaUsingDirective * self;
	ValaCodeVisitor* _tmp0_;
	self = (ValaUsingDirective*) base;
	g_return_if_fail (visitor != NULL);
	_tmp0_ = visitor;
	vala_code_visitor_visit_using_directive (_tmp0_, self);
}


ValaSymbol* vala_using_directive_get_namespace_symbol (ValaUsingDirective* self) {
	ValaSymbol* result;
	ValaSymbol* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_namespace_symbol;
	result = _tmp0_;
	return result;
}


static gpointer _vala_code_node_ref0 (gpointer self) {
	return self ? vala_code_node_ref (self) : NULL;
}


void vala_using_directive_set_namespace_symbol (ValaUsingDirective* self, ValaSymbol* value) {
	ValaSymbol* _tmp0_;
	ValaSymbol* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_namespace_symbol);
	self->priv->_namespace_symbol = _tmp1_;
}


static void vala_using_directive_class_init (ValaUsingDirectiveClass * klass) {
	vala_using_directive_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_using_directive_finalize;
	g_type_class_add_private (klass, sizeof (ValaUsingDirectivePrivate));
	((ValaCodeNodeClass *) klass)->accept = (void (*) (ValaCodeNode *, ValaCodeVisitor*)) vala_using_directive_real_accept;
}


static void vala_using_directive_instance_init (ValaUsingDirective * self) {
	self->priv = VALA_USING_DIRECTIVE_GET_PRIVATE (self);
}


static void vala_using_directive_finalize (ValaCodeNode * obj) {
	ValaUsingDirective * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_USING_DIRECTIVE, ValaUsingDirective);
	_vala_code_node_unref0 (self->priv->_namespace_symbol);
	VALA_CODE_NODE_CLASS (vala_using_directive_parent_class)->finalize (obj);
}


/**
 * A reference to a namespace symbol.
 */
GType vala_using_directive_get_type (void) {
	static volatile gsize vala_using_directive_type_id__volatile = 0;
	if (g_once_init_enter (&vala_using_directive_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaUsingDirectiveClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_using_directive_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaUsingDirective), 0, (GInstanceInitFunc) vala_using_directive_instance_init, NULL };
		GType vala_using_directive_type_id;
		vala_using_directive_type_id = g_type_register_static (VALA_TYPE_CODE_NODE, "ValaUsingDirective", &g_define_type_info, 0);
		g_once_init_leave (&vala_using_directive_type_id__volatile, vala_using_directive_type_id);
	}
	return vala_using_directive_type_id__volatile;
}



