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

/* sourcefile.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:
 * 	Brosch Florian <flo.brosch@gmail.com>
 */

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

enum  {
	VALADOC_API_SOURCE_FILE_0_PROPERTY,
	VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY,
	VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY,
	VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY,
	VALADOC_API_SOURCE_FILE_DATA_PROPERTY,
	VALADOC_API_SOURCE_FILE_NUM_PROPERTIES
};
static GParamSpec* valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ValadocApiSourceFilePrivate {
	ValadocApiPackage* _package;
	gchar* _relative_path;
	gchar* _relative_c_path;
	void* _data;
};


static gpointer valadoc_api_source_file_parent_class = NULL;

#define VALADOC_API_SOURCE_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFilePrivate))
static void valadoc_api_source_file_set_relative_c_path (ValadocApiSourceFile* self, const gchar* value);
static void valadoc_api_source_file_set_relative_path (ValadocApiSourceFile* self, const gchar* value);
static void valadoc_api_source_file_set_package (ValadocApiSourceFile* self, ValadocApiPackage* value);
static void valadoc_api_source_file_set_data (ValadocApiSourceFile* self, void* value);
static void valadoc_api_source_file_finalize (GObject * obj);
static void _vala_valadoc_api_source_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_valadoc_api_source_file_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


gchar* valadoc_api_source_file_get_name (ValadocApiSourceFile* self) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_relative_path;
	_tmp1_ = g_path_get_basename (_tmp0_);
	result = _tmp1_;
	return result;
}


ValadocApiSourceFile* valadoc_api_source_file_construct (GType object_type, ValadocApiPackage* package, const gchar* relative_path, const gchar* relative_c_path, void* data) {
	ValadocApiSourceFile * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ValadocApiPackage* _tmp2_;
	void* _tmp3_;
	g_return_val_if_fail (package != NULL, NULL);
	g_return_val_if_fail (relative_path != NULL, NULL);
	self = (ValadocApiSourceFile*) g_object_new (object_type, NULL);
	_tmp0_ = relative_c_path;
	valadoc_api_source_file_set_relative_c_path (self, _tmp0_);
	_tmp1_ = relative_path;
	valadoc_api_source_file_set_relative_path (self, _tmp1_);
	_tmp2_ = package;
	valadoc_api_source_file_set_package (self, _tmp2_);
	_tmp3_ = data;
	valadoc_api_source_file_set_data (self, _tmp3_);
	return self;
}


ValadocApiSourceFile* valadoc_api_source_file_new (ValadocApiPackage* package, const gchar* relative_path, const gchar* relative_c_path, void* data) {
	return valadoc_api_source_file_construct (VALADOC_API_TYPE_SOURCE_FILE, package, relative_path, relative_c_path, data);
}


ValadocApiPackage* valadoc_api_source_file_get_package (ValadocApiSourceFile* self) {
	ValadocApiPackage* result;
	ValadocApiPackage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_package;
	result = _tmp0_;
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void valadoc_api_source_file_set_package (ValadocApiSourceFile* self, ValadocApiPackage* value) {
	g_return_if_fail (self != NULL);
	if (valadoc_api_source_file_get_package (self) != value) {
		ValadocApiPackage* _tmp0_;
		ValadocApiPackage* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_g_object_unref0 (self->priv->_package);
		self->priv->_package = _tmp1_;
		g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY]);
	}
}


const gchar* valadoc_api_source_file_get_relative_path (ValadocApiSourceFile* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_relative_path;
	result = _tmp0_;
	return result;
}


static void valadoc_api_source_file_set_relative_path (ValadocApiSourceFile* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, valadoc_api_source_file_get_relative_path (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_relative_path);
		self->priv->_relative_path = _tmp1_;
		g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY]);
	}
}


const gchar* valadoc_api_source_file_get_relative_c_path (ValadocApiSourceFile* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_relative_c_path;
	result = _tmp0_;
	return result;
}


static void valadoc_api_source_file_set_relative_c_path (ValadocApiSourceFile* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, valadoc_api_source_file_get_relative_c_path (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_relative_c_path);
		self->priv->_relative_c_path = _tmp1_;
		g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY]);
	}
}


void* valadoc_api_source_file_get_data (ValadocApiSourceFile* self) {
	void* result;
	void* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_data;
	result = _tmp0_;
	return result;
}


static void valadoc_api_source_file_set_data (ValadocApiSourceFile* self, void* value) {
	g_return_if_fail (self != NULL);
	if (valadoc_api_source_file_get_data (self) != value) {
		void* _tmp0_;
		_tmp0_ = value;
		self->priv->_data = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_DATA_PROPERTY]);
	}
}


static void valadoc_api_source_file_class_init (ValadocApiSourceFileClass * klass) {
	valadoc_api_source_file_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ValadocApiSourceFilePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_api_source_file_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_api_source_file_set_property;
	G_OBJECT_CLASS (klass)->finalize = valadoc_api_source_file_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY] = g_param_spec_object ("package", "package", "package", VALADOC_API_TYPE_PACKAGE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY] = g_param_spec_string ("relative-path", "relative-path", "relative-path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY] = g_param_spec_string ("relative-c-path", "relative-c-path", "relative-c-path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_DATA_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_DATA_PROPERTY] = g_param_spec_pointer ("data", "data", "data", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void valadoc_api_source_file_instance_init (ValadocApiSourceFile * self) {
	self->priv = VALADOC_API_SOURCE_FILE_GET_PRIVATE (self);
}


static void valadoc_api_source_file_finalize (GObject * obj) {
	ValadocApiSourceFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFile);
	_g_object_unref0 (self->priv->_package);
	_g_free0 (self->priv->_relative_path);
	_g_free0 (self->priv->_relative_c_path);
	G_OBJECT_CLASS (valadoc_api_source_file_parent_class)->finalize (obj);
}


/**
 * Represents a source file
 */
GType valadoc_api_source_file_get_type (void) {
	static volatile gsize valadoc_api_source_file_type_id__volatile = 0;
	if (g_once_init_enter (&valadoc_api_source_file_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValadocApiSourceFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_api_source_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocApiSourceFile), 0, (GInstanceInitFunc) valadoc_api_source_file_instance_init, NULL };
		GType valadoc_api_source_file_type_id;
		valadoc_api_source_file_type_id = g_type_register_static (G_TYPE_OBJECT, "ValadocApiSourceFile", &g_define_type_info, 0);
		g_once_init_leave (&valadoc_api_source_file_type_id__volatile, valadoc_api_source_file_type_id);
	}
	return valadoc_api_source_file_type_id__volatile;
}


static void _vala_valadoc_api_source_file_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ValadocApiSourceFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFile);
	switch (property_id) {
		case VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY:
		g_value_set_object (value, valadoc_api_source_file_get_package (self));
		break;
		case VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY:
		g_value_set_string (value, valadoc_api_source_file_get_relative_path (self));
		break;
		case VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY:
		g_value_set_string (value, valadoc_api_source_file_get_relative_c_path (self));
		break;
		case VALADOC_API_SOURCE_FILE_DATA_PROPERTY:
		g_value_set_pointer (value, valadoc_api_source_file_get_data (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_valadoc_api_source_file_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	ValadocApiSourceFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFile);
	switch (property_id) {
		case VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY:
		valadoc_api_source_file_set_package (self, g_value_get_object (value));
		break;
		case VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY:
		valadoc_api_source_file_set_relative_path (self, g_value_get_string (value));
		break;
		case VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY:
		valadoc_api_source_file_set_relative_c_path (self, g_value_get_string (value));
		break;
		case VALADOC_API_SOURCE_FILE_DATA_PROPERTY:
		valadoc_api_source_file_set_data (self, g_value_get_pointer (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



