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

#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.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

#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _XmppXepServiceDiscoveryParamSpecIdentity XmppXepServiceDiscoveryParamSpecIdentity;

struct _XmppXepServiceDiscoveryIdentityPrivate {
	gchar* _category;
	gchar* _type_;
	gchar* _name;
};

struct _XmppXepServiceDiscoveryParamSpecIdentity {
	GParamSpec parent_instance;
};

static gint XmppXepServiceDiscoveryIdentity_private_offset;
static gpointer xmpp_xep_service_discovery_identity_parent_class = NULL;

static void xmpp_xep_service_discovery_identity_finalize (XmppXepServiceDiscoveryIdentity * obj);
static GType xmpp_xep_service_discovery_identity_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_service_discovery_identity_get_instance_private (XmppXepServiceDiscoveryIdentity* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepServiceDiscoveryIdentity_private_offset);
}

XmppXepServiceDiscoveryIdentity*
xmpp_xep_service_discovery_identity_construct (GType object_type,
                                               const gchar* category,
                                               const gchar* type,
                                               const gchar* name)
{
	XmppXepServiceDiscoveryIdentity* self = NULL;
	g_return_val_if_fail (category != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	self = (XmppXepServiceDiscoveryIdentity*) g_type_create_instance (object_type);
	xmpp_xep_service_discovery_identity_set_category (self, category);
	xmpp_xep_service_discovery_identity_set_type_ (self, type);
	xmpp_xep_service_discovery_identity_set_name (self, name);
	return self;
}

XmppXepServiceDiscoveryIdentity*
xmpp_xep_service_discovery_identity_new (const gchar* category,
                                         const gchar* type,
                                         const gchar* name)
{
	return xmpp_xep_service_discovery_identity_construct (XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY, category, type, name);
}

guint
xmpp_xep_service_discovery_identity_hash_func (XmppXepServiceDiscoveryIdentity* a)
{
	guint hash = 0U;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	guint result;
	g_return_val_if_fail (a != NULL, 0U);
	_tmp0_ = a->priv->_category;
	_tmp1_ = a->priv->_type_;
	hash = g_str_hash (_tmp0_) ^ g_str_hash (_tmp1_);
	_tmp2_ = a->priv->_name;
	if (_tmp2_ != NULL) {
		const gchar* _tmp3_;
		_tmp3_ = a->priv->_name;
		hash ^= g_str_hash (_tmp3_);
	}
	result = hash;
	return result;
}

gboolean
xmpp_xep_service_discovery_identity_equals_func (XmppXepServiceDiscoveryIdentity* a,
                                                 XmppXepServiceDiscoveryIdentity* b)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean result;
	g_return_val_if_fail (a != NULL, FALSE);
	g_return_val_if_fail (b != NULL, FALSE);
	_tmp2_ = a->priv->_category;
	_tmp3_ = b->priv->_category;
	if (g_strcmp0 (_tmp2_, _tmp3_) == 0) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = a->priv->_type_;
		_tmp5_ = b->priv->_type_;
		_tmp1_ = g_strcmp0 (_tmp4_, _tmp5_) == 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = a->priv->_name;
		_tmp7_ = b->priv->_name;
		_tmp0_ = g_strcmp0 (_tmp6_, _tmp7_) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

const gchar*
xmpp_xep_service_discovery_identity_get_category (XmppXepServiceDiscoveryIdentity* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_category;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_service_discovery_identity_set_category (XmppXepServiceDiscoveryIdentity* self,
                                                  const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_category);
	self->priv->_category = _tmp0_;
}

const gchar*
xmpp_xep_service_discovery_identity_get_type_ (XmppXepServiceDiscoveryIdentity* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_type_;
	result = _tmp0_;
	return result;
}

void
xmpp_xep_service_discovery_identity_set_type_ (XmppXepServiceDiscoveryIdentity* self,
                                               const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_type_);
	self->priv->_type_ = _tmp0_;
}

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

void
xmpp_xep_service_discovery_identity_set_name (XmppXepServiceDiscoveryIdentity* self,
                                              const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_name);
	self->priv->_name = _tmp0_;
}

static void
xmpp_xep_service_discovery_value_identity_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xep_service_discovery_value_identity_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xep_service_discovery_identity_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xep_service_discovery_value_identity_copy_value (const GValue* src_value,
                                                      GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xep_service_discovery_identity_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xep_service_discovery_value_identity_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xep_service_discovery_value_identity_collect_value (GValue* value,
                                                         guint n_collect_values,
                                                         GTypeCValue* collect_values,
                                                         guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXepServiceDiscoveryIdentity * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xep_service_discovery_identity_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xep_service_discovery_value_identity_lcopy_value (const GValue* value,
                                                       guint n_collect_values,
                                                       GTypeCValue* collect_values,
                                                       guint collect_flags)
{
	XmppXepServiceDiscoveryIdentity ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xep_service_discovery_identity_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_xep_service_discovery_param_spec_identity (const gchar* name,
                                                const gchar* nick,
                                                const gchar* blurb,
                                                GType object_type,
                                                GParamFlags flags)
{
	XmppXepServiceDiscoveryParamSpecIdentity* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_xep_service_discovery_value_get_identity (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_xep_service_discovery_value_set_identity (GValue* value,
                                               gpointer v_object)
{
	XmppXepServiceDiscoveryIdentity * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xep_service_discovery_identity_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_service_discovery_identity_unref (old);
	}
}

void
xmpp_xep_service_discovery_value_take_identity (GValue* value,
                                                gpointer v_object)
{
	XmppXepServiceDiscoveryIdentity * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_service_discovery_identity_unref (old);
	}
}

static void
xmpp_xep_service_discovery_identity_class_init (XmppXepServiceDiscoveryIdentityClass * klass,
                                                gpointer klass_data)
{
	xmpp_xep_service_discovery_identity_parent_class = g_type_class_peek_parent (klass);
	((XmppXepServiceDiscoveryIdentityClass *) klass)->finalize = xmpp_xep_service_discovery_identity_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXepServiceDiscoveryIdentity_private_offset);
}

static void
xmpp_xep_service_discovery_identity_instance_init (XmppXepServiceDiscoveryIdentity * self,
                                                   gpointer klass)
{
	self->priv = xmpp_xep_service_discovery_identity_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xep_service_discovery_identity_finalize (XmppXepServiceDiscoveryIdentity * obj)
{
	XmppXepServiceDiscoveryIdentity * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_SERVICE_DISCOVERY_TYPE_IDENTITY, XmppXepServiceDiscoveryIdentity);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->_category);
	_g_free0 (self->priv->_type_);
	_g_free0 (self->priv->_name);
}

static GType
xmpp_xep_service_discovery_identity_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_service_discovery_value_identity_init, xmpp_xep_service_discovery_value_identity_free_value, xmpp_xep_service_discovery_value_identity_copy_value, xmpp_xep_service_discovery_value_identity_peek_pointer, "p", xmpp_xep_service_discovery_value_identity_collect_value, "p", xmpp_xep_service_discovery_value_identity_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepServiceDiscoveryIdentityClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_service_discovery_identity_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepServiceDiscoveryIdentity), 0, (GInstanceInitFunc) xmpp_xep_service_discovery_identity_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xep_service_discovery_identity_type_id;
	xmpp_xep_service_discovery_identity_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepServiceDiscoveryIdentity", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXepServiceDiscoveryIdentity_private_offset = g_type_add_instance_private (xmpp_xep_service_discovery_identity_type_id, sizeof (XmppXepServiceDiscoveryIdentityPrivate));
	return xmpp_xep_service_discovery_identity_type_id;
}

GType
xmpp_xep_service_discovery_identity_get_type (void)
{
	static volatile gsize xmpp_xep_service_discovery_identity_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_service_discovery_identity_type_id__once)) {
		GType xmpp_xep_service_discovery_identity_type_id;
		xmpp_xep_service_discovery_identity_type_id = xmpp_xep_service_discovery_identity_get_type_once ();
		g_once_init_leave (&xmpp_xep_service_discovery_identity_type_id__once, xmpp_xep_service_discovery_identity_type_id);
	}
	return xmpp_xep_service_discovery_identity_type_id__once;
}

gpointer
xmpp_xep_service_discovery_identity_ref (gpointer instance)
{
	XmppXepServiceDiscoveryIdentity * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xep_service_discovery_identity_unref (gpointer instance)
{
	XmppXepServiceDiscoveryIdentity * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_SERVICE_DISCOVERY_IDENTITY_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

