/* category.c generated by valac 0.34.0.65-f52b, the Vala compiler
 * generated from category.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * Copyright © 2014 Nikhar Agrawal
 *
 * This file is part of libgnome-games-support.
 *
 * libgnome-games-support is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * libgnome-games-support is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with libgnome-games-support.  If not, see <http://www.gnu.org/licenses/>.
 */

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


#define GAMES_SCORES_TYPE_CATEGORY (games_scores_category_get_type ())
#define GAMES_SCORES_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategory))
#define GAMES_SCORES_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategoryClass))
#define GAMES_SCORES_IS_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_SCORES_TYPE_CATEGORY))
#define GAMES_SCORES_IS_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_SCORES_TYPE_CATEGORY))
#define GAMES_SCORES_CATEGORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategoryClass))

typedef struct _GamesScoresCategory GamesScoresCategory;
typedef struct _GamesScoresCategoryClass GamesScoresCategoryClass;
typedef struct _GamesScoresCategoryPrivate GamesScoresCategoryPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesScoresCategory {
	GObject parent_instance;
	GamesScoresCategoryPrivate * priv;
};

struct _GamesScoresCategoryClass {
	GObjectClass parent_class;
};

struct _GamesScoresCategoryPrivate {
	gchar* _key;
	gchar* _name;
};


static gpointer games_scores_category_parent_class = NULL;

GType games_scores_category_get_type (void) G_GNUC_CONST;
#define GAMES_SCORES_CATEGORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategoryPrivate))
enum  {
	GAMES_SCORES_CATEGORY_DUMMY_PROPERTY,
	GAMES_SCORES_CATEGORY_KEY,
	GAMES_SCORES_CATEGORY_NAME
};
GamesScoresCategory* games_scores_category_new (const gchar* key, const gchar* name);
GamesScoresCategory* games_scores_category_construct (GType object_type, const gchar* key, const gchar* name);
void games_scores_category_set_key (GamesScoresCategory* self, const gchar* value);
void games_scores_category_set_name (GamesScoresCategory* self, const gchar* value);
const gchar* games_scores_category_get_key (GamesScoresCategory* self);
const gchar* games_scores_category_get_name (GamesScoresCategory* self);
static void games_scores_category_finalize (GObject* obj);
static void _vala_games_scores_category_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_scores_category_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GamesScoresCategory* games_scores_category_construct (GType object_type, const gchar* key, const gchar* name) {
	GamesScoresCategory * self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
#line 46 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_return_val_if_fail (key != NULL, NULL);
#line 46 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 46 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	self = (GamesScoresCategory*) g_object_new (object_type, NULL);
#line 48 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp0_ = key;
#line 48 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	games_scores_category_set_key (self, _tmp0_);
#line 49 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp1_ = name;
#line 49 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	games_scores_category_set_name (self, _tmp1_);
#line 46 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	return self;
#line 98 "category.c"
}


GamesScoresCategory* games_scores_category_new (const gchar* key, const gchar* name) {
#line 46 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	return games_scores_category_construct (GAMES_SCORES_TYPE_CATEGORY, key, name);
#line 105 "category.c"
}


const gchar* games_scores_category_get_key (GamesScoresCategory* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
#line 29 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 29 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp0_ = self->priv->_key;
#line 29 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	result = _tmp0_;
#line 29 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	return result;
#line 120 "category.c"
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_ = 0L;
	gchar _tmp1_ = '\0';
#line 1102 "/home/mcatanzaro/src/jhbuild/install/share/vala-0.36/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, '\0');
#line 1103 "/home/mcatanzaro/src/jhbuild/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp0_ = index;
#line 1103 "/home/mcatanzaro/src/jhbuild/install/share/vala-0.36/vapi/glib-2.0.vapi"
	_tmp1_ = ((gchar*) self)[_tmp0_];
#line 1103 "/home/mcatanzaro/src/jhbuild/install/share/vala-0.36/vapi/glib-2.0.vapi"
	result = _tmp1_;
#line 1103 "/home/mcatanzaro/src/jhbuild/install/share/vala-0.36/vapi/glib-2.0.vapi"
	return result;
#line 138 "category.c"
}


void games_scores_category_set_key (GamesScoresCategory* self, const gchar* value) {
	const gchar* _tmp17_ = NULL;
	gchar* _tmp18_ = NULL;
#line 30 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_return_if_fail (self != NULL);
#line 147 "category.c"
	{
		gint i = 0;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		i = 0;
#line 152 "category.c"
		{
			gboolean _tmp0_ = FALSE;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
			_tmp0_ = TRUE;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
			while (TRUE) {
#line 159 "category.c"
				const gchar* _tmp2_ = NULL;
				gint _tmp3_ = 0;
				gchar _tmp4_ = '\0';
				gboolean _tmp5_ = FALSE;
				gboolean _tmp6_ = FALSE;
				const gchar* _tmp7_ = NULL;
				gint _tmp8_ = 0;
				gchar _tmp9_ = '\0';
				gboolean _tmp10_ = FALSE;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				if (!_tmp0_) {
#line 171 "category.c"
					gint _tmp1_ = 0;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp1_ = i;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					i = _tmp1_ + 1;
#line 177 "category.c"
				}
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp0_ = FALSE;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp2_ = value;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp3_ = i;
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp4_ = string_get (_tmp2_, (glong) _tmp3_);
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				if (!(_tmp4_ != '\0')) {
#line 32 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					break;
#line 191 "category.c"
				}
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp7_ = value;
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp8_ = i;
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp9_ = string_get (_tmp7_, (glong) _tmp8_);
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				_tmp10_ = g_ascii_isalnum (_tmp9_);
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				if (!_tmp10_) {
#line 203 "category.c"
					const gchar* _tmp11_ = NULL;
					gint _tmp12_ = 0;
					gchar _tmp13_ = '\0';
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp11_ = value;
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp12_ = i;
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp13_ = string_get (_tmp11_, (glong) _tmp12_);
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp6_ = _tmp13_ != '-';
#line 215 "category.c"
				} else {
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp6_ = FALSE;
#line 219 "category.c"
				}
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				if (_tmp6_) {
#line 223 "category.c"
					const gchar* _tmp14_ = NULL;
					gint _tmp15_ = 0;
					gchar _tmp16_ = '\0';
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp14_ = value;
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp15_ = i;
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp16_ = string_get (_tmp14_, (glong) _tmp15_);
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp5_ = _tmp16_ != '_';
#line 235 "category.c"
				} else {
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					_tmp5_ = FALSE;
#line 239 "category.c"
				}
#line 34 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
				if (_tmp5_) {
#line 36 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
					g_error ("category.vala:36: Category keys may contain only hyphens, underscores," \
" and alphanumeric characters.");
#line 245 "category.c"
				}
			}
		}
	}
#line 39 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp17_ = value;
#line 39 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp18_ = g_strdup (_tmp17_);
#line 39 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_key);
#line 39 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	self->priv->_key = _tmp18_;
#line 30 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_object_notify ((GObject *) self, "key");
#line 260 "category.c"
}


const gchar* games_scores_category_get_name (GamesScoresCategory* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp0_ = self->priv->_name;
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	result = _tmp0_;
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	return result;
#line 275 "category.c"
}


void games_scores_category_set_name (GamesScoresCategory* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_return_if_fail (self != NULL);
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp0_ = value;
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_tmp1_ = g_strdup (_tmp0_);
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_name);
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	self->priv->_name = _tmp1_;
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_object_notify ((GObject *) self, "name");
#line 294 "category.c"
}


static void games_scores_category_class_init (GamesScoresCategoryClass * klass) {
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	games_scores_category_parent_class = g_type_class_peek_parent (klass);
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_type_class_add_private (klass, sizeof (GamesScoresCategoryPrivate));
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_games_scores_category_get_property;
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_games_scores_category_set_property;
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (klass)->finalize = games_scores_category_finalize;
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCORES_CATEGORY_KEY, g_param_spec_string ("key", "key", "key", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCORES_CATEGORY_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 313 "category.c"
}


static void games_scores_category_instance_init (GamesScoresCategory * self) {
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	self->priv = GAMES_SCORES_CATEGORY_GET_PRIVATE (self);
#line 320 "category.c"
}


static void games_scores_category_finalize (GObject* obj) {
	GamesScoresCategory * self;
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategory);
#line 26 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_key);
#line 44 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_name);
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (games_scores_category_parent_class)->finalize (obj);
#line 334 "category.c"
}


GType games_scores_category_get_type (void) {
	static volatile gsize games_scores_category_type_id__volatile = 0;
	if (g_once_init_enter (&games_scores_category_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesScoresCategoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_scores_category_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesScoresCategory), 0, (GInstanceInitFunc) games_scores_category_instance_init, NULL };
		GType games_scores_category_type_id;
		games_scores_category_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesScoresCategory", &g_define_type_info, 0);
		g_once_init_leave (&games_scores_category_type_id__volatile, games_scores_category_type_id);
	}
	return games_scores_category_type_id__volatile;
}


static void _vala_games_scores_category_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesScoresCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategory);
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	switch (property_id) {
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_KEY:
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		g_value_set_string (value, games_scores_category_get_key (self));
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		break;
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_NAME:
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		g_value_set_string (value, games_scores_category_get_name (self));
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		break;
#line 367 "category.c"
		default:
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		break;
#line 373 "category.c"
	}
}


static void _vala_games_scores_category_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesScoresCategory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategory);
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
	switch (property_id) {
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_KEY:
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		games_scores_category_set_key (self, g_value_get_string (value));
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		break;
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_NAME:
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		games_scores_category_set_name (self, g_value_get_string (value));
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		break;
#line 395 "category.c"
		default:
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 24 "/home/mcatanzaro/src/jhbuild/checkout/libgnome-games-support/games/scores/category.vala"
		break;
#line 401 "category.c"
	}
}



