/* 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 <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.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))
#define _gvFreeContext0(var) ((var == NULL) ? NULL : (var = (gvFreeContext (var), NULL)))


static gpointer valadoc_charts_simple_factory_parent_class = NULL;

Agraph_t* valadoc_compat_gvc_graph_new (const gchar* name);
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 Agnode_t* valadoc_charts_simple_factory_real_configure_type (ValadocChartsSimpleFactory* self, Agnode_t* node, ValadocApiNode* item) {
	Agnode_t* result = NULL;
	Agnode_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* _tmp2_;
	ValadocApiNode* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	Agnode_t* _tmp6_;
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = node;
	agsafeset (_tmp0_, (char*) "shape", (char*) "box", (char*) "");
	_tmp1_ = node;
	agsafeset (_tmp1_, (char*) "fontname", (char*) "Times", (char*) "");
	_tmp2_ = node;
	_tmp3_ = item;
	_tmp4_ = valadoc_api_node_get_full_name (_tmp3_);
	_tmp5_ = _tmp4_;
	agsafeset (_tmp2_, (char*) "label", (char*) _tmp5_, (char*) "");
	_g_free0 (_tmp5_);
	_tmp6_ = node;
	result = _tmp6_;
	return result;
}


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


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


static GVC_t* valadoc_charts_simple_factory_real_create_context (ValadocChartsFactory* base, Agraph_t* graph) {
	ValadocChartsSimpleFactory * self;
	GVC_t* result = NULL;
	GVC_t* context = NULL;
	GVC_t* _tmp0_;
	Agraph_t* _tmp1_;
	Agraph_t* _tmp2_;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	_tmp0_ = gvContext ();
	context = _tmp0_;
	_tmp1_ = graph;
	gvLayoutJobs (context, _tmp1_);
	_tmp2_ = graph;
	gvLayout (context, _tmp2_, (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* result = NULL;
	Agnode_t* node = NULL;
	Agraph_t* _tmp0_;
	ValadocApiClass* _tmp1_;
	Agnode_t* _tmp2_;
	ValadocApiClass* _tmp3_;
	Agnode_t* _tmp4_;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = graph;
	_tmp1_ = item;
	_tmp2_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, _tmp0_, (ValadocApiNode*) _tmp1_);
	_tmp3_ = item;
	_tmp4_ = valadoc_charts_simple_factory_configure_type (self, _tmp2_, (ValadocApiNode*) _tmp3_);
	node = _tmp4_;
	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* result = NULL;
	Agnode_t* node = NULL;
	Agraph_t* _tmp0_;
	ValadocApiStruct* _tmp1_;
	Agnode_t* _tmp2_;
	ValadocApiStruct* _tmp3_;
	Agnode_t* _tmp4_;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = graph;
	_tmp1_ = item;
	_tmp2_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, _tmp0_, (ValadocApiNode*) _tmp1_);
	_tmp3_ = item;
	_tmp4_ = valadoc_charts_simple_factory_configure_type (self, _tmp2_, (ValadocApiNode*) _tmp3_);
	node = _tmp4_;
	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* result = NULL;
	Agraph_t* _tmp0_;
	ValadocApiInterface* _tmp1_;
	Agnode_t* _tmp2_;
	ValadocApiInterface* _tmp3_;
	Agnode_t* _tmp4_;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = graph;
	_tmp1_ = item;
	_tmp2_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, _tmp0_, (ValadocApiNode*) _tmp1_);
	_tmp3_ = item;
	_tmp4_ = valadoc_charts_simple_factory_configure_type (self, _tmp2_, (ValadocApiNode*) _tmp3_);
	result = _tmp4_;
	return result;
}


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


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


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


static Agnode_t* valadoc_charts_simple_factory_real_create_namespace (ValadocChartsFactory* base, Agraph_t* graph, ValadocApiNamespace* item) {
	ValadocChartsSimpleFactory * self;
	Agnode_t* result = NULL;
	Agraph_t* _tmp0_;
	ValadocApiNamespace* _tmp1_;
	Agnode_t* _tmp2_;
	ValadocApiNamespace* _tmp3_;
	Agnode_t* _tmp4_;
	self = (ValadocChartsSimpleFactory*) base;
	g_return_val_if_fail (graph != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = graph;
	_tmp1_ = item;
	_tmp2_ = valadoc_charts_factory_create_type ((ValadocChartsFactory*) self, _tmp0_, (ValadocApiNode*) _tmp1_);
	_tmp3_ = item;
	_tmp4_ = valadoc_charts_simple_factory_configure_type (self, _tmp2_, (ValadocApiNode*) _tmp3_);
	result = _tmp4_;
	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* result = NULL;
	Agedge_t* edge = NULL;
	Agraph_t* _tmp0_;
	Agnode_t* _tmp1_;
	Agnode_t* _tmp2_;
	Agedge_t* _tmp3_;
	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_ = graph;
	_tmp1_ = parent;
	_tmp2_ = child;
	_tmp3_ = agedge (_tmp0_, _tmp1_, _tmp2_, NULL, 1);
	edge = _tmp3_;
	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) {
	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) {
}


GType valadoc_charts_simple_factory_get_type (void) {
	static volatile gsize valadoc_charts_simple_factory_type_id__volatile = 0;
	if (g_once_init_enter (&valadoc_charts_simple_factory_type_id__volatile)) {
		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);
		g_once_init_leave (&valadoc_charts_simple_factory_type_id__volatile, valadoc_charts_simple_factory_type_id);
	}
	return valadoc_charts_simple_factory_type_id__volatile;
}



