/* gcp-unsaved-file.c generated by valac 0.19.0, the Vala compiler
 * generated from gcp-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 GCP_TYPE_UNSAVED_FILE (gcp_unsaved_file_get_type ())
typedef struct _GcpUnsavedFile GcpUnsavedFile;
#define _g_free0(var) (var = (g_free (var), NULL))

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



GType gcp_unsaved_file_get_type (void) G_GNUC_CONST;
GcpUnsavedFile* gcp_unsaved_file_dup (const GcpUnsavedFile* self);
void gcp_unsaved_file_free (GcpUnsavedFile* self);
void gcp_unsaved_file_copy (const GcpUnsavedFile* self, GcpUnsavedFile* dest);
void gcp_unsaved_file_destroy (GcpUnsavedFile* self);
void gcp_unsaved_file_init (GcpUnsavedFile *self, const gchar* f, const gchar* c);


void gcp_unsaved_file_init (GcpUnsavedFile *self, const gchar* f, const gchar* c) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	g_return_if_fail (f != NULL);
	g_return_if_fail (c != NULL);
	memset (self, 0, sizeof (GcpUnsavedFile));
	_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 gcp_unsaved_file_copy (const GcpUnsavedFile* self, GcpUnsavedFile* dest) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gulong _tmp4_;
	_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 gcp_unsaved_file_destroy (GcpUnsavedFile* self) {
	_g_free0 ((*self).filename);
	_g_free0 ((*self).contents);
}


GcpUnsavedFile* gcp_unsaved_file_dup (const GcpUnsavedFile* self) {
	GcpUnsavedFile* dup;
	dup = g_new0 (GcpUnsavedFile, 1);
	gcp_unsaved_file_copy (self, dup);
	return dup;
}


void gcp_unsaved_file_free (GcpUnsavedFile* self) {
	gcp_unsaved_file_destroy (self);
	g_free (self);
}


GType gcp_unsaved_file_get_type (void) {
	static volatile gsize gcp_unsaved_file_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_unsaved_file_type_id__volatile)) {
		GType gcp_unsaved_file_type_id;
		gcp_unsaved_file_type_id = g_boxed_type_register_static ("GcpUnsavedFile", (GBoxedCopyFunc) gcp_unsaved_file_dup, (GBoxedFreeFunc) gcp_unsaved_file_free);
		g_once_init_leave (&gcp_unsaved_file_type_id__volatile, gcp_unsaved_file_type_id);
	}
	return gcp_unsaved_file_type_id__volatile;
}



