/* playstation-uid.c generated by valac 0.36.6.6-c7bee, the Vala compiler
 * generated from playstation-uid.vala, do not modify */

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

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


#define GAMES_TYPE_PLAY_STATION_UID (games_play_station_uid_get_type ())
#define GAMES_PLAY_STATION_UID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLAY_STATION_UID, GamesPlayStationUid))
#define GAMES_PLAY_STATION_UID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLAY_STATION_UID, GamesPlayStationUidClass))
#define GAMES_IS_PLAY_STATION_UID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLAY_STATION_UID))
#define GAMES_IS_PLAY_STATION_UID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLAY_STATION_UID))
#define GAMES_PLAY_STATION_UID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLAY_STATION_UID, GamesPlayStationUidClass))

typedef struct _GamesPlayStationUid GamesPlayStationUid;
typedef struct _GamesPlayStationUidClass GamesPlayStationUidClass;
typedef struct _GamesPlayStationUidPrivate GamesPlayStationUidPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesPlayStationUid {
	GObject parent_instance;
	GamesPlayStationUidPrivate * priv;
};

struct _GamesPlayStationUidClass {
	GObjectClass parent_class;
};

struct _GamesPlayStationUidPrivate {
	gchar* disc_set_id;
	gchar* uid;
};


static gpointer games_play_station_uid_parent_class = NULL;
static GamesUidIface * games_play_station_uid_games_uid_parent_iface = NULL;
static GType games_play_station_uid_type_id = 0;

GType games_play_station_uid_get_type (void) G_GNUC_CONST;
#define GAMES_PLAY_STATION_UID_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_PLAY_STATION_UID, GamesPlayStationUidPrivate))
enum  {
	GAMES_PLAY_STATION_UID_0_PROPERTY
};
GamesPlayStationUid* games_play_station_uid_new (const gchar* disc_set_id);
GamesPlayStationUid* games_play_station_uid_construct (GType object_type, const gchar* disc_set_id);
static gchar* games_play_station_uid_real_get_uid (GamesUid* base, GError** error);
static void games_play_station_uid_finalize (GObject * obj);


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


GamesPlayStationUid* games_play_station_uid_new (const gchar* disc_set_id) {
	return games_play_station_uid_construct (GAMES_TYPE_PLAY_STATION_UID, disc_set_id);
}


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_play_station_uid_real_get_uid (GamesUid* base, GError** error) {
	GamesPlayStationUid * self;
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	self = (GamesPlayStationUid*) base;
	_tmp0_ = self->priv->uid;
	if (_tmp0_ != NULL) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = self->priv->uid;
		_tmp2_ = g_strdup (_tmp1_);
		result = _tmp2_;
		return result;
	}
	_tmp3_ = self->priv->disc_set_id;
	_tmp4_ = string_to_string (_tmp3_);
	_tmp5_ = g_strconcat ("playstation-", _tmp4_, NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_g_free0 (self->priv->uid);
	self->priv->uid = _tmp7_;
	_g_free0 (_tmp6_);
	_tmp8_ = self->priv->uid;
	_tmp9_ = g_strdup (_tmp8_);
	result = _tmp9_;
	return result;
}


static void games_play_station_uid_class_init (GamesPlayStationUidClass * klass) {
	games_play_station_uid_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesPlayStationUidPrivate));
	G_OBJECT_CLASS (klass)->finalize = games_play_station_uid_finalize;
}


static void games_play_station_uid_games_uid_interface_init (GamesUidIface * iface) {
	games_play_station_uid_games_uid_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_uid = (gchar* (*) (GamesUid *, GError**)) games_play_station_uid_real_get_uid;
}


static void games_play_station_uid_instance_init (GamesPlayStationUid * self) {
	self->priv = GAMES_PLAY_STATION_UID_GET_PRIVATE (self);
}


static void games_play_station_uid_finalize (GObject * obj) {
	GamesPlayStationUid * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PLAY_STATION_UID, GamesPlayStationUid);
	_g_free0 (self->priv->disc_set_id);
	_g_free0 (self->priv->uid);
	G_OBJECT_CLASS (games_play_station_uid_parent_class)->finalize (obj);
}


GType games_play_station_uid_get_type (void) {
	return games_play_station_uid_type_id;
}


GType games_play_station_uid_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesPlayStationUidClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_play_station_uid_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPlayStationUid), 0, (GInstanceInitFunc) games_play_station_uid_instance_init, NULL };
	static const GInterfaceInfo games_uid_info = { (GInterfaceInitFunc) games_play_station_uid_games_uid_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_play_station_uid_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesPlayStationUid", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_play_station_uid_type_id, GAMES_TYPE_UID, &games_uid_info);
	return games_play_station_uid_type_id;
}



