/* rygel-tracker-regex-filter.c generated by valac 0.15.1.36-84b2b, the Vala compiler
 * generated from rygel-tracker-regex-filter.vala, do not modify */

/*
 * Copyright (C) 2010 MediaNet Inh.
 *
 * Author: Sunil Mohan Adapa <sunil@medhas.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 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 program; 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_TRACKER_TYPE_QUERY_FILTER (rygel_tracker_query_filter_get_type ())
#define RYGEL_TRACKER_QUERY_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_QUERY_FILTER, RygelTrackerQueryFilter))
#define RYGEL_TRACKER_IS_QUERY_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_QUERY_FILTER))
#define RYGEL_TRACKER_QUERY_FILTER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_TRACKER_TYPE_QUERY_FILTER, RygelTrackerQueryFilterIface))

typedef struct _RygelTrackerQueryFilter RygelTrackerQueryFilter;
typedef struct _RygelTrackerQueryFilterIface RygelTrackerQueryFilterIface;

#define RYGEL_TRACKER_TYPE_REGEX_FILTER (rygel_tracker_regex_filter_get_type ())
#define RYGEL_TRACKER_REGEX_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_REGEX_FILTER, RygelTrackerRegexFilter))
#define RYGEL_TRACKER_REGEX_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_REGEX_FILTER, RygelTrackerRegexFilterClass))
#define RYGEL_TRACKER_IS_REGEX_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_REGEX_FILTER))
#define RYGEL_TRACKER_IS_REGEX_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_REGEX_FILTER))
#define RYGEL_TRACKER_REGEX_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_REGEX_FILTER, RygelTrackerRegexFilterClass))

typedef struct _RygelTrackerRegexFilter RygelTrackerRegexFilter;
typedef struct _RygelTrackerRegexFilterClass RygelTrackerRegexFilterClass;
typedef struct _RygelTrackerRegexFilterPrivate RygelTrackerRegexFilterPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _RygelTrackerQueryFilterIface {
	GTypeInterface parent_iface;
	gchar* (*to_string) (RygelTrackerQueryFilter* self);
};

struct _RygelTrackerRegexFilter {
	GObject parent_instance;
	RygelTrackerRegexFilterPrivate * priv;
	gchar* subject;
	gchar* regex;
	gchar* flags;
};

struct _RygelTrackerRegexFilterClass {
	GObjectClass parent_class;
};


static gpointer rygel_tracker_regex_filter_parent_class = NULL;
static RygelTrackerQueryFilterIface* rygel_tracker_regex_filter_rygel_tracker_query_filter_parent_iface = NULL;

GType rygel_tracker_query_filter_get_type (void) G_GNUC_CONST;
GType rygel_tracker_regex_filter_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_TRACKER_REGEX_FILTER_DUMMY_PROPERTY
};
RygelTrackerRegexFilter* rygel_tracker_regex_filter_new (const gchar* subject, const gchar* regex, const gchar* flags);
RygelTrackerRegexFilter* rygel_tracker_regex_filter_construct (GType object_type, const gchar* subject, const gchar* regex, const gchar* flags);
static gchar* rygel_tracker_regex_filter_real_to_string (RygelTrackerQueryFilter* base);
static void rygel_tracker_regex_filter_finalize (GObject* obj);


RygelTrackerRegexFilter* rygel_tracker_regex_filter_construct (GType object_type, const gchar* subject, const gchar* regex, const gchar* flags) {
	RygelTrackerRegexFilter * self = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_val_if_fail (subject != NULL, NULL);
	g_return_val_if_fail (regex != NULL, NULL);
	g_return_val_if_fail (flags != NULL, NULL);
	self = (RygelTrackerRegexFilter*) g_object_new (object_type, NULL);
	_tmp0_ = subject;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->subject);
	self->subject = _tmp1_;
	_tmp2_ = regex;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->regex);
	self->regex = _tmp3_;
	_tmp4_ = flags;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 (self->flags);
	self->flags = _tmp5_;
	return self;
}


RygelTrackerRegexFilter* rygel_tracker_regex_filter_new (const gchar* subject, const gchar* regex, const gchar* flags) {
	return rygel_tracker_regex_filter_construct (RYGEL_TRACKER_TYPE_REGEX_FILTER, subject, regex, flags);
}


static gchar* rygel_tracker_regex_filter_real_to_string (RygelTrackerQueryFilter* base) {
	RygelTrackerRegexFilter * self;
	gchar* result = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	self = (RygelTrackerRegexFilter*) base;
	_tmp0_ = self->subject;
	_tmp1_ = g_strconcat ("regex(", _tmp0_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat (_tmp2_, ", \"", NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->regex;
	_tmp6_ = g_strconcat (_tmp4_, _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat (_tmp7_, "\", \"", NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->flags;
	_tmp11_ = g_strconcat (_tmp9_, _tmp10_, NULL);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat (_tmp12_, "\")", NULL);
	_tmp14_ = _tmp13_;
	_g_free0 (_tmp12_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	result = _tmp14_;
	return result;
}


static void rygel_tracker_regex_filter_class_init (RygelTrackerRegexFilterClass * klass) {
	rygel_tracker_regex_filter_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = rygel_tracker_regex_filter_finalize;
}


static void rygel_tracker_regex_filter_rygel_tracker_query_filter_interface_init (RygelTrackerQueryFilterIface * iface) {
	rygel_tracker_regex_filter_rygel_tracker_query_filter_parent_iface = g_type_interface_peek_parent (iface);
	iface->to_string = (gchar* (*)(RygelTrackerQueryFilter*)) rygel_tracker_regex_filter_real_to_string;
}


static void rygel_tracker_regex_filter_instance_init (RygelTrackerRegexFilter * self) {
}


static void rygel_tracker_regex_filter_finalize (GObject* obj) {
	RygelTrackerRegexFilter * self;
	self = RYGEL_TRACKER_REGEX_FILTER (obj);
	_g_free0 (self->subject);
	_g_free0 (self->regex);
	_g_free0 (self->flags);
	G_OBJECT_CLASS (rygel_tracker_regex_filter_parent_class)->finalize (obj);
}


/**
 * Regexes in SPARQL query filter
 */
GType rygel_tracker_regex_filter_get_type (void) {
	static volatile gsize rygel_tracker_regex_filter_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_tracker_regex_filter_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelTrackerRegexFilterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_tracker_regex_filter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelTrackerRegexFilter), 0, (GInstanceInitFunc) rygel_tracker_regex_filter_instance_init, NULL };
		static const GInterfaceInfo rygel_tracker_query_filter_info = { (GInterfaceInitFunc) rygel_tracker_regex_filter_rygel_tracker_query_filter_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_tracker_regex_filter_type_id;
		rygel_tracker_regex_filter_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelTrackerRegexFilter", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_tracker_regex_filter_type_id, RYGEL_TRACKER_TYPE_QUERY_FILTER, &rygel_tracker_query_filter_info);
		g_once_init_leave (&rygel_tracker_regex_filter_type_id__volatile, rygel_tracker_regex_filter_type_id);
	}
	return rygel_tracker_regex_filter_type_id__volatile;
}



