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

/* Cacheable.vala
 *
 * Copyright (C) 2009-2023 Jerry Casiano
 *
 * 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/gpl-3.0.txt>.
*/

#include <glib-object.h>
#include <json-glib/json-glib.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

#define FONT_MANAGER_TYPE_CACHEABLE (font_manager_cacheable_get_type ())
#define FONT_MANAGER_CACHEABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FONT_MANAGER_TYPE_CACHEABLE, FontManagerCacheable))
#define FONT_MANAGER_CACHEABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FONT_MANAGER_TYPE_CACHEABLE, FontManagerCacheableClass))
#define FONT_MANAGER_IS_CACHEABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FONT_MANAGER_TYPE_CACHEABLE))
#define FONT_MANAGER_IS_CACHEABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FONT_MANAGER_TYPE_CACHEABLE))
#define FONT_MANAGER_CACHEABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FONT_MANAGER_TYPE_CACHEABLE, FontManagerCacheableClass))

typedef struct _FontManagerCacheable FontManagerCacheable;
typedef struct _FontManagerCacheableClass FontManagerCacheableClass;
typedef struct _FontManagerCacheablePrivate FontManagerCacheablePrivate;
enum  {
	FONT_MANAGER_CACHEABLE_0_PROPERTY,
	FONT_MANAGER_CACHEABLE_NUM_PROPERTIES
};
static GParamSpec* font_manager_cacheable_properties[FONT_MANAGER_CACHEABLE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
enum  {
	FONT_MANAGER_CACHEABLE_CHANGED_SIGNAL,
	FONT_MANAGER_CACHEABLE_NUM_SIGNALS
};
static guint font_manager_cacheable_signals[FONT_MANAGER_CACHEABLE_NUM_SIGNALS] = {0};

struct _FontManagerCacheable {
	GObject parent_instance;
	FontManagerCacheablePrivate * priv;
};

struct _FontManagerCacheableClass {
	GObjectClass parent_class;
	gboolean (*deserialize_property) (FontManagerCacheable* self, const gchar* prop_name, GValue* val, GParamSpec* pspec, JsonNode* node);
	JsonNode* (*serialize_property) (FontManagerCacheable* self, const gchar* prop_name, GValue* val, GParamSpec* pspec);
};

static gpointer font_manager_cacheable_parent_class = NULL;
static JsonSerializableIface * font_manager_cacheable_json_serializable_parent_iface = NULL;

VALA_EXTERN GType font_manager_cacheable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FontManagerCacheable, g_object_unref)
VALA_EXTERN gboolean font_manager_cacheable_deserialize_property (FontManagerCacheable* self,
                                                      const gchar* prop_name,
                                                      GValue* val,
                                                      GParamSpec* pspec,
                                                      JsonNode* node);
VALA_EXTERN JsonNode* font_manager_cacheable_serialize_property (FontManagerCacheable* self,
                                                     const gchar* prop_name,
                                                     GValue* val,
                                                     GParamSpec* pspec);
static gboolean font_manager_cacheable_real_deserialize_property (FontManagerCacheable* self,
                                                           const gchar* prop_name,
                                                           GValue* val,
                                                           GParamSpec* pspec,
                                                           JsonNode* node);
static JsonNode* font_manager_cacheable_real_serialize_property (FontManagerCacheable* self,
                                                          const gchar* prop_name,
                                                          GValue* val,
                                                          GParamSpec* pspec);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN FontManagerCacheable* font_manager_cacheable_new (void);
VALA_EXTERN FontManagerCacheable* font_manager_cacheable_construct (GType object_type);
static GType font_manager_cacheable_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gboolean
font_manager_cacheable_real_deserialize_property (FontManagerCacheable* self,
                                                  const gchar* prop_name,
                                                  GValue* val,
                                                  GParamSpec* pspec,
                                                  JsonNode* node)
{
	GValue _vala_val = {0};
	GValue _tmp0_ = {0};
	GValue _tmp1_ = {0};
	gboolean result;
	g_return_val_if_fail (prop_name != NULL, FALSE);
	g_return_val_if_fail (pspec != NULL, FALSE);
	g_return_val_if_fail (node != NULL, FALSE);
	g_value_init (&_tmp0_, pspec->value_type);
	G_IS_VALUE (&_vala_val) ? (g_value_unset (&_vala_val), NULL) : NULL;
	_vala_val = _tmp0_;
	if (json_node_is_null (node)) {
		result = TRUE;
		if (val) {
			*val = _vala_val;
		} else {
			G_IS_VALUE (&_vala_val) ? (g_value_unset (&_vala_val), NULL) : NULL;
		}
		return result;
	}
	json_node_get_value (node, &_tmp1_);
	G_IS_VALUE (&_vala_val) ? (g_value_unset (&_vala_val), NULL) : NULL;
	_vala_val = _tmp1_;
	result = TRUE;
	if (val) {
		*val = _vala_val;
	} else {
		G_IS_VALUE (&_vala_val) ? (g_value_unset (&_vala_val), NULL) : NULL;
	}
	return result;
}

gboolean
font_manager_cacheable_deserialize_property (FontManagerCacheable* self,
                                             const gchar* prop_name,
                                             GValue* val,
                                             GParamSpec* pspec,
                                             JsonNode* node)
{
	FontManagerCacheableClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = FONT_MANAGER_CACHEABLE_GET_CLASS (self);
	if (_klass_->deserialize_property) {
		return _klass_->deserialize_property (self, prop_name, val, pspec, node);
	}
	return FALSE;
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static JsonNode*
font_manager_cacheable_real_serialize_property (FontManagerCacheable* self,
                                                const gchar* prop_name,
                                                GValue* val,
                                                GParamSpec* pspec)
{
	JsonNode* node = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	JsonNode* result;
	g_return_val_if_fail (prop_name != NULL, NULL);
	g_return_val_if_fail (val != NULL, NULL);
	g_return_val_if_fail (pspec != NULL, NULL);
	_tmp0_ = g_strdup_value_contents (val);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strcmp0 (_tmp1_, "NULL") == 0;
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		JsonNode* _tmp3_;
		_tmp3_ = json_node_new (JSON_NODE_NULL);
		__vala_JsonNode_free0 (node);
		node = _tmp3_;
	} else {
		JsonNode* _tmp4_;
		JsonNode* _tmp5_;
		GValue _tmp6_;
		_tmp4_ = json_node_new (JSON_NODE_VALUE);
		__vala_JsonNode_free0 (node);
		node = _tmp4_;
		_tmp5_ = node;
		_tmp6_ = *val;
		json_node_set_value (_tmp5_, &_tmp6_);
	}
	result = node;
	return result;
}

JsonNode*
font_manager_cacheable_serialize_property (FontManagerCacheable* self,
                                           const gchar* prop_name,
                                           GValue* val,
                                           GParamSpec* pspec)
{
	FontManagerCacheableClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = FONT_MANAGER_CACHEABLE_GET_CLASS (self);
	if (_klass_->serialize_property) {
		return _klass_->serialize_property (self, prop_name, val, pspec);
	}
	return NULL;
}

FontManagerCacheable*
font_manager_cacheable_construct (GType object_type)
{
	FontManagerCacheable * self = NULL;
	self = (FontManagerCacheable*) g_object_new (object_type, NULL);
	return self;
}

FontManagerCacheable*
font_manager_cacheable_new (void)
{
	return font_manager_cacheable_construct (FONT_MANAGER_TYPE_CACHEABLE);
}

static void
font_manager_cacheable_class_init (FontManagerCacheableClass * klass,
                                   gpointer klass_data)
{
	font_manager_cacheable_parent_class = g_type_class_peek_parent (klass);
	((FontManagerCacheableClass *) klass)->deserialize_property = (gboolean (*) (FontManagerCacheable*, const gchar*, GValue*, GParamSpec*, JsonNode*)) font_manager_cacheable_real_deserialize_property;
	((FontManagerCacheableClass *) klass)->serialize_property = (JsonNode* (*) (FontManagerCacheable*, const gchar*, GValue*, GParamSpec*)) font_manager_cacheable_real_serialize_property;
	font_manager_cacheable_signals[FONT_MANAGER_CACHEABLE_CHANGED_SIGNAL] = g_signal_new ("changed", FONT_MANAGER_TYPE_CACHEABLE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
font_manager_cacheable_json_serializable_interface_init (JsonSerializableIface * iface,
                                                         gpointer iface_data)
{
	font_manager_cacheable_json_serializable_parent_iface = g_type_interface_peek_parent (iface);
	iface->deserialize_property = (gboolean (*) (JsonSerializable*, const gchar*, GValue*, GParamSpec*, JsonNode*)) font_manager_cacheable_deserialize_property;
	iface->serialize_property = (JsonNode* (*) (JsonSerializable*, const gchar*, GValue*, GParamSpec*)) font_manager_cacheable_serialize_property;
}

static void
font_manager_cacheable_instance_init (FontManagerCacheable * self,
                                      gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
font_manager_cacheable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FontManagerCacheableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) font_manager_cacheable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FontManagerCacheable), 0, (GInstanceInitFunc) font_manager_cacheable_instance_init, NULL };
	static const GInterfaceInfo json_serializable_info = { (GInterfaceInitFunc) font_manager_cacheable_json_serializable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType font_manager_cacheable_type_id;
	font_manager_cacheable_type_id = g_type_register_static (G_TYPE_OBJECT, "FontManagerCacheable", &g_define_type_info, 0);
	g_type_add_interface_static (font_manager_cacheable_type_id, json_serializable_get_type (), &json_serializable_info);
	return font_manager_cacheable_type_id;
}

GType
font_manager_cacheable_get_type (void)
{
	static volatile gsize font_manager_cacheable_type_id__once = 0;
	if (g_once_init_enter (&font_manager_cacheable_type_id__once)) {
		GType font_manager_cacheable_type_id;
		font_manager_cacheable_type_id = font_manager_cacheable_get_type_once ();
		g_once_init_leave (&font_manager_cacheable_type_id__once, font_manager_cacheable_type_id);
	}
	return font_manager_cacheable_type_id__once;
}

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;
}

