/* abstract-field-details.c generated by valac 0.14.0.3-1a311, the Vala compiler
 * generated from abstract-field-details.vala, do not modify */

/*
 * Copyright (C) 2011 Collabora Ltd.
 *
 * 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/>.
 *
 * Authors:
 *       Marco Barisione <marco.barisione@collabora.co.uk>
 *       Travis Reitter <travis.reitter@collabora.co.uk>
 */

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


#define FOLKS_TYPE_ABSTRACT_FIELD_DETAILS (folks_abstract_field_details_get_type ())
#define FOLKS_ABSTRACT_FIELD_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetails))
#define FOLKS_ABSTRACT_FIELD_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetailsClass))
#define FOLKS_IS_ABSTRACT_FIELD_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS))
#define FOLKS_IS_ABSTRACT_FIELD_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS))
#define FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetailsClass))

typedef struct _FolksAbstractFieldDetails FolksAbstractFieldDetails;
typedef struct _FolksAbstractFieldDetailsClass FolksAbstractFieldDetailsClass;
typedef struct _FolksAbstractFieldDetailsPrivate FolksAbstractFieldDetailsPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _FolksAbstractFieldDetails {
	GObject parent_instance;
	FolksAbstractFieldDetailsPrivate * priv;
};

struct _FolksAbstractFieldDetailsClass {
	GObjectClass parent_class;
	gboolean (*equal) (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
	guint (*hash) (FolksAbstractFieldDetails* self);
	gconstpointer (*get_value) (FolksAbstractFieldDetails* self);
	void (*set_value) (FolksAbstractFieldDetails* self, gconstpointer value);
	GeeMultiMap* (*get_parameters) (FolksAbstractFieldDetails* self);
	void (*set_parameters) (FolksAbstractFieldDetails* self, GeeMultiMap* value);
};

struct _FolksAbstractFieldDetailsPrivate {
	GType t_type;
	GBoxedCopyFunc t_dup_func;
	GDestroyNotify t_destroy_func;
	gpointer _value;
	GeeMultiMap* _parameters;
};


static gpointer folks_abstract_field_details_parent_class = NULL;

GType folks_abstract_field_details_get_type (void) G_GNUC_CONST;
#define FOLKS_ABSTRACT_FIELD_DETAILS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_TYPE_ABSTRACT_FIELD_DETAILS, FolksAbstractFieldDetailsPrivate))
enum  {
	FOLKS_ABSTRACT_FIELD_DETAILS_DUMMY_PROPERTY,
	FOLKS_ABSTRACT_FIELD_DETAILS_T_TYPE,
	FOLKS_ABSTRACT_FIELD_DETAILS_T_DUP_FUNC,
	FOLKS_ABSTRACT_FIELD_DETAILS_T_DESTROY_FUNC,
	FOLKS_ABSTRACT_FIELD_DETAILS_VALUE,
	FOLKS_ABSTRACT_FIELD_DETAILS_PARAMETERS
};
#define FOLKS_ABSTRACT_FIELD_DETAILS_PARAM_TYPE "type"
#define FOLKS_ABSTRACT_FIELD_DETAILS_PARAM_TYPE_HOME "home"
#define FOLKS_ABSTRACT_FIELD_DETAILS_PARAM_TYPE_WORK "work"
#define FOLKS_ABSTRACT_FIELD_DETAILS_PARAM_TYPE_OTHER "other"
GeeCollection* folks_abstract_field_details_get_parameter_values (FolksAbstractFieldDetails* self, const gchar* parameter_name);
GeeMultiMap* folks_abstract_field_details_get_parameters (FolksAbstractFieldDetails* self);
void folks_abstract_field_details_add_parameter (FolksAbstractFieldDetails* self, const gchar* parameter_name, const gchar* parameter_value);
void folks_abstract_field_details_set_parameter (FolksAbstractFieldDetails* self, const gchar* parameter_name, const gchar* parameter_value);
void folks_abstract_field_details_extend_parameters (FolksAbstractFieldDetails* self, GeeMultiMap* additional);
void folks_abstract_field_details_remove_parameter_all (FolksAbstractFieldDetails* self, const gchar* parameter_name);
gboolean folks_abstract_field_details_equal (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
static gboolean folks_abstract_field_details_real_equal (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that);
gconstpointer folks_abstract_field_details_get_value (FolksAbstractFieldDetails* self);
guint folks_abstract_field_details_hash (FolksAbstractFieldDetails* self);
static guint folks_abstract_field_details_real_hash (FolksAbstractFieldDetails* self);
FolksAbstractFieldDetails* folks_abstract_field_details_construct (GType object_type, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func);
void folks_abstract_field_details_set_value (FolksAbstractFieldDetails* self, gconstpointer value);
void folks_abstract_field_details_set_parameters (FolksAbstractFieldDetails* self, GeeMultiMap* value);
static void folks_abstract_field_details_finalize (GObject* obj);
static void _vala_folks_abstract_field_details_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_folks_abstract_field_details_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


/**
   * Get the values for a parameter
   *
   * @param parameter_name the parameter name
   * @return a collection of values for `parameter_name` or `null` (i.e. no
   * collection) if there are no such parameters.
   *
   * @since 0.6.0
   */
GeeCollection* folks_abstract_field_details_get_parameter_values (FolksAbstractFieldDetails* self, const gchar* parameter_name) {
	GeeCollection* result = NULL;
	GeeMultiMap* _tmp0_;
	GeeMultiMap* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	GeeMultiMap* _tmp4_;
	GeeMultiMap* _tmp5_;
	const gchar* _tmp6_;
	GeeCollection* _tmp7_ = NULL;
	GeeCollection* _tmp8_;
	GeeCollection* _tmp9_;
	GeeCollection* _tmp10_;
	GeeCollection* _tmp11_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (parameter_name != NULL, NULL);
	_tmp0_ = folks_abstract_field_details_get_parameters (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = parameter_name;
	_tmp3_ = gee_multi_map_contains (_tmp1_, _tmp2_);
	if (_tmp3_ == FALSE) {
		result = NULL;
		return result;
	}
	_tmp4_ = folks_abstract_field_details_get_parameters (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = parameter_name;
	_tmp7_ = gee_multi_map_get (_tmp5_, _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = gee_collection_get_read_only_view (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	_g_object_unref0 (_tmp8_);
	result = _tmp11_;
	return result;
}


/**
   * Add a new value for a parameter.
   *
   * If there is already a parameter called `parameter_name` then
   * `parameter_value` is added to the existing ones.
   *
   * @param parameter_name the name of the parameter
   * @param parameter_value the value to add
   *
   * @since 0.6.0
   */
void folks_abstract_field_details_add_parameter (FolksAbstractFieldDetails* self, const gchar* parameter_name, const gchar* parameter_value) {
	GeeMultiMap* _tmp0_;
	GeeMultiMap* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parameter_name != NULL);
	g_return_if_fail (parameter_value != NULL);
	_tmp0_ = folks_abstract_field_details_get_parameters (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = parameter_name;
	_tmp3_ = parameter_value;
	gee_multi_map_set (_tmp1_, _tmp2_, _tmp3_);
}


/**
   * Set the value of a parameter.
   *
   * Sets the parameter called `parameter_name` to be `parameter_value`.
   * If there were already parameters with the same name they are replaced.
   *
   * @param parameter_name the name of the parameter
   * @param parameter_value the value to add
   *
   * @since 0.6.0
   */
void folks_abstract_field_details_set_parameter (FolksAbstractFieldDetails* self, const gchar* parameter_name, const gchar* parameter_value) {
	GeeMultiMap* _tmp0_;
	GeeMultiMap* _tmp1_;
	const gchar* _tmp2_;
	GeeMultiMap* _tmp3_;
	GeeMultiMap* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parameter_name != NULL);
	g_return_if_fail (parameter_value != NULL);
	_tmp0_ = folks_abstract_field_details_get_parameters (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = parameter_name;
	gee_multi_map_remove_all (_tmp1_, _tmp2_);
	_tmp3_ = folks_abstract_field_details_get_parameters (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = parameter_name;
	_tmp6_ = parameter_value;
	gee_multi_map_set (_tmp4_, _tmp5_, _tmp6_);
}


/**
   * Extend the existing parameters.
   *
   * Merge the parameters from `additional` into the existing ones.
   *
   * @param additional the parameters to add
   *
   * @since 0.6.0
   */
void folks_abstract_field_details_extend_parameters (FolksAbstractFieldDetails* self, GeeMultiMap* additional) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (additional != NULL);
	{
		GeeMultiMap* _tmp0_;
		GeeSet* _tmp1_ = NULL;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_ = NULL;
		GeeIterator* _tmp4_;
		GeeIterator* _name_it;
		_tmp0_ = additional;
		_tmp1_ = gee_multi_map_get_keys (_tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_name_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			gboolean _tmp6_ = FALSE;
			GeeIterator* _tmp7_;
			gpointer _tmp8_ = NULL;
			gchar* name;
			GeeMultiMap* _tmp9_;
			const gchar* _tmp10_;
			GeeCollection* _tmp11_ = NULL;
			GeeCollection* values;
			_tmp5_ = _name_it;
			_tmp6_ = gee_iterator_next (_tmp5_);
			if (!_tmp6_) {
				break;
			}
			_tmp7_ = _name_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			name = (gchar*) _tmp8_;
			_tmp9_ = additional;
			_tmp10_ = name;
			_tmp11_ = gee_multi_map_get (_tmp9_, _tmp10_);
			values = _tmp11_;
			{
				GeeCollection* _tmp12_;
				GeeIterator* _tmp13_ = NULL;
				GeeIterator* _val_it;
				_tmp12_ = values;
				_tmp13_ = gee_iterable_iterator ((GeeIterable*) _tmp12_);
				_val_it = _tmp13_;
				while (TRUE) {
					GeeIterator* _tmp14_;
					gboolean _tmp15_ = FALSE;
					GeeIterator* _tmp16_;
					gpointer _tmp17_ = NULL;
					gchar* val;
					const gchar* _tmp18_;
					const gchar* _tmp19_;
					_tmp14_ = _val_it;
					_tmp15_ = gee_iterator_next (_tmp14_);
					if (!_tmp15_) {
						break;
					}
					_tmp16_ = _val_it;
					_tmp17_ = gee_iterator_get (_tmp16_);
					val = (gchar*) _tmp17_;
					_tmp18_ = name;
					_tmp19_ = val;
					folks_abstract_field_details_add_parameter (self, _tmp18_, _tmp19_);
					_g_free0 (val);
				}
				_g_object_unref0 (_val_it);
			}
			_g_object_unref0 (values);
			_g_free0 (name);
		}
		_g_object_unref0 (_name_it);
	}
}


/**
   * Remove all instances of a parameter.
   *
   * @param parameter_name the name of the parameter
   *
   * @since 0.6.0
   */
void folks_abstract_field_details_remove_parameter_all (FolksAbstractFieldDetails* self, const gchar* parameter_name) {
	GeeMultiMap* _tmp0_;
	GeeMultiMap* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parameter_name != NULL);
	_tmp0_ = folks_abstract_field_details_get_parameters (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = parameter_name;
	gee_multi_map_remove_all (_tmp1_, _tmp2_);
}


/**
   * An equality function for {@link AbstractFieldDetails}.
   *
   * This defaults to string comparison of the
   * {@link AbstractFieldDetails.value}s if the generic type is string;
   * otherwise, direct pointer comparison of the
   * {@link AbstractFieldDetails.value}s.
   *
   * @param that another {@link AbstractFieldDetails}
   *
   * @return whether the elements are equal
   *
   * @since 0.6.0
   */
static gboolean folks_abstract_field_details_real_equal (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that) {
	gboolean result = FALSE;
	GEqualFunc _tmp0_;
	GEqualFunc equal_func;
	gboolean _tmp2_ = FALSE;
	GType _tmp3_ = 0UL;
	FolksAbstractFieldDetails* _tmp4_;
	GType _tmp5_ = 0UL;
	gboolean _tmp13_;
	GeeMultiMap* _tmp14_;
	GeeMultiMap* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	FolksAbstractFieldDetails* _tmp18_;
	GeeMultiMap* _tmp19_;
	GeeMultiMap* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	g_return_val_if_fail (that != NULL, FALSE);
	_tmp0_ = g_direct_equal;
	equal_func = _tmp0_;
	if (self->priv->t_type == G_TYPE_STRING) {
		GEqualFunc _tmp1_;
		_tmp1_ = g_str_equal;
		equal_func = _tmp1_;
	}
	_tmp3_ = G_TYPE_FROM_INSTANCE ((GObject*) self);
	_tmp4_ = that;
	_tmp5_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp4_);
	if (_tmp3_ != _tmp5_) {
		_tmp2_ = TRUE;
	} else {
		GEqualFunc _tmp6_;
		gconstpointer _tmp7_;
		gconstpointer _tmp8_;
		FolksAbstractFieldDetails* _tmp9_;
		gconstpointer _tmp10_;
		gconstpointer _tmp11_;
		gboolean _tmp12_ = FALSE;
		_tmp6_ = equal_func;
		_tmp7_ = folks_abstract_field_details_get_value (self);
		_tmp8_ = _tmp7_;
		_tmp9_ = that;
		_tmp10_ = folks_abstract_field_details_get_value (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp6_ (_tmp8_, _tmp11_);
		_tmp2_ = !_tmp12_;
	}
	_tmp13_ = _tmp2_;
	if (_tmp13_) {
		result = FALSE;
		return result;
	}
	_tmp14_ = folks_abstract_field_details_get_parameters (self);
	_tmp15_ = _tmp14_;
	_tmp16_ = gee_multi_map_get_size (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = that;
	_tmp19_ = folks_abstract_field_details_get_parameters (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = gee_multi_map_get_size (_tmp20_);
	_tmp22_ = _tmp21_;
	if (_tmp17_ != _tmp22_) {
		result = FALSE;
		return result;
	}
	{
		GeeMultiMap* _tmp23_;
		GeeMultiMap* _tmp24_;
		GeeSet* _tmp25_ = NULL;
		GeeSet* _tmp26_;
		GeeIterator* _tmp27_ = NULL;
		GeeIterator* _tmp28_;
		GeeIterator* _param_it;
		_tmp23_ = folks_abstract_field_details_get_parameters (self);
		_tmp24_ = _tmp23_;
		_tmp25_ = gee_multi_map_get_keys (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = gee_iterable_iterator ((GeeIterable*) _tmp26_);
		_tmp28_ = _tmp27_;
		_g_object_unref0 (_tmp26_);
		_param_it = _tmp28_;
		while (TRUE) {
			GeeIterator* _tmp29_;
			gboolean _tmp30_ = FALSE;
			GeeIterator* _tmp31_;
			gpointer _tmp32_ = NULL;
			gchar* param;
			FolksAbstractFieldDetails* _tmp33_;
			GeeMultiMap* _tmp34_;
			GeeMultiMap* _tmp35_;
			const gchar* _tmp36_;
			gboolean _tmp37_ = FALSE;
			GeeMultiMap* _tmp38_;
			GeeMultiMap* _tmp39_;
			GeeCollection* _tmp40_ = NULL;
			GeeCollection* this_param_values;
			FolksAbstractFieldDetails* _tmp41_;
			GeeMultiMap* _tmp42_;
			GeeMultiMap* _tmp43_;
			GeeCollection* _tmp44_ = NULL;
			GeeCollection* that_param_values;
			GeeCollection* _tmp45_;
			gint _tmp46_;
			gint _tmp47_;
			GeeCollection* _tmp48_;
			gint _tmp49_;
			gint _tmp50_;
			_tmp29_ = _param_it;
			_tmp30_ = gee_iterator_next (_tmp29_);
			if (!_tmp30_) {
				break;
			}
			_tmp31_ = _param_it;
			_tmp32_ = gee_iterator_get (_tmp31_);
			param = (gchar*) _tmp32_;
			_tmp33_ = that;
			_tmp34_ = folks_abstract_field_details_get_parameters (_tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = param;
			_tmp37_ = gee_multi_map_contains (_tmp35_, _tmp36_);
			if (!_tmp37_) {
				result = FALSE;
				_g_free0 (param);
				_g_object_unref0 (_param_it);
				return result;
			}
			_tmp38_ = folks_abstract_field_details_get_parameters (self);
			_tmp39_ = _tmp38_;
			_tmp40_ = gee_multi_map_get_values (_tmp39_);
			this_param_values = _tmp40_;
			_tmp41_ = that;
			_tmp42_ = folks_abstract_field_details_get_parameters (_tmp41_);
			_tmp43_ = _tmp42_;
			_tmp44_ = gee_multi_map_get_values (_tmp43_);
			that_param_values = _tmp44_;
			_tmp45_ = this_param_values;
			_tmp46_ = gee_collection_get_size (_tmp45_);
			_tmp47_ = _tmp46_;
			_tmp48_ = that_param_values;
			_tmp49_ = gee_collection_get_size (_tmp48_);
			_tmp50_ = _tmp49_;
			if (_tmp47_ != _tmp50_) {
				result = FALSE;
				_g_object_unref0 (that_param_values);
				_g_object_unref0 (this_param_values);
				_g_free0 (param);
				_g_object_unref0 (_param_it);
				return result;
			}
			{
				GeeMultiMap* _tmp51_;
				GeeMultiMap* _tmp52_;
				GeeCollection* _tmp53_ = NULL;
				GeeCollection* _tmp54_;
				GeeIterator* _tmp55_ = NULL;
				GeeIterator* _tmp56_;
				GeeIterator* _param_val_it;
				_tmp51_ = folks_abstract_field_details_get_parameters (self);
				_tmp52_ = _tmp51_;
				_tmp53_ = gee_multi_map_get_values (_tmp52_);
				_tmp54_ = _tmp53_;
				_tmp55_ = gee_iterable_iterator ((GeeIterable*) _tmp54_);
				_tmp56_ = _tmp55_;
				_g_object_unref0 (_tmp54_);
				_param_val_it = _tmp56_;
				while (TRUE) {
					GeeIterator* _tmp57_;
					gboolean _tmp58_ = FALSE;
					GeeIterator* _tmp59_;
					gpointer _tmp60_ = NULL;
					gchar* param_val;
					GeeCollection* _tmp61_;
					const gchar* _tmp62_;
					gboolean _tmp63_ = FALSE;
					_tmp57_ = _param_val_it;
					_tmp58_ = gee_iterator_next (_tmp57_);
					if (!_tmp58_) {
						break;
					}
					_tmp59_ = _param_val_it;
					_tmp60_ = gee_iterator_get (_tmp59_);
					param_val = (gchar*) _tmp60_;
					_tmp61_ = that_param_values;
					_tmp62_ = param_val;
					_tmp63_ = gee_collection_contains (_tmp61_, _tmp62_);
					if (!_tmp63_) {
						result = FALSE;
						_g_free0 (param_val);
						_g_object_unref0 (_param_val_it);
						_g_object_unref0 (that_param_values);
						_g_object_unref0 (this_param_values);
						_g_free0 (param);
						_g_object_unref0 (_param_it);
						return result;
					}
					_g_free0 (param_val);
				}
				_g_object_unref0 (_param_val_it);
			}
			_g_object_unref0 (that_param_values);
			_g_object_unref0 (this_param_values);
			_g_free0 (param);
		}
		_g_object_unref0 (_param_it);
	}
	result = TRUE;
	return result;
}


gboolean folks_abstract_field_details_equal (FolksAbstractFieldDetails* self, FolksAbstractFieldDetails* that) {
	g_return_val_if_fail (self != NULL, FALSE);
	return FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS (self)->equal (self, that);
}


/**
   * A hash function for the {@link AbstractFieldDetails}.
   *
   * This defaults to a string hash of the
   * {@link AbstractFieldDetails.value} if the generic type is string;
   * otherwise, direct hash of the {@link AbstractFieldDetails.value}.
   *
   * @return the hash value
   *
   * @since 0.6.0
   */
static guint folks_abstract_field_details_real_hash (FolksAbstractFieldDetails* self) {
	guint result = 0U;
	GHashFunc _tmp0_;
	GHashFunc hash_func;
	GHashFunc _tmp2_;
	gconstpointer _tmp3_;
	gconstpointer _tmp4_;
	guint _tmp5_ = 0U;
	_tmp0_ = g_direct_hash;
	hash_func = _tmp0_;
	if (self->priv->t_type == G_TYPE_STRING) {
		GHashFunc _tmp1_;
		_tmp1_ = g_str_hash;
		hash_func = _tmp1_;
	}
	_tmp2_ = hash_func;
	_tmp3_ = folks_abstract_field_details_get_value (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp2_ (_tmp4_);
	result = _tmp5_;
	return result;
}


guint folks_abstract_field_details_hash (FolksAbstractFieldDetails* self) {
	g_return_val_if_fail (self != NULL, 0U);
	return FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS (self)->hash (self);
}


FolksAbstractFieldDetails* folks_abstract_field_details_construct (GType object_type, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func) {
	FolksAbstractFieldDetails * self = NULL;
	self = (FolksAbstractFieldDetails*) 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;
}


gconstpointer folks_abstract_field_details_get_value (FolksAbstractFieldDetails* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS (self)->get_value (self);
}


static gconstpointer folks_abstract_field_details_real_get_value (FolksAbstractFieldDetails* base) {
	gconstpointer result;
	FolksAbstractFieldDetails* self;
	gconstpointer _tmp0_;
	self = base;
	_tmp0_ = self->priv->_value;
	result = _tmp0_;
	return result;
}


void folks_abstract_field_details_set_value (FolksAbstractFieldDetails* self, gconstpointer value) {
	g_return_if_fail (self != NULL);
	FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS (self)->set_value (self, value);
}


static void folks_abstract_field_details_real_set_value (FolksAbstractFieldDetails* base, gconstpointer value) {
	FolksAbstractFieldDetails* self;
	gconstpointer _tmp0_;
	gpointer _tmp1_;
	self = base;
	_tmp0_ = value;
	_tmp1_ = ((_tmp0_ != NULL) && (self->priv->t_dup_func != NULL)) ? self->priv->t_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_);
	((self->priv->_value == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->t_destroy_func (self->priv->_value), NULL));
	self->priv->_value = _tmp1_;
	g_object_notify ((GObject *) self, "value");
}


GeeMultiMap* folks_abstract_field_details_get_parameters (FolksAbstractFieldDetails* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS (self)->get_parameters (self);
}


static GeeMultiMap* folks_abstract_field_details_real_get_parameters (FolksAbstractFieldDetails* base) {
	GeeMultiMap* result;
	FolksAbstractFieldDetails* self;
	GeeMultiMap* _tmp0_;
	self = base;
	_tmp0_ = self->priv->_parameters;
	result = _tmp0_;
	return result;
}


void folks_abstract_field_details_set_parameters (FolksAbstractFieldDetails* self, GeeMultiMap* value) {
	g_return_if_fail (self != NULL);
	FOLKS_ABSTRACT_FIELD_DETAILS_GET_CLASS (self)->set_parameters (self, value);
}


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


static void folks_abstract_field_details_real_set_parameters (FolksAbstractFieldDetails* base, GeeMultiMap* value) {
	FolksAbstractFieldDetails* self;
	GeeMultiMap* _tmp0_;
	self = base;
	_tmp0_ = value;
	if (_tmp0_ == NULL) {
		GeeMultiMap* _tmp1_;
		_tmp1_ = self->priv->_parameters;
		gee_multi_map_clear (_tmp1_);
	} else {
		GeeMultiMap* _tmp2_;
		GeeMultiMap* _tmp3_;
		_tmp2_ = value;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		_g_object_unref0 (self->priv->_parameters);
		self->priv->_parameters = _tmp3_;
	}
	g_object_notify ((GObject *) self, "parameters");
}


static void folks_abstract_field_details_class_init (FolksAbstractFieldDetailsClass * klass) {
	folks_abstract_field_details_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksAbstractFieldDetailsPrivate));
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->equal = folks_abstract_field_details_real_equal;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->hash = folks_abstract_field_details_real_hash;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->get_value = folks_abstract_field_details_real_get_value;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->set_value = folks_abstract_field_details_real_set_value;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->get_parameters = folks_abstract_field_details_real_get_parameters;
	FOLKS_ABSTRACT_FIELD_DETAILS_CLASS (klass)->set_parameters = folks_abstract_field_details_real_set_parameters;
	G_OBJECT_CLASS (klass)->get_property = _vala_folks_abstract_field_details_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folks_abstract_field_details_set_property;
	G_OBJECT_CLASS (klass)->finalize = folks_abstract_field_details_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_ABSTRACT_FIELD_DETAILS_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), FOLKS_ABSTRACT_FIELD_DETAILS_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), FOLKS_ABSTRACT_FIELD_DETAILS_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));
	/**
	   * The value of the field.
	   *
	   * The value of the field, the exact type and content of which depends on what
	   * the structure is used for.
	   *
	   * @since 0.6.0
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_ABSTRACT_FIELD_DETAILS_VALUE, g_param_spec_pointer ("value", "value", "value", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * The parameters associated with the value.
	   *
	   * A multi-map of the parameters associated with
	   * {@link Folks.AbstractFieldDetails.value}. The keys are the names of
	   * the parameters, while the values are a list of strings.
	   *
	   * @since 0.6.0
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_ABSTRACT_FIELD_DETAILS_PARAMETERS, g_param_spec_object ("parameters", "parameters", "parameters", GEE_TYPE_MULTI_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void folks_abstract_field_details_instance_init (FolksAbstractFieldDetails * self) {
	GeeHashMultiMap* _tmp0_;
	self->priv = FOLKS_ABSTRACT_FIELD_DETAILS_GET_PRIVATE (self);
	_tmp0_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL);
	self->priv->_parameters = (GeeMultiMap*) _tmp0_;
}


static void folks_abstract_field_details_finalize (GObject* obj) {
	FolksAbstractFieldDetails * self;
	self = FOLKS_ABSTRACT_FIELD_DETAILS (obj);
	((self->priv->_value == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->t_destroy_func (self->priv->_value), NULL));
	_g_object_unref0 (self->priv->_parameters);
	G_OBJECT_CLASS (folks_abstract_field_details_parent_class)->finalize (obj);
}


/**
 * Object representing any type of value that can have some vCard-like
 * parameters associated with it.
 *
 * Some contact details, like phone numbers or URLs, can have some
 * extra details associated with them.
 * For instance, a phone number expressed in vcard notation as
 * `tel;type=work,voice:(111) 555-1234` would be represented as
 * a AbstractFieldDetails with value "(111) 555-1234" and with parameters
 * `['type': ('work', 'voice')]`.
 *
 * The parameter name "type" with values "work", "home", or "other" are common
 * amongst most vCard attributes (and thus most AbstractFieldDetails-derived
 * classes). A "type" of "pref" may be used to indicate a preferred
 * {@link AbstractFieldDetails.value} amongst many. See specific classes for
 * information on additional parameters and values specific to that class.
 *
 * See [[http://www.ietf.org/rfc/rfc2426.txt|RFC2426]] for more details on
 * pre-defined parameter names and values.
 *
 * @since 0.6.0
 */
GType folks_abstract_field_details_get_type (void) {
	static volatile gsize folks_abstract_field_details_type_id__volatile = 0;
	if (g_once_init_enter (&folks_abstract_field_details_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksAbstractFieldDetailsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_abstract_field_details_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksAbstractFieldDetails), 0, (GInstanceInitFunc) folks_abstract_field_details_instance_init, NULL };
		GType folks_abstract_field_details_type_id;
		folks_abstract_field_details_type_id = g_type_register_static (G_TYPE_OBJECT, "FolksAbstractFieldDetails", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&folks_abstract_field_details_type_id__volatile, folks_abstract_field_details_type_id);
	}
	return folks_abstract_field_details_type_id__volatile;
}


static void _vala_folks_abstract_field_details_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	FolksAbstractFieldDetails * self;
	self = FOLKS_ABSTRACT_FIELD_DETAILS (object);
	switch (property_id) {
		case FOLKS_ABSTRACT_FIELD_DETAILS_VALUE:
		g_value_set_pointer (value, folks_abstract_field_details_get_value (self));
		break;
		case FOLKS_ABSTRACT_FIELD_DETAILS_PARAMETERS:
		g_value_set_object (value, folks_abstract_field_details_get_parameters (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_folks_abstract_field_details_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	FolksAbstractFieldDetails * self;
	self = FOLKS_ABSTRACT_FIELD_DETAILS (object);
	switch (property_id) {
		case FOLKS_ABSTRACT_FIELD_DETAILS_VALUE:
		folks_abstract_field_details_set_value (self, g_value_get_pointer (value));
		break;
		case FOLKS_ABSTRACT_FIELD_DETAILS_PARAMETERS:
		folks_abstract_field_details_set_parameters (self, g_value_get_object (value));
		break;
		case FOLKS_ABSTRACT_FIELD_DETAILS_T_TYPE:
		self->priv->t_type = g_value_get_gtype (value);
		break;
		case FOLKS_ABSTRACT_FIELD_DETAILS_T_DUP_FUNC:
		self->priv->t_dup_func = g_value_get_pointer (value);
		break;
		case FOLKS_ABSTRACT_FIELD_DETAILS_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;
	}
}



