/* sql-function.c generated by valac 0.40.8, the Vala compiler
 * generated from sql-function.vala, do not modify */

/*
 * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel 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 2.1 of the License, or (at your option) any later version.
 *
 * Rygel 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 this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */


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


#define RYGEL_DATABASE_TYPE_SQL_OPERATOR (rygel_database_sql_operator_get_type ())
#define RYGEL_DATABASE_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_DATABASE_TYPE_SQL_OPERATOR, RygelDatabaseSqlOperator))
#define RYGEL_DATABASE_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_DATABASE_TYPE_SQL_OPERATOR, RygelDatabaseSqlOperatorClass))
#define RYGEL_DATABASE_IS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_DATABASE_TYPE_SQL_OPERATOR))
#define RYGEL_DATABASE_IS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_DATABASE_TYPE_SQL_OPERATOR))
#define RYGEL_DATABASE_SQL_OPERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_DATABASE_TYPE_SQL_OPERATOR, RygelDatabaseSqlOperatorClass))

typedef struct _RygelDatabaseSqlOperator RygelDatabaseSqlOperator;
typedef struct _RygelDatabaseSqlOperatorClass RygelDatabaseSqlOperatorClass;
typedef struct _RygelDatabaseSqlOperatorPrivate RygelDatabaseSqlOperatorPrivate;

#define RYGEL_DATABASE_TYPE_SQL_FUNCTION (rygel_database_sql_function_get_type ())
#define RYGEL_DATABASE_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_DATABASE_TYPE_SQL_FUNCTION, RygelDatabaseSqlFunction))
#define RYGEL_DATABASE_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_DATABASE_TYPE_SQL_FUNCTION, RygelDatabaseSqlFunctionClass))
#define RYGEL_DATABASE_IS_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_DATABASE_TYPE_SQL_FUNCTION))
#define RYGEL_DATABASE_IS_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_DATABASE_TYPE_SQL_FUNCTION))
#define RYGEL_DATABASE_SQL_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_DATABASE_TYPE_SQL_FUNCTION, RygelDatabaseSqlFunctionClass))

typedef struct _RygelDatabaseSqlFunction RygelDatabaseSqlFunction;
typedef struct _RygelDatabaseSqlFunctionClass RygelDatabaseSqlFunctionClass;
typedef struct _RygelDatabaseSqlFunctionPrivate RygelDatabaseSqlFunctionPrivate;
enum  {
	RYGEL_DATABASE_SQL_FUNCTION_0_PROPERTY,
	RYGEL_DATABASE_SQL_FUNCTION_NUM_PROPERTIES
};
static GParamSpec* rygel_database_sql_function_properties[RYGEL_DATABASE_SQL_FUNCTION_NUM_PROPERTIES];

struct _RygelDatabaseSqlOperator {
	GObject parent_instance;
	RygelDatabaseSqlOperatorPrivate * priv;
	gchar* name;
	gchar* arg;
	gchar* collate;
};

struct _RygelDatabaseSqlOperatorClass {
	GObjectClass parent_class;
	gchar* (*to_string) (RygelDatabaseSqlOperator* self);
};

struct _RygelDatabaseSqlFunction {
	RygelDatabaseSqlOperator parent_instance;
	RygelDatabaseSqlFunctionPrivate * priv;
};

struct _RygelDatabaseSqlFunctionClass {
	RygelDatabaseSqlOperatorClass parent_class;
};


static gpointer rygel_database_sql_function_parent_class = NULL;

GType rygel_database_sql_operator_get_type (void) G_GNUC_CONST;
GType rygel_database_sql_function_get_type (void) G_GNUC_CONST;
RygelDatabaseSqlFunction* rygel_database_sql_function_new (const gchar* name,
                                                           const gchar* arg);
RygelDatabaseSqlFunction* rygel_database_sql_function_construct (GType object_type,
                                                                 const gchar* name,
                                                                 const gchar* arg);
RygelDatabaseSqlOperator* rygel_database_sql_operator_new (const gchar* name,
                                                           const gchar* arg,
                                                           const gchar* collate);
RygelDatabaseSqlOperator* rygel_database_sql_operator_construct (GType object_type,
                                                                 const gchar* name,
                                                                 const gchar* arg,
                                                                 const gchar* collate);
static gchar* rygel_database_sql_function_real_to_string (RygelDatabaseSqlOperator* base);


RygelDatabaseSqlFunction*
rygel_database_sql_function_construct (GType object_type,
                                       const gchar* name,
                                       const gchar* arg)
{
	RygelDatabaseSqlFunction * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (arg != NULL, NULL);
	self = (RygelDatabaseSqlFunction*) rygel_database_sql_operator_construct (object_type, name, arg, "");
	return self;
}


RygelDatabaseSqlFunction*
rygel_database_sql_function_new (const gchar* name,
                                 const gchar* arg)
{
	return rygel_database_sql_function_construct (RYGEL_DATABASE_TYPE_SQL_FUNCTION, name, arg);
}


static gchar*
rygel_database_sql_function_real_to_string (RygelDatabaseSqlOperator* base)
{
	RygelDatabaseSqlFunction * self;
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (RygelDatabaseSqlFunction*) base;
	_tmp0_ = ((RygelDatabaseSqlOperator*) self)->name;
	_tmp1_ = ((RygelDatabaseSqlOperator*) self)->arg;
	_tmp2_ = g_strdup_printf ("%s(%s,?)", _tmp0_, _tmp1_);
	result = _tmp2_;
	return result;
}


static void
rygel_database_sql_function_class_init (RygelDatabaseSqlFunctionClass * klass)
{
	rygel_database_sql_function_parent_class = g_type_class_peek_parent (klass);
	((RygelDatabaseSqlOperatorClass *) klass)->to_string = (gchar* (*) (RygelDatabaseSqlOperator *)) rygel_database_sql_function_real_to_string;
}


static void
rygel_database_sql_function_instance_init (RygelDatabaseSqlFunction * self)
{
}


GType
rygel_database_sql_function_get_type (void)
{
	static volatile gsize rygel_database_sql_function_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_database_sql_function_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelDatabaseSqlFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_database_sql_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelDatabaseSqlFunction), 0, (GInstanceInitFunc) rygel_database_sql_function_instance_init, NULL };
		GType rygel_database_sql_function_type_id;
		rygel_database_sql_function_type_id = g_type_register_static (RYGEL_DATABASE_TYPE_SQL_OPERATOR, "RygelDatabaseSqlFunction", &g_define_type_info, 0);
		g_once_init_leave (&rygel_database_sql_function_type_id__volatile, rygel_database_sql_function_type_id);
	}
	return rygel_database_sql_function_type_id__volatile;
}



