/* category.c generated by valac 0.36.1.19-ef50a4, 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;
enum  {
	GAMES_SCORES_CATEGORY_DUMMY_PROPERTY,
	GAMES_SCORES_CATEGORY_KEY,
	GAMES_SCORES_CATEGORY_NAME,
	GAMES_SCORES_CATEGORY_LAST_PROPERTY
};
static GParamSpec* games_scores_category_properties[GAMES_SCORES_CATEGORY_LAST_PROPERTY];
#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))
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_;
	const gchar* _tmp1_;
#line 46 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_return_val_if_fail (key != NULL, NULL);
#line 46 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 46 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	self = (GamesScoresCategory*) g_object_new (object_type, NULL);
#line 48 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_tmp0_ = key;
#line 48 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	games_scores_category_set_key (self, _tmp0_);
#line 49 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_tmp1_ = name;
#line 49 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	games_scores_category_set_name (self, _tmp1_);
#line 46 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	return self;
#line 100 "category.c"
}


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


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


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
#line 1110 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.38/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, '\0');
#line 1111 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.38/vapi/glib-2.0.vapi"
	_tmp0_ = index;
#line 1111 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.38/vapi/glib-2.0.vapi"
	_tmp1_ = ((gchar*) self)[_tmp0_];
#line 1111 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.38/vapi/glib-2.0.vapi"
	result = _tmp1_;
#line 1111 "/home/mcatanzaro/Projects/GNOME/install/share/vala-0.38/vapi/glib-2.0.vapi"
	return result;
#line 140 "category.c"
}


void games_scores_category_set_key (GamesScoresCategory* self, const gchar* value) {
	const gchar* _tmp17_;
	gchar* _tmp18_;
#line 30 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_return_if_fail (self != NULL);
#line 149 "category.c"
	{
		gint i;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		i = 0;
#line 154 "category.c"
		{
			gboolean _tmp0_;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
			_tmp0_ = TRUE;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
			while (TRUE) {
#line 161 "category.c"
				const gchar* _tmp2_;
				gint _tmp3_;
				gchar _tmp4_;
				gboolean _tmp5_ = FALSE;
				gboolean _tmp6_ = FALSE;
				const gchar* _tmp7_;
				gint _tmp8_;
				gchar _tmp9_;
				gboolean _tmp10_;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				if (!_tmp0_) {
#line 173 "category.c"
					gint _tmp1_;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp1_ = i;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					i = _tmp1_ + 1;
#line 179 "category.c"
				}
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp0_ = FALSE;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp2_ = value;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp3_ = i;
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp4_ = string_get (_tmp2_, (glong) _tmp3_);
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				if (!(_tmp4_ != '\0')) {
#line 32 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					break;
#line 193 "category.c"
				}
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp7_ = value;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp8_ = i;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp9_ = string_get (_tmp7_, (glong) _tmp8_);
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				_tmp10_ = g_ascii_isalnum (_tmp9_);
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				if (!_tmp10_) {
#line 205 "category.c"
					const gchar* _tmp11_;
					gint _tmp12_;
					gchar _tmp13_;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp11_ = value;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp12_ = i;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp13_ = string_get (_tmp11_, (glong) _tmp12_);
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp6_ = _tmp13_ != '-';
#line 217 "category.c"
				} else {
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp6_ = FALSE;
#line 221 "category.c"
				}
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				if (_tmp6_) {
#line 225 "category.c"
					const gchar* _tmp14_;
					gint _tmp15_;
					gchar _tmp16_;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp14_ = value;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp15_ = i;
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp16_ = string_get (_tmp14_, (glong) _tmp15_);
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp5_ = _tmp16_ != '_';
#line 237 "category.c"
				} else {
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					_tmp5_ = FALSE;
#line 241 "category.c"
				}
#line 34 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
				if (_tmp5_) {
#line 36 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
					g_error ("category.vala:36: Category keys may contain only hyphens, underscores," \
" and alphanumeric characters.");
#line 247 "category.c"
				}
			}
		}
	}
#line 39 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_tmp17_ = value;
#line 39 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_tmp18_ = g_strdup (_tmp17_);
#line 39 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_key);
#line 39 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	self->priv->_key = _tmp18_;
#line 30 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_object_notify_by_pspec ((GObject *) self, games_scores_category_properties[GAMES_SCORES_CATEGORY_KEY]);
#line 262 "category.c"
}


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


void games_scores_category_set_name (GamesScoresCategory* self, const gchar* value) {
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_return_if_fail (self != NULL);
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	if (g_strcmp0 (value, games_scores_category_get_name (self)) != 0) {
#line 286 "category.c"
		const gchar* _tmp0_;
		gchar* _tmp1_;
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		_tmp0_ = value;
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		_tmp1_ = g_strdup (_tmp0_);
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		_g_free0 (self->priv->_name);
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		self->priv->_name = _tmp1_;
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		g_object_notify_by_pspec ((GObject *) self, games_scores_category_properties[GAMES_SCORES_CATEGORY_NAME]);
#line 299 "category.c"
	}
}


static void games_scores_category_class_init (GamesScoresCategoryClass * klass) {
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	games_scores_category_parent_class = g_type_class_peek_parent (klass);
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_type_class_add_private (klass, sizeof (GamesScoresCategoryPrivate));
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_games_scores_category_get_property;
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_games_scores_category_set_property;
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (klass)->finalize = games_scores_category_finalize;
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCORES_CATEGORY_KEY, games_scores_category_properties[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/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_SCORES_CATEGORY_NAME, games_scores_category_properties[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 319 "category.c"
}


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


static void games_scores_category_finalize (GObject * obj) {
	GamesScoresCategory * self;
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_SCORES_TYPE_CATEGORY, GamesScoresCategory);
#line 26 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_key);
#line 44 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	_g_free0 (self->priv->_name);
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	G_OBJECT_CLASS (games_scores_category_parent_class)->finalize (obj);
#line 340 "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/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	switch (property_id) {
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_KEY:
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		g_value_set_string (value, games_scores_category_get_key (self));
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		break;
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_NAME:
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		g_value_set_string (value, games_scores_category_get_name (self));
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		break;
#line 373 "category.c"
		default:
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		break;
#line 379 "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/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
	switch (property_id) {
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_KEY:
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		games_scores_category_set_key (self, g_value_get_string (value));
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		break;
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		case GAMES_SCORES_CATEGORY_NAME:
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		games_scores_category_set_name (self, g_value_get_string (value));
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		break;
#line 401 "category.c"
		default:
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 24 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/category.vala"
		break;
#line 407 "category.c"
	}
}



