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

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

#include <glib.h>
#include <glib-object.h>
#include <libtracker-sparql/tracker-sparql.h>
#include <stdlib.h>
#include <string.h>


#define GAMES_TYPE_URI_SOURCE (games_uri_source_get_type ())
#define GAMES_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI_SOURCE, GamesUriSource))
#define GAMES_IS_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI_SOURCE))
#define GAMES_URI_SOURCE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_URI_SOURCE, GamesUriSourceIface))

typedef struct _GamesUriSource GamesUriSource;
typedef struct _GamesUriSourceIface GamesUriSourceIface;

#define GAMES_TYPE_URI_ITERATOR (games_uri_iterator_get_type ())
#define GAMES_URI_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI_ITERATOR, GamesUriIterator))
#define GAMES_IS_URI_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI_ITERATOR))
#define GAMES_URI_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_URI_ITERATOR, GamesUriIteratorIface))

typedef struct _GamesUriIterator GamesUriIterator;
typedef struct _GamesUriIteratorIface GamesUriIteratorIface;

#define GAMES_TYPE_URI (games_uri_get_type ())
#define GAMES_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI, GamesUri))
#define GAMES_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_URI, GamesUriClass))
#define GAMES_IS_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI))
#define GAMES_IS_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_URI))
#define GAMES_URI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_URI, GamesUriClass))

typedef struct _GamesUri GamesUri;
typedef struct _GamesUriClass GamesUriClass;

#define GAMES_TYPE_TRACKER_URI_SOURCE (games_tracker_uri_source_get_type ())
#define GAMES_TRACKER_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSource))
#define GAMES_TRACKER_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSourceClass))
#define GAMES_IS_TRACKER_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TRACKER_URI_SOURCE))
#define GAMES_IS_TRACKER_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_TRACKER_URI_SOURCE))
#define GAMES_TRACKER_URI_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSourceClass))

typedef struct _GamesTrackerUriSource GamesTrackerUriSource;
typedef struct _GamesTrackerUriSourceClass GamesTrackerUriSourceClass;
typedef struct _GamesTrackerUriSourcePrivate GamesTrackerUriSourcePrivate;

#define GAMES_TYPE_TRACKER_URI_QUERY (games_tracker_uri_query_get_type ())
#define GAMES_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TRACKER_URI_QUERY, GamesTrackerUriQuery))
#define GAMES_IS_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TRACKER_URI_QUERY))
#define GAMES_TRACKER_URI_QUERY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_TRACKER_URI_QUERY, GamesTrackerUriQueryIface))

typedef struct _GamesTrackerUriQuery GamesTrackerUriQuery;
typedef struct _GamesTrackerUriQueryIface GamesTrackerUriQueryIface;
enum  {
	GAMES_TRACKER_URI_SOURCE_DUMMY_PROPERTY,
	GAMES_TRACKER_URI_SOURCE_LAST_PROPERTY
};
static GParamSpec* games_tracker_uri_source_properties[GAMES_TRACKER_URI_SOURCE_LAST_PROPERTY];
#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 _GamesUriIteratorIface {
	GTypeInterface parent_iface;
	GamesUri* (*get) (GamesUriIterator* self);
	gboolean (*next) (GamesUriIterator* self);
};

struct _GamesUriSourceIface {
	GTypeInterface parent_iface;
	GamesUriIterator* (*iterator) (GamesUriSource* self);
};

struct _GamesTrackerUriSource {
	GObject parent_instance;
	GamesTrackerUriSourcePrivate * priv;
};

struct _GamesTrackerUriSourceClass {
	GObjectClass parent_class;
};

struct _GamesTrackerUriQueryIface {
	GTypeInterface parent_iface;
	gchar* (*get_query) (GamesTrackerUriQuery* self);
};

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


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

gpointer games_uri_ref (gpointer instance);
void games_uri_unref (gpointer instance);
GParamSpec* games_param_spec_uri (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void games_value_set_uri (GValue* value, gpointer v_object);
void games_value_take_uri (GValue* value, gpointer v_object);
gpointer games_value_get_uri (const GValue* value);
GType games_uri_get_type (void) G_GNUC_CONST;
GType games_uri_iterator_get_type (void) G_GNUC_CONST;
GType games_uri_source_get_type (void) G_GNUC_CONST;
GType games_tracker_uri_source_get_type (void) G_GNUC_CONST;
GType games_tracker_uri_query_get_type (void) G_GNUC_CONST;
#define GAMES_TRACKER_URI_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSourcePrivate))
GamesTrackerUriSource* games_tracker_uri_source_new (TrackerSparqlConnection* connection);
GamesTrackerUriSource* games_tracker_uri_source_construct (GType object_type, TrackerSparqlConnection* connection);
static void games_tracker_uri_source_set_connection (GamesTrackerUriSource* self, TrackerSparqlConnection* value);
void games_tracker_uri_source_add_query (GamesTrackerUriSource* self, GamesTrackerUriQuery* query);
static void _vala_array_add16 (GamesTrackerUriQuery** * array, int* length, int* size, GamesTrackerUriQuery* value);
static GamesUriIterator* games_tracker_uri_source_real_iterator (GamesUriSource* base);
static TrackerSparqlConnection* games_tracker_uri_source_get_connection (GamesTrackerUriSource* self);
GamesTrackerUriIterator* games_tracker_uri_iterator_new (TrackerSparqlConnection* connection, GamesTrackerUriQuery** queries, int queries_length1);
GamesTrackerUriIterator* games_tracker_uri_iterator_construct (GType object_type, TrackerSparqlConnection* connection, GamesTrackerUriQuery** queries, int queries_length1);
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 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, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


GamesTrackerUriSource* games_tracker_uri_source_construct (GType object_type, TrackerSparqlConnection* connection) {
	GamesTrackerUriSource * self = NULL;
	TrackerSparqlConnection* _tmp0_;
	g_return_val_if_fail (connection != NULL, NULL);
	self = (GamesTrackerUriSource*) g_object_new (object_type, NULL);
	_tmp0_ = connection;
	games_tracker_uri_source_set_connection (self, _tmp0_);
	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_add16 (GamesTrackerUriQuery** * array, int* length, int* 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_;
	gint _tmp0__length1;
	GamesTrackerUriQuery* _tmp1_;
	GamesTrackerUriQuery* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (query != NULL);
	_tmp0_ = self->priv->queries;
	_tmp0__length1 = self->priv->queries_length1;
	_tmp1_ = query;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_vala_array_add16 (&self->priv->queries, &self->priv->queries_length1, &self->priv->_queries_size_, _tmp2_);
}


static GamesUriIterator* games_tracker_uri_source_real_iterator (GamesUriSource* base) {
	GamesTrackerUriSource * self;
	GamesUriIterator* result = NULL;
	TrackerSparqlConnection* _tmp0_;
	GamesTrackerUriQuery** _tmp1_;
	gint _tmp1__length1;
	GamesTrackerUriIterator* _tmp2_;
	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_;
	TrackerSparqlConnection* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_connection);
	self->priv->_connection = _tmp1_;
}


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) {
	games_tracker_uri_source_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesTrackerUriSourcePrivate));
	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) {
	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) {
	self->priv = GAMES_TRACKER_URI_SOURCE_GET_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);
}


GType games_tracker_uri_source_get_type (void) {
	static volatile gsize games_tracker_uri_source_type_id__volatile = 0;
	if (g_once_init_enter (&games_tracker_uri_source_type_id__volatile)) {
		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);
		g_once_init_leave (&games_tracker_uri_source_type_id__volatile, games_tracker_uri_source_type_id);
	}
	return games_tracker_uri_source_type_id__volatile;
}


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, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



