/* chess-piece.c generated by valac 0.36.0.2-c0ff, the Vala compiler
 * generated from chess-piece.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * Copyright (C) 2010-2016 Robert Ancell
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

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


#define TYPE_PIECE_TYPE (piece_type_get_type ())

#define TYPE_CHESS_PIECE (chess_piece_get_type ())
#define CHESS_PIECE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHESS_PIECE, ChessPiece))
#define CHESS_PIECE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHESS_PIECE, ChessPieceClass))
#define IS_CHESS_PIECE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHESS_PIECE))
#define IS_CHESS_PIECE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHESS_PIECE))
#define CHESS_PIECE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHESS_PIECE, ChessPieceClass))

typedef struct _ChessPiece ChessPiece;
typedef struct _ChessPieceClass ChessPieceClass;
typedef struct _ChessPiecePrivate ChessPiecePrivate;

#define TYPE_CHESS_PLAYER (chess_player_get_type ())
#define CHESS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHESS_PLAYER, ChessPlayer))
#define CHESS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHESS_PLAYER, ChessPlayerClass))
#define IS_CHESS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHESS_PLAYER))
#define IS_CHESS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHESS_PLAYER))
#define CHESS_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHESS_PLAYER, ChessPlayerClass))

typedef struct _ChessPlayer ChessPlayer;
typedef struct _ChessPlayerClass ChessPlayerClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_COLOR (color_get_type ())
typedef struct _ChessPlayerPrivate ChessPlayerPrivate;
enum  {
	CHESS_PIECE_MOVED_SIGNAL,
	CHESS_PIECE_PROMOTED_SIGNAL,
	CHESS_PIECE_DIED_SIGNAL,
	CHESS_PIECE_LAST_SIGNAL
};
static guint chess_piece_signals[CHESS_PIECE_LAST_SIGNAL] = {0};

typedef enum  {
	PIECE_TYPE_PAWN,
	PIECE_TYPE_ROOK,
	PIECE_TYPE_KNIGHT,
	PIECE_TYPE_BISHOP,
	PIECE_TYPE_QUEEN,
	PIECE_TYPE_KING
} PieceType;

struct _ChessPiece {
	GObject parent_instance;
	ChessPiecePrivate * priv;
	ChessPlayer* player;
	PieceType type;
};

struct _ChessPieceClass {
	GObjectClass parent_class;
};

typedef enum  {
	COLOR_WHITE,
	COLOR_BLACK
} Color;

struct _ChessPlayer {
	GObject parent_instance;
	ChessPlayerPrivate * priv;
	Color color;
};

struct _ChessPlayerClass {
	GObjectClass parent_class;
};


static gpointer chess_piece_parent_class = NULL;

GType piece_type_get_type (void) G_GNUC_CONST;
GType chess_piece_get_type (void) G_GNUC_CONST;
GType chess_player_get_type (void) G_GNUC_CONST;
enum  {
	CHESS_PIECE_DUMMY_PROPERTY,
	CHESS_PIECE_COLOR,
	CHESS_PIECE_SYMBOL
};
ChessPiece* chess_piece_new (ChessPlayer* player, PieceType type);
ChessPiece* chess_piece_construct (GType object_type, ChessPlayer* player, PieceType type);
GType color_get_type (void) G_GNUC_CONST;
Color chess_piece_get_color (ChessPiece* self);
gunichar chess_piece_get_symbol (ChessPiece* self);
static void chess_piece_finalize (GObject * obj);
static void _vala_chess_piece_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);


GType piece_type_get_type (void) {
	static volatile gsize piece_type_type_id__volatile = 0;
	if (g_once_init_enter (&piece_type_type_id__volatile)) {
		static const GEnumValue values[] = {{PIECE_TYPE_PAWN, "PIECE_TYPE_PAWN", "pawn"}, {PIECE_TYPE_ROOK, "PIECE_TYPE_ROOK", "rook"}, {PIECE_TYPE_KNIGHT, "PIECE_TYPE_KNIGHT", "knight"}, {PIECE_TYPE_BISHOP, "PIECE_TYPE_BISHOP", "bishop"}, {PIECE_TYPE_QUEEN, "PIECE_TYPE_QUEEN", "queen"}, {PIECE_TYPE_KING, "PIECE_TYPE_KING", "king"}, {0, NULL, NULL}};
		GType piece_type_type_id;
		piece_type_type_id = g_enum_register_static ("PieceType", values);
		g_once_init_leave (&piece_type_type_id__volatile, piece_type_type_id);
	}
	return piece_type_type_id__volatile;
}


static gpointer _g_object_ref0 (gpointer self) {
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	return self ? g_object_ref (self) : NULL;
#line 124 "chess-piece.c"
}


ChessPiece* chess_piece_construct (GType object_type, ChessPlayer* player, PieceType type) {
	ChessPiece * self = NULL;
	ChessPlayer* _tmp0_;
	ChessPlayer* _tmp1_;
	PieceType _tmp2_;
#line 68 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	g_return_val_if_fail (player != NULL, NULL);
#line 68 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	self = (ChessPiece*) g_object_new (object_type, NULL);
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp0_ = player;
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_g_object_unref0 (self->player);
#line 70 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	self->player = _tmp1_;
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp2_ = type;
#line 71 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	self->type = _tmp2_;
#line 68 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	return self;
#line 151 "chess-piece.c"
}


ChessPiece* chess_piece_new (ChessPlayer* player, PieceType type) {
#line 68 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	return chess_piece_construct (TYPE_CHESS_PIECE, player, type);
#line 158 "chess-piece.c"
}


Color chess_piece_get_color (ChessPiece* self) {
	Color result;
	ChessPlayer* _tmp0_;
	Color _tmp1_;
#line 33 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	g_return_val_if_fail (self != NULL, 0);
#line 33 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp0_ = self->player;
#line 33 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp1_ = _tmp0_->color;
#line 33 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	result = _tmp1_;
#line 33 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	return result;
#line 176 "chess-piece.c"
}


gunichar chess_piece_get_symbol (ChessPiece* self) {
	gunichar result;
	gunichar c;
	PieceType _tmp0_;
	ChessPlayer* _tmp1_;
	Color _tmp2_;
	gunichar _tmp5_;
#line 38 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	g_return_val_if_fail (self != NULL, 0U);
#line 40 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	c = (gunichar) ' ';
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp0_ = self->type;
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	switch (_tmp0_) {
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case PIECE_TYPE_PAWN:
#line 197 "chess-piece.c"
		{
#line 44 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			c = (gunichar) 'p';
#line 45 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			break;
#line 203 "chess-piece.c"
		}
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case PIECE_TYPE_ROOK:
#line 207 "chess-piece.c"
		{
#line 47 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			c = (gunichar) 'r';
#line 48 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			break;
#line 213 "chess-piece.c"
		}
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case PIECE_TYPE_KNIGHT:
#line 217 "chess-piece.c"
		{
#line 50 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			c = (gunichar) 'n';
#line 51 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			break;
#line 223 "chess-piece.c"
		}
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case PIECE_TYPE_BISHOP:
#line 227 "chess-piece.c"
		{
#line 53 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			c = (gunichar) 'b';
#line 54 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			break;
#line 233 "chess-piece.c"
		}
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case PIECE_TYPE_QUEEN:
#line 237 "chess-piece.c"
		{
#line 56 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			c = (gunichar) 'q';
#line 57 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			break;
#line 243 "chess-piece.c"
		}
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case PIECE_TYPE_KING:
#line 247 "chess-piece.c"
		{
#line 59 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			c = (gunichar) 'k';
#line 60 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
			break;
#line 253 "chess-piece.c"
		}
		default:
#line 41 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		break;
#line 258 "chess-piece.c"
	}
#line 62 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp1_ = self->player;
#line 62 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp2_ = _tmp1_->color;
#line 62 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	if (_tmp2_ == COLOR_WHITE) {
#line 266 "chess-piece.c"
		gunichar _tmp3_;
		gunichar _tmp4_;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		_tmp3_ = c;
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		_tmp4_ = g_unichar_toupper (_tmp3_);
#line 63 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		c = _tmp4_;
#line 275 "chess-piece.c"
	}
#line 64 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_tmp5_ = c;
#line 64 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	result = _tmp5_;
#line 64 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	return result;
#line 283 "chess-piece.c"
}


static void chess_piece_class_init (ChessPieceClass * klass) {
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	chess_piece_parent_class = g_type_class_peek_parent (klass);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_chess_piece_get_property;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	G_OBJECT_CLASS (klass)->finalize = chess_piece_finalize;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_PIECE_COLOR, g_param_spec_enum ("color", "color", "color", TYPE_COLOR, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_PIECE_SYMBOL, g_param_spec_uint ("symbol", "symbol", "symbol", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	chess_piece_signals[CHESS_PIECE_MOVED_SIGNAL] = g_signal_new ("moved", TYPE_CHESS_PIECE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	chess_piece_signals[CHESS_PIECE_PROMOTED_SIGNAL] = g_signal_new ("promoted", TYPE_CHESS_PIECE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	chess_piece_signals[CHESS_PIECE_DIED_SIGNAL] = g_signal_new ("died", TYPE_CHESS_PIECE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
#line 304 "chess-piece.c"
}


static void chess_piece_instance_init (ChessPiece * self) {
}


static void chess_piece_finalize (GObject * obj) {
	ChessPiece * self;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CHESS_PIECE, ChessPiece);
#line 24 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	_g_object_unref0 (self->player);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	G_OBJECT_CLASS (chess_piece_parent_class)->finalize (obj);
#line 320 "chess-piece.c"
}


GType chess_piece_get_type (void) {
	static volatile gsize chess_piece_type_id__volatile = 0;
	if (g_once_init_enter (&chess_piece_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ChessPieceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) chess_piece_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ChessPiece), 0, (GInstanceInitFunc) chess_piece_instance_init, NULL };
		GType chess_piece_type_id;
		chess_piece_type_id = g_type_register_static (G_TYPE_OBJECT, "ChessPiece", &g_define_type_info, 0);
		g_once_init_leave (&chess_piece_type_id__volatile, chess_piece_type_id);
	}
	return chess_piece_type_id__volatile;
}


static void _vala_chess_piece_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ChessPiece * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CHESS_PIECE, ChessPiece);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
	switch (property_id) {
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case CHESS_PIECE_COLOR:
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		g_value_set_enum (value, chess_piece_get_color (self));
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		break;
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		case CHESS_PIECE_SYMBOL:
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		g_value_set_uint (value, chess_piece_get_symbol (self));
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		break;
#line 353 "chess-piece.c"
		default:
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 22 "/home/mcatanzaro/Projects/GNOME/gnome-chess/lib/chess-piece.vala"
		break;
#line 359 "chess-piece.c"
	}
}



