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

#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gee.h>

#define XMPP_ROSTER_NS_URI "jabber:iq:roster"
#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  {
	XMPP_ROSTER_FLAG_0_PROPERTY,
	XMPP_ROSTER_FLAG_NUM_PROPERTIES
};
static GParamSpec* xmpp_roster_flag_properties[XMPP_ROSTER_FLAG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

static gpointer xmpp_roster_flag_parent_class = NULL;
XmppFlagIdentity* xmpp_roster_flag_IDENTITY = NULL;

static gchar* xmpp_roster_flag_real_get_ns (XmppXmppStreamFlag* base);
static gchar* xmpp_roster_flag_real_get_id (XmppXmppStreamFlag* base);
static void xmpp_roster_flag_finalize (GObject * obj);
static GType xmpp_roster_flag_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GeeCollection*
xmpp_roster_flag_get_roster (XmppRosterFlag* self)
{
	GeeHashMap* _tmp0_;
	GeeCollection* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->roster_items;
	_tmp1_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

XmppRosterItem*
xmpp_roster_flag_get_item (XmppRosterFlag* self,
                           XmppJid* jid)
{
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	XmppRosterItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (jid != NULL, NULL);
	_tmp0_ = self->roster_items;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, jid);
	result = (XmppRosterItem*) _tmp1_;
	return result;
}

static gchar*
xmpp_roster_flag_real_get_ns (XmppXmppStreamFlag* base)
{
	XmppRosterFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppRosterFlag*) base;
	_tmp0_ = g_strdup (XMPP_ROSTER_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_roster_flag_real_get_id (XmppXmppStreamFlag* base)
{
	XmppRosterFlag * self;
	XmppFlagIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppRosterFlag*) base;
	_tmp0_ = xmpp_roster_flag_IDENTITY;
	_tmp1_ = xmpp_flag_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppRosterFlag*
xmpp_roster_flag_construct (GType object_type)
{
	XmppRosterFlag * self = NULL;
	self = (XmppRosterFlag*) xmpp_xmpp_stream_flag_construct (object_type);
	return self;
}

XmppRosterFlag*
xmpp_roster_flag_new (void)
{
	return xmpp_roster_flag_construct (XMPP_ROSTER_TYPE_FLAG);
}

static void
xmpp_roster_flag_class_init (XmppRosterFlagClass * klass,
                             gpointer klass_data)
{
	XmppFlagIdentity* _tmp0_;
	xmpp_roster_flag_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamFlagClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_roster_flag_real_get_ns;
	((XmppXmppStreamFlagClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_roster_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_roster_flag_finalize;
	_tmp0_ = xmpp_flag_identity_new (XMPP_ROSTER_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_ROSTER_NS_URI, XMPP_ROSTER_FLAG_ID);
	xmpp_roster_flag_IDENTITY = _tmp0_;
}

static void
xmpp_roster_flag_instance_init (XmppRosterFlag * self,
                                gpointer klass)
{
	GeeHashMap* _tmp0_;
	_tmp0_ = gee_hash_map_new (XMPP_TYPE_JID, (GBoxedCopyFunc) xmpp_jid_ref, (GDestroyNotify) xmpp_jid_unref, XMPP_ROSTER_TYPE_ITEM, (GBoxedCopyFunc) xmpp_roster_item_ref, (GDestroyNotify) xmpp_roster_item_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->roster_items = _tmp0_;
}

static void
xmpp_roster_flag_finalize (GObject * obj)
{
	XmppRosterFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_ROSTER_TYPE_FLAG, XmppRosterFlag);
	_g_object_unref0 (self->roster_items);
	_g_free0 (self->iq_id);
	G_OBJECT_CLASS (xmpp_roster_flag_parent_class)->finalize (obj);
}

static GType
xmpp_roster_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppRosterFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_roster_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppRosterFlag), 0, (GInstanceInitFunc) xmpp_roster_flag_instance_init, NULL };
	GType xmpp_roster_flag_type_id;
	xmpp_roster_flag_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_FLAG, "XmppRosterFlag", &g_define_type_info, 0);
	return xmpp_roster_flag_type_id;
}

GType
xmpp_roster_flag_get_type (void)
{
	static volatile gsize xmpp_roster_flag_type_id__once = 0;
	if (g_once_init_enter (&xmpp_roster_flag_type_id__once)) {
		GType xmpp_roster_flag_type_id;
		xmpp_roster_flag_type_id = xmpp_roster_flag_get_type_once ();
		g_once_init_leave (&xmpp_roster_flag_type_id__once, xmpp_roster_flag_type_id);
	}
	return xmpp_roster_flag_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;
}

