/* imap-message-data.c generated by valac 0.56.3, the Vala compiler
 * generated from imap-message-data.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "geary-engine.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>

enum  {
	GEARY_IMAP_RF_C822_SIZE_0_PROPERTY,
	GEARY_IMAP_RF_C822_SIZE_NUM_PROPERTIES
};
static GParamSpec* geary_imap_rf_c822_size_properties[GEARY_IMAP_RF_C822_SIZE_NUM_PROPERTIES];
enum  {
	GEARY_IMAP_RF_C822_HEADER_0_PROPERTY,
	GEARY_IMAP_RF_C822_HEADER_NUM_PROPERTIES
};
static GParamSpec* geary_imap_rf_c822_header_properties[GEARY_IMAP_RF_C822_HEADER_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GEARY_IMAP_RF_C822_TEXT_0_PROPERTY,
	GEARY_IMAP_RF_C822_TEXT_NUM_PROPERTIES
};
static GParamSpec* geary_imap_rf_c822_text_properties[GEARY_IMAP_RF_C822_TEXT_NUM_PROPERTIES];
enum  {
	GEARY_IMAP_RF_C822_FULL_0_PROPERTY,
	GEARY_IMAP_RF_C822_FULL_NUM_PROPERTIES
};
static GParamSpec* geary_imap_rf_c822_full_properties[GEARY_IMAP_RF_C822_FULL_NUM_PROPERTIES];

static gpointer geary_imap_rf_c822_size_parent_class = NULL;
static GearyImapMessageDataIface * geary_imap_rf_c822_size_geary_imap_message_data_parent_iface = NULL;
static gpointer geary_imap_rf_c822_header_parent_class = NULL;
static GearyImapMessageDataIface * geary_imap_rf_c822_header_geary_imap_message_data_parent_iface = NULL;
static gpointer geary_imap_rf_c822_text_parent_class = NULL;
static GearyImapMessageDataIface * geary_imap_rf_c822_text_geary_imap_message_data_parent_iface = NULL;
static gpointer geary_imap_rf_c822_full_parent_class = NULL;
static GearyImapMessageDataIface * geary_imap_rf_c822_full_geary_imap_message_data_parent_iface = NULL;

static GType geary_imap_message_data_get_type_once (void);
static GType geary_imap_rf_c822_size_get_type_once (void);
static GType geary_imap_rf_c822_header_get_type_once (void);
static GType geary_imap_rf_c822_text_get_type_once (void);
static GType geary_imap_rf_c822_full_get_type_once (void);

static void
geary_imap_message_data_default_init (GearyImapMessageDataIface * iface,
                                      gpointer iface_data)
{
}

/**
 * MessageData is an IMAP data structure delivered in some form by the server to the client.
 *
 * Note that IMAP specifies that Flags and Attributes are *always* returned as a list, even if only
 * one is present, which is why these elements are MessageData but not the elements within the
 * lists (Flag, Attribute).
 *
 * Also note that Imap.MessageData requires {@link Geary.MessageData.AbstractMessageData}.
 *
 * TODO: Add an abstract to_parameter() method that can be used to serialize the message data.
 */
 G_GNUC_NO_INLINE static GType
geary_imap_message_data_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapMessageDataIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_message_data_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType geary_imap_message_data_type_id;
	geary_imap_message_data_type_id = g_type_register_static (G_TYPE_INTERFACE, "GearyImapMessageData", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (geary_imap_message_data_type_id, GEARY_MESSAGE_DATA_TYPE_ABSTRACT_MESSAGE_DATA);
	return geary_imap_message_data_type_id;
}

GType
geary_imap_message_data_get_type (void)
{
	static gsize geary_imap_message_data_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_message_data_type_id__once)) {
		GType geary_imap_message_data_type_id;
		geary_imap_message_data_type_id = geary_imap_message_data_get_type_once ();
		g_once_init_leave (&geary_imap_message_data_type_id__once, geary_imap_message_data_type_id);
	}
	return geary_imap_message_data_type_id__once;
}

GearyImapRFC822Size*
geary_imap_rf_c822_size_construct (GType object_type,
                                   gint64 value)
{
	GearyImapRFC822Size * self = NULL;
	self = (GearyImapRFC822Size*) geary_message_data_int64_message_data_construct (object_type, value);
	return self;
}

GearyImapRFC822Size*
geary_imap_rf_c822_size_new (gint64 value)
{
	return geary_imap_rf_c822_size_construct (GEARY_IMAP_TYPE_RF_C822_SIZE, value);
}

static void
geary_imap_rf_c822_size_class_init (GearyImapRFC822SizeClass * klass,
                                    gpointer klass_data)
{
	geary_imap_rf_c822_size_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_rf_c822_size_geary_imap_message_data_interface_init (GearyImapMessageDataIface * iface,
                                                                gpointer iface_data)
{
	geary_imap_rf_c822_size_geary_imap_message_data_parent_iface = g_type_interface_peek_parent (iface);
}

static void
geary_imap_rf_c822_size_instance_init (GearyImapRFC822Size * self,
                                       gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
geary_imap_rf_c822_size_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapRFC822SizeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_rf_c822_size_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapRFC822Size), 0, (GInstanceInitFunc) geary_imap_rf_c822_size_instance_init, NULL };
	static const GInterfaceInfo geary_imap_message_data_info = { (GInterfaceInitFunc) geary_imap_rf_c822_size_geary_imap_message_data_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_imap_rf_c822_size_type_id;
	geary_imap_rf_c822_size_type_id = g_type_register_static (GEARY_MESSAGE_DATA_TYPE_INT64_MESSAGE_DATA, "GearyImapRFC822Size", &g_define_type_info, 0);
	g_type_add_interface_static (geary_imap_rf_c822_size_type_id, GEARY_IMAP_TYPE_MESSAGE_DATA, &geary_imap_message_data_info);
	return geary_imap_rf_c822_size_type_id;
}

GType
geary_imap_rf_c822_size_get_type (void)
{
	static gsize geary_imap_rf_c822_size_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_rf_c822_size_type_id__once)) {
		GType geary_imap_rf_c822_size_type_id;
		geary_imap_rf_c822_size_type_id = geary_imap_rf_c822_size_get_type_once ();
		g_once_init_leave (&geary_imap_rf_c822_size_type_id__once, geary_imap_rf_c822_size_type_id);
	}
	return geary_imap_rf_c822_size_type_id__once;
}

GearyImapRFC822Header*
geary_imap_rf_c822_header_construct (GType object_type,
                                     GearyMemoryBuffer* buffer,
                                     GError** error)
{
	GearyImapRFC822Header * self = NULL;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (GEARY_MEMORY_IS_BUFFER (buffer), NULL);
	{
		self = (GearyImapRFC822Header*) geary_rf_c822_header_construct (object_type, buffer, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == GEARY_RF_C822_ERROR) {
				goto __catch0_geary_rf_c822_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;
		}
	}
	goto __finally0;
	__catch0_geary_rf_c822_error:
	{
		GError* _error_ = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		GError* _tmp2_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = _error_;
		_tmp1_ = _tmp0_->message;
		_tmp2_ = g_error_new_literal (GEARY_IMAP_ERROR, GEARY_IMAP_ERROR_INVALID, _tmp1_);
		_inner_error0_ = _tmp2_;
		_g_error_free0 (_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == GEARY_IMAP_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			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;
		}
	}
	return self;
}

GearyImapRFC822Header*
geary_imap_rf_c822_header_new (GearyMemoryBuffer* buffer,
                               GError** error)
{
	return geary_imap_rf_c822_header_construct (GEARY_IMAP_TYPE_RF_C822_HEADER, buffer, error);
}

static void
geary_imap_rf_c822_header_class_init (GearyImapRFC822HeaderClass * klass,
                                      gpointer klass_data)
{
	geary_imap_rf_c822_header_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_rf_c822_header_geary_imap_message_data_interface_init (GearyImapMessageDataIface * iface,
                                                                  gpointer iface_data)
{
	geary_imap_rf_c822_header_geary_imap_message_data_parent_iface = g_type_interface_peek_parent (iface);
}

static void
geary_imap_rf_c822_header_instance_init (GearyImapRFC822Header * self,
                                         gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
geary_imap_rf_c822_header_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapRFC822HeaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_rf_c822_header_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapRFC822Header), 0, (GInstanceInitFunc) geary_imap_rf_c822_header_instance_init, NULL };
	static const GInterfaceInfo geary_imap_message_data_info = { (GInterfaceInitFunc) geary_imap_rf_c822_header_geary_imap_message_data_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_imap_rf_c822_header_type_id;
	geary_imap_rf_c822_header_type_id = g_type_register_static (GEARY_RF_C822_TYPE_HEADER, "GearyImapRFC822Header", &g_define_type_info, 0);
	g_type_add_interface_static (geary_imap_rf_c822_header_type_id, GEARY_IMAP_TYPE_MESSAGE_DATA, &geary_imap_message_data_info);
	return geary_imap_rf_c822_header_type_id;
}

GType
geary_imap_rf_c822_header_get_type (void)
{
	static gsize geary_imap_rf_c822_header_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_rf_c822_header_type_id__once)) {
		GType geary_imap_rf_c822_header_type_id;
		geary_imap_rf_c822_header_type_id = geary_imap_rf_c822_header_get_type_once ();
		g_once_init_leave (&geary_imap_rf_c822_header_type_id__once, geary_imap_rf_c822_header_type_id);
	}
	return geary_imap_rf_c822_header_type_id__once;
}

GearyImapRFC822Text*
geary_imap_rf_c822_text_construct (GType object_type,
                                   GearyMemoryBuffer* buffer)
{
	GearyImapRFC822Text * self = NULL;
	g_return_val_if_fail (GEARY_MEMORY_IS_BUFFER (buffer), NULL);
	self = (GearyImapRFC822Text*) geary_rf_c822_text_construct (object_type, buffer);
	return self;
}

GearyImapRFC822Text*
geary_imap_rf_c822_text_new (GearyMemoryBuffer* buffer)
{
	return geary_imap_rf_c822_text_construct (GEARY_IMAP_TYPE_RF_C822_TEXT, buffer);
}

static void
geary_imap_rf_c822_text_class_init (GearyImapRFC822TextClass * klass,
                                    gpointer klass_data)
{
	geary_imap_rf_c822_text_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_rf_c822_text_geary_imap_message_data_interface_init (GearyImapMessageDataIface * iface,
                                                                gpointer iface_data)
{
	geary_imap_rf_c822_text_geary_imap_message_data_parent_iface = g_type_interface_peek_parent (iface);
}

static void
geary_imap_rf_c822_text_instance_init (GearyImapRFC822Text * self,
                                       gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
geary_imap_rf_c822_text_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapRFC822TextClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_rf_c822_text_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapRFC822Text), 0, (GInstanceInitFunc) geary_imap_rf_c822_text_instance_init, NULL };
	static const GInterfaceInfo geary_imap_message_data_info = { (GInterfaceInitFunc) geary_imap_rf_c822_text_geary_imap_message_data_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_imap_rf_c822_text_type_id;
	geary_imap_rf_c822_text_type_id = g_type_register_static (GEARY_RF_C822_TYPE_TEXT, "GearyImapRFC822Text", &g_define_type_info, 0);
	g_type_add_interface_static (geary_imap_rf_c822_text_type_id, GEARY_IMAP_TYPE_MESSAGE_DATA, &geary_imap_message_data_info);
	return geary_imap_rf_c822_text_type_id;
}

GType
geary_imap_rf_c822_text_get_type (void)
{
	static gsize geary_imap_rf_c822_text_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_rf_c822_text_type_id__once)) {
		GType geary_imap_rf_c822_text_type_id;
		geary_imap_rf_c822_text_type_id = geary_imap_rf_c822_text_get_type_once ();
		g_once_init_leave (&geary_imap_rf_c822_text_type_id__once, geary_imap_rf_c822_text_type_id);
	}
	return geary_imap_rf_c822_text_type_id__once;
}

GearyImapRFC822Full*
geary_imap_rf_c822_full_construct (GType object_type,
                                   GearyMemoryBuffer* buffer)
{
	GearyImapRFC822Full * self = NULL;
	g_return_val_if_fail (GEARY_MEMORY_IS_BUFFER (buffer), NULL);
	self = (GearyImapRFC822Full*) geary_rf_c822_full_construct (object_type, buffer);
	return self;
}

GearyImapRFC822Full*
geary_imap_rf_c822_full_new (GearyMemoryBuffer* buffer)
{
	return geary_imap_rf_c822_full_construct (GEARY_IMAP_TYPE_RF_C822_FULL, buffer);
}

static void
geary_imap_rf_c822_full_class_init (GearyImapRFC822FullClass * klass,
                                    gpointer klass_data)
{
	geary_imap_rf_c822_full_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_rf_c822_full_geary_imap_message_data_interface_init (GearyImapMessageDataIface * iface,
                                                                gpointer iface_data)
{
	geary_imap_rf_c822_full_geary_imap_message_data_parent_iface = g_type_interface_peek_parent (iface);
}

static void
geary_imap_rf_c822_full_instance_init (GearyImapRFC822Full * self,
                                       gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
geary_imap_rf_c822_full_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapRFC822FullClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_rf_c822_full_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapRFC822Full), 0, (GInstanceInitFunc) geary_imap_rf_c822_full_instance_init, NULL };
	static const GInterfaceInfo geary_imap_message_data_info = { (GInterfaceInitFunc) geary_imap_rf_c822_full_geary_imap_message_data_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType geary_imap_rf_c822_full_type_id;
	geary_imap_rf_c822_full_type_id = g_type_register_static (GEARY_RF_C822_TYPE_FULL, "GearyImapRFC822Full", &g_define_type_info, 0);
	g_type_add_interface_static (geary_imap_rf_c822_full_type_id, GEARY_IMAP_TYPE_MESSAGE_DATA, &geary_imap_message_data_info);
	return geary_imap_rf_c822_full_type_id;
}

GType
geary_imap_rf_c822_full_get_type (void)
{
	static gsize geary_imap_rf_c822_full_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_rf_c822_full_type_id__once)) {
		GType geary_imap_rf_c822_full_type_id;
		geary_imap_rf_c822_full_type_id = geary_imap_rf_c822_full_get_type_once ();
		g_once_init_leave (&geary_imap_rf_c822_full_type_id__once, geary_imap_rf_c822_full_type_id);
	}
	return geary_imap_rf_c822_full_type_id__once;
}

