/* ide-vala-completion-item.c generated by valac 0.30.0, the Vala compiler
 * generated from ide-vala-completion-item.vala, do not modify */

/* ide-vala-completion-item.vala
 *
 * Copyright (C) 2015 Christian Hergert <christian@hergert.me>
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <ide.h>
#include <gtksourceview/gtksource.h>
#include <vala.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>
#include <gio/gio.h>


#define IDE_TYPE_VALA_COMPLETION_ITEM (ide_vala_completion_item_get_type ())
#define IDE_VALA_COMPLETION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_COMPLETION_ITEM, IdeValaCompletionItem))
#define IDE_VALA_COMPLETION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_COMPLETION_ITEM, IdeValaCompletionItemClass))
#define IDE_IS_VALA_COMPLETION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_COMPLETION_ITEM))
#define IDE_IS_VALA_COMPLETION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_COMPLETION_ITEM))
#define IDE_VALA_COMPLETION_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_COMPLETION_ITEM, IdeValaCompletionItemClass))

typedef struct _IdeValaCompletionItem IdeValaCompletionItem;
typedef struct _IdeValaCompletionItemClass IdeValaCompletionItemClass;
typedef struct _IdeValaCompletionItemPrivate IdeValaCompletionItemPrivate;

#define IDE_TYPE_VALA_COMPLETION_PROVIDER (ide_vala_completion_provider_get_type ())
#define IDE_VALA_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProvider))
#define IDE_VALA_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProviderClass))
#define IDE_IS_VALA_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_COMPLETION_PROVIDER))
#define IDE_IS_VALA_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_COMPLETION_PROVIDER))
#define IDE_VALA_COMPLETION_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProviderClass))

typedef struct _IdeValaCompletionProvider IdeValaCompletionProvider;
typedef struct _IdeValaCompletionProviderClass IdeValaCompletionProviderClass;
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _IdeValaCompletionProviderPrivate IdeValaCompletionProviderPrivate;

struct _IdeValaCompletionItem {
	IdeCompletionItem parent_instance;
	IdeValaCompletionItemPrivate * priv;
	ValaSymbol* symbol;
};

struct _IdeValaCompletionItemClass {
	IdeCompletionItemClass parent_class;
};

struct _IdeValaCompletionItemPrivate {
	IdeValaCompletionProvider* provider;
	gchar* label;
};

struct _IdeValaCompletionProvider {
	IdeObject parent_instance;
	IdeValaCompletionProviderPrivate * priv;
	gchar* query;
};

struct _IdeValaCompletionProviderClass {
	IdeObjectClass parent_class;
};


static gpointer ide_vala_completion_item_parent_class = NULL;
static guint ide_vala_completion_item_hash_seed;
static guint ide_vala_completion_item_hash_seed = 0U;
static GtkSourceCompletionProposalIface* ide_vala_completion_item_gtk_source_completion_proposal_parent_iface = NULL;
static GType ide_vala_completion_item_type_id = 0;

GType ide_vala_completion_item_get_type (void) G_GNUC_CONST;
GType ide_vala_completion_item_register_type (GTypeModule * module);
GType ide_vala_completion_provider_get_type (void) G_GNUC_CONST;
GType ide_vala_completion_provider_register_type (GTypeModule * module);
#define IDE_VALA_COMPLETION_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDE_TYPE_VALA_COMPLETION_ITEM, IdeValaCompletionItemPrivate))
enum  {
	IDE_VALA_COMPLETION_ITEM_DUMMY_PROPERTY
};
IdeValaCompletionItem* ide_vala_completion_item_new (ValaSymbol* symbol, IdeValaCompletionProvider* provider);
IdeValaCompletionItem* ide_vala_completion_item_construct (GType object_type, ValaSymbol* symbol, IdeValaCompletionProvider* provider);
void ide_vala_completion_item_build_label (IdeValaCompletionItem* self);
static const gchar* ide_vala_completion_item_real_get_icon_name (GtkSourceCompletionProposal* base);
static gboolean ide_vala_completion_item_real_match (IdeCompletionItem* base, const gchar* query, const gchar* casefold);
static gchar* ide_vala_completion_item_real_get_markup (GtkSourceCompletionProposal* base);
static gchar* ide_vala_completion_item_real_get_label (GtkSourceCompletionProposal* base);
static gchar* ide_vala_completion_item_real_get_text (GtkSourceCompletionProposal* base);
static gchar* ide_vala_completion_item_real_get_info (GtkSourceCompletionProposal* base);
static GIcon* ide_vala_completion_item_real_get_gicon (GtkSourceCompletionProposal* base);
static guint ide_vala_completion_item_real_hash (GtkSourceCompletionProposal* base);
static void ide_vala_completion_item_finalize (GObject* obj);


static gpointer _vala_code_node_ref0 (gpointer self) {
	return self ? vala_code_node_ref (self) : NULL;
}


IdeValaCompletionItem* ide_vala_completion_item_construct (GType object_type, ValaSymbol* symbol, IdeValaCompletionProvider* provider) {
	IdeValaCompletionItem * self = NULL;
	ValaSymbol* _tmp0_ = NULL;
	ValaSymbol* _tmp1_ = NULL;
	IdeValaCompletionProvider* _tmp2_ = NULL;
	g_return_val_if_fail (symbol != NULL, NULL);
	g_return_val_if_fail (provider != NULL, NULL);
	self = (IdeValaCompletionItem*) g_object_new (object_type, NULL);
	_tmp0_ = symbol;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->symbol);
	self->symbol = _tmp1_;
	_tmp2_ = provider;
	self->priv->provider = _tmp2_;
	ide_vala_completion_item_build_label (self);
	return self;
}


IdeValaCompletionItem* ide_vala_completion_item_new (ValaSymbol* symbol, IdeValaCompletionProvider* provider) {
	return ide_vala_completion_item_construct (IDE_TYPE_VALA_COMPLETION_ITEM, symbol, provider);
}


static const gchar* ide_vala_completion_item_real_get_icon_name (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	const gchar* result = NULL;
	ValaSymbol* _tmp0_ = NULL;
	self = (IdeValaCompletionItem*) base;
	_tmp0_ = self->symbol;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, VALA_TYPE_LOCAL_VARIABLE)) {
		result = "lang-variable-symbolic";
		return result;
	} else {
		ValaSymbol* _tmp1_ = NULL;
		_tmp1_ = self->symbol;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_FIELD)) {
			result = "struct-field-symbolic";
			return result;
		} else {
			ValaSymbol* _tmp2_ = NULL;
			_tmp2_ = self->symbol;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, VALA_TYPE_SUBROUTINE)) {
				result = "lang-function-symbolic";
				return result;
			} else {
				ValaSymbol* _tmp3_ = NULL;
				_tmp3_ = self->symbol;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, VALA_TYPE_NAMESPACE)) {
					result = "lang-include-symbolic";
					return result;
				} else {
					ValaSymbol* _tmp4_ = NULL;
					_tmp4_ = self->symbol;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_MEMBER_ACCESS)) {
						result = "struct-field-symbolic";
						return result;
					} else {
						ValaSymbol* _tmp5_ = NULL;
						_tmp5_ = self->symbol;
						if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, VALA_TYPE_PROPERTY)) {
							result = "struct-field-symbolic";
							return result;
						} else {
							ValaSymbol* _tmp6_ = NULL;
							_tmp6_ = self->symbol;
							if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, VALA_TYPE_STRUCT)) {
								result = "lang-struct-symbolic";
								return result;
							} else {
								ValaSymbol* _tmp7_ = NULL;
								_tmp7_ = self->symbol;
								if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_CLASS)) {
									result = "lang-class-symbolic";
									return result;
								} else {
									ValaSymbol* _tmp8_ = NULL;
									_tmp8_ = self->symbol;
									if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, VALA_TYPE_ENUM)) {
										result = "lang-enum-symbolic";
										return result;
									} else {
										ValaSymbol* _tmp9_ = NULL;
										_tmp9_ = self->symbol;
										if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, VALA_TYPE_ENUM_VALUE)) {
											result = "lang-enum-value-symbolic";
											return result;
										} else {
											ValaSymbol* _tmp10_ = NULL;
											_tmp10_ = self->symbol;
											if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_DELEGATE)) {
												result = "lang-typedef-symbolic";
												return result;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	result = NULL;
	return result;
}


static gboolean ide_vala_completion_item_real_match (IdeCompletionItem* base, const gchar* query, const gchar* casefold) {
	IdeValaCompletionItem * self;
	gboolean result = FALSE;
	guint priority = 0U;
	gboolean _result_ = FALSE;
	ValaSymbol* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	guint _tmp4_ = 0U;
	gboolean _tmp5_ = FALSE;
	guint _tmp6_ = 0U;
	self = (IdeValaCompletionItem*) base;
	g_return_val_if_fail (query != NULL, FALSE);
	g_return_val_if_fail (casefold != NULL, FALSE);
	priority = (guint) 0;
	_tmp0_ = self->symbol;
	_tmp1_ = vala_symbol_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = casefold;
	_tmp5_ = ide_completion_item_fuzzy_match (_tmp2_, _tmp3_, &_tmp4_);
	priority = _tmp4_;
	_result_ = _tmp5_;
	_tmp6_ = priority;
	ide_completion_item_set_priority ((IdeCompletionItem*) self, _tmp6_);
	result = _result_;
	return result;
}


static gpointer _vala_iterable_ref0 (gpointer self) {
	return self ? vala_iterable_ref (self) : NULL;
}


void ide_vala_completion_item_build_label (IdeValaCompletionItem* self) {
	GString* str = NULL;
	GString* _tmp0_ = NULL;
	ValaSymbol* _tmp1_ = NULL;
	GString* _tmp89_ = NULL;
	gchar* _tmp90_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_string_new ("");
	str = _tmp0_;
	_tmp1_ = self->symbol;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_METHOD)) {
		ValaMethod* method = NULL;
		ValaSymbol* _tmp2_ = NULL;
		ValaMethod* _tmp3_ = NULL;
		GString* _tmp4_ = NULL;
		ValaMethod* _tmp5_ = NULL;
		ValaDataType* _tmp6_ = NULL;
		ValaDataType* _tmp7_ = NULL;
		ValaSymbol* _tmp8_ = NULL;
		ValaScope* _tmp9_ = NULL;
		ValaScope* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		gchar* _tmp12_ = NULL;
		GString* _tmp13_ = NULL;
		ValaMethod* _tmp14_ = NULL;
		const gchar* _tmp15_ = NULL;
		const gchar* _tmp16_ = NULL;
		ValaList* type_params = NULL;
		ValaMethod* _tmp17_ = NULL;
		ValaList* _tmp18_ = NULL;
		ValaList* _tmp19_ = NULL;
		gint _tmp20_ = 0;
		gint _tmp21_ = 0;
		GString* _tmp43_ = NULL;
		ValaList* parameters = NULL;
		ValaMethod* _tmp44_ = NULL;
		ValaList* _tmp45_ = NULL;
		ValaList* _tmp78_ = NULL;
		gint _tmp79_ = 0;
		gint _tmp80_ = 0;
		GString* _tmp84_ = NULL;
		_tmp2_ = self->symbol;
		_tmp3_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, VALA_TYPE_METHOD) ? ((ValaMethod*) _tmp2_) : NULL);
		method = _tmp3_;
		_tmp4_ = str;
		_tmp5_ = method;
		_tmp6_ = vala_method_get_return_type (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = self->symbol;
		_tmp9_ = vala_symbol_get_owner (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = vala_data_type_to_qualified_string (_tmp7_, _tmp10_);
		_tmp12_ = _tmp11_;
		g_string_append (_tmp4_, _tmp12_);
		_g_free0 (_tmp12_);
		_tmp13_ = str;
		_tmp14_ = method;
		_tmp15_ = vala_symbol_get_name ((ValaSymbol*) _tmp14_);
		_tmp16_ = _tmp15_;
		g_string_append_printf (_tmp13_, " %s", _tmp16_);
		_tmp17_ = method;
		_tmp18_ = vala_method_get_type_parameters (_tmp17_);
		type_params = _tmp18_;
		_tmp19_ = type_params;
		_tmp20_ = vala_collection_get_size ((ValaCollection*) _tmp19_);
		_tmp21_ = _tmp20_;
		if (_tmp21_ > 0) {
			GString* _tmp22_ = NULL;
			GString* _tmp39_ = NULL;
			GString* _tmp40_ = NULL;
			gssize _tmp41_ = 0L;
			GString* _tmp42_ = NULL;
			_tmp22_ = str;
			g_string_append (_tmp22_, "&lt;");
			{
				ValaList* _type_param_list = NULL;
				ValaList* _tmp23_ = NULL;
				ValaList* _tmp24_ = NULL;
				gint _type_param_size = 0;
				ValaList* _tmp25_ = NULL;
				gint _tmp26_ = 0;
				gint _tmp27_ = 0;
				gint _type_param_index = 0;
				_tmp23_ = type_params;
				_tmp24_ = _vala_iterable_ref0 (_tmp23_);
				_type_param_list = _tmp24_;
				_tmp25_ = _type_param_list;
				_tmp26_ = vala_collection_get_size ((ValaCollection*) _tmp25_);
				_tmp27_ = _tmp26_;
				_type_param_size = _tmp27_;
				_type_param_index = -1;
				while (TRUE) {
					gint _tmp28_ = 0;
					gint _tmp29_ = 0;
					gint _tmp30_ = 0;
					ValaTypeParameter* type_param = NULL;
					ValaList* _tmp31_ = NULL;
					gint _tmp32_ = 0;
					gpointer _tmp33_ = NULL;
					GString* _tmp34_ = NULL;
					ValaTypeParameter* _tmp35_ = NULL;
					const gchar* _tmp36_ = NULL;
					const gchar* _tmp37_ = NULL;
					GString* _tmp38_ = NULL;
					_tmp28_ = _type_param_index;
					_type_param_index = _tmp28_ + 1;
					_tmp29_ = _type_param_index;
					_tmp30_ = _type_param_size;
					if (!(_tmp29_ < _tmp30_)) {
						break;
					}
					_tmp31_ = _type_param_list;
					_tmp32_ = _type_param_index;
					_tmp33_ = vala_list_get (_tmp31_, _tmp32_);
					type_param = (ValaTypeParameter*) _tmp33_;
					_tmp34_ = str;
					_tmp35_ = type_param;
					_tmp36_ = vala_symbol_get_name ((ValaSymbol*) _tmp35_);
					_tmp37_ = _tmp36_;
					g_string_append (_tmp34_, _tmp37_);
					_tmp38_ = str;
					g_string_append_c (_tmp38_, ',');
					_vala_code_node_unref0 (type_param);
				}
				_vala_iterable_unref0 (_type_param_list);
			}
			_tmp39_ = str;
			_tmp40_ = str;
			_tmp41_ = _tmp40_->len;
			g_string_truncate (_tmp39_, (gsize) (_tmp41_ - 1));
			_tmp42_ = str;
			g_string_append (_tmp42_, "&gt;");
		}
		_tmp43_ = str;
		g_string_append (_tmp43_, " (");
		_tmp44_ = method;
		_tmp45_ = vala_method_get_parameters (_tmp44_);
		parameters = _tmp45_;
		{
			ValaList* _param_list = NULL;
			ValaList* _tmp46_ = NULL;
			ValaList* _tmp47_ = NULL;
			gint _param_size = 0;
			ValaList* _tmp48_ = NULL;
			gint _tmp49_ = 0;
			gint _tmp50_ = 0;
			gint _param_index = 0;
			_tmp46_ = parameters;
			_tmp47_ = _vala_iterable_ref0 (_tmp46_);
			_param_list = _tmp47_;
			_tmp48_ = _param_list;
			_tmp49_ = vala_collection_get_size ((ValaCollection*) _tmp48_);
			_tmp50_ = _tmp49_;
			_param_size = _tmp50_;
			_param_index = -1;
			while (TRUE) {
				gint _tmp51_ = 0;
				gint _tmp52_ = 0;
				gint _tmp53_ = 0;
				ValaParameter* param = NULL;
				ValaList* _tmp54_ = NULL;
				gint _tmp55_ = 0;
				gpointer _tmp56_ = NULL;
				ValaParameter* _tmp57_ = NULL;
				gboolean _tmp58_ = FALSE;
				gboolean _tmp59_ = FALSE;
				ValaParameter* _tmp61_ = NULL;
				ValaParameterDirection _tmp62_ = 0;
				ValaParameterDirection _tmp63_ = 0;
				GString* _tmp69_ = NULL;
				ValaParameter* _tmp70_ = NULL;
				ValaDataType* _tmp71_ = NULL;
				ValaDataType* _tmp72_ = NULL;
				ValaMethod* _tmp73_ = NULL;
				ValaScope* _tmp74_ = NULL;
				ValaScope* _tmp75_ = NULL;
				gchar* _tmp76_ = NULL;
				gchar* _tmp77_ = NULL;
				_tmp51_ = _param_index;
				_param_index = _tmp51_ + 1;
				_tmp52_ = _param_index;
				_tmp53_ = _param_size;
				if (!(_tmp52_ < _tmp53_)) {
					break;
				}
				_tmp54_ = _param_list;
				_tmp55_ = _param_index;
				_tmp56_ = vala_list_get (_tmp54_, _tmp55_);
				param = (ValaParameter*) _tmp56_;
				_tmp57_ = param;
				_tmp58_ = vala_parameter_get_ellipsis (_tmp57_);
				_tmp59_ = _tmp58_;
				if (_tmp59_) {
					GString* _tmp60_ = NULL;
					_tmp60_ = str;
					g_string_append (_tmp60_, "..., ");
					_vala_code_node_unref0 (param);
					break;
				}
				_tmp61_ = param;
				_tmp62_ = vala_parameter_get_direction (_tmp61_);
				_tmp63_ = _tmp62_;
				if (_tmp63_ == VALA_PARAMETER_DIRECTION_OUT) {
					GString* _tmp64_ = NULL;
					_tmp64_ = str;
					g_string_append (_tmp64_, "out ");
				} else {
					ValaParameter* _tmp65_ = NULL;
					ValaParameterDirection _tmp66_ = 0;
					ValaParameterDirection _tmp67_ = 0;
					_tmp65_ = param;
					_tmp66_ = vala_parameter_get_direction (_tmp65_);
					_tmp67_ = _tmp66_;
					if (_tmp67_ == VALA_PARAMETER_DIRECTION_REF) {
						GString* _tmp68_ = NULL;
						_tmp68_ = str;
						g_string_append (_tmp68_, "ref ");
					}
				}
				_tmp69_ = str;
				_tmp70_ = param;
				_tmp71_ = vala_variable_get_variable_type ((ValaVariable*) _tmp70_);
				_tmp72_ = _tmp71_;
				_tmp73_ = method;
				_tmp74_ = vala_symbol_get_owner ((ValaSymbol*) _tmp73_);
				_tmp75_ = _tmp74_;
				_tmp76_ = vala_data_type_to_qualified_string (_tmp72_, _tmp75_);
				_tmp77_ = _tmp76_;
				g_string_append_printf (_tmp69_, "%s, ", _tmp77_);
				_g_free0 (_tmp77_);
				_vala_code_node_unref0 (param);
			}
			_vala_iterable_unref0 (_param_list);
		}
		_tmp78_ = parameters;
		_tmp79_ = vala_collection_get_size ((ValaCollection*) _tmp78_);
		_tmp80_ = _tmp79_;
		if (_tmp80_ > 0) {
			GString* _tmp81_ = NULL;
			GString* _tmp82_ = NULL;
			gssize _tmp83_ = 0L;
			_tmp81_ = str;
			_tmp82_ = str;
			_tmp83_ = _tmp82_->len;
			g_string_truncate (_tmp81_, (gsize) (_tmp83_ - 2));
		}
		_tmp84_ = str;
		g_string_append_c (_tmp84_, ')');
		_vala_iterable_unref0 (parameters);
		_vala_iterable_unref0 (type_params);
		_vala_code_node_unref0 (method);
	} else {
		GString* _tmp85_ = NULL;
		ValaSymbol* _tmp86_ = NULL;
		const gchar* _tmp87_ = NULL;
		const gchar* _tmp88_ = NULL;
		_tmp85_ = str;
		_tmp86_ = self->symbol;
		_tmp87_ = vala_symbol_get_name (_tmp86_);
		_tmp88_ = _tmp87_;
		g_string_append (_tmp85_, _tmp88_);
	}
	_tmp89_ = str;
	_tmp90_ = _tmp89_->str;
	_tmp89_->str = NULL;
	_g_free0 (self->priv->label);
	self->priv->label = _tmp90_;
	_g_string_free0 (str);
}


static gchar* ide_vala_completion_item_real_get_markup (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	gchar* result = NULL;
	IdeValaCompletionProvider* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	self = (IdeValaCompletionItem*) base;
	_tmp0_ = self->priv->provider;
	_tmp1_ = _tmp0_->query;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_ = NULL;
		IdeValaCompletionProvider* _tmp3_ = NULL;
		const gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp2_ = self->priv->label;
		_tmp3_ = self->priv->provider;
		_tmp4_ = _tmp3_->query;
		_tmp5_ = ide_completion_item_fuzzy_highlight (_tmp2_, _tmp4_);
		result = _tmp5_;
		return result;
	}
	_tmp6_ = self->priv->label;
	_tmp7_ = g_strdup (_tmp6_);
	result = _tmp7_;
	return result;
}


static gchar* ide_vala_completion_item_real_get_label (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	gchar* result = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	self = (IdeValaCompletionItem*) base;
	_tmp0_ = self->priv->label;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}


static gchar* ide_vala_completion_item_real_get_text (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	gchar* result = NULL;
	ValaSymbol* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	self = (IdeValaCompletionItem*) base;
	_tmp0_ = self->symbol;
	_tmp1_ = vala_symbol_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}


static gchar* ide_vala_completion_item_real_get_info (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	gchar* result = NULL;
	self = (IdeValaCompletionItem*) base;
	result = NULL;
	return result;
}


static GIcon* ide_vala_completion_item_real_get_gicon (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	GIcon* result = NULL;
	self = (IdeValaCompletionItem*) base;
	result = NULL;
	return result;
}


static guint ide_vala_completion_item_real_hash (GtkSourceCompletionProposal* base) {
	IdeValaCompletionItem * self;
	guint result = 0U;
	ValaSymbol* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	guint _tmp3_ = 0U;
	guint _tmp4_ = 0U;
	self = (IdeValaCompletionItem*) base;
	_tmp0_ = self->symbol;
	_tmp1_ = vala_symbol_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_str_hash (_tmp2_);
	_tmp4_ = ide_vala_completion_item_hash_seed;
	result = _tmp3_ ^ _tmp4_;
	return result;
}


static void ide_vala_completion_item_class_init (IdeValaCompletionItemClass * klass) {
	guint _tmp0_ = 0U;
	ide_vala_completion_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IdeValaCompletionItemPrivate));
	((IdeCompletionItemClass *) klass)->match = ide_vala_completion_item_real_match;
	G_OBJECT_CLASS (klass)->finalize = ide_vala_completion_item_finalize;
	_tmp0_ = g_str_hash ("IdeValaCompletionItem");
	ide_vala_completion_item_hash_seed = _tmp0_;
}


static void ide_vala_completion_item_gtk_source_completion_proposal_interface_init (GtkSourceCompletionProposalIface * iface) {
	ide_vala_completion_item_gtk_source_completion_proposal_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_icon_name = (const gchar* (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_get_icon_name;
	iface->get_markup = (gchar* (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_get_markup;
	iface->get_label = (gchar* (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_get_label;
	iface->get_text = (gchar* (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_get_text;
	iface->get_info = (gchar* (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_get_info;
	iface->get_gicon = (GIcon* (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_get_gicon;
	iface->hash = (guint (*)(GtkSourceCompletionProposal*)) ide_vala_completion_item_real_hash;
}


static void ide_vala_completion_item_instance_init (IdeValaCompletionItem * self) {
	self->priv = IDE_VALA_COMPLETION_ITEM_GET_PRIVATE (self);
}


static void ide_vala_completion_item_finalize (GObject* obj) {
	IdeValaCompletionItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, IDE_TYPE_VALA_COMPLETION_ITEM, IdeValaCompletionItem);
	_vala_code_node_unref0 (self->symbol);
	_g_free0 (self->priv->label);
	G_OBJECT_CLASS (ide_vala_completion_item_parent_class)->finalize (obj);
}


GType ide_vala_completion_item_get_type (void) {
	return ide_vala_completion_item_type_id;
}


GType ide_vala_completion_item_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaCompletionItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_completion_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaCompletionItem), 0, (GInstanceInitFunc) ide_vala_completion_item_instance_init, NULL };
	static const GInterfaceInfo gtk_source_completion_proposal_info = { (GInterfaceInitFunc) ide_vala_completion_item_gtk_source_completion_proposal_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	ide_vala_completion_item_type_id = g_type_module_register_type (module, ide_completion_item_get_type (), "IdeValaCompletionItem", &g_define_type_info, 0);
	g_type_module_add_interface (module, ide_vala_completion_item_type_id, gtk_source_completion_proposal_get_type (), &gtk_source_completion_proposal_info);
	return ide_vala_completion_item_type_id;
}



