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

/* valagircomment.vala
 *
 * Copyright (C) 2011  Florian Brosch
 *
 * 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:
 * 	Florian Brosch <flo.brosch@gmail.com>
 */

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

#define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
#define _vala_comment_unref0(var) ((var == NULL) ? NULL : (var = (vala_comment_unref (var), NULL)))

struct _ValaGirCommentPrivate {
	ValaHashMap* parameter_content;
	ValaComment* _return_content;
};


static gpointer vala_gir_comment_parent_class = NULL;

#define VALA_GIR_COMMENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_GIR_COMMENT, ValaGirCommentPrivate))
G_GNUC_INTERNAL void vala_gir_comment_add_content_for_parameter (ValaGirComment* self, const gchar* name, ValaComment* comment);
static void vala_gir_comment_finalize (ValaComment * obj);


ValaMapIterator* vala_gir_comment_parameter_iterator (ValaGirComment* self) {
	ValaMapIterator* result = NULL;
	ValaHashMap* _tmp0_;
	ValaMapIterator* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->parameter_content;
	_tmp1_ = vala_map_map_iterator ((ValaMap*) _tmp0_);
	result = _tmp1_;
	return result;
}


ValaGirComment* vala_gir_comment_construct (GType object_type, const gchar* comment, ValaSourceReference* _source_reference) {
	ValaGirComment* self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	ValaSourceReference* _tmp2_;
	g_return_val_if_fail (_source_reference != NULL, NULL);
	_tmp1_ = comment;
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp2_ = _source_reference;
	self = (ValaGirComment*) vala_comment_construct (object_type, _tmp0_, _tmp2_);
	return self;
}


ValaGirComment* vala_gir_comment_new (const gchar* comment, ValaSourceReference* _source_reference) {
	return vala_gir_comment_construct (VALA_TYPE_GIR_COMMENT, comment, _source_reference);
}


G_GNUC_INTERNAL void vala_gir_comment_add_content_for_parameter (ValaGirComment* self, const gchar* name, ValaComment* comment) {
	ValaHashMap* _tmp0_;
	const gchar* _tmp1_;
	ValaComment* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (comment != NULL);
	_tmp0_ = self->priv->parameter_content;
	_tmp1_ = name;
	_tmp2_ = comment;
	vala_map_set ((ValaMap*) _tmp0_, _tmp1_, _tmp2_);
}


ValaComment* vala_gir_comment_get_content_for_parameter (ValaGirComment* self, const gchar* name) {
	ValaComment* result = NULL;
	ValaHashMap* _tmp0_;
	const gchar* _tmp1_;
	gpointer _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->parameter_content;
	_tmp1_ = name;
	_tmp2_ = vala_map_get ((ValaMap*) _tmp0_, _tmp1_);
	result = (ValaComment*) _tmp2_;
	return result;
}


ValaComment* vala_gir_comment_get_return_content (ValaGirComment* self) {
	ValaComment* result;
	ValaComment* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_return_content;
	result = _tmp0_;
	return result;
}


static gpointer _vala_comment_ref0 (gpointer self) {
	return self ? vala_comment_ref (self) : NULL;
}


void vala_gir_comment_set_return_content (ValaGirComment* self, ValaComment* value) {
	ValaComment* _tmp0_;
	ValaComment* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_comment_ref0 (_tmp0_);
	_vala_comment_unref0 (self->priv->_return_content);
	self->priv->_return_content = _tmp1_;
}


static void vala_gir_comment_class_init (ValaGirCommentClass * klass) {
	vala_gir_comment_parent_class = g_type_class_peek_parent (klass);
	((ValaCommentClass *) klass)->finalize = vala_gir_comment_finalize;
	g_type_class_add_private (klass, sizeof (ValaGirCommentPrivate));
}


static void vala_gir_comment_instance_init (ValaGirComment * self) {
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GEqualFunc _tmp2_;
	ValaHashMap* _tmp3_;
	self->priv = VALA_GIR_COMMENT_GET_PRIVATE (self);
	_tmp0_ = g_direct_hash;
	_tmp1_ = g_direct_equal;
	_tmp2_ = g_direct_equal;
	_tmp3_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, VALA_TYPE_COMMENT, (GBoxedCopyFunc) vala_comment_ref, (GDestroyNotify) vala_comment_unref, _tmp0_, _tmp1_, _tmp2_);
	self->priv->parameter_content = _tmp3_;
}


static void vala_gir_comment_finalize (ValaComment * obj) {
	ValaGirComment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_GIR_COMMENT, ValaGirComment);
	_vala_map_unref0 (self->priv->parameter_content);
	_vala_comment_unref0 (self->priv->_return_content);
	VALA_COMMENT_CLASS (vala_gir_comment_parent_class)->finalize (obj);
}


/**
 * A documentation comment used by valadoc
 */
GType vala_gir_comment_get_type (void) {
	static volatile gsize vala_gir_comment_type_id__volatile = 0;
	if (g_once_init_enter (&vala_gir_comment_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaGirCommentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_gir_comment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaGirComment), 0, (GInstanceInitFunc) vala_gir_comment_instance_init, NULL };
		GType vala_gir_comment_type_id;
		vala_gir_comment_type_id = g_type_register_static (VALA_TYPE_COMMENT, "ValaGirComment", &g_define_type_info, 0);
		g_once_init_leave (&vala_gir_comment_type_id__volatile, vala_gir_comment_type_id);
	}
	return vala_gir_comment_type_id__volatile;
}



