/* 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 "valadoc.h"
#include <gvc.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

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 _g_free0(var) (var = (g_free (var), NULL))

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

static gint ValadocHtmlSimpleChartFactory_private_offset;
static gpointer valadoc_html_simple_chart_factory_parent_class = NULL;

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 GType valadoc_html_simple_chart_factory_get_type_once (void);

static inline gpointer
valadoc_html_simple_chart_factory_get_instance_private (ValadocHtmlSimpleChartFactory* self)
{
	return G_STRUCT_MEMBER_P (self, ValadocHtmlSimpleChartFactory_private_offset);
}

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_;
	ValadocHtmlLinkHelper* _tmp1_;
	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_ = _g_object_ref0 (settings);
	_g_object_unref0 (self->priv->_settings);
	self->priv->_settings = _tmp0_;
	_tmp1_ = _g_object_ref0 (linker);
	_g_object_unref0 (self->priv->_linker);
	self->priv->_linker = _tmp1_;
	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* graph = NULL;
	Agraph_t* _tmp0_;
	ValadocApiNode* _tmp1_;
	Agraph_t* result;
	self = (ValadocHtmlSimpleChartFactory*) base;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = 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), item);
	graph = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (self->priv->_container);
	self->priv->_container = _tmp1_;
	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* _tmp0_;
	ValadocApiNode* _tmp1_;
	Agnode_t* result;
	self = (ValadocHtmlSimpleChartFactory*) base;
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = 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), node, item);
	_tmp1_ = self->priv->_container;
	if (_tmp1_ != NULL) {
		gchar* link = NULL;
		ValadocHtmlLinkHelper* _tmp2_;
		ValadocApiNode* _tmp3_;
		ValadocSettings* _tmp4_;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp2_ = self->priv->_linker;
		_tmp3_ = self->priv->_container;
		_tmp4_ = self->priv->_settings;
		_tmp5_ = valadoc_html_link_helper_get_relative_link (_tmp2_, (ValadocDocumentation*) _tmp3_, (ValadocDocumentation*) item, _tmp4_);
		link = _tmp5_;
		_tmp6_ = link;
		if (_tmp6_ != NULL) {
			const gchar* _tmp7_;
			_tmp7_ = link;
			agsafeset (node, (char*) "URL", (char*) _tmp7_, (char*) "");
		}
		_g_free0 (link);
	}
	result = node;
	return result;
}

static void
valadoc_html_simple_chart_factory_class_init (ValadocHtmlSimpleChartFactoryClass * klass,
                                              gpointer klass_data)
{
	valadoc_html_simple_chart_factory_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ValadocHtmlSimpleChartFactory_private_offset);
	((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,
                                                 gpointer klass)
{
	self->priv = valadoc_html_simple_chart_factory_get_instance_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);
}

static GType
valadoc_html_simple_chart_factory_get_type_once (void)
{
	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);
	ValadocHtmlSimpleChartFactory_private_offset = g_type_add_instance_private (valadoc_html_simple_chart_factory_type_id, sizeof (ValadocHtmlSimpleChartFactoryPrivate));
	return valadoc_html_simple_chart_factory_type_id;
}

GType
valadoc_html_simple_chart_factory_get_type (void)
{
	static volatile gsize valadoc_html_simple_chart_factory_type_id__once = 0;
	if (g_once_init_enter (&valadoc_html_simple_chart_factory_type_id__once)) {
		GType valadoc_html_simple_chart_factory_type_id;
		valadoc_html_simple_chart_factory_type_id = valadoc_html_simple_chart_factory_get_type_once ();
		g_once_init_leave (&valadoc_html_simple_chart_factory_type_id__once, valadoc_html_simple_chart_factory_type_id);
	}
	return valadoc_html_simple_chart_factory_type_id__once;
}

