/* controller.c generated by valac 0.36.4, the Vala compiler
 * generated from controller.vala, do not modify */

/* This file is part of retro-gtk. License: GPLv3*/

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


#define RETRO_TYPE_CONTROLLER_DESCRIPTION (retro_controller_description_get_type ())
typedef struct _RetroControllerDescription RetroControllerDescription;
#define _g_free0(var) (var = (g_free (var), NULL))

#define RETRO_TYPE_CONTROLLER_INFO (retro_controller_info_get_type ())
typedef struct _RetroControllerInfo RetroControllerInfo;
#define _retro_controller_description_free0(var) ((var == NULL) ? NULL : (var = (retro_controller_description_free (var), NULL)))

struct _RetroControllerDescription {
	gchar* desc;
	guint id;
};

struct _RetroControllerInfo {
	RetroControllerDescription* types;
	guint num_types;
};



GType retro_controller_description_get_type (void) G_GNUC_CONST;
RetroControllerDescription* retro_controller_description_dup (const RetroControllerDescription* self);
void retro_controller_description_free (RetroControllerDescription* self);
void retro_controller_description_copy (const RetroControllerDescription* self, RetroControllerDescription* dest);
void retro_controller_description_destroy (RetroControllerDescription* self);
GType retro_controller_info_get_type (void) G_GNUC_CONST;
RetroControllerInfo* retro_controller_info_dup (const RetroControllerInfo* self);
void retro_controller_info_free (RetroControllerInfo* self);
void retro_controller_info_copy (const RetroControllerInfo* self, RetroControllerInfo* dest);
void retro_controller_info_destroy (RetroControllerInfo* self);


void retro_controller_description_copy (const RetroControllerDescription* self, RetroControllerDescription* dest) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	guint _tmp2_;
	_tmp0_ = (*self).desc;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).desc);
	(*dest).desc = _tmp1_;
	_tmp2_ = (*self).id;
	(*dest).id = _tmp2_;
}


void retro_controller_description_destroy (RetroControllerDescription* self) {
	_g_free0 ((*self).desc);
}


RetroControllerDescription* retro_controller_description_dup (const RetroControllerDescription* self) {
	RetroControllerDescription* dup;
	dup = g_new0 (RetroControllerDescription, 1);
	retro_controller_description_copy (self, dup);
	return dup;
}


void retro_controller_description_free (RetroControllerDescription* self) {
	retro_controller_description_destroy (self);
	g_free (self);
}


GType retro_controller_description_get_type (void) {
	static volatile gsize retro_controller_description_type_id__volatile = 0;
	if (g_once_init_enter (&retro_controller_description_type_id__volatile)) {
		GType retro_controller_description_type_id;
		retro_controller_description_type_id = g_boxed_type_register_static ("RetroControllerDescription", (GBoxedCopyFunc) retro_controller_description_dup, (GBoxedFreeFunc) retro_controller_description_free);
		g_once_init_leave (&retro_controller_description_type_id__volatile, retro_controller_description_type_id);
	}
	return retro_controller_description_type_id__volatile;
}


static gpointer _retro_controller_description_dup0 (gpointer self) {
	return self ? retro_controller_description_dup (self) : NULL;
}


void retro_controller_info_copy (const RetroControllerInfo* self, RetroControllerInfo* dest) {
	RetroControllerDescription* _tmp0_;
	RetroControllerDescription* _tmp1_;
	guint _tmp2_;
	_tmp0_ = (*self).types;
	_tmp1_ = _retro_controller_description_dup0 (_tmp0_);
	_retro_controller_description_free0 ((*dest).types);
	(*dest).types = _tmp1_;
	_tmp2_ = (*self).num_types;
	(*dest).num_types = _tmp2_;
}


void retro_controller_info_destroy (RetroControllerInfo* self) {
	_retro_controller_description_free0 ((*self).types);
}


RetroControllerInfo* retro_controller_info_dup (const RetroControllerInfo* self) {
	RetroControllerInfo* dup;
	dup = g_new0 (RetroControllerInfo, 1);
	retro_controller_info_copy (self, dup);
	return dup;
}


void retro_controller_info_free (RetroControllerInfo* self) {
	retro_controller_info_destroy (self);
	g_free (self);
}


GType retro_controller_info_get_type (void) {
	static volatile gsize retro_controller_info_type_id__volatile = 0;
	if (g_once_init_enter (&retro_controller_info_type_id__volatile)) {
		GType retro_controller_info_type_id;
		retro_controller_info_type_id = g_boxed_type_register_static ("RetroControllerInfo", (GBoxedCopyFunc) retro_controller_info_dup, (GBoxedFreeFunc) retro_controller_info_free);
		g_once_init_leave (&retro_controller_info_type_id__volatile, retro_controller_info_type_id);
	}
	return retro_controller_info_type_id__volatile;
}



