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

/*
 * Copyright (C) 2012-2014 Daiki Ueno <ueno@gnu.org>
 * Copyright (C) 2012-2014 Red Hat, Inc.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

#include "libkkc/libkkc.h"
#include <stdlib.h>
#include <string.h>
#include <glib.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  {
	KKC_SEGMENT_0_PROPERTY,
	KKC_SEGMENT_INPUT_PROPERTY,
	KKC_SEGMENT_OUTPUT_PROPERTY,
	KKC_SEGMENT_NUM_PROPERTIES
};
static GParamSpec* kkc_segment_properties[KKC_SEGMENT_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _KkcSegmentPrivate {
	gchar* _input;
	gchar* _output;
};

static gint KkcSegment_private_offset;
static gpointer kkc_segment_parent_class = NULL;

static void kkc_segment_finalize (GObject * obj);
static GType kkc_segment_get_type_once (void);
static void _vala_kkc_segment_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_kkc_segment_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);

static inline gpointer
kkc_segment_get_instance_private (KkcSegment* self)
{
	return G_STRUCT_MEMBER_P (self, KkcSegment_private_offset);
}

KkcSegment*
kkc_segment_construct (GType object_type,
                       const gchar* input,
                       const gchar* output)
{
	KkcSegment * self = NULL;
	g_return_val_if_fail (input != NULL, NULL);
	g_return_val_if_fail (output != NULL, NULL);
	self = (KkcSegment*) g_object_new (object_type, NULL);
	kkc_segment_set_input (self, input);
	kkc_segment_set_output (self, output);
	return self;
}

KkcSegment*
kkc_segment_new (const gchar* input,
                 const gchar* output)
{
	return kkc_segment_construct (KKC_TYPE_SEGMENT, input, output);
}

const gchar*
kkc_segment_get_input (KkcSegment* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_input;
	result = _tmp0_;
	return result;
}

void
kkc_segment_set_input (KkcSegment* self,
                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = kkc_segment_get_input (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_input);
		self->priv->_input = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, kkc_segment_properties[KKC_SEGMENT_INPUT_PROPERTY]);
	}
}

const gchar*
kkc_segment_get_output (KkcSegment* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_output;
	result = _tmp0_;
	return result;
}

void
kkc_segment_set_output (KkcSegment* self,
                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = kkc_segment_get_output (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_output);
		self->priv->_output = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, kkc_segment_properties[KKC_SEGMENT_OUTPUT_PROPERTY]);
	}
}

static void
kkc_segment_class_init (KkcSegmentClass * klass,
                        gpointer klass_data)
{
	kkc_segment_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &KkcSegment_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_kkc_segment_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_kkc_segment_set_property;
	G_OBJECT_CLASS (klass)->finalize = kkc_segment_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), KKC_SEGMENT_INPUT_PROPERTY, kkc_segment_properties[KKC_SEGMENT_INPUT_PROPERTY] = g_param_spec_string ("input", "input", "input", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KKC_SEGMENT_OUTPUT_PROPERTY, kkc_segment_properties[KKC_SEGMENT_OUTPUT_PROPERTY] = g_param_spec_string ("output", "output", "output", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
kkc_segment_instance_init (KkcSegment * self,
                           gpointer klass)
{
	self->priv = kkc_segment_get_instance_private (self);
}

static void
kkc_segment_finalize (GObject * obj)
{
	KkcSegment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KKC_TYPE_SEGMENT, KkcSegment);
	_g_free0 (self->priv->_input);
	_g_free0 (self->priv->_output);
	_g_object_unref0 (self->next);
	G_OBJECT_CLASS (kkc_segment_parent_class)->finalize (obj);
}

static GType
kkc_segment_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (KkcSegmentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kkc_segment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KkcSegment), 0, (GInstanceInitFunc) kkc_segment_instance_init, NULL };
	GType kkc_segment_type_id;
	kkc_segment_type_id = g_type_register_static (G_TYPE_OBJECT, "KkcSegment", &g_define_type_info, 0);
	KkcSegment_private_offset = g_type_add_instance_private (kkc_segment_type_id, sizeof (KkcSegmentPrivate));
	return kkc_segment_type_id;
}

GType
kkc_segment_get_type (void)
{
	static volatile gsize kkc_segment_type_id__once = 0;
	if (g_once_init_enter (&kkc_segment_type_id__once)) {
		GType kkc_segment_type_id;
		kkc_segment_type_id = kkc_segment_get_type_once ();
		g_once_init_leave (&kkc_segment_type_id__once, kkc_segment_type_id);
	}
	return kkc_segment_type_id__once;
}

static void
_vala_kkc_segment_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	KkcSegment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KKC_TYPE_SEGMENT, KkcSegment);
	switch (property_id) {
		case KKC_SEGMENT_INPUT_PROPERTY:
		g_value_set_string (value, kkc_segment_get_input (self));
		break;
		case KKC_SEGMENT_OUTPUT_PROPERTY:
		g_value_set_string (value, kkc_segment_get_output (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_kkc_segment_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	KkcSegment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KKC_TYPE_SEGMENT, KkcSegment);
	switch (property_id) {
		case KKC_SEGMENT_INPUT_PROPERTY:
		kkc_segment_set_input (self, g_value_get_string (value));
		break;
		case KKC_SEGMENT_OUTPUT_PROPERTY:
		kkc_segment_set_output (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

