/* queryoptions.c generated by valac 0.12.1.1-323029-dirty, the Vala compiler
 * generated from queryoptions.vala, do not modify */

/* queryoptions.vala
 *
 * Copyright (C) 2010 Andrea Del Signore
 *
 * This library 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.
 *
 * This library 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, see <http://www.gnu.org/licenses/>.
 *
 * Author:
 * 	Andrea Del Signore <sejerpz@tin.it>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_QUERY_OPTIONS (afrodite_query_options_get_type ())
#define AFRODITE_QUERY_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_QUERY_OPTIONS, AfroditeQueryOptions))
#define AFRODITE_QUERY_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_QUERY_OPTIONS, AfroditeQueryOptionsClass))
#define AFRODITE_IS_QUERY_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_QUERY_OPTIONS))
#define AFRODITE_IS_QUERY_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_QUERY_OPTIONS))
#define AFRODITE_QUERY_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_QUERY_OPTIONS, AfroditeQueryOptionsClass))

typedef struct _AfroditeQueryOptions AfroditeQueryOptions;
typedef struct _AfroditeQueryOptionsClass AfroditeQueryOptionsClass;
typedef struct _AfroditeQueryOptionsPrivate AfroditeQueryOptionsPrivate;

#define AFRODITE_TYPE_SYMBOL_ACCESSIBILITY (afrodite_symbol_accessibility_get_type ())

#define AFRODITE_TYPE_MEMBER_BINDING (afrodite_member_binding_get_type ())

#define AFRODITE_TYPE_COMPARE_MODE (afrodite_compare_mode_get_type ())
#define _afrodite_query_options_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_query_options_unref (var), NULL)))
typedef struct _AfroditeParamSpecQueryOptions AfroditeParamSpecQueryOptions;

typedef enum  {
	AFRODITE_SYMBOL_ACCESSIBILITY_PRIVATE = 1,
	AFRODITE_SYMBOL_ACCESSIBILITY_INTERNAL = 1 << 1,
	AFRODITE_SYMBOL_ACCESSIBILITY_PROTECTED = 1 << 2,
	AFRODITE_SYMBOL_ACCESSIBILITY_PUBLIC = 1 << 3,
	AFRODITE_SYMBOL_ACCESSIBILITY_ANY = ((AFRODITE_SYMBOL_ACCESSIBILITY_PRIVATE | AFRODITE_SYMBOL_ACCESSIBILITY_INTERNAL) | AFRODITE_SYMBOL_ACCESSIBILITY_PROTECTED) | AFRODITE_SYMBOL_ACCESSIBILITY_PUBLIC
} AfroditeSymbolAccessibility;

typedef enum  {
	AFRODITE_MEMBER_BINDING_INSTANCE = 1,
	AFRODITE_MEMBER_BINDING_CLASS = 1 << 1,
	AFRODITE_MEMBER_BINDING_STATIC = 1 << 2,
	AFRODITE_MEMBER_BINDING_ANY = (AFRODITE_MEMBER_BINDING_INSTANCE | AFRODITE_MEMBER_BINDING_CLASS) | AFRODITE_MEMBER_BINDING_STATIC
} AfroditeMemberBinding;

typedef enum  {
	AFRODITE_COMPARE_MODE_EXACT,
	AFRODITE_COMPARE_MODE_START_WITH
} AfroditeCompareMode;

struct _AfroditeQueryOptions {
	GTypeInstance parent_instance;
	volatile int ref_count;
	AfroditeQueryOptionsPrivate * priv;
	gboolean all_symbols;
	gboolean only_creation_methods;
	gboolean only_static_factories;
	gboolean only_error_domains;
	gboolean exclude_creation_methods;
	gboolean exclude_code_node;
	AfroditeSymbolAccessibility access;
	gboolean auto_member_binding_mode;
	AfroditeMemberBinding binding;
	AfroditeCompareMode compare_mode;
};

struct _AfroditeQueryOptionsClass {
	GTypeClass parent_class;
	void (*finalize) (AfroditeQueryOptions *self);
};

struct _AfroditeParamSpecQueryOptions {
	GParamSpec parent_instance;
};


static gpointer afrodite_query_options_parent_class = NULL;

gpointer afrodite_query_options_ref (gpointer instance);
void afrodite_query_options_unref (gpointer instance);
GParamSpec* afrodite_param_spec_query_options (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_query_options (GValue* value, gpointer v_object);
void afrodite_value_take_query_options (GValue* value, gpointer v_object);
gpointer afrodite_value_get_query_options (const GValue* value);
GType afrodite_query_options_get_type (void) G_GNUC_CONST;
GType afrodite_symbol_accessibility_get_type (void) G_GNUC_CONST;
GType afrodite_member_binding_get_type (void) G_GNUC_CONST;
GType afrodite_compare_mode_get_type (void) G_GNUC_CONST;
enum  {
	AFRODITE_QUERY_OPTIONS_DUMMY_PROPERTY
};
AfroditeQueryOptions* afrodite_query_options_standard (void);
AfroditeQueryOptions* afrodite_query_options_new (void);
AfroditeQueryOptions* afrodite_query_options_construct (GType object_type);
AfroditeQueryOptions* afrodite_query_options_creation_methods (void);
AfroditeQueryOptions* afrodite_query_options_factory_methods (void);
AfroditeQueryOptions* afrodite_query_options_error_domains (void);
void afrodite_query_options_dump_settings (AfroditeQueryOptions* self);
void afrodite_utils_trace (const gchar* format, ...);
static void afrodite_query_options_finalize (AfroditeQueryOptions* obj);


AfroditeQueryOptions* afrodite_query_options_standard (void) {
	AfroditeQueryOptions* result = NULL;
	AfroditeQueryOptions* _tmp0_ = NULL;
	_tmp0_ = afrodite_query_options_new ();
	result = _tmp0_;
	return result;
}


AfroditeQueryOptions* afrodite_query_options_creation_methods (void) {
	AfroditeQueryOptions* result = NULL;
	AfroditeQueryOptions* _tmp0_ = NULL;
	AfroditeQueryOptions* opt;
	_tmp0_ = afrodite_query_options_new ();
	opt = _tmp0_;
	opt->only_creation_methods = TRUE;
	opt->exclude_creation_methods = FALSE;
	result = opt;
	return result;
}


AfroditeQueryOptions* afrodite_query_options_factory_methods (void) {
	AfroditeQueryOptions* result = NULL;
	AfroditeQueryOptions* _tmp0_ = NULL;
	AfroditeQueryOptions* opt;
	_tmp0_ = afrodite_query_options_new ();
	opt = _tmp0_;
	opt->only_static_factories = TRUE;
	result = opt;
	return result;
}


AfroditeQueryOptions* afrodite_query_options_error_domains (void) {
	AfroditeQueryOptions* result = NULL;
	AfroditeQueryOptions* _tmp0_ = NULL;
	AfroditeQueryOptions* opt;
	_tmp0_ = afrodite_query_options_new ();
	opt = _tmp0_;
	opt->only_error_domains = TRUE;
	result = opt;
	return result;
}


void afrodite_query_options_dump_settings (AfroditeQueryOptions* self) {
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	const gchar* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	g_return_if_fail (self != NULL);
	if (self->auto_member_binding_mode) {
		_tmp0_ = "true";
	} else {
		_tmp0_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:72: Member Binding (autoadapt: %s)", _tmp0_);
	if ((self->binding & AFRODITE_MEMBER_BINDING_INSTANCE) != 0) {
		_tmp1_ = "true";
	} else {
		_tmp1_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:73:     Instance: %s", _tmp1_);
	if ((self->binding & AFRODITE_MEMBER_BINDING_STATIC) != 0) {
		_tmp2_ = "true";
	} else {
		_tmp2_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:74:     Static: %s", _tmp2_);
	if ((self->binding & AFRODITE_MEMBER_BINDING_CLASS) != 0) {
		_tmp3_ = "true";
	} else {
		_tmp3_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:75:     Class: %s", _tmp3_);
	afrodite_utils_trace ("queryoptions.vala:77: Scope");
	if ((self->access & AFRODITE_SYMBOL_ACCESSIBILITY_PRIVATE) != 0) {
		_tmp4_ = "true";
	} else {
		_tmp4_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:78:     Private: %s", _tmp4_);
	if ((self->access & AFRODITE_SYMBOL_ACCESSIBILITY_PROTECTED) != 0) {
		_tmp5_ = "true";
	} else {
		_tmp5_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:79:     Protected: %s", _tmp5_);
	if ((self->access & AFRODITE_SYMBOL_ACCESSIBILITY_INTERNAL) != 0) {
		_tmp6_ = "true";
	} else {
		_tmp6_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:80:     Internal: %s", _tmp6_);
	if ((self->access & AFRODITE_SYMBOL_ACCESSIBILITY_PUBLIC) != 0) {
		_tmp7_ = "true";
	} else {
		_tmp7_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:81:     Public: %s", _tmp7_);
	if (self->all_symbols) {
		_tmp8_ = "true";
	} else {
		_tmp8_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:83: All symbols.............: %s", _tmp8_);
	if (self->only_error_domains) {
		_tmp9_ = "true";
	} else {
		_tmp9_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:84: Error domains only......: %s", _tmp9_);
	if (self->only_static_factories) {
		_tmp10_ = "true";
	} else {
		_tmp10_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:85: Static factories only...: %s", _tmp10_);
	if (self->only_creation_methods) {
		_tmp11_ = "true";
	} else {
		_tmp11_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:86: Creation methods only...: %s", _tmp11_);
	if (self->exclude_creation_methods) {
		_tmp12_ = "true";
	} else {
		_tmp12_ = "false";
	}
	afrodite_utils_trace ("queryoptions.vala:87: Creation methods exclude: %s", _tmp12_);
}


AfroditeQueryOptions* afrodite_query_options_construct (GType object_type) {
	AfroditeQueryOptions* self = NULL;
	self = (AfroditeQueryOptions*) g_type_create_instance (object_type);
	return self;
}


AfroditeQueryOptions* afrodite_query_options_new (void) {
	return afrodite_query_options_construct (AFRODITE_TYPE_QUERY_OPTIONS);
}


static void afrodite_value_query_options_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void afrodite_value_query_options_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		afrodite_query_options_unref (value->data[0].v_pointer);
	}
}


static void afrodite_value_query_options_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = afrodite_query_options_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer afrodite_value_query_options_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* afrodite_value_query_options_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		AfroditeQueryOptions* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = afrodite_query_options_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* afrodite_value_query_options_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	AfroditeQueryOptions** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = afrodite_query_options_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* afrodite_param_spec_query_options (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	AfroditeParamSpecQueryOptions* spec;
	g_return_val_if_fail (g_type_is_a (object_type, AFRODITE_TYPE_QUERY_OPTIONS), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer afrodite_value_get_query_options (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_QUERY_OPTIONS), NULL);
	return value->data[0].v_pointer;
}


void afrodite_value_set_query_options (GValue* value, gpointer v_object) {
	AfroditeQueryOptions* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_QUERY_OPTIONS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_QUERY_OPTIONS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		afrodite_query_options_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		afrodite_query_options_unref (old);
	}
}


void afrodite_value_take_query_options (GValue* value, gpointer v_object) {
	AfroditeQueryOptions* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_QUERY_OPTIONS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_QUERY_OPTIONS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		afrodite_query_options_unref (old);
	}
}


static void afrodite_query_options_class_init (AfroditeQueryOptionsClass * klass) {
	afrodite_query_options_parent_class = g_type_class_peek_parent (klass);
	AFRODITE_QUERY_OPTIONS_CLASS (klass)->finalize = afrodite_query_options_finalize;
}


static void afrodite_query_options_instance_init (AfroditeQueryOptions * self) {
	self->all_symbols = FALSE;
	self->only_creation_methods = FALSE;
	self->only_static_factories = FALSE;
	self->only_error_domains = FALSE;
	self->exclude_creation_methods = TRUE;
	self->exclude_code_node = TRUE;
	self->access = AFRODITE_SYMBOL_ACCESSIBILITY_ANY;
	self->auto_member_binding_mode = TRUE;
	self->binding = AFRODITE_MEMBER_BINDING_ANY;
	self->compare_mode = AFRODITE_COMPARE_MODE_EXACT;
	self->ref_count = 1;
}


static void afrodite_query_options_finalize (AfroditeQueryOptions* obj) {
	AfroditeQueryOptions * self;
	self = AFRODITE_QUERY_OPTIONS (obj);
}


GType afrodite_query_options_get_type (void) {
	static volatile gsize afrodite_query_options_type_id__volatile = 0;
	if (g_once_init_enter (&afrodite_query_options_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { afrodite_value_query_options_init, afrodite_value_query_options_free_value, afrodite_value_query_options_copy_value, afrodite_value_query_options_peek_pointer, "p", afrodite_value_query_options_collect_value, "p", afrodite_value_query_options_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (AfroditeQueryOptionsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_query_options_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeQueryOptions), 0, (GInstanceInitFunc) afrodite_query_options_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType afrodite_query_options_type_id;
		afrodite_query_options_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeQueryOptions", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&afrodite_query_options_type_id__volatile, afrodite_query_options_type_id);
	}
	return afrodite_query_options_type_id__volatile;
}


gpointer afrodite_query_options_ref (gpointer instance) {
	AfroditeQueryOptions* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void afrodite_query_options_unref (gpointer instance) {
	AfroditeQueryOptions* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		AFRODITE_QUERY_OPTIONS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



