/* hashutils.c generated by valac 0.30.0.38-a55d, the Vala compiler
 * generated from hashutils.vala, do not modify */

/*
 * This file is part of gnome-code-assistance.
 *
 * Copyright (C) 2013 - Jesse van den Kieboom
 *
 * gnome-code-assistance 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.
 *
 * gnome-code-assistance 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gnome-code-assistance.  If not, see <http://www.gnu.org/licenses/>.
 */

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


#define TYPE_HASH_UTILS (hash_utils_get_type ())
#define HASH_UTILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_UTILS, HashUtils))
#define HASH_UTILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_UTILS, HashUtilsClass))
#define IS_HASH_UTILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_UTILS))
#define IS_HASH_UTILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_UTILS))
#define HASH_UTILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_UTILS, HashUtilsClass))

typedef struct _HashUtils HashUtils;
typedef struct _HashUtilsClass HashUtilsClass;
typedef struct _HashUtilsPrivate HashUtilsPrivate;

#define HASH_UTILS_TYPE_FILE (hash_utils_file_get_type ())
#define HASH_UTILS_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HASH_UTILS_TYPE_FILE, HashUtilsFile))
#define HASH_UTILS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HASH_UTILS_TYPE_FILE, HashUtilsFileClass))
#define HASH_UTILS_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HASH_UTILS_TYPE_FILE))
#define HASH_UTILS_IS_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HASH_UTILS_TYPE_FILE))
#define HASH_UTILS_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HASH_UTILS_TYPE_FILE, HashUtilsFileClass))

typedef struct _HashUtilsFile HashUtilsFile;
typedef struct _HashUtilsFileClass HashUtilsFileClass;
typedef struct _HashUtilsFilePrivate HashUtilsFilePrivate;
typedef struct _HashUtilsParamSpecFile HashUtilsParamSpecFile;
typedef struct _ParamSpecHashUtils ParamSpecHashUtils;

struct _HashUtils {
	GTypeInstance parent_instance;
	volatile int ref_count;
	HashUtilsPrivate * priv;
};

struct _HashUtilsClass {
	GTypeClass parent_class;
	void (*finalize) (HashUtils *self);
};

struct _HashUtilsFile {
	GTypeInstance parent_instance;
	volatile int ref_count;
	HashUtilsFilePrivate * priv;
};

struct _HashUtilsFileClass {
	GTypeClass parent_class;
	void (*finalize) (HashUtilsFile *self);
};

struct _HashUtilsParamSpecFile {
	GParamSpec parent_instance;
};

struct _ParamSpecHashUtils {
	GParamSpec parent_instance;
};


static gpointer hash_utils_parent_class = NULL;
static gpointer hash_utils_file_parent_class = NULL;

gpointer hash_utils_ref (gpointer instance);
void hash_utils_unref (gpointer instance);
GParamSpec* param_spec_hash_utils (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_hash_utils (GValue* value, gpointer v_object);
void value_take_hash_utils (GValue* value, gpointer v_object);
gpointer value_get_hash_utils (const GValue* value);
GType hash_utils_get_type (void) G_GNUC_CONST;
enum  {
	HASH_UTILS_DUMMY_PROPERTY
};
HashUtils* hash_utils_new (void);
HashUtils* hash_utils_construct (GType object_type);
gpointer hash_utils_file_ref (gpointer instance);
void hash_utils_file_unref (gpointer instance);
GParamSpec* hash_utils_param_spec_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void hash_utils_value_set_file (GValue* value, gpointer v_object);
void hash_utils_value_take_file (GValue* value, gpointer v_object);
gpointer hash_utils_value_get_file (const GValue* value);
GType hash_utils_file_get_type (void) G_GNUC_CONST;
enum  {
	HASH_UTILS_FILE_DUMMY_PROPERTY
};
guint hash_utils_file_hash (GFile* f);
gboolean hash_utils_file_equal (GFile* f1, GFile* f2);
HashUtilsFile* hash_utils_file_new (void);
HashUtilsFile* hash_utils_file_construct (GType object_type);
static void hash_utils_file_finalize (HashUtilsFile* obj);
static void hash_utils_finalize (HashUtils* obj);


HashUtils* hash_utils_construct (GType object_type) {
	HashUtils* self = NULL;
	self = (HashUtils*) g_type_create_instance (object_type);
	return self;
}


HashUtils* hash_utils_new (void) {
	return hash_utils_construct (TYPE_HASH_UTILS);
}


guint hash_utils_file_hash (GFile* f) {
	guint result = 0U;
	GFile* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	g_return_val_if_fail (f != NULL, 0U);
	_tmp0_ = f;
	_tmp1_ = g_file_hash (_tmp0_);
	result = _tmp1_;
	return result;
}


gboolean hash_utils_file_equal (GFile* f1, GFile* f2) {
	gboolean result = FALSE;
	GFile* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_val_if_fail (f1 != NULL, FALSE);
	g_return_val_if_fail (f2 != NULL, FALSE);
	_tmp0_ = f1;
	_tmp1_ = f2;
	_tmp2_ = g_file_equal (_tmp0_, _tmp1_);
	result = _tmp2_;
	return result;
}


HashUtilsFile* hash_utils_file_construct (GType object_type) {
	HashUtilsFile* self = NULL;
	self = (HashUtilsFile*) g_type_create_instance (object_type);
	return self;
}


HashUtilsFile* hash_utils_file_new (void) {
	return hash_utils_file_construct (HASH_UTILS_TYPE_FILE);
}


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


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


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


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


static gchar* hash_utils_value_file_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		HashUtilsFile* 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 = hash_utils_file_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* hash_utils_value_file_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	HashUtilsFile** 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 = hash_utils_file_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* hash_utils_param_spec_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	HashUtilsParamSpecFile* spec;
	g_return_val_if_fail (g_type_is_a (object_type, HASH_UTILS_TYPE_FILE), 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 hash_utils_value_get_file (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, HASH_UTILS_TYPE_FILE), NULL);
	return value->data[0].v_pointer;
}


void hash_utils_value_set_file (GValue* value, gpointer v_object) {
	HashUtilsFile* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, HASH_UTILS_TYPE_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, HASH_UTILS_TYPE_FILE));
		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;
		hash_utils_file_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		hash_utils_file_unref (old);
	}
}


void hash_utils_value_take_file (GValue* value, gpointer v_object) {
	HashUtilsFile* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, HASH_UTILS_TYPE_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, HASH_UTILS_TYPE_FILE));
		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) {
		hash_utils_file_unref (old);
	}
}


static void hash_utils_file_class_init (HashUtilsFileClass * klass) {
	hash_utils_file_parent_class = g_type_class_peek_parent (klass);
	((HashUtilsFileClass *) klass)->finalize = hash_utils_file_finalize;
}


static void hash_utils_file_instance_init (HashUtilsFile * self) {
	self->ref_count = 1;
}


static void hash_utils_file_finalize (HashUtilsFile* obj) {
	HashUtilsFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, HASH_UTILS_TYPE_FILE, HashUtilsFile);
	g_signal_handlers_destroy (self);
}


GType hash_utils_file_get_type (void) {
	static volatile gsize hash_utils_file_type_id__volatile = 0;
	if (g_once_init_enter (&hash_utils_file_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { hash_utils_value_file_init, hash_utils_value_file_free_value, hash_utils_value_file_copy_value, hash_utils_value_file_peek_pointer, "p", hash_utils_value_file_collect_value, "p", hash_utils_value_file_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (HashUtilsFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_utils_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashUtilsFile), 0, (GInstanceInitFunc) hash_utils_file_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 hash_utils_file_type_id;
		hash_utils_file_type_id = g_type_register_fundamental (g_type_fundamental_next (), "HashUtilsFile", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&hash_utils_file_type_id__volatile, hash_utils_file_type_id);
	}
	return hash_utils_file_type_id__volatile;
}


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


void hash_utils_file_unref (gpointer instance) {
	HashUtilsFile* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		HASH_UTILS_FILE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


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


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


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


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


static gchar* value_hash_utils_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		HashUtils* 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 = hash_utils_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_hash_utils_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	HashUtils** 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 = hash_utils_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_hash_utils (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecHashUtils* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_HASH_UTILS), 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 value_get_hash_utils (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_HASH_UTILS), NULL);
	return value->data[0].v_pointer;
}


void value_set_hash_utils (GValue* value, gpointer v_object) {
	HashUtils* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_HASH_UTILS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_HASH_UTILS));
		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;
		hash_utils_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		hash_utils_unref (old);
	}
}


void value_take_hash_utils (GValue* value, gpointer v_object) {
	HashUtils* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_HASH_UTILS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_HASH_UTILS));
		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) {
		hash_utils_unref (old);
	}
}


static void hash_utils_class_init (HashUtilsClass * klass) {
	hash_utils_parent_class = g_type_class_peek_parent (klass);
	((HashUtilsClass *) klass)->finalize = hash_utils_finalize;
}


static void hash_utils_instance_init (HashUtils * self) {
	self->ref_count = 1;
}


static void hash_utils_finalize (HashUtils* obj) {
	HashUtils * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_HASH_UTILS, HashUtils);
	g_signal_handlers_destroy (self);
}


GType hash_utils_get_type (void) {
	static volatile gsize hash_utils_type_id__volatile = 0;
	if (g_once_init_enter (&hash_utils_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_hash_utils_init, value_hash_utils_free_value, value_hash_utils_copy_value, value_hash_utils_peek_pointer, "p", value_hash_utils_collect_value, "p", value_hash_utils_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (HashUtilsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_utils_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashUtils), 0, (GInstanceInitFunc) hash_utils_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 hash_utils_type_id;
		hash_utils_type_id = g_type_register_fundamental (g_type_fundamental_next (), "HashUtils", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&hash_utils_type_id__volatile, hash_utils_type_id);
	}
	return hash_utils_type_id__volatile;
}


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


void hash_utils_unref (gpointer instance) {
	HashUtils* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		HASH_UTILS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



