/* plist.c generated by valac 0.38.1.30-90885, the Vala compiler
 * generated from plist.vala, do not modify */

/* 
 * Copyright (C) 2011-2017 Daiki Ueno <ueno@gnu.org>
 * Copyright (C) 2011-2017 Red Hat, Inc.
 * 
 * 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 2
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

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


#define TYPE_PLIST (plist_get_type ())
#define PLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLIST, PList))
#define PLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLIST, PListClass))
#define IS_PLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLIST))
#define IS_PLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLIST))
#define PLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLIST, PListClass))

typedef struct _PList PList;
typedef struct _PListClass PListClass;
typedef struct _PListPrivate PListPrivate;
enum  {
	PLIST_0_PROPERTY,
	PLIST_NUM_PROPERTIES
};
static GParamSpec* plist_properties[PLIST_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

typedef enum  {
	PLIST_PARSE_ERROR_FAILED
} PListParseError;
#define PLIST_PARSE_ERROR plist_parse_error_quark ()
struct _PList {
	GObject parent_instance;
	PListPrivate * priv;
};

struct _PListClass {
	GObjectClass parent_class;
};

struct _PListPrivate {
	GeeMap* map;
};


static gpointer plist_parent_class = NULL;

GQuark plist_parse_error_quark (void);
GType plist_get_type (void) G_GNUC_CONST;
#define PLIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLIST, PListPrivate))
gchar* plist_get (PList* self, const gchar* key);
PList* plist_new (const gchar* str, GError** error);
PList* plist_construct (GType object_type, const gchar* str, GError** error);
gchar* plist_escape (const gchar* str);
gchar* plist_to_string (PList* self);
static void plist_finalize (GObject * obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


GQuark plist_parse_error_quark (void) {
	return g_quark_from_static_string ("plist_parse_error-quark");
}


gchar* plist_get (PList* self, const gchar* key) {
	gchar* result = NULL;
	GeeMap* _tmp0_;
	const gchar* _tmp1_;
	gpointer _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = self->priv->map;
	_tmp1_ = key;
	_tmp2_ = gee_map_get (_tmp0_, _tmp1_);
	result = (gchar*) _tmp2_;
	return result;
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


PList* plist_construct (GType object_type, const gchar* str, GError** error) {
	PList * self = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	gchar* key = NULL;
	gchar* value = NULL;
	gint index = 0;
	gint _tmp37_;
	const gchar* _tmp38_;
	gint _tmp39_;
	gint _tmp40_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (str != NULL, NULL);
	self = (PList*) g_object_new (object_type, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	key = NULL;
	value = NULL;
	{
		gboolean _tmp1_ = FALSE;
		index = 0;
		_tmp1_ = TRUE;
		while (TRUE) {
			gint _tmp3_;
			const gchar* _tmp4_;
			gint _tmp5_;
			gint _tmp6_;
			const gchar* _tmp7_;
			gint _tmp8_;
			gchar _tmp9_;
			if (!_tmp1_) {
				gint _tmp2_;
				_tmp2_ = index;
				index = _tmp2_ + 1;
			}
			_tmp1_ = FALSE;
			_tmp3_ = index;
			_tmp4_ = str;
			_tmp5_ = strlen (_tmp4_);
			_tmp6_ = _tmp5_;
			if (!(_tmp3_ < _tmp6_)) {
				break;
			}
			_tmp7_ = str;
			_tmp8_ = index;
			_tmp9_ = string_get (_tmp7_, (glong) _tmp8_);
			switch (_tmp9_) {
				case '\\':
				{
					gint _tmp10_;
					gint _tmp11_;
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					GString* _tmp16_;
					const gchar* _tmp17_;
					gint _tmp18_;
					gchar _tmp19_;
					_tmp10_ = index;
					index = _tmp10_ + 1;
					_tmp11_ = index;
					_tmp12_ = str;
					_tmp13_ = strlen (_tmp12_);
					_tmp14_ = _tmp13_;
					if (_tmp11_ == _tmp14_) {
						GError* _tmp15_;
						_tmp15_ = g_error_new_literal (PLIST_PARSE_ERROR, PLIST_PARSE_ERROR_FAILED, "");
						_inner_error_ = _tmp15_;
						if (_inner_error_->domain == PLIST_PARSE_ERROR) {
							g_propagate_error (error, _inner_error_);
							_g_free0 (value);
							_g_free0 (key);
							_g_string_free0 (builder);
							_g_object_unref0 (self);
							return NULL;
						} else {
							_g_free0 (value);
							_g_free0 (key);
							_g_string_free0 (builder);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
							return NULL;
						}
					}
					_tmp16_ = builder;
					_tmp17_ = str;
					_tmp18_ = index;
					_tmp19_ = string_get (_tmp17_, (glong) _tmp18_);
					g_string_append_c (_tmp16_, _tmp19_);
					break;
				}
				case ',':
				{
					const gchar* _tmp20_;
					GString* _tmp22_;
					const gchar* _tmp23_;
					gchar* _tmp24_;
					GString* _tmp25_;
					GeeMap* _tmp26_;
					const gchar* _tmp27_;
					const gchar* _tmp28_;
					_tmp20_ = key;
					if (_tmp20_ == NULL) {
						GError* _tmp21_;
						_tmp21_ = g_error_new_literal (PLIST_PARSE_ERROR, PLIST_PARSE_ERROR_FAILED, "");
						_inner_error_ = _tmp21_;
						if (_inner_error_->domain == PLIST_PARSE_ERROR) {
							g_propagate_error (error, _inner_error_);
							_g_free0 (value);
							_g_free0 (key);
							_g_string_free0 (builder);
							_g_object_unref0 (self);
							return NULL;
						} else {
							_g_free0 (value);
							_g_free0 (key);
							_g_string_free0 (builder);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
							return NULL;
						}
					}
					_tmp22_ = builder;
					_tmp23_ = _tmp22_->str;
					_tmp24_ = g_strdup (_tmp23_);
					_g_free0 (value);
					value = _tmp24_;
					_tmp25_ = builder;
					g_string_erase (_tmp25_, (gssize) 0, (gssize) -1);
					_tmp26_ = self->priv->map;
					_tmp27_ = key;
					_tmp28_ = value;
					gee_map_set (_tmp26_, _tmp27_, _tmp28_);
					_g_free0 (key);
					key = NULL;
					break;
				}
				case '=':
				{
					GString* _tmp29_;
					const gchar* _tmp30_;
					gchar* _tmp31_;
					GString* _tmp32_;
					_tmp29_ = builder;
					_tmp30_ = _tmp29_->str;
					_tmp31_ = g_strdup (_tmp30_);
					_g_free0 (key);
					key = _tmp31_;
					_tmp32_ = builder;
					g_string_erase (_tmp32_, (gssize) 0, (gssize) -1);
					_g_free0 (value);
					value = NULL;
					break;
				}
				default:
				{
					GString* _tmp33_;
					const gchar* _tmp34_;
					gint _tmp35_;
					gchar _tmp36_;
					_tmp33_ = builder;
					_tmp34_ = str;
					_tmp35_ = index;
					_tmp36_ = string_get (_tmp34_, (glong) _tmp35_);
					g_string_append_c (_tmp33_, _tmp36_);
					break;
				}
			}
		}
	}
	_tmp37_ = index;
	_tmp38_ = str;
	_tmp39_ = strlen (_tmp38_);
	_tmp40_ = _tmp39_;
	if (_tmp37_ == _tmp40_) {
		const gchar* _tmp41_;
		GString* _tmp43_;
		const gchar* _tmp44_;
		gchar* _tmp45_;
		GeeMap* _tmp46_;
		const gchar* _tmp47_;
		const gchar* _tmp48_;
		_tmp41_ = key;
		if (_tmp41_ == NULL) {
			GError* _tmp42_;
			_tmp42_ = g_error_new_literal (PLIST_PARSE_ERROR, PLIST_PARSE_ERROR_FAILED, "");
			_inner_error_ = _tmp42_;
			if (_inner_error_->domain == PLIST_PARSE_ERROR) {
				g_propagate_error (error, _inner_error_);
				_g_free0 (value);
				_g_free0 (key);
				_g_string_free0 (builder);
				_g_object_unref0 (self);
				return NULL;
			} else {
				_g_free0 (value);
				_g_free0 (key);
				_g_string_free0 (builder);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return NULL;
			}
		}
		_tmp43_ = builder;
		_tmp44_ = _tmp43_->str;
		_tmp45_ = g_strdup (_tmp44_);
		_g_free0 (value);
		value = _tmp45_;
		_tmp46_ = self->priv->map;
		_tmp47_ = key;
		_tmp48_ = value;
		gee_map_set (_tmp46_, _tmp47_, _tmp48_);
	}
	_g_free0 (value);
	_g_free0 (key);
	_g_string_free0 (builder);
	return self;
}


PList* plist_new (const gchar* str, GError** error) {
	return plist_construct (TYPE_PLIST, str, error);
}


static gboolean string_get_next_char (const gchar* self, gint* index, gunichar* c) {
	gunichar _vala_c = 0U;
	gboolean result = FALSE;
	gint _tmp0_;
	gunichar _tmp1_;
	gunichar _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = *index;
	_tmp1_ = g_utf8_get_char (((gchar*) self) + _tmp0_);
	_vala_c = _tmp1_;
	_tmp2_ = _vala_c;
	if (_tmp2_ != ((gunichar) 0)) {
		gint _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = *index;
		_tmp4_ = g_utf8_next_char (((gchar*) self) + _tmp3_);
		*index = (gint) (_tmp4_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
	if (c) {
		*c = _vala_c;
	}
}


gchar* plist_escape (const gchar* str) {
	gchar* result = NULL;
	GString* builder = NULL;
	GString* _tmp0_;
	gint index = 0;
	gunichar uc = 0U;
	GString* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	g_return_val_if_fail (str != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	index = 0;
	while (TRUE) {
		const gchar* _tmp1_;
		gunichar _tmp2_ = 0U;
		gboolean _tmp3_;
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		gunichar _tmp6_;
		GString* _tmp10_;
		gunichar _tmp11_;
		_tmp1_ = str;
		_tmp3_ = string_get_next_char (_tmp1_, &index, &_tmp2_);
		uc = _tmp2_;
		if (!_tmp3_) {
			break;
		}
		_tmp6_ = uc;
		if (_tmp6_ == ((gunichar) ',')) {
			_tmp5_ = TRUE;
		} else {
			gunichar _tmp7_;
			_tmp7_ = uc;
			_tmp5_ = _tmp7_ == ((gunichar) '\\');
		}
		if (_tmp5_) {
			_tmp4_ = TRUE;
		} else {
			gunichar _tmp8_;
			_tmp8_ = uc;
			_tmp4_ = _tmp8_ == ((gunichar) '=');
		}
		if (_tmp4_) {
			GString* _tmp9_;
			_tmp9_ = builder;
			g_string_append (_tmp9_, "\\");
		}
		_tmp10_ = builder;
		_tmp11_ = uc;
		g_string_append_unichar (_tmp10_, _tmp11_);
	}
	_tmp12_ = builder;
	_tmp13_ = _tmp12_->str;
	_tmp14_ = g_strdup (_tmp13_);
	result = _tmp14_;
	_g_string_free0 (builder);
	return result;
}


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


static gchar* _vala_g_strjoinv (const gchar* separator, gchar** str_array, int str_array_length1) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gchar** _tmp3_;
	gint _tmp3__length1;
	_tmp0_ = separator;
	if (_tmp0_ == NULL) {
		separator = "";
	}
	_tmp3_ = str_array;
	_tmp3__length1 = str_array_length1;
	if (_tmp3_ != NULL) {
		_tmp2_ = TRUE;
	} else {
		gchar** _tmp4_;
		gint _tmp4__length1;
		_tmp4_ = str_array;
		_tmp4__length1 = str_array_length1;
		_tmp2_ = _tmp4__length1 > 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp5_ = FALSE;
		gchar** _tmp6_;
		gint _tmp6__length1;
		_tmp6_ = str_array;
		_tmp6__length1 = str_array_length1;
		if (_tmp6__length1 == -1) {
			gchar** _tmp7_;
			gint _tmp7__length1;
			const gchar* _tmp8_;
			_tmp7_ = str_array;
			_tmp7__length1 = str_array_length1;
			_tmp8_ = _tmp7_[0];
			_tmp5_ = _tmp8_ != NULL;
		} else {
			_tmp5_ = FALSE;
		}
		_tmp1_ = _tmp5_;
	}
	if (_tmp1_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp31_;
		gint _tmp33_;
		gint _tmp34_;
		gsize _tmp35_;
		const gchar* _tmp36_;
		gint _tmp37_;
		gint _tmp38_;
		gint _tmp39_;
		const gchar* res = NULL;
		gsize _tmp40_;
		void* _tmp41_;
		void* ptr = NULL;
		const gchar* _tmp42_;
		gchar** _tmp43_;
		gint _tmp43__length1;
		const gchar* _tmp44_;
		void* _tmp45_;
		const gchar* _tmp62_;
		len = (gsize) 1;
		{
			gboolean _tmp9_ = FALSE;
			i = 0;
			_tmp9_ = TRUE;
			while (TRUE) {
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				gchar** _tmp13_;
				gint _tmp13__length1;
				gint _tmp21_ = 0;
				gchar** _tmp22_;
				gint _tmp22__length1;
				gint _tmp23_;
				const gchar* _tmp24_;
				gsize _tmp30_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp13_ = str_array;
				_tmp13__length1 = str_array_length1;
				if (_tmp13__length1 != -1) {
					gint _tmp14_;
					gchar** _tmp15_;
					gint _tmp15__length1;
					_tmp14_ = i;
					_tmp15_ = str_array;
					_tmp15__length1 = str_array_length1;
					_tmp12_ = _tmp14_ < _tmp15__length1;
				} else {
					_tmp12_ = FALSE;
				}
				if (_tmp12_) {
					_tmp11_ = TRUE;
				} else {
					gboolean _tmp16_ = FALSE;
					gchar** _tmp17_;
					gint _tmp17__length1;
					_tmp17_ = str_array;
					_tmp17__length1 = str_array_length1;
					if (_tmp17__length1 == -1) {
						gchar** _tmp18_;
						gint _tmp18__length1;
						gint _tmp19_;
						const gchar* _tmp20_;
						_tmp18_ = str_array;
						_tmp18__length1 = str_array_length1;
						_tmp19_ = i;
						_tmp20_ = _tmp18_[_tmp19_];
						_tmp16_ = _tmp20_ != NULL;
					} else {
						_tmp16_ = FALSE;
					}
					_tmp11_ = _tmp16_;
				}
				if (!_tmp11_) {
					break;
				}
				_tmp22_ = str_array;
				_tmp22__length1 = str_array_length1;
				_tmp23_ = i;
				_tmp24_ = _tmp22_[_tmp23_];
				if (_tmp24_ != NULL) {
					gchar** _tmp25_;
					gint _tmp25__length1;
					gint _tmp26_;
					const gchar* _tmp27_;
					gint _tmp28_;
					gint _tmp29_;
					_tmp25_ = str_array;
					_tmp25__length1 = str_array_length1;
					_tmp26_ = i;
					_tmp27_ = _tmp25_[_tmp26_];
					_tmp28_ = strlen ((const gchar*) _tmp27_);
					_tmp29_ = _tmp28_;
					_tmp21_ = _tmp29_;
				} else {
					_tmp21_ = 0;
				}
				_tmp30_ = len;
				len = _tmp30_ + _tmp21_;
			}
		}
		_tmp31_ = i;
		if (_tmp31_ == 0) {
			gchar* _tmp32_;
			_tmp32_ = g_strdup ("");
			result = _tmp32_;
			return result;
		}
		_tmp33_ = i;
		str_array_length1 = _tmp33_;
		_tmp34_ = str_array_length1;
		_tmp35_ = len;
		_tmp36_ = separator;
		_tmp37_ = strlen ((const gchar*) _tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = i;
		len = _tmp35_ + (_tmp38_ * (_tmp39_ - 1));
		_tmp40_ = len;
		_tmp41_ = g_malloc (_tmp40_);
		res = _tmp41_;
		_tmp42_ = res;
		_tmp43_ = str_array;
		_tmp43__length1 = str_array_length1;
		_tmp44_ = _tmp43_[0];
		_tmp45_ = g_stpcpy ((void*) _tmp42_, (const gchar*) _tmp44_);
		ptr = _tmp45_;
		{
			gboolean _tmp46_ = FALSE;
			i = 1;
			_tmp46_ = TRUE;
			while (TRUE) {
				gint _tmp48_;
				gchar** _tmp49_;
				gint _tmp49__length1;
				void* _tmp50_;
				const gchar* _tmp51_;
				void* _tmp52_;
				const gchar* _tmp53_ = NULL;
				gchar** _tmp54_;
				gint _tmp54__length1;
				gint _tmp55_;
				const gchar* _tmp56_;
				void* _tmp60_;
				void* _tmp61_;
				if (!_tmp46_) {
					gint _tmp47_;
					_tmp47_ = i;
					i = _tmp47_ + 1;
				}
				_tmp46_ = FALSE;
				_tmp48_ = i;
				_tmp49_ = str_array;
				_tmp49__length1 = str_array_length1;
				if (!(_tmp48_ < _tmp49__length1)) {
					break;
				}
				_tmp50_ = ptr;
				_tmp51_ = separator;
				_tmp52_ = g_stpcpy (_tmp50_, (const gchar*) _tmp51_);
				ptr = _tmp52_;
				_tmp54_ = str_array;
				_tmp54__length1 = str_array_length1;
				_tmp55_ = i;
				_tmp56_ = _tmp54_[_tmp55_];
				if (_tmp56_ != NULL) {
					gchar** _tmp57_;
					gint _tmp57__length1;
					gint _tmp58_;
					const gchar* _tmp59_;
					_tmp57_ = str_array;
					_tmp57__length1 = str_array_length1;
					_tmp58_ = i;
					_tmp59_ = _tmp57_[_tmp58_];
					_tmp53_ = (const gchar*) _tmp59_;
				} else {
					_tmp53_ = "";
				}
				_tmp60_ = ptr;
				_tmp61_ = g_stpcpy (_tmp60_, _tmp53_);
				ptr = _tmp61_;
			}
		}
		_tmp62_ = res;
		res = NULL;
		result = (gchar*) _tmp62_;
		return result;
	} else {
		gchar* _tmp63_;
		_tmp63_ = g_strdup ("");
		result = _tmp63_;
		return result;
	}
}


gchar* plist_to_string (PList* self) {
	gchar* result = NULL;
	GeeArrayList* props = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* keys = NULL;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeMap* _tmp3_;
	GeeSet* _tmp4_;
	GeeSet* _tmp5_;
	GeeSet* _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp31_;
	gint _tmp32_;
	gpointer* _tmp33_;
	gchar** _tmp34_;
	gint _tmp34__length1;
	gchar* _tmp35_;
	gchar* _tmp36_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	props = _tmp0_;
	_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	keys = _tmp1_;
	_tmp2_ = keys;
	_tmp3_ = self->priv->map;
	_tmp4_ = gee_map_get_keys (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	gee_array_list_add_all (_tmp2_, (GeeCollection*) _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = keys;
	gee_list_sort ((GeeList*) _tmp7_, NULL, NULL, NULL);
	{
		GeeArrayList* _key_list = NULL;
		GeeArrayList* _tmp8_;
		GeeArrayList* _tmp9_;
		gint _key_size = 0;
		GeeArrayList* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gint _key_index = 0;
		_tmp8_ = keys;
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_key_list = _tmp9_;
		_tmp10_ = _key_list;
		_tmp11_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp10_);
		_tmp12_ = _tmp11_;
		_key_size = _tmp12_;
		_key_index = -1;
		while (TRUE) {
			gint _tmp13_;
			gint _tmp14_;
			gint _tmp15_;
			gchar* key = NULL;
			GeeArrayList* _tmp16_;
			gint _tmp17_;
			gpointer _tmp18_;
			gchar* value = NULL;
			GeeMap* _tmp19_;
			const gchar* _tmp20_;
			gpointer _tmp21_;
			GeeArrayList* _tmp22_;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			const gchar* _tmp26_;
			gchar* _tmp27_;
			gchar* _tmp28_;
			gchar* _tmp29_;
			gchar* _tmp30_;
			_tmp13_ = _key_index;
			_key_index = _tmp13_ + 1;
			_tmp14_ = _key_index;
			_tmp15_ = _key_size;
			if (!(_tmp14_ < _tmp15_)) {
				break;
			}
			_tmp16_ = _key_list;
			_tmp17_ = _key_index;
			_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, _tmp17_);
			key = (gchar*) _tmp18_;
			_tmp19_ = self->priv->map;
			_tmp20_ = key;
			_tmp21_ = gee_map_get (_tmp19_, _tmp20_);
			value = (gchar*) _tmp21_;
			_tmp22_ = props;
			_tmp23_ = key;
			_tmp24_ = plist_escape (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = value;
			_tmp27_ = plist_escape (_tmp26_);
			_tmp28_ = _tmp27_;
			_tmp29_ = g_strdup_printf ("%s=%s", _tmp25_, _tmp28_);
			_tmp30_ = _tmp29_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp30_);
			_g_free0 (_tmp30_);
			_g_free0 (_tmp28_);
			_g_free0 (_tmp25_);
			_g_free0 (value);
			_g_free0 (key);
		}
		_g_object_unref0 (_key_list);
	}
	_tmp31_ = props;
	_tmp33_ = gee_collection_to_array ((GeeCollection*) _tmp31_, &_tmp32_);
	_tmp34_ = _tmp33_;
	_tmp34__length1 = _tmp32_;
	_tmp35_ = _vala_g_strjoinv (",", _tmp34_, _tmp32_);
	_tmp36_ = _tmp35_;
	_tmp34_ = (_vala_array_free (_tmp34_, _tmp34__length1, (GDestroyNotify) g_free), NULL);
	result = _tmp36_;
	_g_object_unref0 (keys);
	_g_object_unref0 (props);
	return result;
}


static void plist_class_init (PListClass * klass) {
	plist_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (PListPrivate));
	G_OBJECT_CLASS (klass)->finalize = plist_finalize;
}


static void plist_instance_init (PList * self) {
	GeeHashMap* _tmp0_;
	self->priv = PLIST_GET_PRIVATE (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->map = (GeeMap*) _tmp0_;
}


static void plist_finalize (GObject * obj) {
	PList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PLIST, PList);
	_g_object_unref0 (self->priv->map);
	G_OBJECT_CLASS (plist_parent_class)->finalize (obj);
}


GType plist_get_type (void) {
	static volatile gsize plist_type_id__volatile = 0;
	if (g_once_init_enter (&plist_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plist_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PList), 0, (GInstanceInitFunc) plist_instance_init, NULL };
		GType plist_type_id;
		plist_type_id = g_type_register_static (G_TYPE_OBJECT, "PList", &g_define_type_info, 0);
		g_once_init_leave (&plist_type_id__volatile, plist_type_id);
	}
	return plist_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



