/* simplechartfactory.c generated by valac, the Vala compiler
 * generated from simplechartfactory.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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <graphviz/gvc.h>
#include "valadoc.h"

enum  {
	VALADOC_CHARTS_SIMPLE_FACTORY_0_PROPERTY,
	VALADOC_CHARTS_SIMPLE_FACTORY_NUM_PROPERTIES
};
static GParamSpec* valadoc_charts_simple_factory_properties[VALADOC_CHARTS_SIMPLE_FACTORY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

static gpointer valadoc_charts_simple_factory_parent_class = NULL;

Agraph_t* valadoc_compat_gvc_graph_new (const gchar* name);
Agedge_t* valadoc_compat_gvc_graph_create_edge (Agraph_t* graph,
                                                Agnode_t* from,
                                                Agnode_t* to);
static Agnode_t* valadoc_charts_simple_factory_real_configure_type (ValadocChartsSimpleFactory* self,
                                                             Agnode_t* node,
                                                             ValadocApiNode* item);
static Agraph_t* valadoc_charts_simple_factory_real_create_graph (ValadocChartsFactory* base,
                                                           ValadocApiNode* item);
static GVC_t* valadoc_charts_simple_factory_real_create_context (ValadocChartsFactory* base,
                                                          Agraph_t* graph);
static Agnode_t* valadoc_charts_simple_factory_real_create_class (ValadocChartsFactory* base,
                                                           Agraph_t* graph,
                                                           ValadocApiClass* item);
static Agnode_t* valadoc_charts_simple_factory_real_create_struct (ValadocChartsFactory* base,
                                                            Agraph_t* graph,
                                                            ValadocApiStruct* item);
static Agnode_t* valadoc_charts_simple_factory_real_create_interface (ValadocChartsFactory* base,
                                                               Agraph_t* graph,
                                                               ValadocApiInterface* item);
static Agnode_t* valadoc_charts_simple_factory_real_create_enum (ValadocChartsFactory* base,
                                                          Agraph_t* graph,
                                                          ValadocApiEnum* item);
static Agnode_t* valadoc_charts_simple_factory_real_create_delegate (ValadocChartsFactory* base,
                                                              Agraph_t* graph,
                                                              ValadocApiDelegate* item);
static Agnode_t* valadoc_charts_simple_factory_real_create_errordomain (ValadocChartsFactory* base,
                                                                 Agraph_t* graph,
                                                                 ValadocApiErrorDomain* item);
static Agnode_t* valadoc_charts_simple_factory_real_create_namespace (ValadocChartsFactory* base,
                                                               Agraph_t* graph,
                                                               ValadocApiNamespace* item);
static Agedge_t* valadoc_charts_simple_factory_real_add_children (ValadocChartsFactory* base,
                                                           Agraph_t* graph,
                                                           Agnode_t* parent,
                                                           Agnode_t* child);
static GType valadoc_charts_simple_factory_get_type_once (void);

static Agnode_t*
valadoc_charts_simple_factory_real_configure_type (ValadocChartsSimpleFactory* self,
                                                   Agnode_t* node,
                                                   ValadocApiNode* item)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	Agnode_t* result;
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	agsafeset (node, (char*) "shape", (char*) "box", (char*) "");
	agsafeset (node, (char*) "fontname", (char*) "Times", (char*) "");
	_tmp0_ = valadoc_api_node_get_full_name (item);
	_tmp1_ = _tmp0_;
	agsafeset (node, (char*) "label", (char*) _tmp1_, (char*) "");
	_g_free0 (_tmp1_);
	result = node;
	return result;
}

Agnode_t*
valadoc_charts_simple_factory_configure_type (ValadocChartsSimpleFactory* self,
                                              Agnode_t* node,
                                              ValadocApiNode* item)
{
	ValadocChartsSimpleFactoryClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = VALADOC_CHARTS_SIMPLE_FACTORY_GET_CLASS (self);
	if (_klass_->configure_type) {
		return _klass_->configure_type (self, node, item);
	}
	return NULL;
}

static Agraph_t*
valadoc_charts_simple_factory_real_create_graph (ValadocChartsFactory* base,
                                                 ValadocApiNode* item)
{
	ValadocChartsSimpleFactory * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	Agraph_t* _tmp2_;
	Agraph_t* _tmp3_;
	Agraph_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_api_node_get_full_name (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = valadoc_compat_gvc_graph_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static GVC_t*
valadoc_charts_simple_factory_real_create_context (ValadocChartsFactory* base,
                                                   Agraph_t* graph)
{
	ValadocChartsSimpleFactory * self;
	GVC_t* context = NULL;
	GVC_t* _tmp0_;
	GVC_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	_tmp0_ = gvContext ();
	context = _tmp0_;
	gvLayoutJobs (context, graph);
	gvLayout (context, graph, (char*) "dot");
	result = context;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_class (ValadocChartsFactory* base,
                                                 Agraph_t* graph,
                                                 ValadocApiClass* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* node = NULL;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	node = _tmp1_;
	agsafeset (node, (char*) "style", (char*) "bold", (char*) "");
	result = node;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_struct (ValadocChartsFactory* base,
                                                  Agraph_t* graph,
                                                  ValadocApiStruct* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* node = NULL;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	node = _tmp1_;
	agsafeset (node, (char*) "style", (char*) "bold", (char*) "");
	result = node;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_interface (ValadocChartsFactory* base,
                                                     Agraph_t* graph,
                                                     ValadocApiInterface* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	result = _tmp1_;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_enum (ValadocChartsFactory* base,
                                                Agraph_t* graph,
                                                ValadocApiEnum* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	result = _tmp1_;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_delegate (ValadocChartsFactory* base,
                                                    Agraph_t* graph,
                                                    ValadocApiDelegate* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	result = _tmp1_;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_errordomain (ValadocChartsFactory* base,
                                                       Agraph_t* graph,
                                                       ValadocApiErrorDomain* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	result = _tmp1_;
	return result;
}

static Agnode_t*
valadoc_charts_simple_factory_real_create_namespace (ValadocChartsFactory* base,
                                                     Agraph_t* graph,
                                                     ValadocApiNamespace* item)
{
	ValadocChartsSimpleFactory * self;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, graph, (ValadocApiNode*) item);
	_tmp1_ = valadoc_charts_simple_factory_configure_type (self, _tmp0_, (ValadocApiNode*) item);
	result = _tmp1_;
	return result;
}

static Agedge_t*
valadoc_charts_simple_factory_real_add_children (ValadocChartsFactory* base,
                                                 Agraph_t* graph,
                                                 Agnode_t* parent,
                                                 Agnode_t* child)
{
	ValadocChartsSimpleFactory * self;
	Agedge_t* edge = NULL;
	Agedge_t* _tmp0_;
	Agedge_t* result;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (parent != NULL, NULL);
	g_return_val_if_fail (child != NULL, NULL);
	_tmp0_ = valadoc_compat_gvc_graph_create_edge (graph, parent, child);
	edge = _tmp0_;
	agsafeset (edge, (char*) "dir", (char*) "back", (char*) "");
	result = edge;
	return result;
}

ValadocChartsSimpleFactory*
valadoc_charts_simple_factory_construct (GType object_type)
{
	ValadocChartsSimpleFactory * self = NULL;
	self = (ValadocChartsSimpleFactory*) valadoc_charts_factory_construct (object_type);
	return self;
}

ValadocChartsSimpleFactory*
valadoc_charts_simple_factory_new (void)
{
	return valadoc_charts_simple_factory_construct (VALADOC_CHARTS_TYPE_SIMPLE_FACTORY);
}

static void
valadoc_charts_simple_factory_class_init (ValadocChartsSimpleFactoryClass * klass,
                                          gpointer klass_data)
{
	valadoc_charts_simple_factory_parent_class = g_type_class_peek_parent (klass);
	((ValadocChartsSimpleFactoryClass *) klass)->configure_type = (Agnode_t* (*) (ValadocChartsSimpleFactory*, Agnode_t*, ValadocApiNode*)) valadoc_charts_simple_factory_real_configure_type;
	((ValadocChartsFactoryClass *) klass)->create_graph = (Agraph_t* (*) (ValadocChartsFactory*, ValadocApiNode*)) valadoc_charts_simple_factory_real_create_graph;
	((ValadocChartsFactoryClass *) klass)->create_context = (GVC_t* (*) (ValadocChartsFactory*, Agraph_t*)) valadoc_charts_simple_factory_real_create_context;
	((ValadocChartsFactoryClass *) klass)->create_class = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiClass*)) valadoc_charts_simple_factory_real_create_class;
	((ValadocChartsFactoryClass *) klass)->create_struct = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiStruct*)) valadoc_charts_simple_factory_real_create_struct;
	((ValadocChartsFactoryClass *) klass)->create_interface = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiInterface*)) valadoc_charts_simple_factory_real_create_interface;
	((ValadocChartsFactoryClass *) klass)->create_enum = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiEnum*)) valadoc_charts_simple_factory_real_create_enum;
	((ValadocChartsFactoryClass *) klass)->create_delegate = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiDelegate*)) valadoc_charts_simple_factory_real_create_delegate;
	((ValadocChartsFactoryClass *) klass)->create_errordomain = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiErrorDomain*)) valadoc_charts_simple_factory_real_create_errordomain;
	((ValadocChartsFactoryClass *) klass)->create_namespace = (Agnode_t* (*) (ValadocChartsFactory*, Agraph_t*, ValadocApiNamespace*)) valadoc_charts_simple_factory_real_create_namespace;
	((ValadocChartsFactoryClass *) klass)->add_children = (Agedge_t* (*) (ValadocChartsFactory*, Agraph_t*, Agnode_t*, Agnode_t*)) valadoc_charts_simple_factory_real_add_children;
}

static void
valadoc_charts_simple_factory_instance_init (ValadocChartsSimpleFactory * self,
                                             gpointer klass)
{
}

static GType
valadoc_charts_simple_factory_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValadocChartsSimpleFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_charts_simple_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocChartsSimpleFactory), 0, (GInstanceInitFunc) valadoc_charts_simple_factory_instance_init, NULL };
	GType valadoc_charts_simple_factory_type_id;
	valadoc_charts_simple_factory_type_id = g_type_register_static (VALADOC_CHARTS_TYPE_FACTORY, "ValadocChartsSimpleFactory", &g_define_type_info, 0);
	return valadoc_charts_simple_factory_type_id;
}

GType
valadoc_charts_simple_factory_get_type (void)
{
	static volatile gsize valadoc_charts_simple_factory_type_id__once = 0;
	if (g_once_init_enter (&valadoc_charts_simple_factory_type_id__once)) {
		GType valadoc_charts_simple_factory_type_id;
		valadoc_charts_simple_factory_type_id = valadoc_charts_simple_factory_get_type_once ();
		g_once_init_leave (&valadoc_charts_simple_factory_type_id__once, valadoc_charts_simple_factory_type_id);
	}
	return valadoc_charts_simple_factory_type_id__once;
}

