/* gca-unsaved-file.c generated by valac 0.27.1, the Vala compiler
 * generated from gca-unsaved-file.vala, do not modify */

/*
 * This file is part of gedit-code-assistant.
 *
 * Copyright (C) 2011 - Jesse van den Kieboom
 *
 * gedit-code-assistant is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * gedit-code-assistant 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 gedit-code-assistant.  If not, see <http://www.gnu.org/licenses/>.
 */

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


#define GCA_TYPE_UNSAVED_FILE (gca_unsaved_file_get_type ())
typedef struct _GcaUnsavedFile GcaUnsavedFile;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GcaUnsavedFile {
	gchar* filename;
	gchar* contents;
	gulong length;
};



GType gca_unsaved_file_get_type (void) G_GNUC_CONST;
GcaUnsavedFile* gca_unsaved_file_dup (const GcaUnsavedFile* self);
void gca_unsaved_file_free (GcaUnsavedFile* self);
void gca_unsaved_file_copy (const GcaUnsavedFile* self, GcaUnsavedFile* dest);
void gca_unsaved_file_destroy (GcaUnsavedFile* self);
void gca_unsaved_file_init (GcaUnsavedFile *self, const gchar* f, const gchar* c);


void gca_unsaved_file_init (GcaUnsavedFile *self, const gchar* f, const gchar* c) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gint _tmp5_ = 0;
	gint _tmp6_ = 0;
	g_return_if_fail (f != NULL);
	g_return_if_fail (c != NULL);
	memset (self, 0, sizeof (GcaUnsavedFile));
	_tmp0_ = f;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*self).filename);
	(*self).filename = _tmp1_;
	_tmp2_ = c;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*self).contents);
	(*self).contents = _tmp3_;
	_tmp4_ = (*self).contents;
	_tmp5_ = strlen (_tmp4_);
	_tmp6_ = _tmp5_;
	(*self).length = (gulong) _tmp6_;
}


void gca_unsaved_file_copy (const GcaUnsavedFile* self, GcaUnsavedFile* dest) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gulong _tmp4_ = 0UL;
	_tmp0_ = (*self).filename;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).filename);
	(*dest).filename = _tmp1_;
	_tmp2_ = (*self).contents;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).contents);
	(*dest).contents = _tmp3_;
	_tmp4_ = (*self).length;
	(*dest).length = _tmp4_;
}


void gca_unsaved_file_destroy (GcaUnsavedFile* self) {
	_g_free0 ((*self).filename);
	_g_free0 ((*self).contents);
}


GcaUnsavedFile* gca_unsaved_file_dup (const GcaUnsavedFile* self) {
	GcaUnsavedFile* dup;
	dup = g_new0 (GcaUnsavedFile, 1);
	gca_unsaved_file_copy (self, dup);
	return dup;
}


void gca_unsaved_file_free (GcaUnsavedFile* self) {
	gca_unsaved_file_destroy (self);
	g_free (self);
}


GType gca_unsaved_file_get_type (void) {
	static volatile gsize gca_unsaved_file_type_id__volatile = 0;
	if (g_once_init_enter (&gca_unsaved_file_type_id__volatile)) {
		GType gca_unsaved_file_type_id;
		gca_unsaved_file_type_id = g_boxed_type_register_static ("GcaUnsavedFile", (GBoxedCopyFunc) gca_unsaved_file_dup, (GBoxedFreeFunc) gca_unsaved_file_free);
		g_once_init_leave (&gca_unsaved_file_type_id__volatile, gca_unsaved_file_type_id);
	}
	return gca_unsaved_file_type_id__volatile;
}



