/* listitem.c generated by valac, the Vala compiler
 * generated from listitem.vala, do not modify */

/* listitem.vala
 *
 * Copyright (C) 2008-2009 Didier Villevalois
 * Copyright (C) 2008-2012 Florian Brosch
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Didier 'Ptitjes Villevalois <ptitjes@free.fr>
 */

#include "valadoc.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <valagee.h>
#include <glib-object.h>

enum  {
	VALADOC_CONTENT_LIST_ITEM_0_PROPERTY,
	VALADOC_CONTENT_LIST_ITEM_NUM_PROPERTIES
};
static GParamSpec* valadoc_content_list_item_properties[VALADOC_CONTENT_LIST_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer valadoc_content_list_item_parent_class = NULL;

 G_GNUC_INTERNAL ValadocContentListItem* valadoc_content_list_item_new (void);
 G_GNUC_INTERNAL ValadocContentListItem* valadoc_content_list_item_construct (GType object_type);
 G_GNUC_INTERNAL ValadocContentBlockContent* valadoc_content_block_content_construct (GType object_type);
static void valadoc_content_list_item_real_check (ValadocContentContentElement* base,
                                           ValadocApiTree* api_root,
                                           ValadocApiNode* container,
                                           const gchar* file_path,
                                           ValadocErrorReporter* reporter,
                                           ValadocSettings* settings);
static void valadoc_content_list_item_real_accept (ValadocContentContentElement* base,
                                            ValadocContentContentVisitor* visitor);
static void valadoc_content_list_item_real_accept_children (ValadocContentContentElement* base,
                                                     ValadocContentContentVisitor* visitor);
static ValadocContentContentElement* valadoc_content_list_item_real_copy (ValadocContentContentElement* base,
                                                                   ValadocContentContentElement* new_parent);
 G_GNUC_INTERNAL void valadoc_content_content_element_set_parent (ValadocContentContentElement* self,
                                                 ValadocContentContentElement* value);
static GType valadoc_content_list_item_get_type_once (void);

 G_GNUC_INTERNAL ValadocContentListItem*
valadoc_content_list_item_construct (GType object_type)
{
	ValadocContentListItem * self = NULL;
	self = (ValadocContentListItem*) valadoc_content_block_content_construct (object_type);
	return self;
}

 G_GNUC_INTERNAL ValadocContentListItem*
valadoc_content_list_item_new (void)
{
	return valadoc_content_list_item_construct (VALADOC_CONTENT_TYPE_LIST_ITEM);
}

static void
valadoc_content_list_item_real_check (ValadocContentContentElement* base,
                                      ValadocApiTree* api_root,
                                      ValadocApiNode* container,
                                      const gchar* file_path,
                                      ValadocErrorReporter* reporter,
                                      ValadocSettings* settings)
{
	ValadocContentListItem * self;
	self = (ValadocContentListItem*) base;
	g_return_if_fail (api_root != NULL);
	g_return_if_fail (container != NULL);
	g_return_if_fail (file_path != NULL);
	g_return_if_fail (reporter != NULL);
	g_return_if_fail (settings != NULL);
	VALADOC_CONTENT_CONTENT_ELEMENT_CLASS (valadoc_content_list_item_parent_class)->check ((ValadocContentContentElement*) G_TYPE_CHECK_INSTANCE_CAST (self, VALADOC_CONTENT_TYPE_BLOCK_CONTENT, ValadocContentBlockContent), api_root, container, file_path, reporter, settings);
}

static void
valadoc_content_list_item_real_accept (ValadocContentContentElement* base,
                                       ValadocContentContentVisitor* visitor)
{
	ValadocContentListItem * self;
	self = (ValadocContentListItem*) base;
	g_return_if_fail (visitor != NULL);
	valadoc_content_content_visitor_visit_list_item (visitor, self);
}

static void
valadoc_content_list_item_real_accept_children (ValadocContentContentElement* base,
                                                ValadocContentContentVisitor* visitor)
{
	ValadocContentListItem * self;
	self = (ValadocContentListItem*) base;
	g_return_if_fail (visitor != NULL);
	VALADOC_CONTENT_CONTENT_ELEMENT_CLASS (valadoc_content_list_item_parent_class)->accept_children ((ValadocContentContentElement*) G_TYPE_CHECK_INSTANCE_CAST (self, VALADOC_CONTENT_TYPE_BLOCK_CONTENT, ValadocContentBlockContent), visitor);
}

static ValadocContentContentElement*
valadoc_content_list_item_real_copy (ValadocContentContentElement* base,
                                     ValadocContentContentElement* new_parent)
{
	ValadocContentListItem * self;
	ValadocContentListItem* item = NULL;
	ValadocContentListItem* _tmp0_;
	ValadocContentListItem* _tmp1_;
	ValadocContentContentElement* result;
	self = (ValadocContentListItem*) base;
	_tmp0_ = valadoc_content_list_item_new ();
	item = _tmp0_;
	_tmp1_ = item;
	valadoc_content_content_element_set_parent ((ValadocContentContentElement*) _tmp1_, new_parent);
	{
		ValaList* _block_list = NULL;
		ValaList* _tmp2_;
		ValaList* _tmp3_;
		gint _block_size = 0;
		ValaList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _block_index = 0;
		_tmp2_ = valadoc_content_block_content_get_content ((ValadocContentBlockContent*) self);
		_tmp3_ = _tmp2_;
		_block_list = _tmp3_;
		_tmp4_ = _block_list;
		_tmp5_ = vala_collection_get_size ((ValaCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_block_size = _tmp6_;
		_block_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			ValadocContentBlock* block = NULL;
			ValaList* _tmp9_;
			gpointer _tmp10_;
			ValadocContentBlock* copy = NULL;
			ValadocContentBlock* _tmp11_;
			ValadocContentListItem* _tmp12_;
			ValadocContentContentElement* _tmp13_;
			ValadocContentBlock* _tmp14_;
			ValadocContentListItem* _tmp15_;
			ValaList* _tmp16_;
			ValaList* _tmp17_;
			ValadocContentBlock* _tmp18_;
			_block_index = _block_index + 1;
			_tmp7_ = _block_index;
			_tmp8_ = _block_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _block_list;
			_tmp10_ = vala_list_get (_tmp9_, _block_index);
			block = (ValadocContentBlock*) _tmp10_;
			_tmp11_ = block;
			_tmp12_ = item;
			_tmp13_ = valadoc_content_content_element_copy ((ValadocContentContentElement*) _tmp11_, (ValadocContentContentElement*) _tmp12_);
			_tmp14_ = VALADOC_CONTENT_IS_BLOCK (_tmp13_) ? ((ValadocContentBlock*) _tmp13_) : NULL;
			if (_tmp14_ == NULL) {
				_g_object_unref0 (_tmp13_);
			}
			copy = _tmp14_;
			_tmp15_ = item;
			_tmp16_ = valadoc_content_block_content_get_content ((ValadocContentBlockContent*) _tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = copy;
			vala_collection_add ((ValaCollection*) _tmp17_, _tmp18_);
			_g_object_unref0 (copy);
			_g_object_unref0 (block);
		}
	}
	result = (ValadocContentContentElement*) item;
	return result;
}

static void
valadoc_content_list_item_class_init (ValadocContentListItemClass * klass,
                                      gpointer klass_data)
{
	valadoc_content_list_item_parent_class = g_type_class_peek_parent (klass);
	((ValadocContentContentElementClass *) klass)->check = (void (*) (ValadocContentContentElement*, ValadocApiTree*, ValadocApiNode*, const gchar*, ValadocErrorReporter*, ValadocSettings*)) valadoc_content_list_item_real_check;
	((ValadocContentContentElementClass *) klass)->accept = (void (*) (ValadocContentContentElement*, ValadocContentContentVisitor*)) valadoc_content_list_item_real_accept;
	((ValadocContentContentElementClass *) klass)->accept_children = (void (*) (ValadocContentContentElement*, ValadocContentContentVisitor*)) valadoc_content_list_item_real_accept_children;
	((ValadocContentContentElementClass *) klass)->copy = (ValadocContentContentElement* (*) (ValadocContentContentElement*, ValadocContentContentElement*)) valadoc_content_list_item_real_copy;
}

static void
valadoc_content_list_item_instance_init (ValadocContentListItem * self,
                                         gpointer klass)
{
}

static GType
valadoc_content_list_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValadocContentListItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_content_list_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocContentListItem), 0, (GInstanceInitFunc) valadoc_content_list_item_instance_init, NULL };
	GType valadoc_content_list_item_type_id;
	valadoc_content_list_item_type_id = g_type_register_static (VALADOC_CONTENT_TYPE_BLOCK_CONTENT, "ValadocContentListItem", &g_define_type_info, 0);
	return valadoc_content_list_item_type_id;
}

GType
valadoc_content_list_item_get_type (void)
{
	static volatile gsize valadoc_content_list_item_type_id__once = 0;
	if (g_once_init_enter (&valadoc_content_list_item_type_id__once)) {
		GType valadoc_content_list_item_type_id;
		valadoc_content_list_item_type_id = valadoc_content_list_item_get_type_once ();
		g_once_init_leave (&valadoc_content_list_item_type_id__once, valadoc_content_list_item_type_id);
	}
	return valadoc_content_list_item_type_id__once;
}

