1 /* documentationimporter.c generated by valac, the Vala compiler
2  * generated from documentationimporter.vala, do not modify */
3 
4 /* resourcelocator.vala
5  *
6  * Copyright (C) 2008-2009 Florian Brosch
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Florian Brosch <flo.brosch@gmail.com>
24  */
25 
26 #include "valadoc.h"
27 #include <stdlib.h>
28 #include <string.h>
29 #include <glib.h>
30 #include <glib-object.h>
31 
32 enum  {
33 	VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_0_PROPERTY,
34 	VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY,
35 	VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_NUM_PROPERTIES
36 };
37 static GParamSpec* valadoc_importer_documentation_importer_properties[VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_NUM_PROPERTIES];
38 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
39 #define _valadoc_api_tree_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_tree_unref (var), NULL)))
40 
41 static gpointer valadoc_importer_documentation_importer_parent_class = NULL;
42 static ValadocResourceLocatorIface * valadoc_importer_documentation_importer_valadoc_resource_locator_parent_iface = NULL;
43 
44 static gchar* valadoc_importer_documentation_importer_real_resolve (ValadocImporterDocumentationImporter* self,
45                                                              const gchar* path);
46 static void valadoc_importer_documentation_importer_real_process (ValadocImporterDocumentationImporter* self,
47                                                            const gchar* filename);
48 static void valadoc_importer_documentation_importer_finalize (GObject * obj);
49 static GType valadoc_importer_documentation_importer_get_type_once (void);
50 static void _vala_valadoc_importer_documentation_importer_get_property (GObject * object,
51                                                                  guint property_id,
52                                                                  GValue * value,
53                                                                  GParamSpec * pspec);
54 
55 const gchar*
valadoc_importer_documentation_importer_get_file_extension(ValadocImporterDocumentationImporter * self)56 valadoc_importer_documentation_importer_get_file_extension (ValadocImporterDocumentationImporter* self)
57 {
58 	g_return_val_if_fail (self != NULL, NULL);
59 	return VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_GET_CLASS (self)->get_file_extension (self);
60 }
61 
62 static gpointer
_g_object_ref0(gpointer self)63 _g_object_ref0 (gpointer self)
64 {
65 	return self ? g_object_ref (self) : NULL;
66 }
67 
68 static gpointer
_valadoc_api_tree_ref0(gpointer self)69 _valadoc_api_tree_ref0 (gpointer self)
70 {
71 	return self ? valadoc_api_tree_ref (self) : NULL;
72 }
73 
74 ValadocImporterDocumentationImporter*
valadoc_importer_documentation_importer_construct(GType object_type,ValadocApiTree * tree,ValadocModuleLoader * modules,ValadocSettings * settings)75 valadoc_importer_documentation_importer_construct (GType object_type,
76                                                    ValadocApiTree* tree,
77                                                    ValadocModuleLoader* modules,
78                                                    ValadocSettings* settings)
79 {
80 	ValadocImporterDocumentationImporter * self = NULL;
81 	ValadocSettings* _tmp0_;
82 	ValadocApiTree* _tmp1_;
83 	g_return_val_if_fail (tree != NULL, NULL);
84 	g_return_val_if_fail (modules != NULL, NULL);
85 	g_return_val_if_fail (settings != NULL, NULL);
86 	self = (ValadocImporterDocumentationImporter*) g_object_new (object_type, NULL);
87 	_tmp0_ = _g_object_ref0 (settings);
88 	_g_object_unref0 (self->settings);
89 	self->settings = _tmp0_;
90 	_g_object_unref0 (self->modules);
91 	self->modules = NULL;
92 	_tmp1_ = _valadoc_api_tree_ref0 (tree);
93 	_valadoc_api_tree_unref0 (self->tree);
94 	self->tree = _tmp1_;
95 	return self;
96 }
97 
98 static gchar*
valadoc_importer_documentation_importer_real_resolve(ValadocImporterDocumentationImporter * self,const gchar * path)99 valadoc_importer_documentation_importer_real_resolve (ValadocImporterDocumentationImporter* self,
100                                                       const gchar* path)
101 {
102 	gchar* _tmp0_;
103 	gchar* result = NULL;
104 	g_return_val_if_fail (path != NULL, NULL);
105 	_tmp0_ = g_strdup (path);
106 	result = _tmp0_;
107 	return result;
108 }
109 
110 gchar*
valadoc_importer_documentation_importer_resolve(ValadocImporterDocumentationImporter * self,const gchar * path)111 valadoc_importer_documentation_importer_resolve (ValadocImporterDocumentationImporter* self,
112                                                  const gchar* path)
113 {
114 	g_return_val_if_fail (self != NULL, NULL);
115 	return VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_GET_CLASS (self)->resolve (self, path);
116 }
117 
118 static void
valadoc_importer_documentation_importer_real_process(ValadocImporterDocumentationImporter * self,const gchar * filename)119 valadoc_importer_documentation_importer_real_process (ValadocImporterDocumentationImporter* self,
120                                                       const gchar* filename)
121 {
122 	g_critical ("Type `%s' does not implement abstract method `valadoc_importer_documentation_importer_process'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
123 	return;
124 }
125 
126 void
valadoc_importer_documentation_importer_process(ValadocImporterDocumentationImporter * self,const gchar * filename)127 valadoc_importer_documentation_importer_process (ValadocImporterDocumentationImporter* self,
128                                                  const gchar* filename)
129 {
130 	g_return_if_fail (self != NULL);
131 	VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_GET_CLASS (self)->process (self, filename);
132 }
133 
134 static void
valadoc_importer_documentation_importer_class_init(ValadocImporterDocumentationImporterClass * klass,gpointer klass_data)135 valadoc_importer_documentation_importer_class_init (ValadocImporterDocumentationImporterClass * klass,
136                                                     gpointer klass_data)
137 {
138 	valadoc_importer_documentation_importer_parent_class = g_type_class_peek_parent (klass);
139 	((ValadocImporterDocumentationImporterClass *) klass)->resolve = (gchar* (*) (ValadocImporterDocumentationImporter*, const gchar*)) valadoc_importer_documentation_importer_real_resolve;
140 	((ValadocImporterDocumentationImporterClass *) klass)->process = (void (*) (ValadocImporterDocumentationImporter*, const gchar*)) valadoc_importer_documentation_importer_real_process;
141 	G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_importer_documentation_importer_get_property;
142 	G_OBJECT_CLASS (klass)->finalize = valadoc_importer_documentation_importer_finalize;
143 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY, valadoc_importer_documentation_importer_properties[VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY] = g_param_spec_string ("file-extension", "file-extension", "file-extension", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
144 }
145 
146 static void
valadoc_importer_documentation_importer_valadoc_resource_locator_interface_init(ValadocResourceLocatorIface * iface,gpointer iface_data)147 valadoc_importer_documentation_importer_valadoc_resource_locator_interface_init (ValadocResourceLocatorIface * iface,
148                                                                                  gpointer iface_data)
149 {
150 	valadoc_importer_documentation_importer_valadoc_resource_locator_parent_iface = g_type_interface_peek_parent (iface);
151 	iface->resolve = (gchar* (*) (ValadocResourceLocator*, const gchar*)) valadoc_importer_documentation_importer_resolve;
152 }
153 
154 static void
valadoc_importer_documentation_importer_instance_init(ValadocImporterDocumentationImporter * self,gpointer klass)155 valadoc_importer_documentation_importer_instance_init (ValadocImporterDocumentationImporter * self,
156                                                        gpointer klass)
157 {
158 }
159 
160 static void
valadoc_importer_documentation_importer_finalize(GObject * obj)161 valadoc_importer_documentation_importer_finalize (GObject * obj)
162 {
163 	ValadocImporterDocumentationImporter * self;
164 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_IMPORTER_TYPE_DOCUMENTATION_IMPORTER, ValadocImporterDocumentationImporter);
165 	_g_object_unref0 (self->modules);
166 	_g_object_unref0 (self->settings);
167 	_valadoc_api_tree_unref0 (self->tree);
168 	G_OBJECT_CLASS (valadoc_importer_documentation_importer_parent_class)->finalize (obj);
169 }
170 
171 static GType
valadoc_importer_documentation_importer_get_type_once(void)172 valadoc_importer_documentation_importer_get_type_once (void)
173 {
174 	static const GTypeInfo g_define_type_info = { sizeof (ValadocImporterDocumentationImporterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_importer_documentation_importer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocImporterDocumentationImporter), 0, (GInstanceInitFunc) valadoc_importer_documentation_importer_instance_init, NULL };
175 	static const GInterfaceInfo valadoc_resource_locator_info = { (GInterfaceInitFunc) valadoc_importer_documentation_importer_valadoc_resource_locator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
176 	GType valadoc_importer_documentation_importer_type_id;
177 	valadoc_importer_documentation_importer_type_id = g_type_register_static (G_TYPE_OBJECT, "ValadocImporterDocumentationImporter", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
178 	g_type_add_interface_static (valadoc_importer_documentation_importer_type_id, VALADOC_TYPE_RESOURCE_LOCATOR, &valadoc_resource_locator_info);
179 	return valadoc_importer_documentation_importer_type_id;
180 }
181 
182 GType
valadoc_importer_documentation_importer_get_type(void)183 valadoc_importer_documentation_importer_get_type (void)
184 {
185 	static volatile gsize valadoc_importer_documentation_importer_type_id__volatile = 0;
186 	if (g_once_init_enter (&valadoc_importer_documentation_importer_type_id__volatile)) {
187 		GType valadoc_importer_documentation_importer_type_id;
188 		valadoc_importer_documentation_importer_type_id = valadoc_importer_documentation_importer_get_type_once ();
189 		g_once_init_leave (&valadoc_importer_documentation_importer_type_id__volatile, valadoc_importer_documentation_importer_type_id);
190 	}
191 	return valadoc_importer_documentation_importer_type_id__volatile;
192 }
193 
194 static void
_vala_valadoc_importer_documentation_importer_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)195 _vala_valadoc_importer_documentation_importer_get_property (GObject * object,
196                                                             guint property_id,
197                                                             GValue * value,
198                                                             GParamSpec * pspec)
199 {
200 	ValadocImporterDocumentationImporter * self;
201 	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_IMPORTER_TYPE_DOCUMENTATION_IMPORTER, ValadocImporterDocumentationImporter);
202 	switch (property_id) {
203 		default:
204 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
205 		break;
206 	}
207 }
208 
209