/* rpc.c generated by valac 0.30.0.38-a55d, the Vala compiler
 * generated from rpc.vala, do not modify */


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


#define RPC_TYPE_PARSE (rpc_parse_get_type ())

#define TYPE_OPEN_DOCUMENT (open_document_get_type ())
typedef struct _OpenDocument OpenDocument;
typedef struct _RpcParse RpcParse;

#define RPC_TYPE_DOCUMENT (rpc_document_get_type ())

#define TYPE_DIAGNOSTIC (diagnostic_get_type ())

#define TYPE_FIXIT (fixit_get_type ())

#define TYPE_SOURCE_RANGE (source_range_get_type ())

#define TYPE_SOURCE_LOCATION (source_location_get_type ())
typedef struct _SourceLocation SourceLocation;
typedef struct _SourceRange SourceRange;
typedef struct _Fixit Fixit;
typedef struct _Diagnostic Diagnostic;
typedef struct _RpcDocument RpcDocument;
#define _g_free0(var) (var = (g_free (var), NULL))

#define RPC_TYPE_REPLY (rpc_reply_get_type ())
typedef struct _RpcReply RpcReply;

struct _OpenDocument {
	gchar* path;
	gchar* data_path;
};

struct _RpcParse {
	gchar** args;
	gint args_length1;
	OpenDocument* documents;
	gint documents_length1;
};

struct _SourceLocation {
	gint64 line;
	gint64 column;
};

struct _SourceRange {
	gint64 file;
	SourceLocation start;
	SourceLocation end;
};

struct _Fixit {
	SourceRange location;
	gchar* replacement;
};

struct _Diagnostic {
	guint32 severity;
	Fixit* fixits;
	gint fixits_length1;
	SourceRange* locations;
	gint locations_length1;
	gchar* message;
};

struct _RpcDocument {
	gchar* path;
	Diagnostic* diagnostics;
	gint diagnostics_length1;
};

struct _RpcReply {
	RpcDocument* documents;
	gint documents_length1;
};



GType rpc_parse_get_type (void) G_GNUC_CONST;
GType open_document_get_type (void) G_GNUC_CONST;
OpenDocument* open_document_dup (const OpenDocument* self);
void open_document_free (OpenDocument* self);
void open_document_copy (const OpenDocument* self, OpenDocument* dest);
void open_document_destroy (OpenDocument* self);
RpcParse* rpc_parse_dup (const RpcParse* self);
void rpc_parse_free (RpcParse* self);
void rpc_parse_copy (const RpcParse* self, RpcParse* dest);
void rpc_parse_destroy (RpcParse* self);
static void _vala_OpenDocument_array_free (OpenDocument* array, gint array_length);
static gchar** _vala_array_dup3 (gchar** self, int length);
static OpenDocument* _vala_array_dup4 (OpenDocument* self, int length);
GType rpc_document_get_type (void) G_GNUC_CONST;
GType diagnostic_get_type (void) G_GNUC_CONST;
GType fixit_get_type (void) G_GNUC_CONST;
GType source_range_get_type (void) G_GNUC_CONST;
GType source_location_get_type (void) G_GNUC_CONST;
SourceLocation* source_location_dup (const SourceLocation* self);
void source_location_free (SourceLocation* self);
SourceRange* source_range_dup (const SourceRange* self);
void source_range_free (SourceRange* self);
Fixit* fixit_dup (const Fixit* self);
void fixit_free (Fixit* self);
void fixit_copy (const Fixit* self, Fixit* dest);
void fixit_destroy (Fixit* self);
Diagnostic* diagnostic_dup (const Diagnostic* self);
void diagnostic_free (Diagnostic* self);
void diagnostic_copy (const Diagnostic* self, Diagnostic* dest);
void diagnostic_destroy (Diagnostic* self);
RpcDocument* rpc_document_dup (const RpcDocument* self);
void rpc_document_free (RpcDocument* self);
void rpc_document_copy (const RpcDocument* self, RpcDocument* dest);
void rpc_document_destroy (RpcDocument* self);
static void _vala_Diagnostic_array_free (Diagnostic* array, gint array_length);
static Diagnostic* _vala_array_dup5 (Diagnostic* self, int length);
GType rpc_reply_get_type (void) G_GNUC_CONST;
RpcReply* rpc_reply_dup (const RpcReply* self);
void rpc_reply_free (RpcReply* self);
void rpc_reply_copy (const RpcReply* self, RpcReply* dest);
void rpc_reply_destroy (RpcReply* self);
static void _vala_RpcDocument_array_free (RpcDocument* array, gint array_length);
static RpcDocument* _vala_array_dup6 (RpcDocument* self, int length);
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);


static void _vala_OpenDocument_array_free (OpenDocument* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			open_document_destroy (&array[i]);
		}
	}
	g_free (array);
}


static gchar** _vala_array_dup3 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static OpenDocument* _vala_array_dup4 (OpenDocument* self, int length) {
	OpenDocument* result;
	int i;
	result = g_new0 (OpenDocument, length);
	for (i = 0; i < length; i++) {
		OpenDocument _tmp0_ = {0};
		open_document_copy (&self[i], &_tmp0_);
		result[i] = _tmp0_;
	}
	return result;
}


void rpc_parse_copy (const RpcParse* self, RpcParse* dest) {
	gchar** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	OpenDocument* _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	OpenDocument* _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	_tmp0_ = (*self).args;
	_tmp0__length1 = (*self).args_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	(*dest).args = (_vala_array_free ((*dest).args, (*dest).args_length1, (GDestroyNotify) g_free), NULL);
	(*dest).args = _tmp1_;
	(*dest).args_length1 = _tmp1__length1;
	_tmp2_ = (*self).documents;
	_tmp2__length1 = (*self).documents_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup4 (_tmp2_, _tmp2__length1) : ((gpointer) _tmp2_);
	_tmp3__length1 = _tmp2__length1;
	(*dest).documents = (_vala_OpenDocument_array_free ((*dest).documents, (*dest).documents_length1), NULL);
	(*dest).documents = _tmp3_;
	(*dest).documents_length1 = _tmp3__length1;
}


void rpc_parse_destroy (RpcParse* self) {
	(*self).args = (_vala_array_free ((*self).args, (*self).args_length1, (GDestroyNotify) g_free), NULL);
	(*self).documents = (_vala_OpenDocument_array_free ((*self).documents, (*self).documents_length1), NULL);
}


RpcParse* rpc_parse_dup (const RpcParse* self) {
	RpcParse* dup;
	dup = g_new0 (RpcParse, 1);
	rpc_parse_copy (self, dup);
	return dup;
}


void rpc_parse_free (RpcParse* self) {
	rpc_parse_destroy (self);
	g_free (self);
}


GType rpc_parse_get_type (void) {
	static volatile gsize rpc_parse_type_id__volatile = 0;
	if (g_once_init_enter (&rpc_parse_type_id__volatile)) {
		GType rpc_parse_type_id;
		rpc_parse_type_id = g_boxed_type_register_static ("RpcParse", (GBoxedCopyFunc) rpc_parse_dup, (GBoxedFreeFunc) rpc_parse_free);
		g_once_init_leave (&rpc_parse_type_id__volatile, rpc_parse_type_id);
	}
	return rpc_parse_type_id__volatile;
}


static void _vala_Diagnostic_array_free (Diagnostic* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			diagnostic_destroy (&array[i]);
		}
	}
	g_free (array);
}


static Diagnostic* _vala_array_dup5 (Diagnostic* self, int length) {
	Diagnostic* result;
	int i;
	result = g_new0 (Diagnostic, length);
	for (i = 0; i < length; i++) {
		Diagnostic _tmp0_ = {0};
		diagnostic_copy (&self[i], &_tmp0_);
		result[i] = _tmp0_;
	}
	return result;
}


void rpc_document_copy (const RpcDocument* self, RpcDocument* dest) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	Diagnostic* _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	Diagnostic* _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	_tmp0_ = (*self).path;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).path);
	(*dest).path = _tmp1_;
	_tmp2_ = (*self).diagnostics;
	_tmp2__length1 = (*self).diagnostics_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup5 (_tmp2_, _tmp2__length1) : ((gpointer) _tmp2_);
	_tmp3__length1 = _tmp2__length1;
	(*dest).diagnostics = (_vala_Diagnostic_array_free ((*dest).diagnostics, (*dest).diagnostics_length1), NULL);
	(*dest).diagnostics = _tmp3_;
	(*dest).diagnostics_length1 = _tmp3__length1;
}


void rpc_document_destroy (RpcDocument* self) {
	_g_free0 ((*self).path);
	(*self).diagnostics = (_vala_Diagnostic_array_free ((*self).diagnostics, (*self).diagnostics_length1), NULL);
}


RpcDocument* rpc_document_dup (const RpcDocument* self) {
	RpcDocument* dup;
	dup = g_new0 (RpcDocument, 1);
	rpc_document_copy (self, dup);
	return dup;
}


void rpc_document_free (RpcDocument* self) {
	rpc_document_destroy (self);
	g_free (self);
}


GType rpc_document_get_type (void) {
	static volatile gsize rpc_document_type_id__volatile = 0;
	if (g_once_init_enter (&rpc_document_type_id__volatile)) {
		GType rpc_document_type_id;
		rpc_document_type_id = g_boxed_type_register_static ("RpcDocument", (GBoxedCopyFunc) rpc_document_dup, (GBoxedFreeFunc) rpc_document_free);
		g_once_init_leave (&rpc_document_type_id__volatile, rpc_document_type_id);
	}
	return rpc_document_type_id__volatile;
}


static void _vala_RpcDocument_array_free (RpcDocument* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			rpc_document_destroy (&array[i]);
		}
	}
	g_free (array);
}


static RpcDocument* _vala_array_dup6 (RpcDocument* self, int length) {
	RpcDocument* result;
	int i;
	result = g_new0 (RpcDocument, length);
	for (i = 0; i < length; i++) {
		RpcDocument _tmp0_ = {0};
		rpc_document_copy (&self[i], &_tmp0_);
		result[i] = _tmp0_;
	}
	return result;
}


void rpc_reply_copy (const RpcReply* self, RpcReply* dest) {
	RpcDocument* _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	RpcDocument* _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	_tmp0_ = (*self).documents;
	_tmp0__length1 = (*self).documents_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup6 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	(*dest).documents = (_vala_RpcDocument_array_free ((*dest).documents, (*dest).documents_length1), NULL);
	(*dest).documents = _tmp1_;
	(*dest).documents_length1 = _tmp1__length1;
}


void rpc_reply_destroy (RpcReply* self) {
	(*self).documents = (_vala_RpcDocument_array_free ((*self).documents, (*self).documents_length1), NULL);
}


RpcReply* rpc_reply_dup (const RpcReply* self) {
	RpcReply* dup;
	dup = g_new0 (RpcReply, 1);
	rpc_reply_copy (self, dup);
	return dup;
}


void rpc_reply_free (RpcReply* self) {
	rpc_reply_destroy (self);
	g_free (self);
}


GType rpc_reply_get_type (void) {
	static volatile gsize rpc_reply_type_id__volatile = 0;
	if (g_once_init_enter (&rpc_reply_type_id__volatile)) {
		GType rpc_reply_type_id;
		rpc_reply_type_id = g_boxed_type_register_static ("RpcReply", (GBoxedCopyFunc) rpc_reply_dup, (GBoxedFreeFunc) rpc_reply_free);
		g_once_init_leave (&rpc_reply_type_id__volatile, rpc_reply_type_id);
	}
	return rpc_reply_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);
}



