/* Token.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Token.vala, do not modify */

/*-
 * Copyright (c) 2018 elementary LLC. (https://elementary.io)
 *               2014 Marvin Beckers <beckersmarvin@gmail.com>
 *
 * 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/>.
 *
 * Authored by: Marvin Beckers <beckersmarvin@gmail.com>
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef enum  {
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_NULL_NUMBER,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_NUMBER,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_OPERATOR,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_FUNCTION,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_SEPARATOR,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_CONSTANT,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_P_LEFT,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_P_RIGHT,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_ALPHA,
	PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_EOF
} PantheonCalculatorCoreTokenType;

#define PANTHEON_CALCULATOR_CORE_TYPE_TOKEN_TYPE (pantheon_calculator_core_token_type_get_type ())

#define PANTHEON_CALCULATOR_CORE_TYPE_TOKEN (pantheon_calculator_core_token_get_type ())
#define PANTHEON_CALCULATOR_CORE_TOKEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, PantheonCalculatorCoreToken))
#define PANTHEON_CALCULATOR_CORE_TOKEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, PantheonCalculatorCoreTokenClass))
#define PANTHEON_CALCULATOR_CORE_IS_TOKEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANTHEON_CALCULATOR_CORE_TYPE_TOKEN))
#define PANTHEON_CALCULATOR_CORE_IS_TOKEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANTHEON_CALCULATOR_CORE_TYPE_TOKEN))
#define PANTHEON_CALCULATOR_CORE_TOKEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, PantheonCalculatorCoreTokenClass))

typedef struct _PantheonCalculatorCoreToken PantheonCalculatorCoreToken;
typedef struct _PantheonCalculatorCoreTokenClass PantheonCalculatorCoreTokenClass;
typedef struct _PantheonCalculatorCoreTokenPrivate PantheonCalculatorCoreTokenPrivate;
enum  {
	PANTHEON_CALCULATOR_CORE_TOKEN_0_PROPERTY,
	PANTHEON_CALCULATOR_CORE_TOKEN_CONTENT_PROPERTY,
	PANTHEON_CALCULATOR_CORE_TOKEN_TOKEN_TYPE_PROPERTY,
	PANTHEON_CALCULATOR_CORE_TOKEN_NUM_PROPERTIES
};
static GParamSpec* pantheon_calculator_core_token_properties[PANTHEON_CALCULATOR_CORE_TOKEN_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _PantheonCalculatorCoreToken {
	GObject parent_instance;
	PantheonCalculatorCoreTokenPrivate * priv;
};

struct _PantheonCalculatorCoreTokenClass {
	GObjectClass parent_class;
};

struct _PantheonCalculatorCoreTokenPrivate {
	gchar* _content;
	PantheonCalculatorCoreTokenType _token_type;
};

static gint PantheonCalculatorCoreToken_private_offset;
static gpointer pantheon_calculator_core_token_parent_class = NULL;

VALA_EXTERN GType pantheon_calculator_core_token_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType pantheon_calculator_core_token_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PantheonCalculatorCoreToken, g_object_unref)
VALA_EXTERN PantheonCalculatorCoreToken* pantheon_calculator_core_token_new (const gchar* in_content,
                                                                 PantheonCalculatorCoreTokenType in_token_type);
VALA_EXTERN PantheonCalculatorCoreToken* pantheon_calculator_core_token_construct (GType object_type,
                                                                       const gchar* in_content,
                                                                       PantheonCalculatorCoreTokenType in_token_type);
VALA_EXTERN const gchar* pantheon_calculator_core_token_get_content (PantheonCalculatorCoreToken* self);
VALA_EXTERN void pantheon_calculator_core_token_set_content (PantheonCalculatorCoreToken* self,
                                                 const gchar* value);
VALA_EXTERN PantheonCalculatorCoreTokenType pantheon_calculator_core_token_get_token_type (PantheonCalculatorCoreToken* self);
VALA_EXTERN void pantheon_calculator_core_token_set_token_type (PantheonCalculatorCoreToken* self,
                                                    PantheonCalculatorCoreTokenType value);
static void pantheon_calculator_core_token_finalize (GObject * obj);
static GType pantheon_calculator_core_token_get_type_once (void);
static void _vala_pantheon_calculator_core_token_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_pantheon_calculator_core_token_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);

static GType
pantheon_calculator_core_token_type_get_type_once (void)
{
	static const GEnumValue values[] = {{PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_NULL_NUMBER, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_NULL_NUMBER", "null-number"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_NUMBER, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_NUMBER", "number"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_OPERATOR, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_OPERATOR", "operator"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_FUNCTION, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_FUNCTION", "function"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_SEPARATOR, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_SEPARATOR", "separator"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_CONSTANT, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_CONSTANT", "constant"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_P_LEFT, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_P_LEFT", "p-left"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_P_RIGHT, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_P_RIGHT", "p-right"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_ALPHA, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_ALPHA", "alpha"}, {PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_EOF, "PANTHEON_CALCULATOR_CORE_TOKEN_TYPE_EOF", "eof"}, {0, NULL, NULL}};
	GType pantheon_calculator_core_token_type_type_id;
	pantheon_calculator_core_token_type_type_id = g_enum_register_static ("PantheonCalculatorCoreTokenType", values);
	return pantheon_calculator_core_token_type_type_id;
}

GType
pantheon_calculator_core_token_type_get_type (void)
{
	static volatile gsize pantheon_calculator_core_token_type_type_id__once = 0;
	if (g_once_init_enter (&pantheon_calculator_core_token_type_type_id__once)) {
		GType pantheon_calculator_core_token_type_type_id;
		pantheon_calculator_core_token_type_type_id = pantheon_calculator_core_token_type_get_type_once ();
		g_once_init_leave (&pantheon_calculator_core_token_type_type_id__once, pantheon_calculator_core_token_type_type_id);
	}
	return pantheon_calculator_core_token_type_type_id__once;
}

static inline gpointer
pantheon_calculator_core_token_get_instance_private (PantheonCalculatorCoreToken* self)
{
	return G_STRUCT_MEMBER_P (self, PantheonCalculatorCoreToken_private_offset);
}

PantheonCalculatorCoreToken*
pantheon_calculator_core_token_construct (GType object_type,
                                          const gchar* in_content,
                                          PantheonCalculatorCoreTokenType in_token_type)
{
	PantheonCalculatorCoreToken * self = NULL;
	g_return_val_if_fail (in_content != NULL, NULL);
	self = (PantheonCalculatorCoreToken*) g_object_new (object_type, "content", in_content, "token-type", in_token_type, NULL);
	return self;
}

PantheonCalculatorCoreToken*
pantheon_calculator_core_token_new (const gchar* in_content,
                                    PantheonCalculatorCoreTokenType in_token_type)
{
	return pantheon_calculator_core_token_construct (PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, in_content, in_token_type);
}

const gchar*
pantheon_calculator_core_token_get_content (PantheonCalculatorCoreToken* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content;
	result = _tmp0_;
	return result;
}

void
pantheon_calculator_core_token_set_content (PantheonCalculatorCoreToken* self,
                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = pantheon_calculator_core_token_get_content (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_content);
		self->priv->_content = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pantheon_calculator_core_token_properties[PANTHEON_CALCULATOR_CORE_TOKEN_CONTENT_PROPERTY]);
	}
}

PantheonCalculatorCoreTokenType
pantheon_calculator_core_token_get_token_type (PantheonCalculatorCoreToken* self)
{
	PantheonCalculatorCoreTokenType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_token_type;
	return result;
}

void
pantheon_calculator_core_token_set_token_type (PantheonCalculatorCoreToken* self,
                                               PantheonCalculatorCoreTokenType value)
{
	PantheonCalculatorCoreTokenType old_value;
	g_return_if_fail (self != NULL);
	old_value = pantheon_calculator_core_token_get_token_type (self);
	if (old_value != value) {
		self->priv->_token_type = value;
		g_object_notify_by_pspec ((GObject *) self, pantheon_calculator_core_token_properties[PANTHEON_CALCULATOR_CORE_TOKEN_TOKEN_TYPE_PROPERTY]);
	}
}

static void
pantheon_calculator_core_token_class_init (PantheonCalculatorCoreTokenClass * klass,
                                           gpointer klass_data)
{
	pantheon_calculator_core_token_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PantheonCalculatorCoreToken_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_pantheon_calculator_core_token_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_pantheon_calculator_core_token_set_property;
	G_OBJECT_CLASS (klass)->finalize = pantheon_calculator_core_token_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PANTHEON_CALCULATOR_CORE_TOKEN_CONTENT_PROPERTY, pantheon_calculator_core_token_properties[PANTHEON_CALCULATOR_CORE_TOKEN_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PANTHEON_CALCULATOR_CORE_TOKEN_TOKEN_TYPE_PROPERTY, pantheon_calculator_core_token_properties[PANTHEON_CALCULATOR_CORE_TOKEN_TOKEN_TYPE_PROPERTY] = g_param_spec_enum ("token-type", "token-type", "token-type", PANTHEON_CALCULATOR_CORE_TYPE_TOKEN_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
pantheon_calculator_core_token_instance_init (PantheonCalculatorCoreToken * self,
                                              gpointer klass)
{
	self->priv = pantheon_calculator_core_token_get_instance_private (self);
}

static void
pantheon_calculator_core_token_finalize (GObject * obj)
{
	PantheonCalculatorCoreToken * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, PantheonCalculatorCoreToken);
	_g_free0 (self->priv->_content);
	G_OBJECT_CLASS (pantheon_calculator_core_token_parent_class)->finalize (obj);
}

static GType
pantheon_calculator_core_token_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PantheonCalculatorCoreTokenClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pantheon_calculator_core_token_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PantheonCalculatorCoreToken), 0, (GInstanceInitFunc) pantheon_calculator_core_token_instance_init, NULL };
	GType pantheon_calculator_core_token_type_id;
	pantheon_calculator_core_token_type_id = g_type_register_static (G_TYPE_OBJECT, "PantheonCalculatorCoreToken", &g_define_type_info, 0);
	PantheonCalculatorCoreToken_private_offset = g_type_add_instance_private (pantheon_calculator_core_token_type_id, sizeof (PantheonCalculatorCoreTokenPrivate));
	return pantheon_calculator_core_token_type_id;
}

GType
pantheon_calculator_core_token_get_type (void)
{
	static volatile gsize pantheon_calculator_core_token_type_id__once = 0;
	if (g_once_init_enter (&pantheon_calculator_core_token_type_id__once)) {
		GType pantheon_calculator_core_token_type_id;
		pantheon_calculator_core_token_type_id = pantheon_calculator_core_token_get_type_once ();
		g_once_init_leave (&pantheon_calculator_core_token_type_id__once, pantheon_calculator_core_token_type_id);
	}
	return pantheon_calculator_core_token_type_id__once;
}

static void
_vala_pantheon_calculator_core_token_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	PantheonCalculatorCoreToken * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, PantheonCalculatorCoreToken);
	switch (property_id) {
		case PANTHEON_CALCULATOR_CORE_TOKEN_CONTENT_PROPERTY:
		g_value_set_string (value, pantheon_calculator_core_token_get_content (self));
		break;
		case PANTHEON_CALCULATOR_CORE_TOKEN_TOKEN_TYPE_PROPERTY:
		g_value_set_enum (value, pantheon_calculator_core_token_get_token_type (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_pantheon_calculator_core_token_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	PantheonCalculatorCoreToken * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PANTHEON_CALCULATOR_CORE_TYPE_TOKEN, PantheonCalculatorCoreToken);
	switch (property_id) {
		case PANTHEON_CALCULATOR_CORE_TOKEN_CONTENT_PROPERTY:
		pantheon_calculator_core_token_set_content (self, g_value_get_string (value));
		break;
		case PANTHEON_CALCULATOR_CORE_TOKEN_TOKEN_TYPE_PROPERTY:
		pantheon_calculator_core_token_set_token_type (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

