1 /* sourcefile.c generated by valac, the Vala compiler
2 * generated from sourcefile.vala, do not modify */
3
4 /* sourcefile.vala
5 *
6 * Copyright (C) 2011 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 * Brosch Florian <flo.brosch@gmail.com>
24 */
25
26 #include "valadoc.h"
27 #include <stdlib.h>
28 #include <string.h>
29 #include <glib.h>
30 #include <vala.h>
31 #include <glib-object.h>
32
33 enum {
34 VALADOC_API_SOURCE_FILE_0_PROPERTY,
35 VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY,
36 VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY,
37 VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY,
38 VALADOC_API_SOURCE_FILE_DATA_PROPERTY,
39 VALADOC_API_SOURCE_FILE_NUM_PROPERTIES
40 };
41 static GParamSpec* valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_NUM_PROPERTIES];
42 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
43 #define _g_free0(var) (var = (g_free (var), NULL))
44 #define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))
45
46 struct _ValadocApiSourceFilePrivate {
47 ValadocApiPackage* _package;
48 gchar* _relative_path;
49 gchar* _relative_c_path;
50 ValaSourceFile* _data;
51 };
52
53 static gint ValadocApiSourceFile_private_offset;
54 static gpointer valadoc_api_source_file_parent_class = NULL;
55
56 static void valadoc_api_source_file_set_package (ValadocApiSourceFile* self,
57 ValadocApiPackage* value);
58 static void valadoc_api_source_file_set_relative_path (ValadocApiSourceFile* self,
59 const gchar* value);
60 static void valadoc_api_source_file_set_relative_c_path (ValadocApiSourceFile* self,
61 const gchar* value);
62 static void valadoc_api_source_file_set_data (ValadocApiSourceFile* self,
63 ValaSourceFile* value);
64 static void valadoc_api_source_file_finalize (GObject * obj);
65 static GType valadoc_api_source_file_get_type_once (void);
66 static void _vala_valadoc_api_source_file_get_property (GObject * object,
67 guint property_id,
68 GValue * value,
69 GParamSpec * pspec);
70 static void _vala_valadoc_api_source_file_set_property (GObject * object,
71 guint property_id,
72 const GValue * value,
73 GParamSpec * pspec);
74
75 static inline gpointer
valadoc_api_source_file_get_instance_private(ValadocApiSourceFile * self)76 valadoc_api_source_file_get_instance_private (ValadocApiSourceFile* self)
77 {
78 return G_STRUCT_MEMBER_P (self, ValadocApiSourceFile_private_offset);
79 }
80
81 ValadocApiPackage*
valadoc_api_source_file_get_package(ValadocApiSourceFile * self)82 valadoc_api_source_file_get_package (ValadocApiSourceFile* self)
83 {
84 ValadocApiPackage* result;
85 ValadocApiPackage* _tmp0_;
86 g_return_val_if_fail (self != NULL, NULL);
87 _tmp0_ = self->priv->_package;
88 result = _tmp0_;
89 return result;
90 }
91
92 static gpointer
_g_object_ref0(gpointer self)93 _g_object_ref0 (gpointer self)
94 {
95 return self ? g_object_ref (self) : NULL;
96 }
97
98 static void
valadoc_api_source_file_set_package(ValadocApiSourceFile * self,ValadocApiPackage * value)99 valadoc_api_source_file_set_package (ValadocApiSourceFile* self,
100 ValadocApiPackage* value)
101 {
102 ValadocApiPackage* old_value;
103 g_return_if_fail (self != NULL);
104 old_value = valadoc_api_source_file_get_package (self);
105 if (old_value != value) {
106 ValadocApiPackage* _tmp0_;
107 _tmp0_ = _g_object_ref0 (value);
108 _g_object_unref0 (self->priv->_package);
109 self->priv->_package = _tmp0_;
110 g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY]);
111 }
112 }
113
114 const gchar*
valadoc_api_source_file_get_relative_path(ValadocApiSourceFile * self)115 valadoc_api_source_file_get_relative_path (ValadocApiSourceFile* self)
116 {
117 const gchar* result;
118 const gchar* _tmp0_;
119 g_return_val_if_fail (self != NULL, NULL);
120 _tmp0_ = self->priv->_relative_path;
121 result = _tmp0_;
122 return result;
123 }
124
125 static void
valadoc_api_source_file_set_relative_path(ValadocApiSourceFile * self,const gchar * value)126 valadoc_api_source_file_set_relative_path (ValadocApiSourceFile* self,
127 const gchar* value)
128 {
129 gchar* old_value;
130 g_return_if_fail (self != NULL);
131 old_value = valadoc_api_source_file_get_relative_path (self);
132 if (g_strcmp0 (value, old_value) != 0) {
133 gchar* _tmp0_;
134 _tmp0_ = g_strdup (value);
135 _g_free0 (self->priv->_relative_path);
136 self->priv->_relative_path = _tmp0_;
137 g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY]);
138 }
139 }
140
141 const gchar*
valadoc_api_source_file_get_relative_c_path(ValadocApiSourceFile * self)142 valadoc_api_source_file_get_relative_c_path (ValadocApiSourceFile* self)
143 {
144 const gchar* result;
145 const gchar* _tmp0_;
146 g_return_val_if_fail (self != NULL, NULL);
147 _tmp0_ = self->priv->_relative_c_path;
148 result = _tmp0_;
149 return result;
150 }
151
152 static void
valadoc_api_source_file_set_relative_c_path(ValadocApiSourceFile * self,const gchar * value)153 valadoc_api_source_file_set_relative_c_path (ValadocApiSourceFile* self,
154 const gchar* value)
155 {
156 gchar* old_value;
157 g_return_if_fail (self != NULL);
158 old_value = valadoc_api_source_file_get_relative_c_path (self);
159 if (g_strcmp0 (value, old_value) != 0) {
160 gchar* _tmp0_;
161 _tmp0_ = g_strdup (value);
162 _g_free0 (self->priv->_relative_c_path);
163 self->priv->_relative_c_path = _tmp0_;
164 g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY]);
165 }
166 }
167
168 gchar*
valadoc_api_source_file_get_name(ValadocApiSourceFile * self)169 valadoc_api_source_file_get_name (ValadocApiSourceFile* self)
170 {
171 const gchar* _tmp0_;
172 gchar* _tmp1_;
173 gchar* result = NULL;
174 g_return_val_if_fail (self != NULL, NULL);
175 _tmp0_ = self->priv->_relative_path;
176 _tmp1_ = g_path_get_basename (_tmp0_);
177 result = _tmp1_;
178 return result;
179 }
180
181 ValaSourceFile*
valadoc_api_source_file_get_data(ValadocApiSourceFile * self)182 valadoc_api_source_file_get_data (ValadocApiSourceFile* self)
183 {
184 ValaSourceFile* result;
185 ValaSourceFile* _tmp0_;
186 g_return_val_if_fail (self != NULL, NULL);
187 _tmp0_ = self->priv->_data;
188 result = _tmp0_;
189 return result;
190 }
191
192 static gpointer
_vala_source_file_ref0(gpointer self)193 _vala_source_file_ref0 (gpointer self)
194 {
195 return self ? vala_source_file_ref (self) : NULL;
196 }
197
198 static void
valadoc_api_source_file_set_data(ValadocApiSourceFile * self,ValaSourceFile * value)199 valadoc_api_source_file_set_data (ValadocApiSourceFile* self,
200 ValaSourceFile* value)
201 {
202 ValaSourceFile* old_value;
203 g_return_if_fail (self != NULL);
204 old_value = valadoc_api_source_file_get_data (self);
205 if (old_value != value) {
206 ValaSourceFile* _tmp0_;
207 _tmp0_ = _vala_source_file_ref0 (value);
208 _vala_source_file_unref0 (self->priv->_data);
209 self->priv->_data = _tmp0_;
210 g_object_notify_by_pspec ((GObject *) self, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_DATA_PROPERTY]);
211 }
212 }
213
214 ValadocApiSourceFile*
valadoc_api_source_file_construct(GType object_type,ValadocApiPackage * package,const gchar * relative_path,const gchar * relative_c_path,ValaSourceFile * data)215 valadoc_api_source_file_construct (GType object_type,
216 ValadocApiPackage* package,
217 const gchar* relative_path,
218 const gchar* relative_c_path,
219 ValaSourceFile* data)
220 {
221 ValadocApiSourceFile * self = NULL;
222 g_return_val_if_fail (package != NULL, NULL);
223 g_return_val_if_fail (relative_path != NULL, NULL);
224 self = (ValadocApiSourceFile*) g_object_new (object_type, NULL);
225 valadoc_api_source_file_set_relative_c_path (self, relative_c_path);
226 valadoc_api_source_file_set_relative_path (self, relative_path);
227 valadoc_api_source_file_set_package (self, package);
228 valadoc_api_source_file_set_data (self, data);
229 return self;
230 }
231
232 ValadocApiSourceFile*
valadoc_api_source_file_new(ValadocApiPackage * package,const gchar * relative_path,const gchar * relative_c_path,ValaSourceFile * data)233 valadoc_api_source_file_new (ValadocApiPackage* package,
234 const gchar* relative_path,
235 const gchar* relative_c_path,
236 ValaSourceFile* data)
237 {
238 return valadoc_api_source_file_construct (VALADOC_API_TYPE_SOURCE_FILE, package, relative_path, relative_c_path, data);
239 }
240
241 static void
valadoc_api_source_file_class_init(ValadocApiSourceFileClass * klass,gpointer klass_data)242 valadoc_api_source_file_class_init (ValadocApiSourceFileClass * klass,
243 gpointer klass_data)
244 {
245 valadoc_api_source_file_parent_class = g_type_class_peek_parent (klass);
246 g_type_class_adjust_private_offset (klass, &ValadocApiSourceFile_private_offset);
247 G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_api_source_file_get_property;
248 G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_api_source_file_set_property;
249 G_OBJECT_CLASS (klass)->finalize = valadoc_api_source_file_finalize;
250 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY] = g_param_spec_object ("package", "package", "package", VALADOC_API_TYPE_PACKAGE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
251 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY] = g_param_spec_string ("relative-path", "relative-path", "relative-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
252 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY] = g_param_spec_string ("relative-c-path", "relative-c-path", "relative-c-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
253 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_SOURCE_FILE_DATA_PROPERTY, valadoc_api_source_file_properties[VALADOC_API_SOURCE_FILE_DATA_PROPERTY] = vala_param_spec_source_file ("data", "data", "data", VALA_TYPE_SOURCE_FILE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
254 }
255
256 static void
valadoc_api_source_file_instance_init(ValadocApiSourceFile * self,gpointer klass)257 valadoc_api_source_file_instance_init (ValadocApiSourceFile * self,
258 gpointer klass)
259 {
260 self->priv = valadoc_api_source_file_get_instance_private (self);
261 }
262
263 static void
valadoc_api_source_file_finalize(GObject * obj)264 valadoc_api_source_file_finalize (GObject * obj)
265 {
266 ValadocApiSourceFile * self;
267 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFile);
268 _g_object_unref0 (self->priv->_package);
269 _g_free0 (self->priv->_relative_path);
270 _g_free0 (self->priv->_relative_c_path);
271 _vala_source_file_unref0 (self->priv->_data);
272 G_OBJECT_CLASS (valadoc_api_source_file_parent_class)->finalize (obj);
273 }
274
275 /**
276 * Represents a source file
277 */
278 static GType
valadoc_api_source_file_get_type_once(void)279 valadoc_api_source_file_get_type_once (void)
280 {
281 static const GTypeInfo g_define_type_info = { sizeof (ValadocApiSourceFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_api_source_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocApiSourceFile), 0, (GInstanceInitFunc) valadoc_api_source_file_instance_init, NULL };
282 GType valadoc_api_source_file_type_id;
283 valadoc_api_source_file_type_id = g_type_register_static (G_TYPE_OBJECT, "ValadocApiSourceFile", &g_define_type_info, 0);
284 ValadocApiSourceFile_private_offset = g_type_add_instance_private (valadoc_api_source_file_type_id, sizeof (ValadocApiSourceFilePrivate));
285 return valadoc_api_source_file_type_id;
286 }
287
288 GType
valadoc_api_source_file_get_type(void)289 valadoc_api_source_file_get_type (void)
290 {
291 static volatile gsize valadoc_api_source_file_type_id__volatile = 0;
292 if (g_once_init_enter (&valadoc_api_source_file_type_id__volatile)) {
293 GType valadoc_api_source_file_type_id;
294 valadoc_api_source_file_type_id = valadoc_api_source_file_get_type_once ();
295 g_once_init_leave (&valadoc_api_source_file_type_id__volatile, valadoc_api_source_file_type_id);
296 }
297 return valadoc_api_source_file_type_id__volatile;
298 }
299
300 static void
_vala_valadoc_api_source_file_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)301 _vala_valadoc_api_source_file_get_property (GObject * object,
302 guint property_id,
303 GValue * value,
304 GParamSpec * pspec)
305 {
306 ValadocApiSourceFile * self;
307 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFile);
308 switch (property_id) {
309 case VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY:
310 g_value_set_object (value, valadoc_api_source_file_get_package (self));
311 break;
312 case VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY:
313 g_value_set_string (value, valadoc_api_source_file_get_relative_path (self));
314 break;
315 case VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY:
316 g_value_set_string (value, valadoc_api_source_file_get_relative_c_path (self));
317 break;
318 case VALADOC_API_SOURCE_FILE_DATA_PROPERTY:
319 vala_value_set_source_file (value, valadoc_api_source_file_get_data (self));
320 break;
321 default:
322 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
323 break;
324 }
325 }
326
327 static void
_vala_valadoc_api_source_file_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)328 _vala_valadoc_api_source_file_set_property (GObject * object,
329 guint property_id,
330 const GValue * value,
331 GParamSpec * pspec)
332 {
333 ValadocApiSourceFile * self;
334 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_SOURCE_FILE, ValadocApiSourceFile);
335 switch (property_id) {
336 case VALADOC_API_SOURCE_FILE_PACKAGE_PROPERTY:
337 valadoc_api_source_file_set_package (self, g_value_get_object (value));
338 break;
339 case VALADOC_API_SOURCE_FILE_RELATIVE_PATH_PROPERTY:
340 valadoc_api_source_file_set_relative_path (self, g_value_get_string (value));
341 break;
342 case VALADOC_API_SOURCE_FILE_RELATIVE_C_PATH_PROPERTY:
343 valadoc_api_source_file_set_relative_c_path (self, g_value_get_string (value));
344 break;
345 case VALADOC_API_SOURCE_FILE_DATA_PROPERTY:
346 valadoc_api_source_file_set_data (self, vala_value_get_source_file (value));
347 break;
348 default:
349 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
350 break;
351 }
352 }
353
354