1 /* struct.c generated by valac, the Vala compiler
2 * generated from struct.vala, do not modify */
3
4 /* struct.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 * 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 <valagee.h>
31 #include <glib-object.h>
32 #include <vala.h>
33 #include <valacodegen.h>
34
35 enum {
36 VALADOC_API_STRUCT_0_PROPERTY,
37 VALADOC_API_STRUCT_BASE_TYPE_PROPERTY,
38 VALADOC_API_STRUCT_NODE_TYPE_PROPERTY,
39 VALADOC_API_STRUCT_NUM_PROPERTIES
40 };
41 static GParamSpec* valadoc_api_struct_properties[VALADOC_API_STRUCT_NUM_PROPERTIES];
42 #define _g_free0(var) (var = (g_free (var), NULL))
43 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
44 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
45 #define _valadoc_api_signature_builder_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_signature_builder_unref (var), NULL)))
46
47 struct _ValadocApiStructPrivate {
48 gchar* dup_function_cname;
49 gchar* copy_function_cname;
50 gchar* free_function_cname;
51 gchar* destroy_function_cname;
52 gchar* type_id;
53 gchar* cname;
54 ValadocApiTypeReference* _base_type;
55 ValaSet* _known_child_structs;
56 };
57
58 static gint ValadocApiStruct_private_offset;
59 static gpointer valadoc_api_struct_parent_class = NULL;
60
61 static void valadoc_api_struct_real_accept (ValadocApiNode* base,
62 ValadocApiVisitor* visitor);
63 static ValadocContentInline* valadoc_api_struct_real_build_signature (ValadocApiItem* base);
64 static void valadoc_api_struct_finalize (GObject * obj);
65 static GType valadoc_api_struct_get_type_once (void);
66 static void _vala_valadoc_api_struct_get_property (GObject * object,
67 guint property_id,
68 GValue * value,
69 GParamSpec * pspec);
70 static void _vala_valadoc_api_struct_set_property (GObject * object,
71 guint property_id,
72 const GValue * value,
73 GParamSpec * pspec);
74
75 static inline gpointer
valadoc_api_struct_get_instance_private(ValadocApiStruct * self)76 valadoc_api_struct_get_instance_private (ValadocApiStruct* self)
77 {
78 return G_STRUCT_MEMBER_P (self, ValadocApiStruct_private_offset);
79 }
80
81 ValadocApiStruct*
valadoc_api_struct_construct(GType object_type,ValadocApiNode * parent,ValadocApiSourceFile * file,const gchar * name,ValaSymbolAccessibility accessibility,ValadocApiSourceComment * comment,ValaStruct * data)82 valadoc_api_struct_construct (GType object_type,
83 ValadocApiNode* parent,
84 ValadocApiSourceFile* file,
85 const gchar* name,
86 ValaSymbolAccessibility accessibility,
87 ValadocApiSourceComment* comment,
88 ValaStruct* data)
89 {
90 ValadocApiStruct * self = NULL;
91 gboolean _tmp0_ = FALSE;
92 ValaDataType* _tmp1_;
93 ValaDataType* _tmp2_;
94 gboolean is_basic_type = FALSE;
95 gchar* _tmp5_;
96 gchar* _tmp6_;
97 gchar* _tmp7_;
98 gchar* _tmp8_;
99 gchar* _tmp9_;
100 gchar* _tmp10_;
101 g_return_val_if_fail (parent != NULL, NULL);
102 g_return_val_if_fail (file != NULL, NULL);
103 g_return_val_if_fail (name != NULL, NULL);
104 g_return_val_if_fail (data != NULL, NULL);
105 _tmp1_ = vala_struct_get_base_type (data);
106 _tmp2_ = _tmp1_;
107 if (_tmp2_ == NULL) {
108 gboolean _tmp3_ = FALSE;
109 gboolean _tmp4_ = FALSE;
110 if (vala_struct_is_boolean_type (data)) {
111 _tmp4_ = TRUE;
112 } else {
113 _tmp4_ = vala_struct_is_floating_type (data);
114 }
115 if (_tmp4_) {
116 _tmp3_ = TRUE;
117 } else {
118 _tmp3_ = vala_struct_is_integer_type (data);
119 }
120 _tmp0_ = _tmp3_;
121 } else {
122 _tmp0_ = FALSE;
123 }
124 is_basic_type = _tmp0_;
125 self = (ValadocApiStruct*) valadoc_api_typesymbol_construct (object_type, parent, file, name, accessibility, comment, is_basic_type, (ValaTypeSymbol*) data);
126 _tmp5_ = vala_get_ccode_dup_function ((ValaTypeSymbol*) data);
127 _g_free0 (self->priv->dup_function_cname);
128 self->priv->dup_function_cname = _tmp5_;
129 _tmp6_ = vala_get_ccode_copy_function ((ValaTypeSymbol*) data);
130 _g_free0 (self->priv->copy_function_cname);
131 self->priv->copy_function_cname = _tmp6_;
132 _tmp7_ = vala_get_ccode_free_function ((ValaTypeSymbol*) data);
133 _g_free0 (self->priv->free_function_cname);
134 self->priv->free_function_cname = _tmp7_;
135 _tmp8_ = vala_get_ccode_destroy_function ((ValaTypeSymbol*) data);
136 _g_free0 (self->priv->destroy_function_cname);
137 self->priv->destroy_function_cname = _tmp8_;
138 _tmp9_ = vala_get_ccode_name ((ValaCodeNode*) data);
139 _g_free0 (self->priv->cname);
140 self->priv->cname = _tmp9_;
141 _tmp10_ = vala_get_ccode_type_id ((ValaCodeNode*) data);
142 _g_free0 (self->priv->type_id);
143 self->priv->type_id = _tmp10_;
144 return self;
145 }
146
147 ValadocApiStruct*
valadoc_api_struct_new(ValadocApiNode * parent,ValadocApiSourceFile * file,const gchar * name,ValaSymbolAccessibility accessibility,ValadocApiSourceComment * comment,ValaStruct * data)148 valadoc_api_struct_new (ValadocApiNode* parent,
149 ValadocApiSourceFile* file,
150 const gchar* name,
151 ValaSymbolAccessibility accessibility,
152 ValadocApiSourceComment* comment,
153 ValaStruct* data)
154 {
155 return valadoc_api_struct_construct (VALADOC_API_TYPE_STRUCT, parent, file, name, accessibility, comment, data);
156 }
157
158 ValadocApiTypeReference*
valadoc_api_struct_get_base_type(ValadocApiStruct * self)159 valadoc_api_struct_get_base_type (ValadocApiStruct* self)
160 {
161 ValadocApiTypeReference* result;
162 ValadocApiTypeReference* _tmp0_;
163 g_return_val_if_fail (self != NULL, NULL);
164 _tmp0_ = self->priv->_base_type;
165 result = _tmp0_;
166 return result;
167 }
168
169 static gpointer
_g_object_ref0(gpointer self)170 _g_object_ref0 (gpointer self)
171 {
172 return self ? g_object_ref (self) : NULL;
173 }
174
175 void
valadoc_api_struct_set_base_type(ValadocApiStruct * self,ValadocApiTypeReference * value)176 valadoc_api_struct_set_base_type (ValadocApiStruct* self,
177 ValadocApiTypeReference* value)
178 {
179 ValadocApiTypeReference* old_value;
180 g_return_if_fail (self != NULL);
181 old_value = valadoc_api_struct_get_base_type (self);
182 if (old_value != value) {
183 ValadocApiTypeReference* _tmp0_;
184 _tmp0_ = _g_object_ref0 (value);
185 _g_object_unref0 (self->priv->_base_type);
186 self->priv->_base_type = _tmp0_;
187 g_object_notify_by_pspec ((GObject *) self, valadoc_api_struct_properties[VALADOC_API_STRUCT_BASE_TYPE_PROPERTY]);
188 }
189 }
190
191 /**
192 * Returns the name of this struct as it is used in C.
193 */
194 gchar*
valadoc_api_struct_get_cname(ValadocApiStruct * self)195 valadoc_api_struct_get_cname (ValadocApiStruct* self)
196 {
197 const gchar* _tmp0_;
198 gchar* _tmp1_;
199 gchar* result = NULL;
200 g_return_val_if_fail (self != NULL, NULL);
201 _tmp0_ = self->priv->cname;
202 _tmp1_ = g_strdup (_tmp0_);
203 result = _tmp1_;
204 return result;
205 }
206
207 /**
208 * Returns the C symbol representing the runtime type id for this data type.
209 */
210 gchar*
valadoc_api_struct_get_type_id(ValadocApiStruct * self)211 valadoc_api_struct_get_type_id (ValadocApiStruct* self)
212 {
213 const gchar* _tmp0_;
214 gchar* _tmp1_;
215 gchar* result = NULL;
216 g_return_val_if_fail (self != NULL, NULL);
217 _tmp0_ = self->priv->type_id;
218 _tmp1_ = g_strdup (_tmp0_);
219 result = _tmp1_;
220 return result;
221 }
222
223 /**
224 * Returns the C function name that duplicates instances of this data
225 * type.
226 */
227 gchar*
valadoc_api_struct_get_dup_function_cname(ValadocApiStruct * self)228 valadoc_api_struct_get_dup_function_cname (ValadocApiStruct* self)
229 {
230 const gchar* _tmp0_;
231 gchar* _tmp1_;
232 gchar* result = NULL;
233 g_return_val_if_fail (self != NULL, NULL);
234 _tmp0_ = self->priv->dup_function_cname;
235 _tmp1_ = g_strdup (_tmp0_);
236 result = _tmp1_;
237 return result;
238 }
239
240 /**
241 * Returns the C function name that copies instances of this data
242 * type.
243 */
244 gchar*
valadoc_api_struct_get_copy_function_cname(ValadocApiStruct * self)245 valadoc_api_struct_get_copy_function_cname (ValadocApiStruct* self)
246 {
247 const gchar* _tmp0_;
248 gchar* _tmp1_;
249 gchar* result = NULL;
250 g_return_val_if_fail (self != NULL, NULL);
251 _tmp0_ = self->priv->copy_function_cname;
252 _tmp1_ = g_strdup (_tmp0_);
253 result = _tmp1_;
254 return result;
255 }
256
257 /**
258 * Returns the C function name that frees instances of this data type.
259 */
260 gchar*
valadoc_api_struct_get_free_function_cname(ValadocApiStruct * self)261 valadoc_api_struct_get_free_function_cname (ValadocApiStruct* self)
262 {
263 const gchar* _tmp0_;
264 gchar* _tmp1_;
265 gchar* result = NULL;
266 g_return_val_if_fail (self != NULL, NULL);
267 _tmp0_ = self->priv->free_function_cname;
268 _tmp1_ = g_strdup (_tmp0_);
269 result = _tmp1_;
270 return result;
271 }
272
273 /**
274 * Returns the C function name that destroys instances of this data type.
275 */
276 gchar*
valadoc_api_struct_get_destroy_function_cname(ValadocApiStruct * self)277 valadoc_api_struct_get_destroy_function_cname (ValadocApiStruct* self)
278 {
279 const gchar* _tmp0_;
280 gchar* _tmp1_;
281 gchar* result = NULL;
282 g_return_val_if_fail (self != NULL, NULL);
283 _tmp0_ = self->priv->destroy_function_cname;
284 _tmp1_ = g_strdup (_tmp0_);
285 result = _tmp1_;
286 return result;
287 }
288
289 static ValadocApiNodeType
valadoc_api_struct_real_get_node_type(ValadocApiNode * base)290 valadoc_api_struct_real_get_node_type (ValadocApiNode* base)
291 {
292 ValadocApiNodeType result;
293 ValadocApiStruct* self;
294 self = (ValadocApiStruct*) base;
295 result = VALADOC_API_NODE_TYPE_STRUCT;
296 return result;
297 }
298
299 /**
300 * {@inheritDoc}
301 */
302 static void
valadoc_api_struct_real_accept(ValadocApiNode * base,ValadocApiVisitor * visitor)303 valadoc_api_struct_real_accept (ValadocApiNode* base,
304 ValadocApiVisitor* visitor)
305 {
306 ValadocApiStruct * self;
307 self = (ValadocApiStruct*) base;
308 g_return_if_fail (visitor != NULL);
309 valadoc_api_visitor_visit_struct (visitor, self);
310 }
311
312 /**
313 * Returns a list of all known structs based on this struct
314 */
315 static gpointer
_vala_iterable_ref0(gpointer self)316 _vala_iterable_ref0 (gpointer self)
317 {
318 return self ? vala_iterable_ref (self) : NULL;
319 }
320
321 ValaCollection*
valadoc_api_struct_get_known_child_structs(ValadocApiStruct * self)322 valadoc_api_struct_get_known_child_structs (ValadocApiStruct* self)
323 {
324 ValaSet* _tmp0_;
325 ValaCollection* _tmp1_;
326 ValaCollection* result = NULL;
327 g_return_val_if_fail (self != NULL, NULL);
328 _tmp0_ = self->priv->_known_child_structs;
329 _tmp1_ = _vala_iterable_ref0 ((ValaCollection*) _tmp0_);
330 result = _tmp1_;
331 return result;
332 }
333
334 void
valadoc_api_struct_register_child_struct(ValadocApiStruct * self,ValadocApiStruct * stru)335 valadoc_api_struct_register_child_struct (ValadocApiStruct* self,
336 ValadocApiStruct* stru)
337 {
338 ValadocApiTypeReference* _tmp0_;
339 ValaSet* _tmp4_;
340 g_return_if_fail (self != NULL);
341 g_return_if_fail (stru != NULL);
342 _tmp0_ = self->priv->_base_type;
343 if (_tmp0_ != NULL) {
344 ValadocApiTypeReference* _tmp1_;
345 ValadocApiItem* _tmp2_;
346 ValadocApiItem* _tmp3_;
347 _tmp1_ = self->priv->_base_type;
348 _tmp2_ = valadoc_api_typereference_get_data_type (_tmp1_);
349 _tmp3_ = _tmp2_;
350 valadoc_api_struct_register_child_struct (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, VALADOC_API_TYPE_STRUCT, ValadocApiStruct), stru);
351 }
352 _tmp4_ = self->priv->_known_child_structs;
353 vala_collection_add ((ValaCollection*) _tmp4_, stru);
354 }
355
356 /**
357 * {@inheritDoc}
358 */
359 static ValadocContentInline*
valadoc_api_struct_real_build_signature(ValadocApiItem * base)360 valadoc_api_struct_real_build_signature (ValadocApiItem* base)
361 {
362 ValadocApiStruct * self;
363 ValadocApiSignatureBuilder* signature = NULL;
364 ValadocApiSignatureBuilder* _tmp0_;
365 ValadocApiSignatureBuilder* _tmp1_;
366 ValaSymbolAccessibility _tmp2_;
367 ValaSymbolAccessibility _tmp3_;
368 const gchar* _tmp4_;
369 ValadocApiSignatureBuilder* _tmp5_;
370 ValadocApiSignatureBuilder* _tmp6_;
371 ValaList* type_parameters = NULL;
372 ValaList* _tmp7_;
373 ValaList* _tmp8_;
374 gint _tmp9_;
375 gint _tmp10_;
376 ValadocApiTypeReference* _tmp27_;
377 ValadocApiSignatureBuilder* _tmp33_;
378 ValadocContentRun* _tmp34_;
379 ValadocContentInline* result = NULL;
380 self = (ValadocApiStruct*) base;
381 _tmp0_ = valadoc_api_signature_builder_new ();
382 signature = _tmp0_;
383 _tmp1_ = signature;
384 _tmp2_ = valadoc_api_symbol_get_accessibility ((ValadocApiSymbol*) self);
385 _tmp3_ = _tmp2_;
386 _tmp4_ = vala_symbol_accessibility_to_string (_tmp3_);
387 valadoc_api_signature_builder_append_keyword (_tmp1_, _tmp4_, TRUE);
388 _tmp5_ = signature;
389 valadoc_api_signature_builder_append_keyword (_tmp5_, "struct", TRUE);
390 _tmp6_ = signature;
391 valadoc_api_signature_builder_append_symbol (_tmp6_, (ValadocApiNode*) self, TRUE);
392 _tmp7_ = valadoc_api_node_get_children_by_type ((ValadocApiNode*) self, VALADOC_API_NODE_TYPE_TYPE_PARAMETER, FALSE);
393 type_parameters = _tmp7_;
394 _tmp8_ = type_parameters;
395 _tmp9_ = vala_collection_get_size ((ValaCollection*) _tmp8_);
396 _tmp10_ = _tmp9_;
397 if (_tmp10_ > 0) {
398 ValadocApiSignatureBuilder* _tmp11_;
399 gboolean first = FALSE;
400 ValadocApiSignatureBuilder* _tmp26_;
401 _tmp11_ = signature;
402 valadoc_api_signature_builder_append (_tmp11_, "<", FALSE);
403 first = TRUE;
404 {
405 ValaList* _param_list = NULL;
406 ValaList* _tmp12_;
407 ValaList* _tmp13_;
408 gint _param_size = 0;
409 ValaList* _tmp14_;
410 gint _tmp15_;
411 gint _tmp16_;
412 gint _param_index = 0;
413 _tmp12_ = type_parameters;
414 _tmp13_ = _vala_iterable_ref0 (_tmp12_);
415 _param_list = _tmp13_;
416 _tmp14_ = _param_list;
417 _tmp15_ = vala_collection_get_size ((ValaCollection*) _tmp14_);
418 _tmp16_ = _tmp15_;
419 _param_size = _tmp16_;
420 _param_index = -1;
421 while (TRUE) {
422 gint _tmp17_;
423 gint _tmp18_;
424 ValadocApiItem* param = NULL;
425 ValaList* _tmp19_;
426 gpointer _tmp20_;
427 ValadocApiSignatureBuilder* _tmp22_;
428 ValadocApiItem* _tmp23_;
429 ValadocContentInline* _tmp24_;
430 ValadocContentInline* _tmp25_;
431 _param_index = _param_index + 1;
432 _tmp17_ = _param_index;
433 _tmp18_ = _param_size;
434 if (!(_tmp17_ < _tmp18_)) {
435 break;
436 }
437 _tmp19_ = _param_list;
438 _tmp20_ = vala_list_get (_tmp19_, _param_index);
439 param = (ValadocApiItem*) ((ValadocApiNode*) _tmp20_);
440 if (!first) {
441 ValadocApiSignatureBuilder* _tmp21_;
442 _tmp21_ = signature;
443 valadoc_api_signature_builder_append (_tmp21_, ",", FALSE);
444 }
445 _tmp22_ = signature;
446 _tmp23_ = param;
447 _tmp24_ = valadoc_api_item_get_signature (_tmp23_);
448 _tmp25_ = _tmp24_;
449 valadoc_api_signature_builder_append_content (_tmp22_, _tmp25_, FALSE);
450 first = FALSE;
451 _g_object_unref0 (param);
452 }
453 _vala_iterable_unref0 (_param_list);
454 }
455 _tmp26_ = signature;
456 valadoc_api_signature_builder_append (_tmp26_, ">", FALSE);
457 }
458 _tmp27_ = self->priv->_base_type;
459 if (_tmp27_ != NULL) {
460 ValadocApiSignatureBuilder* _tmp28_;
461 ValadocApiSignatureBuilder* _tmp29_;
462 ValadocApiTypeReference* _tmp30_;
463 ValadocContentInline* _tmp31_;
464 ValadocContentInline* _tmp32_;
465 _tmp28_ = signature;
466 valadoc_api_signature_builder_append (_tmp28_, ":", TRUE);
467 _tmp29_ = signature;
468 _tmp30_ = self->priv->_base_type;
469 _tmp31_ = valadoc_api_item_get_signature ((ValadocApiItem*) _tmp30_);
470 _tmp32_ = _tmp31_;
471 valadoc_api_signature_builder_append_content (_tmp29_, _tmp32_, TRUE);
472 }
473 _tmp33_ = signature;
474 _tmp34_ = valadoc_api_signature_builder_get (_tmp33_);
475 result = (ValadocContentInline*) _tmp34_;
476 _vala_iterable_unref0 (type_parameters);
477 _valadoc_api_signature_builder_unref0 (signature);
478 return result;
479 }
480
481 static void
valadoc_api_struct_class_init(ValadocApiStructClass * klass,gpointer klass_data)482 valadoc_api_struct_class_init (ValadocApiStructClass * klass,
483 gpointer klass_data)
484 {
485 valadoc_api_struct_parent_class = g_type_class_peek_parent (klass);
486 g_type_class_adjust_private_offset (klass, &ValadocApiStruct_private_offset);
487 ((ValadocApiNodeClass *) klass)->accept = (void (*) (ValadocApiNode*, ValadocApiVisitor*)) valadoc_api_struct_real_accept;
488 ((ValadocApiItemClass *) klass)->build_signature = (ValadocContentInline* (*) (ValadocApiItem*)) valadoc_api_struct_real_build_signature;
489 VALADOC_API_NODE_CLASS (klass)->get_node_type = valadoc_api_struct_real_get_node_type;
490 G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_api_struct_get_property;
491 G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_api_struct_set_property;
492 G_OBJECT_CLASS (klass)->finalize = valadoc_api_struct_finalize;
493 /**
494 * Specifies the base struct.
495 */
496 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_STRUCT_BASE_TYPE_PROPERTY, valadoc_api_struct_properties[VALADOC_API_STRUCT_BASE_TYPE_PROPERTY] = g_param_spec_object ("base-type", "base-type", "base-type", VALADOC_API_TYPE_TYPEREFERENCE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
497 /**
498 * {@inheritDoc}
499 */
500 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_STRUCT_NODE_TYPE_PROPERTY, valadoc_api_struct_properties[VALADOC_API_STRUCT_NODE_TYPE_PROPERTY] = g_param_spec_enum ("node-type", "node-type", "node-type", VALADOC_API_TYPE_NODE_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
501 }
502
503 static void
valadoc_api_struct_instance_init(ValadocApiStruct * self,gpointer klass)504 valadoc_api_struct_instance_init (ValadocApiStruct * self,
505 gpointer klass)
506 {
507 GHashFunc _tmp0_;
508 GEqualFunc _tmp1_;
509 ValaHashSet* _tmp2_;
510 self->priv = valadoc_api_struct_get_instance_private (self);
511 _tmp0_ = g_direct_hash;
512 _tmp1_ = g_direct_equal;
513 _tmp2_ = vala_hash_set_new (VALADOC_API_TYPE_STRUCT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_, _tmp1_);
514 self->priv->_known_child_structs = (ValaSet*) _tmp2_;
515 }
516
517 static void
valadoc_api_struct_finalize(GObject * obj)518 valadoc_api_struct_finalize (GObject * obj)
519 {
520 ValadocApiStruct * self;
521 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_API_TYPE_STRUCT, ValadocApiStruct);
522 _g_free0 (self->priv->dup_function_cname);
523 _g_free0 (self->priv->copy_function_cname);
524 _g_free0 (self->priv->free_function_cname);
525 _g_free0 (self->priv->destroy_function_cname);
526 _g_free0 (self->priv->type_id);
527 _g_free0 (self->priv->cname);
528 _g_object_unref0 (self->priv->_base_type);
529 _vala_iterable_unref0 (self->priv->_known_child_structs);
530 G_OBJECT_CLASS (valadoc_api_struct_parent_class)->finalize (obj);
531 }
532
533 /**
534 * Represents a struct declaration.
535 */
536 static GType
valadoc_api_struct_get_type_once(void)537 valadoc_api_struct_get_type_once (void)
538 {
539 static const GTypeInfo g_define_type_info = { sizeof (ValadocApiStructClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_api_struct_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocApiStruct), 0, (GInstanceInitFunc) valadoc_api_struct_instance_init, NULL };
540 GType valadoc_api_struct_type_id;
541 valadoc_api_struct_type_id = g_type_register_static (VALADOC_API_TYPE_TYPESYMBOL, "ValadocApiStruct", &g_define_type_info, 0);
542 ValadocApiStruct_private_offset = g_type_add_instance_private (valadoc_api_struct_type_id, sizeof (ValadocApiStructPrivate));
543 return valadoc_api_struct_type_id;
544 }
545
546 GType
valadoc_api_struct_get_type(void)547 valadoc_api_struct_get_type (void)
548 {
549 static volatile gsize valadoc_api_struct_type_id__volatile = 0;
550 if (g_once_init_enter (&valadoc_api_struct_type_id__volatile)) {
551 GType valadoc_api_struct_type_id;
552 valadoc_api_struct_type_id = valadoc_api_struct_get_type_once ();
553 g_once_init_leave (&valadoc_api_struct_type_id__volatile, valadoc_api_struct_type_id);
554 }
555 return valadoc_api_struct_type_id__volatile;
556 }
557
558 static void
_vala_valadoc_api_struct_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)559 _vala_valadoc_api_struct_get_property (GObject * object,
560 guint property_id,
561 GValue * value,
562 GParamSpec * pspec)
563 {
564 ValadocApiStruct * self;
565 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_STRUCT, ValadocApiStruct);
566 switch (property_id) {
567 case VALADOC_API_STRUCT_BASE_TYPE_PROPERTY:
568 g_value_set_object (value, valadoc_api_struct_get_base_type (self));
569 break;
570 case VALADOC_API_STRUCT_NODE_TYPE_PROPERTY:
571 g_value_set_enum (value, valadoc_api_node_get_node_type ((ValadocApiNode*) self));
572 break;
573 default:
574 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
575 break;
576 }
577 }
578
579 static void
_vala_valadoc_api_struct_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)580 _vala_valadoc_api_struct_set_property (GObject * object,
581 guint property_id,
582 const GValue * value,
583 GParamSpec * pspec)
584 {
585 ValadocApiStruct * self;
586 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_STRUCT, ValadocApiStruct);
587 switch (property_id) {
588 case VALADOC_API_STRUCT_BASE_TYPE_PROPERTY:
589 valadoc_api_struct_set_base_type (self, g_value_get_object (value));
590 break;
591 default:
592 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
593 break;
594 }
595 }
596
597