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

/* simplechartfactory.vala
 *
 * Copyright (C) 2008  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:
 * 	Florian Brosch <flo.brosch@gmail.com>
 */

#include <glib.h>
#include <glib-object.h>
#include "valadoc.h"
#include <graphviz/gvc.h>
#include <stdlib.h>
#include <string.h>

enum  {
	VALADOC_HTML_SIMPLE_CHART_FACTORY_0_PROPERTY,
	VALADOC_HTML_SIMPLE_CHART_FACTORY_NUM_PROPERTIES
};
static GParamSpec* valadoc_html_simple_chart_factory_properties[VALADOC_HTML_SIMPLE_CHART_FACTORY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _agclose0(var) ((var == NULL) ? NULL : (var = (agclose (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ValadocHtmlSimpleChartFactoryPrivate {
	ValadocSettings* _settings;
	ValadocApiNode* _container;
	ValadocHtmlLinkHelper* _linker;
};


static gpointer valadoc_html_simple_chart_factory_parent_class = NULL;

#define VALADOC_HTML_SIMPLE_CHART_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALADOC_HTML_TYPE_SIMPLE_CHART_FACTORY, ValadocHtmlSimpleChartFactoryPrivate))
static Agraph_t* valadoc_html_simple_chart_factory_real_create_graph (ValadocChartsFactory* base, ValadocApiNode* item);
static Agnode_t* valadoc_html_simple_chart_factory_real_configure_type (ValadocChartsSimpleFactory* base, Agnode_t* node, ValadocApiNode* item);
static void valadoc_html_simple_chart_factory_finalize (GObject * obj);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


ValadocHtmlSimpleChartFactory* valadoc_html_simple_chart_factory_construct (GType object_type, ValadocSettings* settings, ValadocHtmlLinkHelper* linker) {
	ValadocHtmlSimpleChartFactory * self = NULL;
	ValadocSettings* _tmp0_;
	ValadocSettings* _tmp1_;
	ValadocHtmlLinkHelper* _tmp2_;
	ValadocHtmlLinkHelper* _tmp3_;
	g_return_val_if_fail (settings != NULL, NULL);
	g_return_val_if_fail (linker != NULL, NULL);
	self = (ValadocHtmlSimpleChartFactory*) valadoc_charts_simple_factory_construct (object_type);
	_tmp0_ = settings;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_settings);
	self->priv->_settings = _tmp1_;
	_tmp2_ = linker;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->_linker);
	self->priv->_linker = _tmp3_;
	return self;
}


ValadocHtmlSimpleChartFactory* valadoc_html_simple_chart_factory_new (ValadocSettings* settings, ValadocHtmlLinkHelper* linker) {
	return valadoc_html_simple_chart_factory_construct (VALADOC_HTML_TYPE_SIMPLE_CHART_FACTORY, settings, linker);
}


static Agraph_t* valadoc_html_simple_chart_factory_real_create_graph (ValadocChartsFactory* base, ValadocApiNode* item) {
	ValadocHtmlSimpleChartFactory * self;
	Agraph_t* result = NULL;
	Agraph_t* graph = NULL;
	ValadocApiNode* _tmp0_;
	Agraph_t* _tmp1_;
	ValadocApiNode* _tmp2_;
	ValadocApiNode* _tmp3_;
	self = (ValadocHtmlSimpleChartFactory*) base;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = item;
	_tmp1_ = VALADOC_CHARTS_FACTORY_CLASS (valadoc_html_simple_chart_factory_parent_class)->create_graph ((ValadocChartsFactory*) G_TYPE_CHECK_INSTANCE_CAST (self, VALADOC_CHARTS_TYPE_SIMPLE_FACTORY, ValadocChartsSimpleFactory), _tmp0_);
	graph = _tmp1_;
	_tmp2_ = item;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->_container);
	self->priv->_container = _tmp3_;
	result = graph;
	return result;
}


static Agnode_t* valadoc_html_simple_chart_factory_real_configure_type (ValadocChartsSimpleFactory* base, Agnode_t* node, ValadocApiNode* item) {
	ValadocHtmlSimpleChartFactory * self;
	Agnode_t* result = NULL;
	Agnode_t* _tmp0_;
	ValadocApiNode* _tmp1_;
	Agnode_t* _tmp2_;
	ValadocApiNode* _tmp3_;
	Agnode_t* _tmp12_;
	self = (ValadocHtmlSimpleChartFactory*) base;
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = node;
	_tmp1_ = item;
	_tmp2_ = VALADOC_CHARTS_SIMPLE_FACTORY_CLASS (valadoc_html_simple_chart_factory_parent_class)->configure_type (G_TYPE_CHECK_INSTANCE_CAST (self, VALADOC_CHARTS_TYPE_SIMPLE_FACTORY, ValadocChartsSimpleFactory), _tmp0_, _tmp1_);
	_tmp3_ = self->priv->_container;
	if (_tmp3_ != NULL) {
		gchar* link = NULL;
		ValadocHtmlLinkHelper* _tmp4_;
		ValadocApiNode* _tmp5_;
		ValadocApiNode* _tmp6_;
		ValadocSettings* _tmp7_;
		gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp4_ = self->priv->_linker;
		_tmp5_ = self->priv->_container;
		_tmp6_ = item;
		_tmp7_ = self->priv->_settings;
		_tmp8_ = valadoc_html_link_helper_get_relative_link (_tmp4_, (ValadocDocumentation*) _tmp5_, (ValadocDocumentation*) _tmp6_, _tmp7_);
		link = _tmp8_;
		_tmp9_ = link;
		if (_tmp9_ != NULL) {
			Agnode_t* _tmp10_;
			const gchar* _tmp11_;
			_tmp10_ = node;
			_tmp11_ = link;
			agsafeset (_tmp10_, (char*) "URL", (char*) _tmp11_, (char*) "");
		}
		_g_free0 (link);
	}
	_tmp12_ = node;
	result = _tmp12_;
	return result;
}


static void valadoc_html_simple_chart_factory_class_init (ValadocHtmlSimpleChartFactoryClass * klass) {
	valadoc_html_simple_chart_factory_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ValadocHtmlSimpleChartFactoryPrivate));
	((ValadocChartsFactoryClass *) klass)->create_graph = (Agraph_t* (*) (ValadocChartsFactory *, ValadocApiNode*)) valadoc_html_simple_chart_factory_real_create_graph;
	((ValadocChartsSimpleFactoryClass *) klass)->configure_type = (Agnode_t* (*) (ValadocChartsSimpleFactory *, Agnode_t*, ValadocApiNode*)) valadoc_html_simple_chart_factory_real_configure_type;
	G_OBJECT_CLASS (klass)->finalize = valadoc_html_simple_chart_factory_finalize;
}


static void valadoc_html_simple_chart_factory_instance_init (ValadocHtmlSimpleChartFactory * self) {
	self->priv = VALADOC_HTML_SIMPLE_CHART_FACTORY_GET_PRIVATE (self);
}


static void valadoc_html_simple_chart_factory_finalize (GObject * obj) {
	ValadocHtmlSimpleChartFactory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_HTML_TYPE_SIMPLE_CHART_FACTORY, ValadocHtmlSimpleChartFactory);
	_g_object_unref0 (self->priv->_settings);
	_g_object_unref0 (self->priv->_container);
	_g_object_unref0 (self->priv->_linker);
	G_OBJECT_CLASS (valadoc_html_simple_chart_factory_parent_class)->finalize (obj);
}


GType valadoc_html_simple_chart_factory_get_type (void) {
	static volatile gsize valadoc_html_simple_chart_factory_type_id__volatile = 0;
	if (g_once_init_enter (&valadoc_html_simple_chart_factory_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValadocHtmlSimpleChartFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_html_simple_chart_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocHtmlSimpleChartFactory), 0, (GInstanceInitFunc) valadoc_html_simple_chart_factory_instance_init, NULL };
		GType valadoc_html_simple_chart_factory_type_id;
		valadoc_html_simple_chart_factory_type_id = g_type_register_static (VALADOC_CHARTS_TYPE_SIMPLE_FACTORY, "ValadocHtmlSimpleChartFactory", &g_define_type_info, 0);
		g_once_init_leave (&valadoc_html_simple_chart_factory_type_id__volatile, valadoc_html_simple_chart_factory_type_id);
	}
	return valadoc_html_simple_chart_factory_type_id__volatile;
}



