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

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include "gnome-games.h"
#include <libtracker-sparql/tracker-sparql.h>
#include <glib.h>
#include <glib-object.h>
#include <string.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  {
	GAMES_TRACKER_URI_SOURCE_0_PROPERTY,
	GAMES_TRACKER_URI_SOURCE_NUM_PROPERTIES
};
static GParamSpec* games_tracker_uri_source_properties[GAMES_TRACKER_URI_SOURCE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_TRACKER_URI_ITERATOR (games_tracker_uri_iterator_get_type ())
#define GAMES_TRACKER_URI_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TRACKER_URI_ITERATOR, GamesTrackerUriIterator))
#define GAMES_TRACKER_URI_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_TRACKER_URI_ITERATOR, GamesTrackerUriIteratorClass))
#define GAMES_IS_TRACKER_URI_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TRACKER_URI_ITERATOR))
#define GAMES_IS_TRACKER_URI_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_TRACKER_URI_ITERATOR))
#define GAMES_TRACKER_URI_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_TRACKER_URI_ITERATOR, GamesTrackerUriIteratorClass))

typedef struct _GamesTrackerUriIterator GamesTrackerUriIterator;
typedef struct _GamesTrackerUriIteratorClass GamesTrackerUriIteratorClass;

struct _GamesTrackerUriSourcePrivate {
	TrackerSparqlConnection* _connection;
	GamesTrackerUriQuery** queries;
	gint queries_length1;
	gint _queries_size_;
};

static gint GamesTrackerUriSource_private_offset;
static gpointer games_tracker_uri_source_parent_class = NULL;
static GamesUriSourceIface * games_tracker_uri_source_games_uri_source_parent_iface = NULL;

static void games_tracker_uri_source_set_connection (GamesTrackerUriSource* self,
                                              TrackerSparqlConnection* value);
static void _vala_array_add35 (GamesTrackerUriQuery** * array,
                        gint* length,
                        gint* size,
                        GamesTrackerUriQuery* value);
static GamesUriIterator* games_tracker_uri_source_real_iterator (GamesUriSource* base);
static TrackerSparqlConnection* games_tracker_uri_source_get_connection (GamesTrackerUriSource* self);
VALA_EXTERN GamesTrackerUriIterator* games_tracker_uri_iterator_new (TrackerSparqlConnection* connection,
                                                         GamesTrackerUriQuery** queries,
                                                         gint queries_length1);
VALA_EXTERN GamesTrackerUriIterator* games_tracker_uri_iterator_construct (GType object_type,
                                                               TrackerSparqlConnection* connection,
                                                               GamesTrackerUriQuery** queries,
                                                               gint queries_length1);
VALA_EXTERN GType games_tracker_uri_iterator_get_type (void) G_GNUC_CONST ;
static GObject * games_tracker_uri_source_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void games_tracker_uri_source_finalize (GObject * obj);
static GType games_tracker_uri_source_get_type_once (void);
static void _vala_games_tracker_uri_source_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_games_tracker_uri_source_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_tracker_uri_source_get_instance_private (GamesTrackerUriSource* self)
{
	return G_STRUCT_MEMBER_P (self, GamesTrackerUriSource_private_offset);
}

GamesTrackerUriSource*
games_tracker_uri_source_construct (GType object_type,
                                    TrackerSparqlConnection* connection)
{
	GamesTrackerUriSource * self = NULL;
	g_return_val_if_fail (connection != NULL, NULL);
	self = (GamesTrackerUriSource*) g_object_new (object_type, NULL);
	games_tracker_uri_source_set_connection (self, connection);
	return self;
}

GamesTrackerUriSource*
games_tracker_uri_source_new (TrackerSparqlConnection* connection)
{
	return games_tracker_uri_source_construct (GAMES_TYPE_TRACKER_URI_SOURCE, connection);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
_vala_array_add35 (GamesTrackerUriQuery** * array,
                   gint* length,
                   gint* size,
                   GamesTrackerUriQuery* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesTrackerUriQuery*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

void
games_tracker_uri_source_add_query (GamesTrackerUriSource* self,
                                    GamesTrackerUriQuery* query)
{
	GamesTrackerUriQuery* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (query != NULL);
	_tmp0_ = _g_object_ref0 (query);
	_vala_array_add35 (&self->priv->queries, &self->priv->queries_length1, &self->priv->_queries_size_, _tmp0_);
}

static GamesUriIterator*
games_tracker_uri_source_real_iterator (GamesUriSource* base)
{
	GamesTrackerUriSource * self;
	TrackerSparqlConnection* _tmp0_;
	GamesTrackerUriQuery** _tmp1_;
	gint _tmp1__length1;
	GamesTrackerUriIterator* _tmp2_;
	GamesUriIterator* result;
	self = (GamesTrackerUriSource*) base;
	_tmp0_ = self->priv->_connection;
	_tmp1_ = self->priv->queries;
	_tmp1__length1 = self->priv->queries_length1;
	_tmp2_ = games_tracker_uri_iterator_new (_tmp0_, _tmp1_, _tmp1__length1);
	result = (GamesUriIterator*) _tmp2_;
	return result;
}

static TrackerSparqlConnection*
games_tracker_uri_source_get_connection (GamesTrackerUriSource* self)
{
	TrackerSparqlConnection* result;
	TrackerSparqlConnection* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_connection;
	result = _tmp0_;
	return result;
}

static void
games_tracker_uri_source_set_connection (GamesTrackerUriSource* self,
                                         TrackerSparqlConnection* value)
{
	TrackerSparqlConnection* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_connection);
	self->priv->_connection = _tmp0_;
}

static GObject *
games_tracker_uri_source_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesTrackerUriSource * self;
	GamesTrackerUriQuery** _tmp0_;
	parent_class = G_OBJECT_CLASS (games_tracker_uri_source_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSource);
	_tmp0_ = g_new0 (GamesTrackerUriQuery*, 0 + 1);
	self->priv->queries = (_vala_array_free (self->priv->queries, self->priv->queries_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->queries = _tmp0_;
	self->priv->queries_length1 = 0;
	self->priv->_queries_size_ = self->priv->queries_length1;
	return obj;
}

static void
games_tracker_uri_source_class_init (GamesTrackerUriSourceClass * klass,
                                     gpointer klass_data)
{
	games_tracker_uri_source_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesTrackerUriSource_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_tracker_uri_source_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_tracker_uri_source_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_tracker_uri_source_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_tracker_uri_source_finalize;
}

static void
games_tracker_uri_source_games_uri_source_interface_init (GamesUriSourceIface * iface,
                                                          gpointer iface_data)
{
	games_tracker_uri_source_games_uri_source_parent_iface = g_type_interface_peek_parent (iface);
	iface->iterator = (GamesUriIterator* (*) (GamesUriSource*)) games_tracker_uri_source_real_iterator;
}

static void
games_tracker_uri_source_instance_init (GamesTrackerUriSource * self,
                                        gpointer klass)
{
	self->priv = games_tracker_uri_source_get_instance_private (self);
}

static void
games_tracker_uri_source_finalize (GObject * obj)
{
	GamesTrackerUriSource * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSource);
	_g_object_unref0 (self->priv->_connection);
	self->priv->queries = (_vala_array_free (self->priv->queries, self->priv->queries_length1, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (games_tracker_uri_source_parent_class)->finalize (obj);
}

static GType
games_tracker_uri_source_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesTrackerUriSourceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_tracker_uri_source_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesTrackerUriSource), 0, (GInstanceInitFunc) games_tracker_uri_source_instance_init, NULL };
	static const GInterfaceInfo games_uri_source_info = { (GInterfaceInitFunc) games_tracker_uri_source_games_uri_source_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType games_tracker_uri_source_type_id;
	games_tracker_uri_source_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesTrackerUriSource", &g_define_type_info, 0);
	g_type_add_interface_static (games_tracker_uri_source_type_id, GAMES_TYPE_URI_SOURCE, &games_uri_source_info);
	GamesTrackerUriSource_private_offset = g_type_add_instance_private (games_tracker_uri_source_type_id, sizeof (GamesTrackerUriSourcePrivate));
	return games_tracker_uri_source_type_id;
}

GType
games_tracker_uri_source_get_type (void)
{
	static volatile gsize games_tracker_uri_source_type_id__once = 0;
	if (g_once_init_enter (&games_tracker_uri_source_type_id__once)) {
		GType games_tracker_uri_source_type_id;
		games_tracker_uri_source_type_id = games_tracker_uri_source_get_type_once ();
		g_once_init_leave (&games_tracker_uri_source_type_id__once, games_tracker_uri_source_type_id);
	}
	return games_tracker_uri_source_type_id__once;
}

static void
_vala_games_tracker_uri_source_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	GamesTrackerUriSource * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSource);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_tracker_uri_source_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	GamesTrackerUriSource * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSource);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

