/* 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 "valadoc.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <vala.h>
#include <glib-object.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

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))
#define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))

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

static gint ValadocApiSourceFile_private_offset;
static gpointer valadoc_api_source_file_parent_class = NULL;

static void valadoc_api_source_file_set_package (ValadocApiSourceFile* self,
                                          ValadocApiPackage* value);
static void valadoc_api_source_file_set_relative_path (ValadocApiSourceFile* self,
                                                const gchar* value);
static void valadoc_api_source_file_set_relative_c_path (ValadocApiSourceFile* self,
                                                  const gchar* value);
static void valadoc_api_source_file_set_data (ValadocApiSourceFile* self,
                                       ValaSourceFile* value);
static void valadoc_api_source_file_finalize (GObject * obj);
static GType valadoc_api_source_file_get_type_once (void);
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);

static inline gpointer
valadoc_api_source_file_get_instance_private (ValadocApiSourceFile* self)
{
	return G_STRUCT_MEMBER_P (self, ValadocApiSourceFile_private_offset);
}

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)
{
	ValadocApiPackage* old_value;
	g_return_if_fail (self != NULL);
	old_value = valadoc_api_source_file_get_package (self);
	if (old_value != value) {
		ValadocApiPackage* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_package);
		self->priv->_package = _tmp0_;
		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)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = valadoc_api_source_file_get_relative_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_relative_path);
		self->priv->_relative_path = _tmp0_;
		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)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = valadoc_api_source_file_get_relative_c_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_relative_c_path);
		self->priv->_relative_c_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY]);
	}
}

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

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

static gpointer
_vala_source_file_ref0 (gpointer self)
{
	return self ? vala_source_file_ref (self) : NULL;
}

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

ValadocApiSourceFile*
valadoc_api_source_file_construct (GType object_type,
                                   ValadocApiPackage* package,
                                   const gchar* relative_path,
                                   const gchar* relative_c_path,
                                   ValaSourceFile* data)
{
	ValadocApiSourceFile * self = NULL;
	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);
	valadoc_api_source_file_set_relative_c_path (self, relative_c_path);
	valadoc_api_source_file_set_relative_path (self, relative_path);
	valadoc_api_source_file_set_package (self, package);
	valadoc_api_source_file_set_data (self, data);
	return self;
}

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

static void
valadoc_api_source_file_class_init (ValadocApiSourceFileClass * klass,
                                    gpointer klass_data)
{
	valadoc_api_source_file_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ValadocApiSourceFile_private_offset);
	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_STRINGS | 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_STRINGS | 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_STRINGS | 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] = vala_param_spec_source_file ("data", "data", "data", VALA_TYPE_SOURCE_FILE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
valadoc_api_source_file_instance_init (ValadocApiSourceFile * self,
                                       gpointer klass)
{
	self->priv = valadoc_api_source_file_get_instance_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);
	_vala_source_file_unref0 (self->priv->_data);
	G_OBJECT_CLASS (valadoc_api_source_file_parent_class)->finalize (obj);
}

/**
 * Represents a source file
 */
static GType
valadoc_api_source_file_get_type_once (void)
{
	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);
	ValadocApiSourceFile_private_offset = g_type_add_instance_private (valadoc_api_source_file_type_id, sizeof (ValadocApiSourceFilePrivate));
	return valadoc_api_source_file_type_id;
}

GType
valadoc_api_source_file_get_type (void)
{
	static volatile gsize valadoc_api_source_file_type_id__once = 0;
	if (g_once_init_enter (&valadoc_api_source_file_type_id__once)) {
		GType valadoc_api_source_file_type_id;
		valadoc_api_source_file_type_id = valadoc_api_source_file_get_type_once ();
		g_once_init_leave (&valadoc_api_source_file_type_id__once, valadoc_api_source_file_type_id);
	}
	return valadoc_api_source_file_type_id__once;
}

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:
		vala_value_set_source_file (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, vala_value_get_source_file (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

