/* mime-type-tracker-uri-query.c generated by valac 0.36.12.13-3ae08, the Vala compiler
 * generated from mime-type-tracker-uri-query.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>


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

#define GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY (games_mime_type_tracker_uri_query_get_type ())
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQuery))
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQueryClass))
#define GAMES_IS_MIME_TYPE_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY))
#define GAMES_IS_MIME_TYPE_TRACKER_URI_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY))
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQueryClass))

typedef struct _GamesMimeTypeTrackerUriQuery GamesMimeTypeTrackerUriQuery;
typedef struct _GamesMimeTypeTrackerUriQueryClass GamesMimeTypeTrackerUriQueryClass;
typedef struct _GamesMimeTypeTrackerUriQueryPrivate GamesMimeTypeTrackerUriQueryPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

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

struct _GamesMimeTypeTrackerUriQuery {
	GObject parent_instance;
	GamesMimeTypeTrackerUriQueryPrivate * priv;
};

struct _GamesMimeTypeTrackerUriQueryClass {
	GObjectClass parent_class;
};

struct _GamesMimeTypeTrackerUriQueryPrivate {
	gchar* mime_type;
};


static gpointer games_mime_type_tracker_uri_query_parent_class = NULL;
static GamesTrackerUriQueryIface * games_mime_type_tracker_uri_query_games_tracker_uri_query_parent_iface = NULL;

GType games_tracker_uri_query_get_type (void) G_GNUC_CONST;
GType games_mime_type_tracker_uri_query_get_type (void) G_GNUC_CONST;
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQueryPrivate))
enum  {
	GAMES_MIME_TYPE_TRACKER_URI_QUERY_0_PROPERTY
};
GamesMimeTypeTrackerUriQuery* games_mime_type_tracker_uri_query_new (const gchar* mime_type);
GamesMimeTypeTrackerUriQuery* games_mime_type_tracker_uri_query_construct (GType object_type, const gchar* mime_type);
static gchar* games_mime_type_tracker_uri_query_real_get_query (GamesTrackerUriQuery* base);
static void games_mime_type_tracker_uri_query_finalize (GObject * obj);


GamesMimeTypeTrackerUriQuery* games_mime_type_tracker_uri_query_construct (GType object_type, const gchar* mime_type) {
	GamesMimeTypeTrackerUriQuery * self = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (mime_type != NULL, NULL);
	self = (GamesMimeTypeTrackerUriQuery*) g_object_new (object_type, NULL);
	_tmp0_ = mime_type;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->mime_type);
	self->priv->mime_type = _tmp1_;
	return self;
}


GamesMimeTypeTrackerUriQuery* games_mime_type_tracker_uri_query_new (const gchar* mime_type) {
	return games_mime_type_tracker_uri_query_construct (GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, mime_type);
}


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


static gchar* games_mime_type_tracker_uri_query_real_get_query (GamesTrackerUriQuery* base) {
	GamesMimeTypeTrackerUriQuery * self;
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (GamesMimeTypeTrackerUriQuery*) base;
	_tmp0_ = self->priv->mime_type;
	_tmp1_ = string_to_string (_tmp0_);
	_tmp2_ = g_strconcat ("SELECT DISTINCT nie:url(?urn) WHERE { ?urn nie:mimeType \"", _tmp1_, "\" . }", NULL);
	result = _tmp2_;
	return result;
}


static void games_mime_type_tracker_uri_query_class_init (GamesMimeTypeTrackerUriQueryClass * klass) {
	games_mime_type_tracker_uri_query_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesMimeTypeTrackerUriQueryPrivate));
	G_OBJECT_CLASS (klass)->finalize = games_mime_type_tracker_uri_query_finalize;
}


static void games_mime_type_tracker_uri_query_games_tracker_uri_query_interface_init (GamesTrackerUriQueryIface * iface) {
	games_mime_type_tracker_uri_query_games_tracker_uri_query_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_query = (gchar* (*) (GamesTrackerUriQuery *)) games_mime_type_tracker_uri_query_real_get_query;
}


static void games_mime_type_tracker_uri_query_instance_init (GamesMimeTypeTrackerUriQuery * self) {
	self->priv = GAMES_MIME_TYPE_TRACKER_URI_QUERY_GET_PRIVATE (self);
}


static void games_mime_type_tracker_uri_query_finalize (GObject * obj) {
	GamesMimeTypeTrackerUriQuery * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQuery);
	_g_free0 (self->priv->mime_type);
	G_OBJECT_CLASS (games_mime_type_tracker_uri_query_parent_class)->finalize (obj);
}


GType games_mime_type_tracker_uri_query_get_type (void) {
	static volatile gsize games_mime_type_tracker_uri_query_type_id__volatile = 0;
	if (g_once_init_enter (&games_mime_type_tracker_uri_query_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesMimeTypeTrackerUriQueryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_mime_type_tracker_uri_query_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesMimeTypeTrackerUriQuery), 0, (GInstanceInitFunc) games_mime_type_tracker_uri_query_instance_init, NULL };
		static const GInterfaceInfo games_tracker_uri_query_info = { (GInterfaceInitFunc) games_mime_type_tracker_uri_query_games_tracker_uri_query_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType games_mime_type_tracker_uri_query_type_id;
		games_mime_type_tracker_uri_query_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesMimeTypeTrackerUriQuery", &g_define_type_info, 0);
		g_type_add_interface_static (games_mime_type_tracker_uri_query_type_id, GAMES_TYPE_TRACKER_URI_QUERY, &games_tracker_uri_query_info);
		g_once_init_leave (&games_mime_type_tracker_uri_query_type_id__volatile, games_mime_type_tracker_uri_query_type_id);
	}
	return games_mime_type_tracker_uri_query_type_id__volatile;
}



