/* mime-type-tracker-uri-query.c generated by valac 0.56.18-dirty, 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 "gnome-games.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.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_MIME_TYPE_TRACKER_URI_QUERY_0_PROPERTY,
	GAMES_MIME_TYPE_TRACKER_URI_QUERY_NUM_PROPERTIES
};
static GParamSpec* games_mime_type_tracker_uri_query_properties[GAMES_MIME_TYPE_TRACKER_URI_QUERY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesMimeTypeTrackerUriQueryPrivate {
	gchar* mime_type;
};

static gint GamesMimeTypeTrackerUriQuery_private_offset;
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;

static gchar* games_mime_type_tracker_uri_query_real_get_query (GamesTrackerUriQuery* base);
static void games_mime_type_tracker_uri_query_finalize (GObject * obj);
static GType games_mime_type_tracker_uri_query_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_mime_type_tracker_uri_query_get_instance_private (GamesMimeTypeTrackerUriQuery* self)
{
	return G_STRUCT_MEMBER_P (self, GamesMimeTypeTrackerUriQuery_private_offset);
}

GamesMimeTypeTrackerUriQuery*
games_mime_type_tracker_uri_query_construct (GType object_type,
                                             const gchar* mime_type)
{
	GamesMimeTypeTrackerUriQuery * self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (mime_type != NULL, NULL);
	self = (GamesMimeTypeTrackerUriQuery*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (mime_type);
	_g_free0 (self->priv->mime_type);
	self->priv->mime_type = _tmp0_;
	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;
	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;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	self = (GamesMimeTypeTrackerUriQuery*) base;
	_tmp0_ = self->priv->mime_type;
	_tmp1_ = string_to_string (_tmp0_);
	_tmp2_ = g_strconcat ("SELECT DISTINCT nie:isStoredAs(?urn) { GRAPH tracker:Software { ?urn n" \
"ie:mimeType \"", _tmp1_, "\" . } }", NULL);
	result = _tmp2_;
	return result;
}

static void
games_mime_type_tracker_uri_query_class_init (GamesMimeTypeTrackerUriQueryClass * klass,
                                              gpointer klass_data)
{
	games_mime_type_tracker_uri_query_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesMimeTypeTrackerUriQuery_private_offset);
	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,
                                                                          gpointer iface_data)
{
	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,
                                                 gpointer klass)
{
	self->priv = games_mime_type_tracker_uri_query_get_instance_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);
}

static GType
games_mime_type_tracker_uri_query_get_type_once (void)
{
	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);
	GamesMimeTypeTrackerUriQuery_private_offset = g_type_add_instance_private (games_mime_type_tracker_uri_query_type_id, sizeof (GamesMimeTypeTrackerUriQueryPrivate));
	return games_mime_type_tracker_uri_query_type_id;
}

GType
games_mime_type_tracker_uri_query_get_type (void)
{
	static volatile gsize games_mime_type_tracker_uri_query_type_id__once = 0;
	if (g_once_init_enter (&games_mime_type_tracker_uri_query_type_id__once)) {
		GType games_mime_type_tracker_uri_query_type_id;
		games_mime_type_tracker_uri_query_type_id = games_mime_type_tracker_uri_query_get_type_once ();
		g_once_init_leave (&games_mime_type_tracker_uri_query_type_id__once, games_mime_type_tracker_uri_query_type_id);
	}
	return games_mime_type_tracker_uri_query_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;
}

