/* vdf-parser.c generated by valac 0.56.19, the Vala compiler
 * generated from vdf-parser.vala, do not modify */

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_0_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CHILDREN_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_START_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_END_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_START_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_END_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_START_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_END_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CLOSING_BRACE_START_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_ENTRY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_0_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_CONTENT_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_ROOT_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_vdf_vdf_document_properties[PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_NUM_PROPERTIES];
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
enum  {
	PROTON_PLUS_UTILS_VDF_VDF_PARSER_0_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_PARSER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_vdf_vdf_parser_properties[PROTON_PLUS_UTILS_VDF_VDF_PARSER_NUM_PROPERTIES];

#define PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER (proton_plus_utils_vdf_vdf_parser_document_parser_get_type ())
#define PROTON_PLUS_UTILS_VDF_VDF_PARSER_DOCUMENT_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER, ProtonPlusUtilsVDFVdfParserDocumentParser))
#define PROTON_PLUS_UTILS_VDF_VDF_PARSER_DOCUMENT_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER, ProtonPlusUtilsVDFVdfParserDocumentParserClass))
#define PROTON_PLUS_UTILS_VDF_VDF_PARSER_IS_DOCUMENT_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER))
#define PROTON_PLUS_UTILS_VDF_VDF_PARSER_IS_DOCUMENT_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER))
#define PROTON_PLUS_UTILS_VDF_VDF_PARSER_DOCUMENT_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER, ProtonPlusUtilsVDFVdfParserDocumentParserClass))

typedef struct _ProtonPlusUtilsVDFVdfParserDocumentParser ProtonPlusUtilsVDFVdfParserDocumentParser;
typedef struct _ProtonPlusUtilsVDFVdfParserDocumentParserClass ProtonPlusUtilsVDFVdfParserDocumentParserClass;
typedef struct _ProtonPlusUtilsVDFVdfParserDocumentParserPrivate ProtonPlusUtilsVDFVdfParserDocumentParserPrivate;
enum  {
	PROTON_PLUS_UTILS_VDF_VDF_PARSER_DOCUMENT_PARSER_0_PROPERTY,
	PROTON_PLUS_UTILS_VDF_VDF_PARSER_DOCUMENT_PARSER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_vdf_vdf_parser_document_parser_properties[PROTON_PLUS_UTILS_VDF_VDF_PARSER_DOCUMENT_PARSER_NUM_PROPERTIES];
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

struct _ProtonPlusUtilsVDFVdfEntryPrivate {
	gchar* _key;
	gchar* _value;
	GeeArrayList* _children;
	gint _start;
	gint _end;
	gint _value_start;
	gint _value_end;
	gint _key_start;
	gint _key_end;
	gint _closing_brace_start;
};

struct _ProtonPlusUtilsVDFVdfDocumentPrivate {
	gchar* _content;
	ProtonPlusUtilsVDFVdfEntry* _root;
};

struct _ProtonPlusUtilsVDFVdfParserDocumentParser {
	GObject parent_instance;
	ProtonPlusUtilsVDFVdfParserDocumentParserPrivate * priv;
};

struct _ProtonPlusUtilsVDFVdfParserDocumentParserClass {
	GObjectClass parent_class;
};

struct _ProtonPlusUtilsVDFVdfParserDocumentParserPrivate {
	gchar* content;
	gint position;
};

static gint ProtonPlusUtilsVDFVdfEntry_private_offset;
static gpointer proton_plus_utils_vdf_vdf_entry_parent_class = NULL;
static gint ProtonPlusUtilsVDFVdfDocument_private_offset;
static gpointer proton_plus_utils_vdf_vdf_document_parent_class = NULL;
static gpointer proton_plus_utils_vdf_vdf_parser_parent_class = NULL;
static gint ProtonPlusUtilsVDFVdfParserDocumentParser_private_offset;
static gpointer proton_plus_utils_vdf_vdf_parser_document_parser_parent_class = NULL;

static void proton_plus_utils_vdf_vdf_entry_set_key (ProtonPlusUtilsVDFVdfEntry* self,
                                              const gchar* value);
static void proton_plus_utils_vdf_vdf_entry_set_start (ProtonPlusUtilsVDFVdfEntry* self,
                                                gint value);
static void proton_plus_utils_vdf_vdf_entry_set_end (ProtonPlusUtilsVDFVdfEntry* self,
                                              gint value);
static void proton_plus_utils_vdf_vdf_entry_set_value_start (ProtonPlusUtilsVDFVdfEntry* self,
                                                      gint value);
static void proton_plus_utils_vdf_vdf_entry_set_value_end (ProtonPlusUtilsVDFVdfEntry* self,
                                                    gint value);
static void proton_plus_utils_vdf_vdf_entry_set_key_start (ProtonPlusUtilsVDFVdfEntry* self,
                                                    gint value);
static void proton_plus_utils_vdf_vdf_entry_set_key_end (ProtonPlusUtilsVDFVdfEntry* self,
                                                  gint value);
static void proton_plus_utils_vdf_vdf_entry_set_closing_brace_start (ProtonPlusUtilsVDFVdfEntry* self,
                                                              gint value);
static void proton_plus_utils_vdf_vdf_entry_set_children (ProtonPlusUtilsVDFVdfEntry* self,
                                                   GeeArrayList* value);
VALA_EXTERN void proton_plus_utils_vdf_vdf_entry_set_value_range (ProtonPlusUtilsVDFVdfEntry* self,
                                                      const gchar* value,
                                                      gint start,
                                                      gint end);
static void proton_plus_utils_vdf_vdf_entry_set_value (ProtonPlusUtilsVDFVdfEntry* self,
                                                const gchar* value);
VALA_EXTERN void proton_plus_utils_vdf_vdf_entry_set_key_range (ProtonPlusUtilsVDFVdfEntry* self,
                                                    gint start,
                                                    gint end);
VALA_EXTERN void proton_plus_utils_vdf_vdf_entry_set_block_end (ProtonPlusUtilsVDFVdfEntry* self,
                                                    gint closing_brace_start,
                                                    gint end);
static void proton_plus_utils_vdf_vdf_entry_finalize (GObject * obj);
static GType proton_plus_utils_vdf_vdf_entry_get_type_once (void);
static void _vala_proton_plus_utils_vdf_vdf_entry_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void _vala_proton_plus_utils_vdf_vdf_entry_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec);
static void proton_plus_utils_vdf_vdf_document_set_content (ProtonPlusUtilsVDFVdfDocument* self,
                                                     const gchar* value);
static void proton_plus_utils_vdf_vdf_document_set_root (ProtonPlusUtilsVDFVdfDocument* self,
                                                  ProtonPlusUtilsVDFVdfEntry* value);
static gint proton_plus_utils_vdf_vdf_document_line_start (ProtonPlusUtilsVDFVdfDocument* self,
                                                    gint position);
static void proton_plus_utils_vdf_vdf_document_finalize (GObject * obj);
static GType proton_plus_utils_vdf_vdf_document_get_type_once (void);
static void _vala_proton_plus_utils_vdf_vdf_document_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_proton_plus_utils_vdf_vdf_document_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);
static GType proton_plus_utils_vdf_vdf_parser_document_parser_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static ProtonPlusUtilsVDFVdfParserDocumentParser* proton_plus_utils_vdf_vdf_parser_document_parser_new (const gchar* content);
static ProtonPlusUtilsVDFVdfParserDocumentParser* proton_plus_utils_vdf_vdf_parser_document_parser_construct (GType object_type,
                                                                                                       const gchar* content);
static ProtonPlusUtilsVDFVdfDocument* proton_plus_utils_vdf_vdf_parser_document_parser_parse (ProtonPlusUtilsVDFVdfParserDocumentParser* self);
static gboolean proton_plus_utils_vdf_vdf_parser_document_parser_parse_entries (ProtonPlusUtilsVDFVdfParserDocumentParser* self,
                                                                         ProtonPlusUtilsVDFVdfEntry* parent,
                                                                         gboolean expect_closing_brace);
static void proton_plus_utils_vdf_vdf_parser_document_parser_skip_ignored (ProtonPlusUtilsVDFVdfParserDocumentParser* self);
static void proton_plus_utils_vdf_vdf_parser_document_parser_advance (ProtonPlusUtilsVDFVdfParserDocumentParser* self);
static gboolean proton_plus_utils_vdf_vdf_parser_document_parser_read_quoted (ProtonPlusUtilsVDFVdfParserDocumentParser* self,
                                                                       gchar** value,
                                                                       gint* start,
                                                                       gint* end);
static void proton_plus_utils_vdf_vdf_parser_document_parser_finalize (GObject * obj);
static GType proton_plus_utils_vdf_vdf_parser_document_parser_get_type_once (void);
static GType proton_plus_utils_vdf_vdf_parser_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_utils_vdf_vdf_entry_get_instance_private (ProtonPlusUtilsVDFVdfEntry* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsVDFVdfEntry_private_offset);
}

ProtonPlusUtilsVDFVdfEntry*
proton_plus_utils_vdf_vdf_entry_construct (GType object_type,
                                           const gchar* key,
                                           gint start)
{
	ProtonPlusUtilsVDFVdfEntry * self = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	g_return_val_if_fail (key != NULL, NULL);
	self = (ProtonPlusUtilsVDFVdfEntry*) g_object_new (object_type, NULL);
	proton_plus_utils_vdf_vdf_entry_set_key (self, key);
	proton_plus_utils_vdf_vdf_entry_set_start (self, start);
	proton_plus_utils_vdf_vdf_entry_set_end (self, start);
	proton_plus_utils_vdf_vdf_entry_set_value_start (self, -1);
	proton_plus_utils_vdf_vdf_entry_set_value_end (self, -1);
	proton_plus_utils_vdf_vdf_entry_set_key_start (self, -1);
	proton_plus_utils_vdf_vdf_entry_set_key_end (self, -1);
	proton_plus_utils_vdf_vdf_entry_set_closing_brace_start (self, -1);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_UTILS_VDF_TYPE_VDF_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_tmp1_ = _tmp0_;
	proton_plus_utils_vdf_vdf_entry_set_children (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	return self;
}

ProtonPlusUtilsVDFVdfEntry*
proton_plus_utils_vdf_vdf_entry_new (const gchar* key,
                                     gint start)
{
	return proton_plus_utils_vdf_vdf_entry_construct (PROTON_PLUS_UTILS_VDF_TYPE_VDF_ENTRY, key, start);
}

ProtonPlusUtilsVDFVdfEntry*
proton_plus_utils_vdf_vdf_entry_get_child (ProtonPlusUtilsVDFVdfEntry* self,
                                           const gchar* child_key)
{
	ProtonPlusUtilsVDFVdfEntry* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (child_key != NULL, NULL);
	{
		GeeArrayList* _child_list = NULL;
		GeeArrayList* _tmp0_;
		gint _child_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _child_index = 0;
		_tmp0_ = self->priv->_children;
		_child_list = _tmp0_;
		_tmp1_ = _child_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_child_size = _tmp3_;
		_child_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ProtonPlusUtilsVDFVdfEntry* child = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			ProtonPlusUtilsVDFVdfEntry* _tmp8_;
			const gchar* _tmp9_;
			_child_index = _child_index + 1;
			_tmp4_ = _child_index;
			_tmp5_ = _child_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _child_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _child_index);
			child = (ProtonPlusUtilsVDFVdfEntry*) _tmp7_;
			_tmp8_ = child;
			_tmp9_ = _tmp8_->priv->_key;
			if (g_strcmp0 (_tmp9_, child_key) == 0) {
				result = child;
				return result;
			}
			_g_object_unref0 (child);
		}
	}
	result = NULL;
	return result;
}

void
proton_plus_utils_vdf_vdf_entry_set_value_range (ProtonPlusUtilsVDFVdfEntry* self,
                                                 const gchar* value,
                                                 gint start,
                                                 gint end)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (value != NULL);
	proton_plus_utils_vdf_vdf_entry_set_value (self, value);
	proton_plus_utils_vdf_vdf_entry_set_value_start (self, start);
	proton_plus_utils_vdf_vdf_entry_set_value_end (self, end);
	proton_plus_utils_vdf_vdf_entry_set_end (self, end);
}

void
proton_plus_utils_vdf_vdf_entry_set_key_range (ProtonPlusUtilsVDFVdfEntry* self,
                                               gint start,
                                               gint end)
{
	g_return_if_fail (self != NULL);
	proton_plus_utils_vdf_vdf_entry_set_key_start (self, start);
	proton_plus_utils_vdf_vdf_entry_set_key_end (self, end);
}

void
proton_plus_utils_vdf_vdf_entry_set_block_end (ProtonPlusUtilsVDFVdfEntry* self,
                                               gint closing_brace_start,
                                               gint end)
{
	g_return_if_fail (self != NULL);
	proton_plus_utils_vdf_vdf_entry_set_closing_brace_start (self, closing_brace_start);
	proton_plus_utils_vdf_vdf_entry_set_end (self, end);
}

const gchar*
proton_plus_utils_vdf_vdf_entry_get_key (ProtonPlusUtilsVDFVdfEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_key;
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_key (ProtonPlusUtilsVDFVdfEntry* self,
                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_key (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_key);
		self->priv->_key = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_PROPERTY]);
	}
}

const gchar*
proton_plus_utils_vdf_vdf_entry_get_value (ProtonPlusUtilsVDFVdfEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_value;
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_value (ProtonPlusUtilsVDFVdfEntry* self,
                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_value (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_value);
		self->priv->_value = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_PROPERTY]);
	}
}

GeeArrayList*
proton_plus_utils_vdf_vdf_entry_get_children (ProtonPlusUtilsVDFVdfEntry* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_children;
	result = _tmp0_;
	return result;
}

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

static void
proton_plus_utils_vdf_vdf_entry_set_children (ProtonPlusUtilsVDFVdfEntry* self,
                                              GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_children (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_children);
		self->priv->_children = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CHILDREN_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_start (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_start;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_start (ProtonPlusUtilsVDFVdfEntry* self,
                                           gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_start (self);
	if (old_value != value) {
		self->priv->_start = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_START_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_end (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_end;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_end (ProtonPlusUtilsVDFVdfEntry* self,
                                         gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_end (self);
	if (old_value != value) {
		self->priv->_end = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_END_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_value_start (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_value_start;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_value_start (ProtonPlusUtilsVDFVdfEntry* self,
                                                 gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_value_start (self);
	if (old_value != value) {
		self->priv->_value_start = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_START_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_value_end (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_value_end;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_value_end (ProtonPlusUtilsVDFVdfEntry* self,
                                               gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_value_end (self);
	if (old_value != value) {
		self->priv->_value_end = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_END_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_key_start (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_key_start;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_key_start (ProtonPlusUtilsVDFVdfEntry* self,
                                               gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_key_start (self);
	if (old_value != value) {
		self->priv->_key_start = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_START_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_key_end (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_key_end;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_key_end (ProtonPlusUtilsVDFVdfEntry* self,
                                             gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_key_end (self);
	if (old_value != value) {
		self->priv->_key_end = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_END_PROPERTY]);
	}
}

gint
proton_plus_utils_vdf_vdf_entry_get_closing_brace_start (ProtonPlusUtilsVDFVdfEntry* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_closing_brace_start;
	return result;
}

static void
proton_plus_utils_vdf_vdf_entry_set_closing_brace_start (ProtonPlusUtilsVDFVdfEntry* self,
                                                         gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_entry_get_closing_brace_start (self);
	if (old_value != value) {
		self->priv->_closing_brace_start = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CLOSING_BRACE_START_PROPERTY]);
	}
}

static void
proton_plus_utils_vdf_vdf_entry_class_init (ProtonPlusUtilsVDFVdfEntryClass * klass,
                                            gpointer klass_data)
{
	proton_plus_utils_vdf_vdf_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsVDFVdfEntry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_vdf_vdf_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_utils_vdf_vdf_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_vdf_vdf_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_PROPERTY] = g_param_spec_string ("key", "key", "key", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_PROPERTY] = g_param_spec_string ("value", "value", "value", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CHILDREN_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CHILDREN_PROPERTY] = g_param_spec_object ("children", "children", "children", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_START_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_START_PROPERTY] = g_param_spec_int ("start", "start", "start", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_END_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_END_PROPERTY] = g_param_spec_int ("end", "end", "end", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_START_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_START_PROPERTY] = g_param_spec_int ("value-start", "value-start", "value-start", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_END_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_END_PROPERTY] = g_param_spec_int ("value-end", "value-end", "value-end", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_START_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_START_PROPERTY] = g_param_spec_int ("key-start", "key-start", "key-start", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_END_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_END_PROPERTY] = g_param_spec_int ("key-end", "key-end", "key-end", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CLOSING_BRACE_START_PROPERTY, proton_plus_utils_vdf_vdf_entry_properties[PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CLOSING_BRACE_START_PROPERTY] = g_param_spec_int ("closing-brace-start", "closing-brace-start", "closing-brace-start", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_utils_vdf_vdf_entry_instance_init (ProtonPlusUtilsVDFVdfEntry * self,
                                               gpointer klass)
{
	self->priv = proton_plus_utils_vdf_vdf_entry_get_instance_private (self);
}

static void
proton_plus_utils_vdf_vdf_entry_finalize (GObject * obj)
{
	ProtonPlusUtilsVDFVdfEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_VDF_TYPE_VDF_ENTRY, ProtonPlusUtilsVDFVdfEntry);
	_g_free0 (self->priv->_key);
	_g_free0 (self->priv->_value);
	_g_object_unref0 (self->priv->_children);
	G_OBJECT_CLASS (proton_plus_utils_vdf_vdf_entry_parent_class)->finalize (obj);
}

/**
     * A parsed VDF key/value entry.  Source positions refer to the original
     * document, which lets callers make small edits without serializing the
     * whole file again.
     */
static GType
proton_plus_utils_vdf_vdf_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsVDFVdfEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_vdf_vdf_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsVDFVdfEntry), 0, (GInstanceInitFunc) proton_plus_utils_vdf_vdf_entry_instance_init, NULL };
	GType proton_plus_utils_vdf_vdf_entry_type_id;
	proton_plus_utils_vdf_vdf_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsVDFVdfEntry", &g_define_type_info, 0);
	ProtonPlusUtilsVDFVdfEntry_private_offset = g_type_add_instance_private (proton_plus_utils_vdf_vdf_entry_type_id, sizeof (ProtonPlusUtilsVDFVdfEntryPrivate));
	return proton_plus_utils_vdf_vdf_entry_type_id;
}

GType
proton_plus_utils_vdf_vdf_entry_get_type (void)
{
	static volatile gsize proton_plus_utils_vdf_vdf_entry_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_vdf_vdf_entry_type_id__once)) {
		GType proton_plus_utils_vdf_vdf_entry_type_id;
		proton_plus_utils_vdf_vdf_entry_type_id = proton_plus_utils_vdf_vdf_entry_get_type_once ();
		g_once_init_leave (&proton_plus_utils_vdf_vdf_entry_type_id__once, proton_plus_utils_vdf_vdf_entry_type_id);
	}
	return proton_plus_utils_vdf_vdf_entry_type_id__once;
}

static void
_vala_proton_plus_utils_vdf_vdf_entry_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	ProtonPlusUtilsVDFVdfEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_VDF_TYPE_VDF_ENTRY, ProtonPlusUtilsVDFVdfEntry);
	switch (property_id) {
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_PROPERTY:
		g_value_set_string (value, proton_plus_utils_vdf_vdf_entry_get_key (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_PROPERTY:
		g_value_set_string (value, proton_plus_utils_vdf_vdf_entry_get_value (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CHILDREN_PROPERTY:
		g_value_set_object (value, proton_plus_utils_vdf_vdf_entry_get_children (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_START_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_start (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_END_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_end (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_START_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_value_start (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_END_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_value_end (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_START_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_key_start (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_END_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_key_end (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CLOSING_BRACE_START_PROPERTY:
		g_value_set_int (value, proton_plus_utils_vdf_vdf_entry_get_closing_brace_start (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_utils_vdf_vdf_entry_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec)
{
	ProtonPlusUtilsVDFVdfEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_VDF_TYPE_VDF_ENTRY, ProtonPlusUtilsVDFVdfEntry);
	switch (property_id) {
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_key (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_value (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CHILDREN_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_children (self, g_value_get_object (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_START_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_start (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_END_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_end (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_START_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_value_start (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_VALUE_END_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_value_end (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_START_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_key_start (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_KEY_END_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_key_end (self, g_value_get_int (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_ENTRY_CLOSING_BRACE_START_PROPERTY:
		proton_plus_utils_vdf_vdf_entry_set_closing_brace_start (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
proton_plus_utils_vdf_vdf_document_get_instance_private (ProtonPlusUtilsVDFVdfDocument* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsVDFVdfDocument_private_offset);
}

ProtonPlusUtilsVDFVdfDocument*
proton_plus_utils_vdf_vdf_document_construct (GType object_type,
                                              const gchar* content,
                                              ProtonPlusUtilsVDFVdfEntry* root)
{
	ProtonPlusUtilsVDFVdfDocument * self = NULL;
	g_return_val_if_fail (content != NULL, NULL);
	g_return_val_if_fail (root != NULL, NULL);
	self = (ProtonPlusUtilsVDFVdfDocument*) g_object_new (object_type, NULL);
	proton_plus_utils_vdf_vdf_document_set_content (self, content);
	proton_plus_utils_vdf_vdf_document_set_root (self, root);
	return self;
}

ProtonPlusUtilsVDFVdfDocument*
proton_plus_utils_vdf_vdf_document_new (const gchar* content,
                                        ProtonPlusUtilsVDFVdfEntry* root)
{
	return proton_plus_utils_vdf_vdf_document_construct (PROTON_PLUS_UTILS_VDF_TYPE_VDF_DOCUMENT, content, root);
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

gchar*
proton_plus_utils_vdf_vdf_document_replace_value (ProtonPlusUtilsVDFVdfDocument* self,
                                                  ProtonPlusUtilsVDFVdfEntry* entry,
                                                  const gchar* value)
{
	const gchar* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = self->priv->_content;
	_tmp1_ = proton_plus_utils_vdf_vdf_entry_get_value_start (entry);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_substring (_tmp0_, (glong) 0, (glong) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = proton_plus_utils_vdf_vdf_document_quote (value);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strconcat (_tmp4_, _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_content;
	_tmp10_ = proton_plus_utils_vdf_vdf_entry_get_value_end (entry);
	_tmp11_ = _tmp10_;
	_tmp12_ = string_substring (_tmp9_, (glong) _tmp11_, (glong) -1);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp8_, _tmp13_, NULL);
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp13_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	result = _tmp15_;
	return result;
}

gchar*
proton_plus_utils_vdf_vdf_document_replace_key (ProtonPlusUtilsVDFVdfDocument* self,
                                                ProtonPlusUtilsVDFVdfEntry* entry,
                                                const gchar* key)
{
	const gchar* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = self->priv->_content;
	_tmp1_ = proton_plus_utils_vdf_vdf_entry_get_key_start (entry);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_substring (_tmp0_, (glong) 0, (glong) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = proton_plus_utils_vdf_vdf_document_quote (key);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strconcat (_tmp4_, _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_content;
	_tmp10_ = proton_plus_utils_vdf_vdf_entry_get_key_end (entry);
	_tmp11_ = _tmp10_;
	_tmp12_ = string_substring (_tmp9_, (glong) _tmp11_, (glong) -1);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp8_, _tmp13_, NULL);
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp13_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	result = _tmp15_;
	return result;
}

static gunichar
string_get_char (const gchar* self,
                 glong index)
{
	gunichar result;
	g_return_val_if_fail (self != NULL, 0U);
	result = g_utf8_get_char (((gchar*) self) + index);
	return result;
}

gchar*
proton_plus_utils_vdf_vdf_document_remove_entry (ProtonPlusUtilsVDFVdfDocument* self,
                                                 ProtonPlusUtilsVDFVdfEntry* entry)
{
	gint start = 0;
	gint _tmp0_;
	gint _tmp1_;
	gint end = 0;
	gint _tmp2_;
	gint _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_vdf_entry_get_start (entry);
	_tmp1_ = _tmp0_;
	start = proton_plus_utils_vdf_vdf_document_line_start (self, _tmp1_);
	_tmp2_ = proton_plus_utils_vdf_vdf_entry_get_end (entry);
	_tmp3_ = _tmp2_;
	end = _tmp3_;
	_tmp5_ = self->priv->_content;
	_tmp6_ = strlen (_tmp5_);
	_tmp7_ = _tmp6_;
	if (end < _tmp7_) {
		const gchar* _tmp8_;
		_tmp8_ = self->priv->_content;
		_tmp4_ = string_get_char (_tmp8_, (glong) end) == ((gunichar) '\n');
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		gint _tmp9_;
		_tmp9_ = end;
		end = _tmp9_ + 1;
	}
	_tmp10_ = self->priv->_content;
	_tmp11_ = string_substring (_tmp10_, (glong) 0, (glong) start);
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->_content;
	_tmp14_ = string_substring (_tmp13_, (glong) end, (glong) -1);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strconcat (_tmp12_, _tmp15_, NULL);
	_tmp17_ = _tmp16_;
	_g_free0 (_tmp15_);
	_g_free0 (_tmp12_);
	result = _tmp17_;
	return result;
}

gchar*
proton_plus_utils_vdf_vdf_document_insert_before_closing_brace (ProtonPlusUtilsVDFVdfDocument* self,
                                                                ProtonPlusUtilsVDFVdfEntry* entry,
                                                                const gchar* text)
{
	gint position = 0;
	gint _tmp0_;
	gint _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_vdf_entry_get_closing_brace_start (entry);
	_tmp1_ = _tmp0_;
	position = proton_plus_utils_vdf_vdf_document_line_start (self, _tmp1_);
	_tmp2_ = self->priv->_content;
	_tmp3_ = string_substring (_tmp2_, (glong) 0, (glong) position);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strconcat (_tmp4_, text, NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->_content;
	_tmp8_ = string_substring (_tmp7_, (glong) position, (glong) -1);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strconcat (_tmp6_, _tmp9_, NULL);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	result = _tmp11_;
	return result;
}

gchar*
proton_plus_utils_vdf_vdf_document_indentation_of_closing_brace (ProtonPlusUtilsVDFVdfDocument* self,
                                                                 ProtonPlusUtilsVDFVdfEntry* entry)
{
	gint line_start = 0;
	gint _tmp0_;
	gint _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_vdf_entry_get_closing_brace_start (entry);
	_tmp1_ = _tmp0_;
	line_start = proton_plus_utils_vdf_vdf_document_line_start (self, _tmp1_);
	_tmp2_ = self->priv->_content;
	_tmp3_ = proton_plus_utils_vdf_vdf_entry_get_closing_brace_start (entry);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_substring (_tmp2_, (glong) line_start, (glong) (_tmp4_ - line_start));
	result = _tmp5_;
	return result;
}

static gint
string_last_index_of (const gchar* self,
                      const gchar* needle,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = g_strrstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gint
proton_plus_utils_vdf_vdf_document_line_start (ProtonPlusUtilsVDFVdfDocument* self,
                                               gint position)
{
	gint previous_newline = 0;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_ = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_content;
	_tmp1_ = string_substring (_tmp0_, (glong) 0, (glong) position);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_last_index_of (_tmp2_, "\n", 0);
	_g_free0 (_tmp2_);
	previous_newline = _tmp3_;
	if (previous_newline == -1) {
		_tmp4_ = 0;
	} else {
		_tmp4_ = previous_newline + 1;
	}
	result = _tmp4_;
	return result;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

gchar*
proton_plus_utils_vdf_vdf_document_quote (const gchar* value)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = string_replace (value, "\\", "\\\\");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_replace (_tmp1_, "\"", "\\\"");
	_tmp3_ = _tmp2_;
	_tmp4_ = string_replace (_tmp3_, "\n", "\\n");
	_tmp5_ = _tmp4_;
	_tmp6_ = string_replace (_tmp5_, "\r", "\\r");
	_tmp7_ = _tmp6_;
	_tmp8_ = string_replace (_tmp7_, "\t", "\\t");
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup_printf ("\"%s\"", _tmp9_);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp11_;
	return result;
}

const gchar*
proton_plus_utils_vdf_vdf_document_get_content (ProtonPlusUtilsVDFVdfDocument* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content;
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_vdf_vdf_document_set_content (ProtonPlusUtilsVDFVdfDocument* self,
                                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_document_get_content (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_content);
		self->priv->_content = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_document_properties[PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_CONTENT_PROPERTY]);
	}
}

ProtonPlusUtilsVDFVdfEntry*
proton_plus_utils_vdf_vdf_document_get_root (ProtonPlusUtilsVDFVdfDocument* self)
{
	ProtonPlusUtilsVDFVdfEntry* result;
	ProtonPlusUtilsVDFVdfEntry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_root;
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_vdf_vdf_document_set_root (ProtonPlusUtilsVDFVdfDocument* self,
                                             ProtonPlusUtilsVDFVdfEntry* value)
{
	ProtonPlusUtilsVDFVdfEntry* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_vdf_vdf_document_get_root (self);
	if (old_value != value) {
		ProtonPlusUtilsVDFVdfEntry* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_root);
		self->priv->_root = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_vdf_vdf_document_properties[PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_ROOT_PROPERTY]);
	}
}

static void
proton_plus_utils_vdf_vdf_document_class_init (ProtonPlusUtilsVDFVdfDocumentClass * klass,
                                               gpointer klass_data)
{
	proton_plus_utils_vdf_vdf_document_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsVDFVdfDocument_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_vdf_vdf_document_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_utils_vdf_vdf_document_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_vdf_vdf_document_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_CONTENT_PROPERTY, proton_plus_utils_vdf_vdf_document_properties[PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_ROOT_PROPERTY, proton_plus_utils_vdf_vdf_document_properties[PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_ROOT_PROPERTY] = g_param_spec_object ("root", "root", "root", PROTON_PLUS_UTILS_VDF_TYPE_VDF_ENTRY, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_utils_vdf_vdf_document_instance_init (ProtonPlusUtilsVDFVdfDocument * self,
                                                  gpointer klass)
{
	self->priv = proton_plus_utils_vdf_vdf_document_get_instance_private (self);
}

static void
proton_plus_utils_vdf_vdf_document_finalize (GObject * obj)
{
	ProtonPlusUtilsVDFVdfDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_VDF_TYPE_VDF_DOCUMENT, ProtonPlusUtilsVDFVdfDocument);
	_g_free0 (self->priv->_content);
	_g_object_unref0 (self->priv->_root);
	G_OBJECT_CLASS (proton_plus_utils_vdf_vdf_document_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_vdf_vdf_document_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsVDFVdfDocumentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_vdf_vdf_document_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsVDFVdfDocument), 0, (GInstanceInitFunc) proton_plus_utils_vdf_vdf_document_instance_init, NULL };
	GType proton_plus_utils_vdf_vdf_document_type_id;
	proton_plus_utils_vdf_vdf_document_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsVDFVdfDocument", &g_define_type_info, 0);
	ProtonPlusUtilsVDFVdfDocument_private_offset = g_type_add_instance_private (proton_plus_utils_vdf_vdf_document_type_id, sizeof (ProtonPlusUtilsVDFVdfDocumentPrivate));
	return proton_plus_utils_vdf_vdf_document_type_id;
}

GType
proton_plus_utils_vdf_vdf_document_get_type (void)
{
	static volatile gsize proton_plus_utils_vdf_vdf_document_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_vdf_vdf_document_type_id__once)) {
		GType proton_plus_utils_vdf_vdf_document_type_id;
		proton_plus_utils_vdf_vdf_document_type_id = proton_plus_utils_vdf_vdf_document_get_type_once ();
		g_once_init_leave (&proton_plus_utils_vdf_vdf_document_type_id__once, proton_plus_utils_vdf_vdf_document_type_id);
	}
	return proton_plus_utils_vdf_vdf_document_type_id__once;
}

static void
_vala_proton_plus_utils_vdf_vdf_document_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	ProtonPlusUtilsVDFVdfDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_VDF_TYPE_VDF_DOCUMENT, ProtonPlusUtilsVDFVdfDocument);
	switch (property_id) {
		case PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_CONTENT_PROPERTY:
		g_value_set_string (value, proton_plus_utils_vdf_vdf_document_get_content (self));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_ROOT_PROPERTY:
		g_value_set_object (value, proton_plus_utils_vdf_vdf_document_get_root (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_utils_vdf_vdf_document_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	ProtonPlusUtilsVDFVdfDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_VDF_TYPE_VDF_DOCUMENT, ProtonPlusUtilsVDFVdfDocument);
	switch (property_id) {
		case PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_CONTENT_PROPERTY:
		proton_plus_utils_vdf_vdf_document_set_content (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_UTILS_VDF_VDF_DOCUMENT_ROOT_PROPERTY:
		proton_plus_utils_vdf_vdf_document_set_root (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

ProtonPlusUtilsVDFVdfDocument*
proton_plus_utils_vdf_vdf_parser_parse_document (const gchar* vdf_content)
{
	ProtonPlusUtilsVDFVdfParserDocumentParser* parser = NULL;
	ProtonPlusUtilsVDFVdfParserDocumentParser* _tmp0_;
	ProtonPlusUtilsVDFVdfDocument* _tmp1_;
	ProtonPlusUtilsVDFVdfDocument* result;
	g_return_val_if_fail (vdf_content != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_vdf_parser_document_parser_new (vdf_content);
	parser = _tmp0_;
	_tmp1_ = proton_plus_utils_vdf_vdf_parser_document_parser_parse (parser);
	result = _tmp1_;
	_g_object_unref0 (parser);
	return result;
}

ProtonPlusUtilsVDFVdfParser*
proton_plus_utils_vdf_vdf_parser_construct (GType object_type)
{
	ProtonPlusUtilsVDFVdfParser * self = NULL;
	self = (ProtonPlusUtilsVDFVdfParser*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusUtilsVDFVdfParser*
proton_plus_utils_vdf_vdf_parser_new (void)
{
	return proton_plus_utils_vdf_vdf_parser_construct (PROTON_PLUS_UTILS_VDF_TYPE_VDF_PARSER);
}

static inline gpointer
proton_plus_utils_vdf_vdf_parser_document_parser_get_instance_private (ProtonPlusUtilsVDFVdfParserDocumentParser* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsVDFVdfParserDocumentParser_private_offset);
}

static ProtonPlusUtilsVDFVdfParserDocumentParser*
proton_plus_utils_vdf_vdf_parser_document_parser_construct (GType object_type,
                                                            const gchar* content)
{
	ProtonPlusUtilsVDFVdfParserDocumentParser * self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (content != NULL, NULL);
	self = (ProtonPlusUtilsVDFVdfParserDocumentParser*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (content);
	_g_free0 (self->priv->content);
	self->priv->content = _tmp0_;
	return self;
}

static ProtonPlusUtilsVDFVdfParserDocumentParser*
proton_plus_utils_vdf_vdf_parser_document_parser_new (const gchar* content)
{
	return proton_plus_utils_vdf_vdf_parser_document_parser_construct (PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER, content);
}

static ProtonPlusUtilsVDFVdfDocument*
proton_plus_utils_vdf_vdf_parser_document_parser_parse (ProtonPlusUtilsVDFVdfParserDocumentParser* self)
{
	ProtonPlusUtilsVDFVdfEntry* root = NULL;
	ProtonPlusUtilsVDFVdfEntry* _tmp0_;
	ProtonPlusUtilsVDFVdfEntry* _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	ProtonPlusUtilsVDFVdfEntry* _tmp5_;
	const gchar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	const gchar* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	const gchar* _tmp12_;
	ProtonPlusUtilsVDFVdfEntry* _tmp13_;
	ProtonPlusUtilsVDFVdfDocument* _tmp14_;
	ProtonPlusUtilsVDFVdfDocument* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_vdf_entry_new ("", 0);
	root = _tmp0_;
	_tmp1_ = root;
	if (!proton_plus_utils_vdf_vdf_parser_document_parser_parse_entries (self, _tmp1_, FALSE)) {
		result = NULL;
		_g_object_unref0 (root);
		return result;
	}
	proton_plus_utils_vdf_vdf_parser_document_parser_skip_ignored (self);
	_tmp2_ = self->priv->content;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	if (self->priv->position != _tmp4_) {
		result = NULL;
		_g_object_unref0 (root);
		return result;
	}
	_tmp5_ = root;
	_tmp6_ = self->priv->content;
	_tmp7_ = strlen (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->content;
	_tmp10_ = strlen (_tmp9_);
	_tmp11_ = _tmp10_;
	proton_plus_utils_vdf_vdf_entry_set_block_end (_tmp5_, _tmp8_, _tmp11_);
	_tmp12_ = self->priv->content;
	_tmp13_ = root;
	_tmp14_ = proton_plus_utils_vdf_vdf_document_new (_tmp12_, _tmp13_);
	result = _tmp14_;
	_g_object_unref0 (root);
	return result;
}

static gboolean
proton_plus_utils_vdf_vdf_parser_document_parser_parse_entries (ProtonPlusUtilsVDFVdfParserDocumentParser* self,
                                                                ProtonPlusUtilsVDFVdfEntry* parent,
                                                                gboolean expect_closing_brace)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (parent != NULL, FALSE);
	while (TRUE) {
		const gchar* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		const gchar* _tmp3_;
		gint entry_start = 0;
		gchar* key = NULL;
		gint key_start = 0;
		gint key_end = 0;
		gchar* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		gboolean _tmp7_;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		ProtonPlusUtilsVDFVdfEntry* entry = NULL;
		const gchar* _tmp11_;
		ProtonPlusUtilsVDFVdfEntry* _tmp12_;
		ProtonPlusUtilsVDFVdfEntry* _tmp13_;
		const gchar* _tmp14_;
		GeeArrayList* _tmp22_;
		GeeArrayList* _tmp23_;
		ProtonPlusUtilsVDFVdfEntry* _tmp24_;
		proton_plus_utils_vdf_vdf_parser_document_parser_skip_ignored (self);
		_tmp0_ = self->priv->content;
		_tmp1_ = strlen (_tmp0_);
		_tmp2_ = _tmp1_;
		if (self->priv->position >= _tmp2_) {
			result = !expect_closing_brace;
			return result;
		}
		_tmp3_ = self->priv->content;
		if (string_get_char (_tmp3_, (glong) self->priv->position) == ((gunichar) '}')) {
			gint closing_brace_start = 0;
			if (!expect_closing_brace) {
				result = FALSE;
				return result;
			}
			closing_brace_start = self->priv->position;
			proton_plus_utils_vdf_vdf_parser_document_parser_advance (self);
			proton_plus_utils_vdf_vdf_entry_set_block_end (parent, closing_brace_start, self->priv->position);
			result = TRUE;
			return result;
		}
		entry_start = self->priv->position;
		_tmp7_ = proton_plus_utils_vdf_vdf_parser_document_parser_read_quoted (self, &_tmp4_, &_tmp5_, &_tmp6_);
		_g_free0 (key);
		key = _tmp4_;
		key_start = _tmp5_;
		key_end = _tmp6_;
		if (!_tmp7_) {
			result = FALSE;
			_g_free0 (key);
			return result;
		}
		proton_plus_utils_vdf_vdf_parser_document_parser_skip_ignored (self);
		_tmp8_ = self->priv->content;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		if (self->priv->position >= _tmp10_) {
			result = FALSE;
			_g_free0 (key);
			return result;
		}
		_tmp11_ = key;
		_tmp12_ = proton_plus_utils_vdf_vdf_entry_new (_tmp11_, entry_start);
		entry = _tmp12_;
		_tmp13_ = entry;
		proton_plus_utils_vdf_vdf_entry_set_key_range (_tmp13_, key_start, key_end);
		_tmp14_ = self->priv->content;
		if (string_get_char (_tmp14_, (glong) self->priv->position) == ((gunichar) '{')) {
			ProtonPlusUtilsVDFVdfEntry* _tmp15_;
			proton_plus_utils_vdf_vdf_parser_document_parser_advance (self);
			_tmp15_ = entry;
			if (!proton_plus_utils_vdf_vdf_parser_document_parser_parse_entries (self, _tmp15_, TRUE)) {
				result = FALSE;
				_g_object_unref0 (entry);
				_g_free0 (key);
				return result;
			}
		} else {
			gchar* value = NULL;
			gint value_start = 0;
			gint value_end = 0;
			gchar* _tmp16_ = NULL;
			gint _tmp17_ = 0;
			gint _tmp18_ = 0;
			gboolean _tmp19_;
			ProtonPlusUtilsVDFVdfEntry* _tmp20_;
			const gchar* _tmp21_;
			_tmp19_ = proton_plus_utils_vdf_vdf_parser_document_parser_read_quoted (self, &_tmp16_, &_tmp17_, &_tmp18_);
			_g_free0 (value);
			value = _tmp16_;
			value_start = _tmp17_;
			value_end = _tmp18_;
			if (!_tmp19_) {
				result = FALSE;
				_g_free0 (value);
				_g_object_unref0 (entry);
				_g_free0 (key);
				return result;
			}
			_tmp20_ = entry;
			_tmp21_ = value;
			proton_plus_utils_vdf_vdf_entry_set_value_range (_tmp20_, _tmp21_, value_start, value_end);
			_g_free0 (value);
		}
		_tmp22_ = proton_plus_utils_vdf_vdf_entry_get_children (parent);
		_tmp23_ = _tmp22_;
		_tmp24_ = entry;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp23_, _tmp24_);
		_g_object_unref0 (entry);
		_g_free0 (key);
	}
}

static gboolean
proton_plus_utils_vdf_vdf_parser_document_parser_read_quoted (ProtonPlusUtilsVDFVdfParserDocumentParser* self,
                                                              gchar** value,
                                                              gint* start,
                                                              gint* end)
{
	gchar* _vala_value = NULL;
	gint _vala_start = 0;
	gint _vala_end = 0;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	GString* builder = NULL;
	GString* _tmp6_;
	gboolean escaped = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = g_strdup ("");
	_g_free0 (_vala_value);
	_vala_value = _tmp0_;
	_vala_start = -1;
	_vala_end = -1;
	_tmp2_ = self->priv->content;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	if (self->priv->position >= _tmp4_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = self->priv->content;
		_tmp1_ = string_get_char (_tmp5_, (glong) self->priv->position) != ((gunichar) '"');
	}
	if (_tmp1_) {
		result = FALSE;
		if (value) {
			*value = _vala_value;
		} else {
			_g_free0 (_vala_value);
		}
		if (start) {
			*start = _vala_start;
		}
		if (end) {
			*end = _vala_end;
		}
		return result;
	}
	_vala_start = self->priv->position;
	proton_plus_utils_vdf_vdf_parser_document_parser_advance (self);
	_tmp6_ = g_string_new ("");
	builder = _tmp6_;
	escaped = FALSE;
	while (TRUE) {
		const gchar* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gunichar character = 0U;
		const gchar* _tmp10_;
		_tmp7_ = self->priv->content;
		_tmp8_ = strlen (_tmp7_);
		_tmp9_ = _tmp8_;
		if (!(self->priv->position < _tmp9_)) {
			break;
		}
		_tmp10_ = self->priv->content;
		character = string_get_char (_tmp10_, (glong) self->priv->position);
		proton_plus_utils_vdf_vdf_parser_document_parser_advance (self);
		if (escaped) {
			switch (character) {
				case 'n':
				{
					GString* _tmp11_;
					_tmp11_ = builder;
					g_string_append_c (_tmp11_, '\n');
					break;
				}
				case 'r':
				{
					GString* _tmp12_;
					_tmp12_ = builder;
					g_string_append_c (_tmp12_, '\r');
					break;
				}
				case 't':
				{
					GString* _tmp13_;
					_tmp13_ = builder;
					g_string_append_c (_tmp13_, '\t');
					break;
				}
				default:
				{
					GString* _tmp14_;
					_tmp14_ = builder;
					g_string_append_unichar (_tmp14_, character);
					break;
				}
			}
			escaped = FALSE;
		} else {
			if (character == ((gunichar) '\\')) {
				escaped = TRUE;
			} else {
				if (character == ((gunichar) '"')) {
					GString* _tmp15_;
					const gchar* _tmp16_;
					gchar* _tmp17_;
					_vala_end = self->priv->position;
					_tmp15_ = builder;
					_tmp16_ = _tmp15_->str;
					_tmp17_ = g_strdup (_tmp16_);
					_g_free0 (_vala_value);
					_vala_value = _tmp17_;
					result = TRUE;
					_g_string_free0 (builder);
					if (value) {
						*value = _vala_value;
					} else {
						_g_free0 (_vala_value);
					}
					if (start) {
						*start = _vala_start;
					}
					if (end) {
						*end = _vala_end;
					}
					return result;
				} else {
					GString* _tmp18_;
					_tmp18_ = builder;
					g_string_append_unichar (_tmp18_, character);
				}
			}
		}
	}
	result = FALSE;
	_g_string_free0 (builder);
	if (value) {
		*value = _vala_value;
	} else {
		_g_free0 (_vala_value);
	}
	if (start) {
		*start = _vala_start;
	}
	if (end) {
		*end = _vala_end;
	}
	return result;
}

static void
proton_plus_utils_vdf_vdf_parser_document_parser_skip_ignored (ProtonPlusUtilsVDFVdfParserDocumentParser* self)
{
	g_return_if_fail (self != NULL);
	while (TRUE) {
		const gchar* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gunichar character = 0U;
		const gchar* _tmp3_;
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		_tmp0_ = self->priv->content;
		_tmp1_ = strlen (_tmp0_);
		_tmp2_ = _tmp1_;
		if (!(self->priv->position < _tmp2_)) {
			break;
		}
		_tmp3_ = self->priv->content;
		character = string_get_char (_tmp3_, (glong) self->priv->position);
		if (character == ((gunichar) ' ')) {
			_tmp6_ = TRUE;
		} else {
			_tmp6_ = character == ((gunichar) '\t');
		}
		if (_tmp6_) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = character == ((gunichar) '\r');
		}
		if (_tmp5_) {
			_tmp4_ = TRUE;
		} else {
			_tmp4_ = character == ((gunichar) '\n');
		}
		if (_tmp4_) {
			proton_plus_utils_vdf_vdf_parser_document_parser_advance (self);
		} else {
			gboolean _tmp7_ = FALSE;
			gboolean _tmp8_ = FALSE;
			if (character == ((gunichar) '/')) {
				const gchar* _tmp9_;
				gint _tmp10_;
				gint _tmp11_;
				_tmp9_ = self->priv->content;
				_tmp10_ = strlen (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp8_ = (self->priv->position + 1) < _tmp11_;
			} else {
				_tmp8_ = FALSE;
			}
			if (_tmp8_) {
				const gchar* _tmp12_;
				_tmp12_ = self->priv->content;
				_tmp7_ = string_get_char (_tmp12_, (glong) (self->priv->position + 1)) == ((gunichar) '/');
			} else {
				_tmp7_ = FALSE;
			}
			if (_tmp7_) {
				self->priv->position = self->priv->position + 2;
				while (TRUE) {
					gboolean _tmp13_ = FALSE;
					const gchar* _tmp14_;
					gint _tmp15_;
					gint _tmp16_;
					_tmp14_ = self->priv->content;
					_tmp15_ = strlen (_tmp14_);
					_tmp16_ = _tmp15_;
					if (self->priv->position < _tmp16_) {
						const gchar* _tmp17_;
						_tmp17_ = self->priv->content;
						_tmp13_ = string_get_char (_tmp17_, (glong) self->priv->position) != ((gunichar) '\n');
					} else {
						_tmp13_ = FALSE;
					}
					if (!_tmp13_) {
						break;
					}
					proton_plus_utils_vdf_vdf_parser_document_parser_advance (self);
				}
			} else {
				return;
			}
		}
	}
}

static gchar*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

static void
proton_plus_utils_vdf_vdf_parser_document_parser_advance (ProtonPlusUtilsVDFVdfParserDocumentParser* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->content;
	_tmp1_ = g_unichar_to_string (string_get_char (_tmp0_, (glong) self->priv->position));
	_tmp2_ = _tmp1_;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	self->priv->position = self->priv->position + _tmp4_;
	_g_free0 (_tmp2_);
}

static void
proton_plus_utils_vdf_vdf_parser_document_parser_class_init (ProtonPlusUtilsVDFVdfParserDocumentParserClass * klass,
                                                             gpointer klass_data)
{
	proton_plus_utils_vdf_vdf_parser_document_parser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsVDFVdfParserDocumentParser_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_vdf_vdf_parser_document_parser_finalize;
}

static void
proton_plus_utils_vdf_vdf_parser_document_parser_instance_init (ProtonPlusUtilsVDFVdfParserDocumentParser * self,
                                                                gpointer klass)
{
	self->priv = proton_plus_utils_vdf_vdf_parser_document_parser_get_instance_private (self);
	self->priv->position = 0;
}

static void
proton_plus_utils_vdf_vdf_parser_document_parser_finalize (GObject * obj)
{
	ProtonPlusUtilsVDFVdfParserDocumentParser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_VDF_VDF_PARSER_TYPE_DOCUMENT_PARSER, ProtonPlusUtilsVDFVdfParserDocumentParser);
	_g_free0 (self->priv->content);
	G_OBJECT_CLASS (proton_plus_utils_vdf_vdf_parser_document_parser_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_vdf_vdf_parser_document_parser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsVDFVdfParserDocumentParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_vdf_vdf_parser_document_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsVDFVdfParserDocumentParser), 0, (GInstanceInitFunc) proton_plus_utils_vdf_vdf_parser_document_parser_instance_init, NULL };
	GType proton_plus_utils_vdf_vdf_parser_document_parser_type_id;
	proton_plus_utils_vdf_vdf_parser_document_parser_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsVDFVdfParserDocumentParser", &g_define_type_info, 0);
	ProtonPlusUtilsVDFVdfParserDocumentParser_private_offset = g_type_add_instance_private (proton_plus_utils_vdf_vdf_parser_document_parser_type_id, sizeof (ProtonPlusUtilsVDFVdfParserDocumentParserPrivate));
	return proton_plus_utils_vdf_vdf_parser_document_parser_type_id;
}

static GType
proton_plus_utils_vdf_vdf_parser_document_parser_get_type (void)
{
	static volatile gsize proton_plus_utils_vdf_vdf_parser_document_parser_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_vdf_vdf_parser_document_parser_type_id__once)) {
		GType proton_plus_utils_vdf_vdf_parser_document_parser_type_id;
		proton_plus_utils_vdf_vdf_parser_document_parser_type_id = proton_plus_utils_vdf_vdf_parser_document_parser_get_type_once ();
		g_once_init_leave (&proton_plus_utils_vdf_vdf_parser_document_parser_type_id__once, proton_plus_utils_vdf_vdf_parser_document_parser_type_id);
	}
	return proton_plus_utils_vdf_vdf_parser_document_parser_type_id__once;
}

static void
proton_plus_utils_vdf_vdf_parser_class_init (ProtonPlusUtilsVDFVdfParserClass * klass,
                                             gpointer klass_data)
{
	proton_plus_utils_vdf_vdf_parser_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_utils_vdf_vdf_parser_instance_init (ProtonPlusUtilsVDFVdfParser * self,
                                                gpointer klass)
{
}

static GType
proton_plus_utils_vdf_vdf_parser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsVDFVdfParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_vdf_vdf_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsVDFVdfParser), 0, (GInstanceInitFunc) proton_plus_utils_vdf_vdf_parser_instance_init, NULL };
	GType proton_plus_utils_vdf_vdf_parser_type_id;
	proton_plus_utils_vdf_vdf_parser_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsVDFVdfParser", &g_define_type_info, 0);
	return proton_plus_utils_vdf_vdf_parser_type_id;
}

GType
proton_plus_utils_vdf_vdf_parser_get_type (void)
{
	static volatile gsize proton_plus_utils_vdf_vdf_parser_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_vdf_vdf_parser_type_id__once)) {
		GType proton_plus_utils_vdf_vdf_parser_type_id;
		proton_plus_utils_vdf_vdf_parser_type_id = proton_plus_utils_vdf_vdf_parser_get_type_once ();
		g_once_init_leave (&proton_plus_utils_vdf_vdf_parser_type_id__once, proton_plus_utils_vdf_vdf_parser_type_id);
	}
	return proton_plus_utils_vdf_vdf_parser_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

