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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <glib.h>
#include <stdlib.h>
#include <string.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  {
	OBJECTS_COLOR_0_PROPERTY,
	OBJECTS_COLOR_ID_PROPERTY,
	OBJECTS_COLOR_NAME_PROPERTY,
	OBJECTS_COLOR_NAME_CODE_PROPERTY,
	OBJECTS_COLOR_HEXADECIMAL_PROPERTY,
	OBJECTS_COLOR_NUM_PROPERTIES
};
static GParamSpec* objects_color_properties[OBJECTS_COLOR_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ObjectsColorPrivate {
	gint _id;
	gchar* _name;
	gchar* _name_code;
	gchar* _hexadecimal;
};

static gint ObjectsColor_private_offset;
static gpointer objects_color_parent_class = NULL;

static void objects_color_finalize (GObject * obj);
static GType objects_color_get_type_once (void);
static void _vala_objects_color_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_objects_color_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
objects_color_get_instance_private (ObjectsColor* self)
{
	return G_STRUCT_MEMBER_P (self, ObjectsColor_private_offset);
}

ObjectsColor*
objects_color_construct (GType object_type,
                         gint id,
                         const gchar* name,
                         const gchar* name_code,
                         const gchar* hexadecimal)
{
	ObjectsColor * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (name_code != NULL, NULL);
	g_return_val_if_fail (hexadecimal != NULL, NULL);
	self = (ObjectsColor*) g_object_new (object_type, "id", id, "name", name, "name-code", name_code, "hexadecimal", hexadecimal, NULL);
	return self;
}

ObjectsColor*
objects_color_new (gint id,
                   const gchar* name,
                   const gchar* name_code,
                   const gchar* hexadecimal)
{
	return objects_color_construct (OBJECTS_TYPE_COLOR, id, name, name_code, hexadecimal);
}

gint
objects_color_get_id (ObjectsColor* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_id;
	return result;
}

static void
objects_color_set_id (ObjectsColor* self,
                      gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_color_get_id (self);
	if (old_value != value) {
		self->priv->_id = value;
		g_object_notify_by_pspec ((GObject *) self, objects_color_properties[OBJECTS_COLOR_ID_PROPERTY]);
	}
}

const gchar*
objects_color_get_name (ObjectsColor* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

static void
objects_color_set_name (ObjectsColor* self,
                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_color_get_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_color_properties[OBJECTS_COLOR_NAME_PROPERTY]);
	}
}

const gchar*
objects_color_get_name_code (ObjectsColor* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name_code;
	result = _tmp0_;
	return result;
}

static void
objects_color_set_name_code (ObjectsColor* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_color_get_name_code (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name_code);
		self->priv->_name_code = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_color_properties[OBJECTS_COLOR_NAME_CODE_PROPERTY]);
	}
}

const gchar*
objects_color_get_hexadecimal (ObjectsColor* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_hexadecimal;
	result = _tmp0_;
	return result;
}

static void
objects_color_set_hexadecimal (ObjectsColor* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_color_get_hexadecimal (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_hexadecimal);
		self->priv->_hexadecimal = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_color_properties[OBJECTS_COLOR_HEXADECIMAL_PROPERTY]);
	}
}

static void
objects_color_class_init (ObjectsColorClass * klass,
                          gpointer klass_data)
{
	objects_color_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ObjectsColor_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_objects_color_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_objects_color_set_property;
	G_OBJECT_CLASS (klass)->finalize = objects_color_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_COLOR_ID_PROPERTY, objects_color_properties[OBJECTS_COLOR_ID_PROPERTY] = g_param_spec_int ("id", "id", "id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_COLOR_NAME_PROPERTY, objects_color_properties[OBJECTS_COLOR_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_COLOR_NAME_CODE_PROPERTY, objects_color_properties[OBJECTS_COLOR_NAME_CODE_PROPERTY] = g_param_spec_string ("name-code", "name-code", "name-code", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_COLOR_HEXADECIMAL_PROPERTY, objects_color_properties[OBJECTS_COLOR_HEXADECIMAL_PROPERTY] = g_param_spec_string ("hexadecimal", "hexadecimal", "hexadecimal", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
objects_color_instance_init (ObjectsColor * self,
                             gpointer klass)
{
	self->priv = objects_color_get_instance_private (self);
}

static void
objects_color_finalize (GObject * obj)
{
	ObjectsColor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_COLOR, ObjectsColor);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_name_code);
	_g_free0 (self->priv->_hexadecimal);
	G_OBJECT_CLASS (objects_color_parent_class)->finalize (obj);
}

static GType
objects_color_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsColorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_color_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsColor), 0, (GInstanceInitFunc) objects_color_instance_init, NULL };
	GType objects_color_type_id;
	objects_color_type_id = g_type_register_static (G_TYPE_OBJECT, "ObjectsColor", &g_define_type_info, 0);
	ObjectsColor_private_offset = g_type_add_instance_private (objects_color_type_id, sizeof (ObjectsColorPrivate));
	return objects_color_type_id;
}

GType
objects_color_get_type (void)
{
	static volatile gsize objects_color_type_id__once = 0;
	if (g_once_init_enter (&objects_color_type_id__once)) {
		GType objects_color_type_id;
		objects_color_type_id = objects_color_get_type_once ();
		g_once_init_leave (&objects_color_type_id__once, objects_color_type_id);
	}
	return objects_color_type_id__once;
}

static void
_vala_objects_color_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	ObjectsColor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_COLOR, ObjectsColor);
	switch (property_id) {
		case OBJECTS_COLOR_ID_PROPERTY:
		g_value_set_int (value, objects_color_get_id (self));
		break;
		case OBJECTS_COLOR_NAME_PROPERTY:
		g_value_set_string (value, objects_color_get_name (self));
		break;
		case OBJECTS_COLOR_NAME_CODE_PROPERTY:
		g_value_set_string (value, objects_color_get_name_code (self));
		break;
		case OBJECTS_COLOR_HEXADECIMAL_PROPERTY:
		g_value_set_string (value, objects_color_get_hexadecimal (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_objects_color_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	ObjectsColor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_COLOR, ObjectsColor);
	switch (property_id) {
		case OBJECTS_COLOR_ID_PROPERTY:
		objects_color_set_id (self, g_value_get_int (value));
		break;
		case OBJECTS_COLOR_NAME_PROPERTY:
		objects_color_set_name (self, g_value_get_string (value));
		break;
		case OBJECTS_COLOR_NAME_CODE_PROPERTY:
		objects_color_set_name_code (self, g_value_get_string (value));
		break;
		case OBJECTS_COLOR_HEXADECIMAL_PROPERTY:
		objects_color_set_hexadecimal (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

