/* gca-source-index.c generated by valac 0.27.1, the Vala compiler
 * generated from gca-source-index.vala, do not modify */

/*
 * This file is part of gedit-code-assistant.
 *
 * Copyright (C) 2011 - Jesse van den Kieboom
 *
 * gedit-code-assistant 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.
 *
 * gedit-code-assistant 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 gedit-code-assistant.  If not, see <http://www.gnu.org/licenses/>.
 */

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


#define GCA_TYPE_SOURCE_INDEX (gca_source_index_get_type ())
#define GCA_SOURCE_INDEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_SOURCE_INDEX, GcaSourceIndex))
#define GCA_SOURCE_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_SOURCE_INDEX, GcaSourceIndexClass))
#define GCA_IS_SOURCE_INDEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_SOURCE_INDEX))
#define GCA_IS_SOURCE_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_SOURCE_INDEX))
#define GCA_SOURCE_INDEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_SOURCE_INDEX, GcaSourceIndexClass))

typedef struct _GcaSourceIndex GcaSourceIndex;
typedef struct _GcaSourceIndexClass GcaSourceIndexClass;
typedef struct _GcaSourceIndexPrivate GcaSourceIndexPrivate;

#define GCA_SOURCE_INDEX_TYPE_WRAPPER (gca_source_index_wrapper_get_type ())
#define GCA_SOURCE_INDEX_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_SOURCE_INDEX_TYPE_WRAPPER, GcaSourceIndexWrapper))
#define GCA_SOURCE_INDEX_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_SOURCE_INDEX_TYPE_WRAPPER, GcaSourceIndexWrapperClass))
#define GCA_SOURCE_INDEX_IS_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_SOURCE_INDEX_TYPE_WRAPPER))
#define GCA_SOURCE_INDEX_IS_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_SOURCE_INDEX_TYPE_WRAPPER))
#define GCA_SOURCE_INDEX_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_SOURCE_INDEX_TYPE_WRAPPER, GcaSourceIndexWrapperClass))

typedef struct _GcaSourceIndexWrapper GcaSourceIndexWrapper;
typedef struct _GcaSourceIndexWrapperClass GcaSourceIndexWrapperClass;

#define GCA_SOURCE_INDEX_TYPE_FIND_FLAGS (gca_source_index_find_flags_get_type ())
#define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL)))

#define GCA_TYPE_SOURCE_RANGE_SUPPORT (gca_source_range_support_get_type ())
#define GCA_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_SOURCE_RANGE_SUPPORT, GcaSourceRangeSupport))
#define GCA_IS_SOURCE_RANGE_SUPPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_SOURCE_RANGE_SUPPORT))
#define GCA_SOURCE_RANGE_SUPPORT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GCA_TYPE_SOURCE_RANGE_SUPPORT, GcaSourceRangeSupportIface))

typedef struct _GcaSourceRangeSupport GcaSourceRangeSupport;
typedef struct _GcaSourceRangeSupportIface GcaSourceRangeSupportIface;

#define GCA_TYPE_SOURCE_RANGE (gca_source_range_get_type ())

#define GCA_TYPE_SOURCE_LOCATION (gca_source_location_get_type ())
typedef struct _GcaSourceLocation GcaSourceLocation;
typedef struct _GcaSourceRange GcaSourceRange;
typedef struct _GcaSourceIndexWrapperPrivate GcaSourceIndexWrapperPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GCA_SOURCE_INDEX_TYPE_ITERATOR (gca_source_index_iterator_get_type ())
#define GCA_SOURCE_INDEX_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIterator))
#define GCA_SOURCE_INDEX_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIteratorClass))
#define GCA_SOURCE_INDEX_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_SOURCE_INDEX_TYPE_ITERATOR))
#define GCA_SOURCE_INDEX_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_SOURCE_INDEX_TYPE_ITERATOR))
#define GCA_SOURCE_INDEX_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIteratorClass))

typedef struct _GcaSourceIndexIterator GcaSourceIndexIterator;
typedef struct _GcaSourceIndexIteratorClass GcaSourceIndexIteratorClass;
typedef struct _GcaSourceIndexIteratorPrivate GcaSourceIndexIteratorPrivate;

struct _GcaSourceIndex {
	GObject parent_instance;
	GcaSourceIndexPrivate * priv;
};

struct _GcaSourceIndexClass {
	GObjectClass parent_class;
};

struct _GcaSourceIndexPrivate {
	GType t_type;
	GBoxedCopyFunc t_dup_func;
	GDestroyNotify t_destroy_func;
	GSequence* d_index;
};

typedef enum  {
	GCA_SOURCE_INDEX_FIND_FLAGS_NONE = 0,
	GCA_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY = 1 << 0,
	GCA_SOURCE_INDEX_FIND_FLAGS_INNER_MOST = 1 << 1
} GcaSourceIndexFindFlags;

struct _GcaSourceLocation {
	gint line;
	gint column;
};

struct _GcaSourceRange {
	GcaSourceLocation start;
	GcaSourceLocation end;
};

struct _GcaSourceRangeSupportIface {
	GTypeInterface parent_iface;
	GcaSourceRange* (*get_ranges) (GcaSourceRangeSupport* self, int* result_length1);
};

typedef void (*GcaSourceIndexWrapEachFunc) (GcaSourceIndexWrapper* wrapper, void* user_data);
struct _GcaSourceIndexWrapper {
	GObject parent_instance;
	GcaSourceIndexWrapperPrivate * priv;
	GcaSourceRangeSupport* obj;
	GcaSourceRange range;
	gint idx;
	gboolean encapsulated;
};

struct _GcaSourceIndexWrapperClass {
	GObjectClass parent_class;
};

struct _GcaSourceIndexIterator {
	GObject parent_instance;
	GcaSourceIndexIteratorPrivate * priv;
};

struct _GcaSourceIndexIteratorClass {
	GObjectClass parent_class;
};

struct _GcaSourceIndexIteratorPrivate {
	GType t_type;
	GBoxedCopyFunc t_dup_func;
	GDestroyNotify t_destroy_func;
	GSequenceIter* d_iter;
	gboolean d_first;
};


static gpointer gca_source_index_parent_class = NULL;
static gpointer gca_source_index_wrapper_parent_class = NULL;
static gpointer gca_source_index_iterator_parent_class = NULL;

GType gca_source_index_get_type (void) G_GNUC_CONST;
GType gca_source_index_wrapper_get_type (void) G_GNUC_CONST;
#define GCA_SOURCE_INDEX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCA_TYPE_SOURCE_INDEX, GcaSourceIndexPrivate))
enum  {
	GCA_SOURCE_INDEX_DUMMY_PROPERTY,
	GCA_SOURCE_INDEX_T_TYPE,
	GCA_SOURCE_INDEX_T_DUP_FUNC,
	GCA_SOURCE_INDEX_T_DESTROY_FUNC,
	GCA_SOURCE_INDEX_LENGTH
};
static GType gca_source_index_find_flags_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
GType gca_source_range_get_type (void) G_GNUC_CONST;
GType gca_source_location_get_type (void) G_GNUC_CONST;
GcaSourceLocation* gca_source_location_dup (const GcaSourceLocation* self);
void gca_source_location_free (GcaSourceLocation* self);
GcaSourceRange* gca_source_range_dup (const GcaSourceRange* self);
void gca_source_range_free (GcaSourceRange* self);
GType gca_source_range_support_get_type (void) G_GNUC_CONST;
void gca_source_index_add (GcaSourceIndex* self, GcaSourceRangeSupport* range);
static void gca_source_index_wrap_each (GcaSourceIndex* self, GcaSourceRangeSupport* range, GcaSourceIndexWrapEachFunc func, void* func_target);
static void __lambda12_ (GcaSourceIndex* self, GcaSourceIndexWrapper* wrapper);
static gint gca_source_index_compare_func (GcaSourceIndex* self, GcaSourceIndexWrapper* a, GcaSourceIndexWrapper* b);
static gint _gca_source_index_compare_func_gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
gboolean gca_source_range_contains_range (GcaSourceRange *self, GcaSourceRange* range);
static void ___lambda12__gca_source_index_wrap_each_func (GcaSourceIndexWrapper* wrapper, gpointer self);
GcaSourceRange* gca_source_range_support_get_ranges (GcaSourceRangeSupport* self, int* result_length1);
GcaSourceIndexWrapper* gca_source_index_wrapper_new (GcaSourceRangeSupport* obj, GcaSourceRange* range, gint idx);
GcaSourceIndexWrapper* gca_source_index_wrapper_construct (GType object_type, GcaSourceRangeSupport* obj, GcaSourceRange* range, gint idx);
gpointer* gca_source_index_find_at_line (GcaSourceIndex* self, gint line, int* result_length1);
static gpointer* gca_source_index_find_at_priv (GcaSourceIndex* self, GcaSourceRange* range, GcaSourceIndexFindFlags flags, int* result_length1);
void gca_source_location_to_range (GcaSourceLocation *self, GcaSourceRange* result);
gpointer* gca_source_index_find_at (GcaSourceIndex* self, GcaSourceRange* range, int* result_length1);
static gboolean gca_source_index_find_at_condition (GcaSourceIndex* self, GcaSourceIndexWrapper* wrapper, GcaSourceRange* range, GcaSourceIndexFindFlags flags);
gboolean gca_source_range_contains_line (GcaSourceRange *self, gint line);
void gca_source_index_clear (GcaSourceIndex* self);
gint gca_source_range_compare_to (GcaSourceRange *self, GcaSourceRange* other);
GType gca_source_index_iterator_get_type (void) G_GNUC_CONST;
GcaSourceIndexIterator* gca_source_index_iterator (GcaSourceIndex* self);
GcaSourceIndexIterator* gca_source_index_iterator_new (GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func, GSequenceIter* iter);
GcaSourceIndexIterator* gca_source_index_iterator_construct (GType object_type, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func, GSequenceIter* iter);
GcaSourceIndex* gca_source_index_new (GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func);
GcaSourceIndex* gca_source_index_construct (GType object_type, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func);
gint gca_source_index_get_length (GcaSourceIndex* self);
static GObject * gca_source_index_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _g_object_unref0_ (gpointer var);
enum  {
	GCA_SOURCE_INDEX_WRAPPER_DUMMY_PROPERTY
};
static void gca_source_index_wrapper_finalize (GObject* obj);
#define GCA_SOURCE_INDEX_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIteratorPrivate))
enum  {
	GCA_SOURCE_INDEX_ITERATOR_DUMMY_PROPERTY,
	GCA_SOURCE_INDEX_ITERATOR_T_TYPE,
	GCA_SOURCE_INDEX_ITERATOR_T_DUP_FUNC,
	GCA_SOURCE_INDEX_ITERATOR_T_DESTROY_FUNC
};
gboolean gca_source_index_iterator_next (GcaSourceIndexIterator* self);
gpointer gca_source_index_iterator_get (GcaSourceIndexIterator* self);
static void gca_source_index_iterator_finalize (GObject* obj);
static void _vala_gca_source_index_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gca_source_index_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void gca_source_index_finalize (GObject* obj);
static void _vala_gca_source_index_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gca_source_index_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static GType gca_source_index_find_flags_get_type (void) {
	static volatile gsize gca_source_index_find_flags_type_id__volatile = 0;
	if (g_once_init_enter (&gca_source_index_find_flags_type_id__volatile)) {
		static const GFlagsValue values[] = {{GCA_SOURCE_INDEX_FIND_FLAGS_NONE, "GCA_SOURCE_INDEX_FIND_FLAGS_NONE", "none"}, {GCA_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY, "GCA_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY", "line-only"}, {GCA_SOURCE_INDEX_FIND_FLAGS_INNER_MOST, "GCA_SOURCE_INDEX_FIND_FLAGS_INNER_MOST", "inner-most"}, {0, NULL, NULL}};
		GType gca_source_index_find_flags_type_id;
		gca_source_index_find_flags_type_id = g_flags_register_static ("GcaSourceIndexFindFlags", values);
		g_once_init_leave (&gca_source_index_find_flags_type_id__volatile, gca_source_index_find_flags_type_id);
	}
	return gca_source_index_find_flags_type_id__volatile;
}


static gint _gca_source_index_compare_func_gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
	gint result;
	result = gca_source_index_compare_func ((GcaSourceIndex*) self, (GcaSourceIndexWrapper*) a, (GcaSourceIndexWrapper*) b);
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void __lambda12_ (GcaSourceIndex* self, GcaSourceIndexWrapper* wrapper) {
	GSequenceIter* iter = NULL;
	GSequence* _tmp0_ = NULL;
	GcaSourceIndexWrapper* _tmp1_ = NULL;
	GSequenceIter* _tmp2_ = NULL;
	GSequenceIter* prev = NULL;
	GSequenceIter* _tmp3_ = NULL;
	GSequenceIter* _tmp17_ = NULL;
	GcaSourceIndexWrapper* _tmp18_ = NULL;
	GcaSourceIndexWrapper* _tmp19_ = NULL;
	GSequenceIter* _tmp20_ = NULL;
	g_return_if_fail (wrapper != NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = wrapper;
	_tmp2_ = g_sequence_search (_tmp0_, _tmp1_, _gca_source_index_compare_func_gcompare_data_func, self);
	iter = _tmp2_;
	_tmp3_ = iter;
	prev = _tmp3_;
	while (TRUE) {
		GSequenceIter* _tmp4_ = NULL;
		gboolean _tmp5_ = FALSE;
		GSequenceIter* _tmp6_ = NULL;
		GSequenceIter* _tmp7_ = NULL;
		GSequenceIter* _tmp8_ = NULL;
		gconstpointer _tmp9_ = NULL;
		GcaSourceIndexWrapper* _tmp10_ = NULL;
		GcaSourceRange _tmp11_ = {0};
		gboolean _tmp12_ = FALSE;
		GSequenceIter* _tmp14_ = NULL;
		gconstpointer _tmp15_ = NULL;
		gboolean _tmp16_ = FALSE;
		_tmp4_ = prev;
		_tmp5_ = g_sequence_iter_is_begin (_tmp4_);
		if (!(!_tmp5_)) {
			break;
		}
		_tmp6_ = prev;
		_tmp7_ = g_sequence_iter_prev (_tmp6_);
		prev = _tmp7_;
		_tmp8_ = prev;
		_tmp9_ = g_sequence_get (_tmp8_);
		_tmp10_ = wrapper;
		_tmp11_ = _tmp10_->range;
		_tmp12_ = gca_source_range_contains_range (&((GcaSourceIndexWrapper*) _tmp9_)->range, &_tmp11_);
		if (_tmp12_) {
			GcaSourceIndexWrapper* _tmp13_ = NULL;
			_tmp13_ = wrapper;
			_tmp13_->encapsulated = TRUE;
			break;
		}
		_tmp14_ = prev;
		_tmp15_ = g_sequence_get (_tmp14_);
		_tmp16_ = ((GcaSourceIndexWrapper*) _tmp15_)->encapsulated;
		if (!_tmp16_) {
			break;
		}
	}
	_tmp17_ = iter;
	_tmp18_ = wrapper;
	_tmp19_ = _g_object_ref0 (_tmp18_);
	_tmp20_ = g_sequence_insert_before (_tmp17_, _tmp19_);
	iter = _tmp20_;
	while (TRUE) {
		gboolean _tmp21_ = FALSE;
		GSequenceIter* _tmp22_ = NULL;
		gboolean _tmp23_ = FALSE;
		GSequenceIter* _tmp29_ = NULL;
		gconstpointer _tmp30_ = NULL;
		GSequenceIter* _tmp31_ = NULL;
		GSequenceIter* _tmp32_ = NULL;
		_tmp22_ = iter;
		_tmp23_ = g_sequence_iter_is_end (_tmp22_);
		if (!_tmp23_) {
			GcaSourceIndexWrapper* _tmp24_ = NULL;
			GSequenceIter* _tmp25_ = NULL;
			gconstpointer _tmp26_ = NULL;
			GcaSourceRange _tmp27_ = {0};
			gboolean _tmp28_ = FALSE;
			_tmp24_ = wrapper;
			_tmp25_ = iter;
			_tmp26_ = g_sequence_get (_tmp25_);
			_tmp27_ = ((GcaSourceIndexWrapper*) _tmp26_)->range;
			_tmp28_ = gca_source_range_contains_range (&_tmp24_->range, &_tmp27_);
			_tmp21_ = _tmp28_;
		} else {
			_tmp21_ = FALSE;
		}
		if (!_tmp21_) {
			break;
		}
		_tmp29_ = iter;
		_tmp30_ = g_sequence_get (_tmp29_);
		((GcaSourceIndexWrapper*) _tmp30_)->encapsulated = TRUE;
		_tmp31_ = iter;
		_tmp32_ = g_sequence_iter_next (_tmp31_);
		iter = _tmp32_;
	}
}


static void ___lambda12__gca_source_index_wrap_each_func (GcaSourceIndexWrapper* wrapper, gpointer self) {
	__lambda12_ ((GcaSourceIndex*) self, wrapper);
}


void gca_source_index_add (GcaSourceIndex* self, GcaSourceRangeSupport* range) {
	GcaSourceRangeSupport* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (range != NULL);
	_tmp0_ = range;
	gca_source_index_wrap_each (self, _tmp0_, ___lambda12__gca_source_index_wrap_each_func, self);
}


static void gca_source_index_wrap_each (GcaSourceIndex* self, GcaSourceRangeSupport* range, GcaSourceIndexWrapEachFunc func, void* func_target) {
	GcaSourceRange* ranges = NULL;
	GcaSourceRangeSupport* _tmp0_ = NULL;
	GcaSourceRange* _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	GcaSourceRange* _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	gint ranges_length1 = 0;
	gint _ranges_size_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (range != NULL);
	_tmp0_ = range;
	_tmp1_ = gca_source_range_support_get_ranges (_tmp0_, &_tmp1__length1);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	ranges = _tmp2_;
	ranges_length1 = _tmp2__length1;
	_ranges_size_ = ranges_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_ = 0;
				GcaSourceRange* _tmp6_ = NULL;
				gint _tmp6__length1 = 0;
				GcaSourceIndexWrapEachFunc _tmp7_ = NULL;
				void* _tmp7__target = NULL;
				GcaSourceRangeSupport* _tmp8_ = NULL;
				GcaSourceRange* _tmp9_ = NULL;
				gint _tmp9__length1 = 0;
				gint _tmp10_ = 0;
				GcaSourceRange _tmp11_ = {0};
				gint _tmp12_ = 0;
				GcaSourceIndexWrapper* _tmp13_ = NULL;
				GcaSourceIndexWrapper* _tmp14_ = NULL;
				if (!_tmp3_) {
					gint _tmp4_ = 0;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = i;
				_tmp6_ = ranges;
				_tmp6__length1 = ranges_length1;
				if (!(_tmp5_ < _tmp6__length1)) {
					break;
				}
				_tmp7_ = func;
				_tmp7__target = func_target;
				_tmp8_ = range;
				_tmp9_ = ranges;
				_tmp9__length1 = ranges_length1;
				_tmp10_ = i;
				_tmp11_ = _tmp9_[_tmp10_];
				_tmp12_ = i;
				_tmp13_ = gca_source_index_wrapper_new (_tmp8_, &_tmp11_, _tmp12_);
				_tmp14_ = _tmp13_;
				_tmp7_ (_tmp14_, _tmp7__target);
				_g_object_unref0 (_tmp14_);
			}
		}
	}
	ranges = (g_free (ranges), NULL);
}


gpointer* gca_source_index_find_at_line (GcaSourceIndex* self, gint line, int* result_length1) {
	gpointer* result = NULL;
	GcaSourceLocation loc = {0};
	gint _tmp0_ = 0;
	GcaSourceLocation _tmp1_ = {0};
	GcaSourceRange _tmp2_ = {0};
	gint _tmp3_ = 0;
	gpointer* _tmp4_ = NULL;
	gpointer* _tmp5_ = NULL;
	gint _tmp5__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = line;
	memset (&_tmp1_, 0, sizeof (GcaSourceLocation));
	_tmp1_.line = _tmp0_;
	_tmp1_.column = 0;
	loc = _tmp1_;
	gca_source_location_to_range (&loc, &_tmp2_);
	_tmp4_ = gca_source_index_find_at_priv (self, &_tmp2_, GCA_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY, &_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp5__length1 = _tmp3_;
	if (result_length1) {
		*result_length1 = _tmp5__length1;
	}
	result = _tmp5_;
	return result;
}


gpointer* gca_source_index_find_at (GcaSourceIndex* self, GcaSourceRange* range, int* result_length1) {
	gpointer* result = NULL;
	GcaSourceRange _tmp0_ = {0};
	gint _tmp1_ = 0;
	gpointer* _tmp2_ = NULL;
	gpointer* _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (range != NULL, NULL);
	_tmp0_ = *range;
	_tmp2_ = gca_source_index_find_at_priv (self, &_tmp0_, GCA_SOURCE_INDEX_FIND_FLAGS_NONE, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}


static gboolean gca_source_index_find_at_condition (GcaSourceIndex* self, GcaSourceIndexWrapper* wrapper, GcaSourceRange* range, GcaSourceIndexFindFlags flags) {
	gboolean result = FALSE;
	gboolean lineonly = FALSE;
	GcaSourceIndexFindFlags _tmp0_ = 0;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (wrapper != NULL, FALSE);
	g_return_val_if_fail (range != NULL, FALSE);
	_tmp0_ = flags;
	lineonly = (_tmp0_ & GCA_SOURCE_INDEX_FIND_FLAGS_LINE_ONLY) != 0;
	_tmp1_ = lineonly;
	if (_tmp1_) {
		gboolean _tmp2_ = FALSE;
		GcaSourceIndexWrapper* _tmp3_ = NULL;
		GcaSourceRange _tmp4_ = {0};
		GcaSourceLocation _tmp5_ = {0};
		gint _tmp6_ = 0;
		gboolean _tmp7_ = FALSE;
		_tmp3_ = wrapper;
		_tmp4_ = *range;
		_tmp5_ = _tmp4_.start;
		_tmp6_ = _tmp5_.line;
		_tmp7_ = gca_source_range_contains_line (&_tmp3_->range, _tmp6_);
		if (_tmp7_) {
			GcaSourceIndexWrapper* _tmp8_ = NULL;
			GcaSourceRange _tmp9_ = {0};
			GcaSourceLocation _tmp10_ = {0};
			gint _tmp11_ = 0;
			gboolean _tmp12_ = FALSE;
			_tmp8_ = wrapper;
			_tmp9_ = *range;
			_tmp10_ = _tmp9_.end;
			_tmp11_ = _tmp10_.line;
			_tmp12_ = gca_source_range_contains_line (&_tmp8_->range, _tmp11_);
			_tmp2_ = _tmp12_;
		} else {
			_tmp2_ = FALSE;
		}
		result = _tmp2_;
		return result;
	} else {
		GcaSourceIndexWrapper* _tmp13_ = NULL;
		GcaSourceRange _tmp14_ = {0};
		gboolean _tmp15_ = FALSE;
		_tmp13_ = wrapper;
		_tmp14_ = *range;
		_tmp15_ = gca_source_range_contains_range (&_tmp13_->range, &_tmp14_);
		result = _tmp15_;
		return result;
	}
}


static gpointer* gca_source_index_find_at_priv (GcaSourceIndex* self, GcaSourceRange* range, GcaSourceIndexFindFlags flags, int* result_length1) {
	gpointer* result = NULL;
	GeeLinkedList* ret = NULL;
	GeeLinkedList* _tmp0_ = NULL;
	GSequenceIter* iter = NULL;
	GeeHashMap* uniq = NULL;
	GeeHashMap* _tmp1_ = NULL;
	GSequence* _tmp2_ = NULL;
	GcaSourceRange _tmp3_ = {0};
	GcaSourceIndexWrapper* _tmp4_ = NULL;
	GcaSourceIndexWrapper* _tmp5_ = NULL;
	GSequenceIter* _tmp6_ = NULL;
	GcaSourceIndexFindFlags _tmp7_ = 0;
	GSequenceIter* _tmp28_ = NULL;
	gboolean _tmp29_ = FALSE;
	GeeLinkedList* _tmp93_ = NULL;
	gint _tmp94_ = 0;
	gpointer* _tmp95_ = NULL;
	gpointer* _tmp96_ = NULL;
	gint _tmp96__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (range != NULL, NULL);
	_tmp0_ = gee_linked_list_new (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	ret = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, g_object_unref, G_TYPE_BOOLEAN, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	uniq = _tmp1_;
	_tmp2_ = self->priv->d_index;
	_tmp3_ = *range;
	_tmp4_ = gca_source_index_wrapper_new (NULL, &_tmp3_, 0);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_sequence_search (_tmp2_, _tmp5_, _gca_source_index_compare_func_gcompare_data_func, self);
	iter = _tmp6_;
	_g_object_unref0 (_tmp5_);
	_tmp7_ = flags;
	if ((_tmp7_ & GCA_SOURCE_INDEX_FIND_FLAGS_INNER_MOST) != 0) {
		gpointer* _tmp26_ = NULL;
		gpointer* _tmp27_ = NULL;
		gint _tmp27__length1 = 0;
		while (TRUE) {
			GSequenceIter* _tmp8_ = NULL;
			gboolean _tmp9_ = FALSE;
			GSequenceIter* _tmp10_ = NULL;
			GSequenceIter* _tmp11_ = NULL;
			GSequenceIter* _tmp12_ = NULL;
			gconstpointer _tmp13_ = NULL;
			GcaSourceRange _tmp14_ = {0};
			GcaSourceIndexFindFlags _tmp15_ = 0;
			gboolean _tmp16_ = FALSE;
			_tmp8_ = iter;
			_tmp9_ = g_sequence_iter_is_begin (_tmp8_);
			if (!(!_tmp9_)) {
				break;
			}
			_tmp10_ = iter;
			_tmp11_ = g_sequence_iter_prev (_tmp10_);
			iter = _tmp11_;
			_tmp12_ = iter;
			_tmp13_ = g_sequence_get (_tmp12_);
			_tmp14_ = *range;
			_tmp15_ = flags;
			_tmp16_ = gca_source_index_find_at_condition (self, (GcaSourceIndexWrapper*) _tmp13_, &_tmp14_, _tmp15_);
			if (_tmp16_) {
				GSequenceIter* _tmp17_ = NULL;
				gconstpointer _tmp18_ = NULL;
				GcaSourceRangeSupport* _tmp19_ = NULL;
				gpointer _tmp20_ = NULL;
				gpointer* _tmp21_ = NULL;
				gpointer* _tmp22_ = NULL;
				gint _tmp22__length1 = 0;
				_tmp17_ = iter;
				_tmp18_ = g_sequence_get (_tmp17_);
				_tmp19_ = ((GcaSourceIndexWrapper*) _tmp18_)->obj;
				_tmp20_ = ((((gconstpointer) _tmp19_) != NULL) && (self->priv->t_dup_func != NULL)) ? self->priv->t_dup_func ((gpointer) ((gconstpointer) _tmp19_)) : ((gpointer) ((gconstpointer) _tmp19_));
				_tmp21_ = g_new0 (gpointer, 1);
				_tmp21_[0] = _tmp20_;
				_tmp22_ = _tmp21_;
				_tmp22__length1 = 1;
				if (result_length1) {
					*result_length1 = _tmp22__length1;
				}
				result = _tmp22_;
				_g_object_unref0 (uniq);
				_g_object_unref0 (ret);
				return result;
			} else {
				GSequenceIter* _tmp23_ = NULL;
				gconstpointer _tmp24_ = NULL;
				gboolean _tmp25_ = FALSE;
				_tmp23_ = iter;
				_tmp24_ = g_sequence_get (_tmp23_);
				_tmp25_ = ((GcaSourceIndexWrapper*) _tmp24_)->encapsulated;
				if (!_tmp25_) {
					break;
				}
			}
		}
		_tmp26_ = g_new0 (gpointer, 0);
		_tmp27_ = _tmp26_;
		_tmp27__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp27__length1;
		}
		result = _tmp27_;
		_g_object_unref0 (uniq);
		_g_object_unref0 (ret);
		return result;
	}
	_tmp28_ = iter;
	_tmp29_ = g_sequence_iter_is_begin (_tmp28_);
	if (!_tmp29_) {
		GSequenceIter* prev = NULL;
		GSequenceIter* _tmp30_ = NULL;
		GSequenceIter* _tmp31_ = NULL;
		_tmp30_ = iter;
		_tmp31_ = g_sequence_iter_prev (_tmp30_);
		prev = _tmp31_;
		while (TRUE) {
			gboolean _tmp32_ = FALSE;
			GSequenceIter* _tmp33_ = NULL;
			gconstpointer _tmp34_ = NULL;
			GcaSourceRange _tmp35_ = {0};
			GcaSourceIndexFindFlags _tmp36_ = 0;
			gboolean _tmp37_ = FALSE;
			GcaSourceRangeSupport* val = NULL;
			GSequenceIter* _tmp41_ = NULL;
			gconstpointer _tmp42_ = NULL;
			GcaSourceRangeSupport* _tmp43_ = NULL;
			GcaSourceRangeSupport* _tmp44_ = NULL;
			gboolean _tmp45_ = FALSE;
			GSequenceIter* _tmp46_ = NULL;
			gconstpointer _tmp47_ = NULL;
			GcaSourceRange _tmp48_ = {0};
			GcaSourceIndexFindFlags _tmp49_ = 0;
			gboolean _tmp50_ = FALSE;
			GSequenceIter* _tmp58_ = NULL;
			gboolean _tmp59_ = FALSE;
			GSequenceIter* _tmp60_ = NULL;
			GSequenceIter* _tmp61_ = NULL;
			_tmp33_ = prev;
			_tmp34_ = g_sequence_get (_tmp33_);
			_tmp35_ = *range;
			_tmp36_ = flags;
			_tmp37_ = gca_source_index_find_at_condition (self, (GcaSourceIndexWrapper*) _tmp34_, &_tmp35_, _tmp36_);
			if (_tmp37_) {
				_tmp32_ = TRUE;
			} else {
				GSequenceIter* _tmp38_ = NULL;
				gconstpointer _tmp39_ = NULL;
				gboolean _tmp40_ = FALSE;
				_tmp38_ = prev;
				_tmp39_ = g_sequence_get (_tmp38_);
				_tmp40_ = ((GcaSourceIndexWrapper*) _tmp39_)->encapsulated;
				_tmp32_ = _tmp40_;
			}
			if (!_tmp32_) {
				break;
			}
			_tmp41_ = prev;
			_tmp42_ = g_sequence_get (_tmp41_);
			_tmp43_ = ((GcaSourceIndexWrapper*) _tmp42_)->obj;
			_tmp44_ = _g_object_ref0 (_tmp43_);
			val = _tmp44_;
			_tmp46_ = prev;
			_tmp47_ = g_sequence_get (_tmp46_);
			_tmp48_ = *range;
			_tmp49_ = flags;
			_tmp50_ = gca_source_index_find_at_condition (self, (GcaSourceIndexWrapper*) _tmp47_, &_tmp48_, _tmp49_);
			if (_tmp50_) {
				GeeHashMap* _tmp51_ = NULL;
				GcaSourceRangeSupport* _tmp52_ = NULL;
				gboolean _tmp53_ = FALSE;
				_tmp51_ = uniq;
				_tmp52_ = val;
				_tmp53_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp51_, (GObject*) _tmp52_);
				_tmp45_ = !_tmp53_;
			} else {
				_tmp45_ = FALSE;
			}
			if (_tmp45_) {
				GeeLinkedList* _tmp54_ = NULL;
				GcaSourceRangeSupport* _tmp55_ = NULL;
				GeeHashMap* _tmp56_ = NULL;
				GcaSourceRangeSupport* _tmp57_ = NULL;
				_tmp54_ = ret;
				_tmp55_ = val;
				gee_abstract_list_insert ((GeeAbstractList*) _tmp54_, 0, (gconstpointer) _tmp55_);
				_tmp56_ = uniq;
				_tmp57_ = val;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp56_, (GObject*) _tmp57_, (gpointer) ((gintptr) TRUE));
			}
			_tmp58_ = prev;
			_tmp59_ = g_sequence_iter_is_begin (_tmp58_);
			if (_tmp59_) {
				_g_object_unref0 (val);
				break;
			}
			_tmp60_ = prev;
			_tmp61_ = g_sequence_iter_prev (_tmp60_);
			prev = _tmp61_;
			_g_object_unref0 (val);
		}
	}
	while (TRUE) {
		gboolean _tmp62_ = FALSE;
		GSequenceIter* _tmp63_ = NULL;
		gboolean _tmp64_ = FALSE;
		GcaSourceRangeSupport* val = NULL;
		GSequenceIter* _tmp74_ = NULL;
		gconstpointer _tmp75_ = NULL;
		GcaSourceRangeSupport* _tmp76_ = NULL;
		GcaSourceRangeSupport* _tmp77_ = NULL;
		gboolean _tmp78_ = FALSE;
		GSequenceIter* _tmp79_ = NULL;
		gconstpointer _tmp80_ = NULL;
		GcaSourceRange _tmp81_ = {0};
		GcaSourceIndexFindFlags _tmp82_ = 0;
		gboolean _tmp83_ = FALSE;
		GSequenceIter* _tmp91_ = NULL;
		GSequenceIter* _tmp92_ = NULL;
		_tmp63_ = iter;
		_tmp64_ = g_sequence_iter_is_end (_tmp63_);
		if (!_tmp64_) {
			gboolean _tmp65_ = FALSE;
			GSequenceIter* _tmp66_ = NULL;
			gconstpointer _tmp67_ = NULL;
			GcaSourceRange _tmp68_ = {0};
			GcaSourceIndexFindFlags _tmp69_ = 0;
			gboolean _tmp70_ = FALSE;
			_tmp66_ = iter;
			_tmp67_ = g_sequence_get (_tmp66_);
			_tmp68_ = *range;
			_tmp69_ = flags;
			_tmp70_ = gca_source_index_find_at_condition (self, (GcaSourceIndexWrapper*) _tmp67_, &_tmp68_, _tmp69_);
			if (_tmp70_) {
				_tmp65_ = TRUE;
			} else {
				GSequenceIter* _tmp71_ = NULL;
				gconstpointer _tmp72_ = NULL;
				gboolean _tmp73_ = FALSE;
				_tmp71_ = iter;
				_tmp72_ = g_sequence_get (_tmp71_);
				_tmp73_ = ((GcaSourceIndexWrapper*) _tmp72_)->encapsulated;
				_tmp65_ = _tmp73_;
			}
			_tmp62_ = _tmp65_;
		} else {
			_tmp62_ = FALSE;
		}
		if (!_tmp62_) {
			break;
		}
		_tmp74_ = iter;
		_tmp75_ = g_sequence_get (_tmp74_);
		_tmp76_ = ((GcaSourceIndexWrapper*) _tmp75_)->obj;
		_tmp77_ = _g_object_ref0 (_tmp76_);
		val = _tmp77_;
		_tmp79_ = iter;
		_tmp80_ = g_sequence_get (_tmp79_);
		_tmp81_ = *range;
		_tmp82_ = flags;
		_tmp83_ = gca_source_index_find_at_condition (self, (GcaSourceIndexWrapper*) _tmp80_, &_tmp81_, _tmp82_);
		if (_tmp83_) {
			GeeHashMap* _tmp84_ = NULL;
			GcaSourceRangeSupport* _tmp85_ = NULL;
			gboolean _tmp86_ = FALSE;
			_tmp84_ = uniq;
			_tmp85_ = val;
			_tmp86_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp84_, (GObject*) _tmp85_);
			_tmp78_ = !_tmp86_;
		} else {
			_tmp78_ = FALSE;
		}
		if (_tmp78_) {
			GeeLinkedList* _tmp87_ = NULL;
			GcaSourceRangeSupport* _tmp88_ = NULL;
			GeeHashMap* _tmp89_ = NULL;
			GcaSourceRangeSupport* _tmp90_ = NULL;
			_tmp87_ = ret;
			_tmp88_ = val;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp87_, (gconstpointer) _tmp88_);
			_tmp89_ = uniq;
			_tmp90_ = val;
			gee_abstract_map_set ((GeeAbstractMap*) _tmp89_, (GObject*) _tmp90_, (gpointer) ((gintptr) TRUE));
		}
		_tmp91_ = iter;
		_tmp92_ = g_sequence_iter_next (_tmp91_);
		iter = _tmp92_;
		_g_object_unref0 (val);
	}
	_tmp93_ = ret;
	_tmp95_ = gee_collection_to_array ((GeeCollection*) _tmp93_, &_tmp94_);
	_tmp96_ = _tmp95_;
	_tmp96__length1 = _tmp94_;
	if (result_length1) {
		*result_length1 = _tmp96__length1;
	}
	result = _tmp96_;
	_g_object_unref0 (uniq);
	_g_object_unref0 (ret);
	return result;
}


void gca_source_index_clear (GcaSourceIndex* self) {
	GSequence* _tmp0_ = NULL;
	GSequenceIter* _tmp1_ = NULL;
	GSequence* _tmp2_ = NULL;
	GSequenceIter* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = g_sequence_get_begin_iter (_tmp0_);
	_tmp2_ = self->priv->d_index;
	_tmp3_ = g_sequence_get_end_iter (_tmp2_);
	g_sequence_remove_range (_tmp1_, _tmp3_);
}


static gint gca_source_index_compare_func (GcaSourceIndex* self, GcaSourceIndexWrapper* a, GcaSourceIndexWrapper* b) {
	gint result = 0;
	GcaSourceRange ra = {0};
	GcaSourceIndexWrapper* _tmp0_ = NULL;
	GcaSourceRange _tmp1_ = {0};
	GcaSourceRange rb = {0};
	GcaSourceIndexWrapper* _tmp2_ = NULL;
	GcaSourceRange _tmp3_ = {0};
	GcaSourceRange _tmp4_ = {0};
	gint _tmp5_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp0_ = a;
	_tmp1_ = _tmp0_->range;
	ra = _tmp1_;
	_tmp2_ = b;
	_tmp3_ = _tmp2_->range;
	rb = _tmp3_;
	_tmp4_ = rb;
	_tmp5_ = gca_source_range_compare_to (&ra, &_tmp4_);
	result = _tmp5_;
	return result;
}


GcaSourceIndexIterator* gca_source_index_iterator (GcaSourceIndex* self) {
	GcaSourceIndexIterator* result = NULL;
	GSequence* _tmp0_ = NULL;
	GSequenceIter* _tmp1_ = NULL;
	GcaSourceIndexIterator* _tmp2_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = g_sequence_get_begin_iter (_tmp0_);
	_tmp2_ = gca_source_index_iterator_new (self->priv->t_type, (GBoxedCopyFunc) self->priv->t_dup_func, self->priv->t_destroy_func, _tmp1_);
	result = _tmp2_;
	return result;
}


GcaSourceIndex* gca_source_index_construct (GType object_type, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func) {
	GcaSourceIndex * self = NULL;
	self = (GcaSourceIndex*) g_object_new (object_type, NULL);
	self->priv->t_type = t_type;
	self->priv->t_dup_func = t_dup_func;
	self->priv->t_destroy_func = t_destroy_func;
	return self;
}


GcaSourceIndex* gca_source_index_new (GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func) {
	return gca_source_index_construct (GCA_TYPE_SOURCE_INDEX, t_type, t_dup_func, t_destroy_func);
}


gint gca_source_index_get_length (GcaSourceIndex* self) {
	gint result;
	GSequence* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->d_index;
	_tmp1_ = g_sequence_get_length (_tmp0_);
	result = _tmp1_;
	return result;
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static GObject * gca_source_index_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GcaSourceIndex * self;
	GSequence* _tmp0_ = NULL;
	parent_class = G_OBJECT_CLASS (gca_source_index_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_TYPE_SOURCE_INDEX, GcaSourceIndex);
	_tmp0_ = g_sequence_new (_g_object_unref0_);
	_g_sequence_free0 (self->priv->d_index);
	self->priv->d_index = _tmp0_;
	return obj;
}


GcaSourceIndexWrapper* gca_source_index_wrapper_construct (GType object_type, GcaSourceRangeSupport* obj, GcaSourceRange* range, gint idx) {
	GcaSourceIndexWrapper * self = NULL;
	GcaSourceRangeSupport* _tmp0_ = NULL;
	GcaSourceRangeSupport* _tmp1_ = NULL;
	GcaSourceRange _tmp2_ = {0};
	gint _tmp3_ = 0;
	g_return_val_if_fail (range != NULL, NULL);
	self = (GcaSourceIndexWrapper*) g_object_new (object_type, NULL);
	_tmp0_ = obj;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->obj);
	self->obj = _tmp1_;
	_tmp2_ = *range;
	self->range = _tmp2_;
	_tmp3_ = idx;
	self->idx = _tmp3_;
	self->encapsulated = FALSE;
	return self;
}


GcaSourceIndexWrapper* gca_source_index_wrapper_new (GcaSourceRangeSupport* obj, GcaSourceRange* range, gint idx) {
	return gca_source_index_wrapper_construct (GCA_SOURCE_INDEX_TYPE_WRAPPER, obj, range, idx);
}


static void gca_source_index_wrapper_class_init (GcaSourceIndexWrapperClass * klass) {
	gca_source_index_wrapper_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = gca_source_index_wrapper_finalize;
}


static void gca_source_index_wrapper_instance_init (GcaSourceIndexWrapper * self) {
}


static void gca_source_index_wrapper_finalize (GObject* obj) {
	GcaSourceIndexWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_SOURCE_INDEX_TYPE_WRAPPER, GcaSourceIndexWrapper);
	_g_object_unref0 (self->obj);
	G_OBJECT_CLASS (gca_source_index_wrapper_parent_class)->finalize (obj);
}


GType gca_source_index_wrapper_get_type (void) {
	static volatile gsize gca_source_index_wrapper_type_id__volatile = 0;
	if (g_once_init_enter (&gca_source_index_wrapper_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaSourceIndexWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_source_index_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaSourceIndexWrapper), 0, (GInstanceInitFunc) gca_source_index_wrapper_instance_init, NULL };
		GType gca_source_index_wrapper_type_id;
		gca_source_index_wrapper_type_id = g_type_register_static (G_TYPE_OBJECT, "GcaSourceIndexWrapper", &g_define_type_info, 0);
		g_once_init_leave (&gca_source_index_wrapper_type_id__volatile, gca_source_index_wrapper_type_id);
	}
	return gca_source_index_wrapper_type_id__volatile;
}


GcaSourceIndexIterator* gca_source_index_iterator_construct (GType object_type, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func, GSequenceIter* iter) {
	GcaSourceIndexIterator * self = NULL;
	GSequenceIter* _tmp0_ = NULL;
	g_return_val_if_fail (iter != NULL, NULL);
	self = (GcaSourceIndexIterator*) g_object_new (object_type, NULL);
	self->priv->t_type = t_type;
	self->priv->t_dup_func = t_dup_func;
	self->priv->t_destroy_func = t_destroy_func;
	_tmp0_ = iter;
	self->priv->d_iter = _tmp0_;
	self->priv->d_first = TRUE;
	return self;
}


GcaSourceIndexIterator* gca_source_index_iterator_new (GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func, GSequenceIter* iter) {
	return gca_source_index_iterator_construct (GCA_SOURCE_INDEX_TYPE_ITERATOR, t_type, t_dup_func, t_destroy_func, iter);
}


gboolean gca_source_index_iterator_next (GcaSourceIndexIterator* self) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	GSequenceIter* _tmp5_ = NULL;
	gboolean _tmp6_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->d_first;
	if (_tmp0_) {
		self->priv->d_first = FALSE;
	} else {
		GSequenceIter* _tmp1_ = NULL;
		gboolean _tmp2_ = FALSE;
		_tmp1_ = self->priv->d_iter;
		_tmp2_ = g_sequence_iter_is_end (_tmp1_);
		if (!_tmp2_) {
			GSequenceIter* _tmp3_ = NULL;
			GSequenceIter* _tmp4_ = NULL;
			_tmp3_ = self->priv->d_iter;
			_tmp4_ = g_sequence_iter_next (_tmp3_);
			self->priv->d_iter = _tmp4_;
		}
	}
	_tmp5_ = self->priv->d_iter;
	_tmp6_ = g_sequence_iter_is_end (_tmp5_);
	result = !_tmp6_;
	return result;
}


gpointer gca_source_index_iterator_get (GcaSourceIndexIterator* self) {
	gpointer result = NULL;
	GSequenceIter* _tmp0_ = NULL;
	gconstpointer _tmp1_ = NULL;
	GcaSourceRangeSupport* _tmp2_ = NULL;
	gpointer _tmp3_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_iter;
	_tmp1_ = g_sequence_get (_tmp0_);
	_tmp2_ = ((GcaSourceIndexWrapper*) _tmp1_)->obj;
	_tmp3_ = ((((gconstpointer) _tmp2_) != NULL) && (self->priv->t_dup_func != NULL)) ? self->priv->t_dup_func ((gpointer) ((gconstpointer) _tmp2_)) : ((gpointer) ((gconstpointer) _tmp2_));
	result = _tmp3_;
	return result;
}


static void gca_source_index_iterator_class_init (GcaSourceIndexIteratorClass * klass) {
	gca_source_index_iterator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcaSourceIndexIteratorPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gca_source_index_iterator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gca_source_index_iterator_set_property;
	G_OBJECT_CLASS (klass)->finalize = gca_source_index_iterator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_ITERATOR_T_TYPE, g_param_spec_gtype ("t-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_ITERATOR_T_DUP_FUNC, g_param_spec_pointer ("t-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_ITERATOR_T_DESTROY_FUNC, g_param_spec_pointer ("t-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void gca_source_index_iterator_instance_init (GcaSourceIndexIterator * self) {
	self->priv = GCA_SOURCE_INDEX_ITERATOR_GET_PRIVATE (self);
}


static void gca_source_index_iterator_finalize (GObject* obj) {
	GcaSourceIndexIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIterator);
	G_OBJECT_CLASS (gca_source_index_iterator_parent_class)->finalize (obj);
}


GType gca_source_index_iterator_get_type (void) {
	static volatile gsize gca_source_index_iterator_type_id__volatile = 0;
	if (g_once_init_enter (&gca_source_index_iterator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaSourceIndexIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_source_index_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaSourceIndexIterator), 0, (GInstanceInitFunc) gca_source_index_iterator_instance_init, NULL };
		GType gca_source_index_iterator_type_id;
		gca_source_index_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GcaSourceIndexIterator", &g_define_type_info, 0);
		g_once_init_leave (&gca_source_index_iterator_type_id__volatile, gca_source_index_iterator_type_id);
	}
	return gca_source_index_iterator_type_id__volatile;
}


static void _vala_gca_source_index_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcaSourceIndexIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIterator);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gca_source_index_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcaSourceIndexIterator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_SOURCE_INDEX_TYPE_ITERATOR, GcaSourceIndexIterator);
	switch (property_id) {
		case GCA_SOURCE_INDEX_ITERATOR_T_TYPE:
		self->priv->t_type = g_value_get_gtype (value);
		break;
		case GCA_SOURCE_INDEX_ITERATOR_T_DUP_FUNC:
		self->priv->t_dup_func = g_value_get_pointer (value);
		break;
		case GCA_SOURCE_INDEX_ITERATOR_T_DESTROY_FUNC:
		self->priv->t_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void gca_source_index_class_init (GcaSourceIndexClass * klass) {
	gca_source_index_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcaSourceIndexPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gca_source_index_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gca_source_index_set_property;
	G_OBJECT_CLASS (klass)->constructor = gca_source_index_constructor;
	G_OBJECT_CLASS (klass)->finalize = gca_source_index_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_T_TYPE, g_param_spec_gtype ("t-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_T_DUP_FUNC, g_param_spec_pointer ("t-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_T_DESTROY_FUNC, g_param_spec_pointer ("t-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_SOURCE_INDEX_LENGTH, g_param_spec_int ("length", "length", "length", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gca_source_index_instance_init (GcaSourceIndex * self) {
	self->priv = GCA_SOURCE_INDEX_GET_PRIVATE (self);
}


static void gca_source_index_finalize (GObject* obj) {
	GcaSourceIndex * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_TYPE_SOURCE_INDEX, GcaSourceIndex);
	_g_sequence_free0 (self->priv->d_index);
	G_OBJECT_CLASS (gca_source_index_parent_class)->finalize (obj);
}


GType gca_source_index_get_type (void) {
	static volatile gsize gca_source_index_type_id__volatile = 0;
	if (g_once_init_enter (&gca_source_index_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaSourceIndexClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_source_index_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaSourceIndex), 0, (GInstanceInitFunc) gca_source_index_instance_init, NULL };
		GType gca_source_index_type_id;
		gca_source_index_type_id = g_type_register_static (G_TYPE_OBJECT, "GcaSourceIndex", &g_define_type_info, 0);
		g_once_init_leave (&gca_source_index_type_id__volatile, gca_source_index_type_id);
	}
	return gca_source_index_type_id__volatile;
}


static void _vala_gca_source_index_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcaSourceIndex * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_SOURCE_INDEX, GcaSourceIndex);
	switch (property_id) {
		case GCA_SOURCE_INDEX_LENGTH:
		g_value_set_int (value, gca_source_index_get_length (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gca_source_index_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcaSourceIndex * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_SOURCE_INDEX, GcaSourceIndex);
	switch (property_id) {
		case GCA_SOURCE_INDEX_T_TYPE:
		self->priv->t_type = g_value_get_gtype (value);
		break;
		case GCA_SOURCE_INDEX_T_DUP_FUNC:
		self->priv->t_dup_func = g_value_get_pointer (value);
		break;
		case GCA_SOURCE_INDEX_T_DESTROY_FUNC:
		self->priv->t_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



