/* steam-game-data.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from steam-game-data.vala, do not modify */

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

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "games-steam-plugin.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

#define GAMES_TYPE_STEAM_GAME_DATA (games_steam_game_data_get_type ())
#define GAMES_STEAM_GAME_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_GAME_DATA, GamesSteamGameData))
#define GAMES_STEAM_GAME_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_GAME_DATA, GamesSteamGameDataClass))
#define GAMES_IS_STEAM_GAME_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_GAME_DATA))
#define GAMES_IS_STEAM_GAME_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_GAME_DATA))
#define GAMES_STEAM_GAME_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_GAME_DATA, GamesSteamGameDataClass))

typedef struct _GamesSteamGameData GamesSteamGameData;
typedef struct _GamesSteamGameDataClass GamesSteamGameDataClass;
typedef struct _GamesSteamGameDataPrivate GamesSteamGameDataPrivate;
enum  {
	GAMES_STEAM_GAME_DATA_0_PROPERTY,
	GAMES_STEAM_GAME_DATA_NUM_PROPERTIES
};
static GParamSpec* games_steam_game_data_properties[GAMES_STEAM_GAME_DATA_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

struct _GamesSteamGameData {
	GObject parent_instance;
	GamesSteamGameDataPrivate * priv;
};

struct _GamesSteamGameDataClass {
	GObjectClass parent_class;
};

struct _GamesSteamGameDataPrivate {
	GHashTable* games;
};

static gint GamesSteamGameData_private_offset;
static gpointer games_steam_game_data_parent_class = NULL;
static GType games_steam_game_data_type_id = 0;

GType games_steam_game_data_register_type (GTypeModule * module);
VALA_EXTERN GType games_steam_game_data_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void games_steam_game_data_add_game (GamesSteamGameData* self,
                                     const gchar* appid,
                                     const gchar* title);
VALA_EXTERN gchar** games_steam_game_data_get_appids (GamesSteamGameData* self,
                                          gint* result_length1);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
VALA_EXTERN gchar* games_steam_game_data_get_title (GamesSteamGameData* self,
                                        const gchar* appid);
VALA_EXTERN GamesSteamGameData* games_steam_game_data_new (void);
VALA_EXTERN GamesSteamGameData* games_steam_game_data_construct (GType object_type);
static GObject * games_steam_game_data_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _g_free0_ (gpointer var);
static void games_steam_game_data_finalize (GObject * obj);

static inline gpointer
games_steam_game_data_get_instance_private (GamesSteamGameData* self)
{
	return G_STRUCT_MEMBER_P (self, GamesSteamGameData_private_offset);
}

void
games_steam_game_data_add_game (GamesSteamGameData* self,
                                const gchar* appid,
                                const gchar* title)
{
	GHashTable* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (appid != NULL);
	g_return_if_fail (title != NULL);
	_tmp0_ = self->priv->games;
	_tmp1_ = g_strdup (appid);
	_tmp2_ = g_strdup (title);
	g_hash_table_insert (_tmp0_, _tmp1_, _tmp2_);
}

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

gchar**
games_steam_game_data_get_appids (GamesSteamGameData* self,
                                  gint* result_length1)
{
	GHashTable* _tmp0_;
	guint _tmp1_ = 0;
	gconstpointer* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->games;
	_tmp2_ = g_hash_table_get_keys_as_array (_tmp0_, &_tmp1_);
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup1 (_tmp2_, _tmp1_) : _tmp2_;
	_tmp3__length1 = _tmp1_;
	_tmp2_ = (g_free (_tmp2_), NULL);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

gchar*
games_steam_game_data_get_title (GamesSteamGameData* self,
                                 const gchar* appid)
{
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (appid != NULL, NULL);
	_tmp0_ = self->priv->games;
	_tmp1_ = g_hash_table_lookup (_tmp0_, appid);
	_tmp2_ = g_strdup ((const gchar*) _tmp1_);
	result = _tmp2_;
	return result;
}

GamesSteamGameData*
games_steam_game_data_construct (GType object_type)
{
	GamesSteamGameData * self = NULL;
	self = (GamesSteamGameData*) g_object_new (object_type, NULL);
	return self;
}

GamesSteamGameData*
games_steam_game_data_new (void)
{
	return games_steam_game_data_construct (GAMES_TYPE_STEAM_GAME_DATA);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static GObject *
games_steam_game_data_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesSteamGameData * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	parent_class = G_OBJECT_CLASS (games_steam_game_data_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_STEAM_GAME_DATA, GamesSteamGameData);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_free0_);
	_g_hash_table_unref0 (self->priv->games);
	self->priv->games = _tmp2_;
	return obj;
}

static void
games_steam_game_data_class_init (GamesSteamGameDataClass * klass,
                                  gpointer klass_data)
{
	games_steam_game_data_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesSteamGameData_private_offset);
	G_OBJECT_CLASS (klass)->constructor = games_steam_game_data_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_steam_game_data_finalize;
}

static void
games_steam_game_data_instance_init (GamesSteamGameData * self,
                                     gpointer klass)
{
	self->priv = games_steam_game_data_get_instance_private (self);
}

static void
games_steam_game_data_finalize (GObject * obj)
{
	GamesSteamGameData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_STEAM_GAME_DATA, GamesSteamGameData);
	_g_hash_table_unref0 (self->priv->games);
	G_OBJECT_CLASS (games_steam_game_data_parent_class)->finalize (obj);
}

GType
games_steam_game_data_get_type (void)
{
	return games_steam_game_data_type_id;
}

GType
games_steam_game_data_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesSteamGameDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_steam_game_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesSteamGameData), 0, (GInstanceInitFunc) games_steam_game_data_instance_init, NULL };
	games_steam_game_data_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesSteamGameData", &g_define_type_info, 0);
	GamesSteamGameData_private_offset = sizeof (GamesSteamGameDataPrivate);
	return games_steam_game_data_type_id;
}

