1 /* typereference.c generated by valac, the Vala compiler
2 * generated from typereference.vala, do not modify */
3
4 /* typereference.vala
5 *
6 * Copyright (C) 2008-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 <valagee.h>
28 #include <glib-object.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <glib.h>
32 #include <vala.h>
33
34 enum {
35 VALADOC_API_TYPEREFERENCE_0_PROPERTY,
36 VALADOC_API_TYPEREFERENCE_DATA_TYPE_PROPERTY,
37 VALADOC_API_TYPEREFERENCE_IS_OWNED_PROPERTY,
38 VALADOC_API_TYPEREFERENCE_IS_WEAK_PROPERTY,
39 VALADOC_API_TYPEREFERENCE_IS_UNOWNED_PROPERTY,
40 VALADOC_API_TYPEREFERENCE_IS_DYNAMIC_PROPERTY,
41 VALADOC_API_TYPEREFERENCE_IS_NULLABLE_PROPERTY,
42 VALADOC_API_TYPEREFERENCE_NUM_PROPERTIES
43 };
44 static GParamSpec* valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_NUM_PROPERTIES];
45 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
46 #define _g_free0(var) (var = (g_free (var), NULL))
47 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
48 #define _valadoc_api_signature_builder_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_signature_builder_unref (var), NULL)))
49
50 struct _ValadocApiTypeReferencePrivate {
51 ValaArrayList* type_arguments;
52 gchar* dbus_type_signature;
53 ValadocApiOwnership ownership;
54 ValadocApiItem* _data_type;
55 gboolean _is_dynamic;
56 gboolean _is_nullable;
57 };
58
59 static gint ValadocApiTypeReference_private_offset;
60 static gpointer valadoc_api_typereference_parent_class = NULL;
61
62 static void valadoc_api_typereference_set_is_nullable (ValadocApiTypeReference* self,
63 gboolean value);
64 static void valadoc_api_typereference_set_is_dynamic (ValadocApiTypeReference* self,
65 gboolean value);
66 static ValadocApiOwnership valadoc_api_typereference_get_type_reference_ownership (ValadocApiTypeReference* self,
67 ValaDataType* element);
68 static ValadocContentInline* valadoc_api_typereference_real_build_signature (ValadocApiItem* base);
69 static void valadoc_api_typereference_finalize (GObject * obj);
70 static GType valadoc_api_typereference_get_type_once (void);
71 static void _vala_valadoc_api_typereference_get_property (GObject * object,
72 guint property_id,
73 GValue * value,
74 GParamSpec * pspec);
75 static void _vala_valadoc_api_typereference_set_property (GObject * object,
76 guint property_id,
77 const GValue * value,
78 GParamSpec * pspec);
79
80 static inline gpointer
valadoc_api_typereference_get_instance_private(ValadocApiTypeReference * self)81 valadoc_api_typereference_get_instance_private (ValadocApiTypeReference* self)
82 {
83 return G_STRUCT_MEMBER_P (self, ValadocApiTypeReference_private_offset);
84 }
85
86 ValadocApiTypeReference*
valadoc_api_typereference_construct(GType object_type,ValadocApiItem * parent,gboolean is_dynamic,gboolean is_nullable,const gchar * dbus_type_signature,ValaDataType * data)87 valadoc_api_typereference_construct (GType object_type,
88 ValadocApiItem* parent,
89 gboolean is_dynamic,
90 gboolean is_nullable,
91 const gchar* dbus_type_signature,
92 ValaDataType* data)
93 {
94 ValadocApiTypeReference * self = NULL;
95 gchar* _tmp0_;
96 g_return_val_if_fail (parent != NULL, NULL);
97 self = (ValadocApiTypeReference*) valadoc_api_item_construct (object_type, (ValaCodeNode*) data);
98 _tmp0_ = g_strdup (dbus_type_signature);
99 _g_free0 (self->priv->dbus_type_signature);
100 self->priv->dbus_type_signature = _tmp0_;
101 valadoc_api_typereference_set_is_nullable (self, is_nullable);
102 valadoc_api_typereference_set_is_dynamic (self, is_dynamic);
103 self->priv->ownership = valadoc_api_typereference_get_type_reference_ownership (self, data);
104 valadoc_api_item_set_parent ((ValadocApiItem*) self, parent);
105 return self;
106 }
107
108 ValadocApiTypeReference*
valadoc_api_typereference_new(ValadocApiItem * parent,gboolean is_dynamic,gboolean is_nullable,const gchar * dbus_type_signature,ValaDataType * data)109 valadoc_api_typereference_new (ValadocApiItem* parent,
110 gboolean is_dynamic,
111 gboolean is_nullable,
112 const gchar* dbus_type_signature,
113 ValaDataType* data)
114 {
115 return valadoc_api_typereference_construct (VALADOC_API_TYPE_TYPEREFERENCE, parent, is_dynamic, is_nullable, dbus_type_signature, data);
116 }
117
118 static ValadocApiOwnership
valadoc_api_typereference_get_type_reference_ownership(ValadocApiTypeReference * self,ValaDataType * element)119 valadoc_api_typereference_get_type_reference_ownership (ValadocApiTypeReference* self,
120 ValaDataType* element)
121 {
122 ValaDataType* type = NULL;
123 ValaDataType* _tmp0_;
124 ValadocApiOwnership result = 0;
125 g_return_val_if_fail (self != NULL, 0);
126 type = element;
127 _tmp0_ = type;
128 if (_tmp0_ != NULL) {
129 ValaDataType* _tmp1_;
130 ValaCodeNode* _tmp2_;
131 ValaCodeNode* _tmp3_;
132 ValaDataType* _tmp26_;
133 _tmp1_ = type;
134 _tmp2_ = vala_code_node_get_parent_node ((ValaCodeNode*) _tmp1_);
135 _tmp3_ = _tmp2_;
136 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, VALA_TYPE_PARAMETER)) {
137 ValaDataType* _tmp4_;
138 ValaCodeNode* _tmp5_;
139 ValaCodeNode* _tmp6_;
140 ValaParameterDirection _tmp7_;
141 ValaParameterDirection _tmp8_;
142 _tmp4_ = type;
143 _tmp5_ = vala_code_node_get_parent_node ((ValaCodeNode*) _tmp4_);
144 _tmp6_ = _tmp5_;
145 _tmp7_ = vala_parameter_get_direction (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, VALA_TYPE_PARAMETER, ValaParameter));
146 _tmp8_ = _tmp7_;
147 if (_tmp8_ == VALA_PARAMETER_DIRECTION_IN) {
148 ValaDataType* _tmp9_;
149 gboolean _tmp10_;
150 gboolean _tmp11_;
151 _tmp9_ = type;
152 _tmp10_ = vala_data_type_get_value_owned (_tmp9_);
153 _tmp11_ = _tmp10_;
154 if (_tmp11_) {
155 result = VALADOC_API_OWNERSHIP_OWNED;
156 return result;
157 }
158 } else {
159 ValaDataType* _tmp12_;
160 _tmp12_ = type;
161 if (vala_data_type_is_weak (_tmp12_)) {
162 result = VALADOC_API_OWNERSHIP_UNOWNED;
163 return result;
164 }
165 }
166 result = VALADOC_API_OWNERSHIP_DEFAULT;
167 return result;
168 } else {
169 ValaDataType* _tmp13_;
170 ValaCodeNode* _tmp14_;
171 ValaCodeNode* _tmp15_;
172 _tmp13_ = type;
173 _tmp14_ = vala_code_node_get_parent_node ((ValaCodeNode*) _tmp13_);
174 _tmp15_ = _tmp14_;
175 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, VALA_TYPE_PROPERTY_ACCESSOR)) {
176 ValaDataType* _tmp16_;
177 ValaCodeNode* _tmp17_;
178 ValaCodeNode* _tmp18_;
179 ValaDataType* _tmp19_;
180 ValaDataType* _tmp20_;
181 gboolean _tmp21_;
182 gboolean _tmp22_;
183 _tmp16_ = type;
184 _tmp17_ = vala_code_node_get_parent_node ((ValaCodeNode*) _tmp16_);
185 _tmp18_ = _tmp17_;
186 _tmp19_ = vala_property_accessor_get_value_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, VALA_TYPE_PROPERTY_ACCESSOR, ValaPropertyAccessor));
187 _tmp20_ = _tmp19_;
188 _tmp21_ = vala_data_type_get_value_owned (_tmp20_);
189 _tmp22_ = _tmp21_;
190 if (_tmp22_) {
191 result = VALADOC_API_OWNERSHIP_OWNED;
192 return result;
193 }
194 result = VALADOC_API_OWNERSHIP_DEFAULT;
195 return result;
196 } else {
197 ValaDataType* _tmp23_;
198 ValaCodeNode* _tmp24_;
199 ValaCodeNode* _tmp25_;
200 _tmp23_ = type;
201 _tmp24_ = vala_code_node_get_parent_node ((ValaCodeNode*) _tmp23_);
202 _tmp25_ = _tmp24_;
203 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp25_, VALA_TYPE_CONSTANT)) {
204 result = VALADOC_API_OWNERSHIP_DEFAULT;
205 return result;
206 }
207 }
208 }
209 _tmp26_ = type;
210 if (vala_data_type_is_weak (_tmp26_)) {
211 result = VALADOC_API_OWNERSHIP_UNOWNED;
212 return result;
213 }
214 }
215 result = VALADOC_API_OWNERSHIP_DEFAULT;
216 return result;
217 }
218
219 /**
220 * Returns a copy of the list of generic type arguments.
221 *
222 * @return type argument list
223 */
224 static gpointer
_vala_iterable_ref0(gpointer self)225 _vala_iterable_ref0 (gpointer self)
226 {
227 return self ? vala_iterable_ref (self) : NULL;
228 }
229
230 ValaCollection*
valadoc_api_typereference_get_type_arguments(ValadocApiTypeReference * self)231 valadoc_api_typereference_get_type_arguments (ValadocApiTypeReference* self)
232 {
233 ValaArrayList* _tmp0_;
234 ValaCollection* _tmp1_;
235 ValaCollection* result = NULL;
236 g_return_val_if_fail (self != NULL, NULL);
237 _tmp0_ = self->priv->type_arguments;
238 _tmp1_ = _vala_iterable_ref0 ((ValaCollection*) _tmp0_);
239 result = _tmp1_;
240 return result;
241 }
242
243 void
valadoc_api_typereference_add_type_argument(ValadocApiTypeReference * self,ValadocApiTypeReference * type_ref)244 valadoc_api_typereference_add_type_argument (ValadocApiTypeReference* self,
245 ValadocApiTypeReference* type_ref)
246 {
247 ValaArrayList* _tmp0_;
248 g_return_if_fail (self != NULL);
249 g_return_if_fail (type_ref != NULL);
250 _tmp0_ = self->priv->type_arguments;
251 vala_collection_add ((ValaCollection*) _tmp0_, type_ref);
252 }
253
254 ValadocApiItem*
valadoc_api_typereference_get_data_type(ValadocApiTypeReference * self)255 valadoc_api_typereference_get_data_type (ValadocApiTypeReference* self)
256 {
257 ValadocApiItem* result;
258 ValadocApiItem* _tmp0_;
259 g_return_val_if_fail (self != NULL, NULL);
260 _tmp0_ = self->priv->_data_type;
261 result = _tmp0_;
262 return result;
263 }
264
265 static gpointer
_g_object_ref0(gpointer self)266 _g_object_ref0 (gpointer self)
267 {
268 return self ? g_object_ref (self) : NULL;
269 }
270
271 void
valadoc_api_typereference_set_data_type(ValadocApiTypeReference * self,ValadocApiItem * value)272 valadoc_api_typereference_set_data_type (ValadocApiTypeReference* self,
273 ValadocApiItem* value)
274 {
275 ValadocApiItem* old_value;
276 g_return_if_fail (self != NULL);
277 old_value = valadoc_api_typereference_get_data_type (self);
278 if (old_value != value) {
279 ValadocApiItem* _tmp0_;
280 _tmp0_ = _g_object_ref0 (value);
281 _g_object_unref0 (self->priv->_data_type);
282 self->priv->_data_type = _tmp0_;
283 g_object_notify_by_pspec ((GObject *) self, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_DATA_TYPE_PROPERTY]);
284 }
285 }
286
287 gboolean
valadoc_api_typereference_get_is_owned(ValadocApiTypeReference * self)288 valadoc_api_typereference_get_is_owned (ValadocApiTypeReference* self)
289 {
290 gboolean result;
291 ValadocApiOwnership _tmp0_;
292 g_return_val_if_fail (self != NULL, FALSE);
293 _tmp0_ = self->priv->ownership;
294 result = _tmp0_ == VALADOC_API_OWNERSHIP_OWNED;
295 return result;
296 }
297
298 gboolean
valadoc_api_typereference_get_is_weak(ValadocApiTypeReference * self)299 valadoc_api_typereference_get_is_weak (ValadocApiTypeReference* self)
300 {
301 gboolean result;
302 ValadocApiOwnership _tmp0_;
303 g_return_val_if_fail (self != NULL, FALSE);
304 _tmp0_ = self->priv->ownership;
305 result = _tmp0_ == VALADOC_API_OWNERSHIP_WEAK;
306 return result;
307 }
308
309 gboolean
valadoc_api_typereference_get_is_unowned(ValadocApiTypeReference * self)310 valadoc_api_typereference_get_is_unowned (ValadocApiTypeReference* self)
311 {
312 gboolean result;
313 ValadocApiOwnership _tmp0_;
314 g_return_val_if_fail (self != NULL, FALSE);
315 _tmp0_ = self->priv->ownership;
316 result = _tmp0_ == VALADOC_API_OWNERSHIP_UNOWNED;
317 return result;
318 }
319
320 gboolean
valadoc_api_typereference_get_is_dynamic(ValadocApiTypeReference * self)321 valadoc_api_typereference_get_is_dynamic (ValadocApiTypeReference* self)
322 {
323 gboolean result;
324 g_return_val_if_fail (self != NULL, FALSE);
325 result = self->priv->_is_dynamic;
326 return result;
327 }
328
329 static void
valadoc_api_typereference_set_is_dynamic(ValadocApiTypeReference * self,gboolean value)330 valadoc_api_typereference_set_is_dynamic (ValadocApiTypeReference* self,
331 gboolean value)
332 {
333 gboolean old_value;
334 g_return_if_fail (self != NULL);
335 old_value = valadoc_api_typereference_get_is_dynamic (self);
336 if (old_value != value) {
337 self->priv->_is_dynamic = value;
338 g_object_notify_by_pspec ((GObject *) self, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_DYNAMIC_PROPERTY]);
339 }
340 }
341
342 gboolean
valadoc_api_typereference_get_is_nullable(ValadocApiTypeReference * self)343 valadoc_api_typereference_get_is_nullable (ValadocApiTypeReference* self)
344 {
345 gboolean result;
346 g_return_val_if_fail (self != NULL, FALSE);
347 result = self->priv->_is_nullable;
348 return result;
349 }
350
351 static void
valadoc_api_typereference_set_is_nullable(ValadocApiTypeReference * self,gboolean value)352 valadoc_api_typereference_set_is_nullable (ValadocApiTypeReference* self,
353 gboolean value)
354 {
355 gboolean old_value;
356 g_return_if_fail (self != NULL);
357 old_value = valadoc_api_typereference_get_is_nullable (self);
358 if (old_value != value) {
359 self->priv->_is_nullable = value;
360 g_object_notify_by_pspec ((GObject *) self, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_NULLABLE_PROPERTY]);
361 }
362 }
363
364 gchar*
valadoc_api_typereference_get_dbus_type_signature(ValadocApiTypeReference * self)365 valadoc_api_typereference_get_dbus_type_signature (ValadocApiTypeReference* self)
366 {
367 const gchar* _tmp0_;
368 gchar* _tmp1_;
369 gchar* result = NULL;
370 g_return_val_if_fail (self != NULL, NULL);
371 _tmp0_ = self->priv->dbus_type_signature;
372 _tmp1_ = g_strdup (_tmp0_);
373 result = _tmp1_;
374 return result;
375 }
376
377 /**
378 * {@inheritDoc}
379 */
380 static ValadocContentInline*
valadoc_api_typereference_real_build_signature(ValadocApiItem * base)381 valadoc_api_typereference_real_build_signature (ValadocApiItem* base)
382 {
383 ValadocApiTypeReference * self;
384 ValadocApiSignatureBuilder* signature = NULL;
385 ValadocApiSignatureBuilder* _tmp0_;
386 gboolean _tmp1_;
387 gboolean _tmp3_;
388 gboolean _tmp4_;
389 ValadocApiItem* _tmp12_;
390 ValaArrayList* _tmp21_;
391 gint _tmp22_;
392 gint _tmp23_;
393 gboolean _tmp40_;
394 ValadocApiSignatureBuilder* _tmp42_;
395 ValadocContentRun* _tmp43_;
396 ValadocContentInline* result = NULL;
397 self = (ValadocApiTypeReference*) base;
398 _tmp0_ = valadoc_api_signature_builder_new ();
399 signature = _tmp0_;
400 _tmp1_ = self->priv->_is_dynamic;
401 if (_tmp1_) {
402 ValadocApiSignatureBuilder* _tmp2_;
403 _tmp2_ = signature;
404 valadoc_api_signature_builder_append_keyword (_tmp2_, "dynamic", TRUE);
405 }
406 _tmp3_ = valadoc_api_typereference_get_is_weak (self);
407 _tmp4_ = _tmp3_;
408 if (_tmp4_) {
409 ValadocApiSignatureBuilder* _tmp5_;
410 _tmp5_ = signature;
411 valadoc_api_signature_builder_append_keyword (_tmp5_, "weak", TRUE);
412 } else {
413 gboolean _tmp6_;
414 gboolean _tmp7_;
415 _tmp6_ = valadoc_api_typereference_get_is_owned (self);
416 _tmp7_ = _tmp6_;
417 if (_tmp7_) {
418 ValadocApiSignatureBuilder* _tmp8_;
419 _tmp8_ = signature;
420 valadoc_api_signature_builder_append_keyword (_tmp8_, "owned", TRUE);
421 } else {
422 gboolean _tmp9_;
423 gboolean _tmp10_;
424 _tmp9_ = valadoc_api_typereference_get_is_unowned (self);
425 _tmp10_ = _tmp9_;
426 if (_tmp10_) {
427 ValadocApiSignatureBuilder* _tmp11_;
428 _tmp11_ = signature;
429 valadoc_api_signature_builder_append_keyword (_tmp11_, "unowned", TRUE);
430 }
431 }
432 }
433 _tmp12_ = self->priv->_data_type;
434 if (_tmp12_ == NULL) {
435 ValadocApiSignatureBuilder* _tmp13_;
436 _tmp13_ = signature;
437 valadoc_api_signature_builder_append_keyword (_tmp13_, "void", TRUE);
438 } else {
439 ValadocApiItem* _tmp14_;
440 _tmp14_ = self->priv->_data_type;
441 if (VALADOC_API_IS_SYMBOL (_tmp14_)) {
442 ValadocApiSignatureBuilder* _tmp15_;
443 ValadocApiItem* _tmp16_;
444 _tmp15_ = signature;
445 _tmp16_ = self->priv->_data_type;
446 valadoc_api_signature_builder_append_type (_tmp15_, (ValadocApiNode*) G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, VALADOC_API_TYPE_SYMBOL, ValadocApiSymbol), TRUE);
447 } else {
448 ValadocApiSignatureBuilder* _tmp17_;
449 ValadocApiItem* _tmp18_;
450 ValadocContentInline* _tmp19_;
451 ValadocContentInline* _tmp20_;
452 _tmp17_ = signature;
453 _tmp18_ = self->priv->_data_type;
454 _tmp19_ = valadoc_api_item_get_signature (_tmp18_);
455 _tmp20_ = _tmp19_;
456 valadoc_api_signature_builder_append_content (_tmp17_, _tmp20_, TRUE);
457 }
458 }
459 _tmp21_ = self->priv->type_arguments;
460 _tmp22_ = vala_collection_get_size ((ValaCollection*) _tmp21_);
461 _tmp23_ = _tmp22_;
462 if (_tmp23_ > 0) {
463 ValadocApiSignatureBuilder* _tmp24_;
464 gboolean first = FALSE;
465 ValadocApiSignatureBuilder* _tmp39_;
466 _tmp24_ = signature;
467 valadoc_api_signature_builder_append (_tmp24_, "<", FALSE);
468 first = TRUE;
469 {
470 ValaArrayList* _param_list = NULL;
471 ValaArrayList* _tmp25_;
472 ValaArrayList* _tmp26_;
473 gint _param_size = 0;
474 ValaArrayList* _tmp27_;
475 gint _tmp28_;
476 gint _tmp29_;
477 gint _param_index = 0;
478 _tmp25_ = self->priv->type_arguments;
479 _tmp26_ = _vala_iterable_ref0 (_tmp25_);
480 _param_list = _tmp26_;
481 _tmp27_ = _param_list;
482 _tmp28_ = vala_collection_get_size ((ValaCollection*) _tmp27_);
483 _tmp29_ = _tmp28_;
484 _param_size = _tmp29_;
485 _param_index = -1;
486 while (TRUE) {
487 gint _tmp30_;
488 gint _tmp31_;
489 ValadocApiItem* param = NULL;
490 ValaArrayList* _tmp32_;
491 gpointer _tmp33_;
492 ValadocApiSignatureBuilder* _tmp35_;
493 ValadocApiItem* _tmp36_;
494 ValadocContentInline* _tmp37_;
495 ValadocContentInline* _tmp38_;
496 _param_index = _param_index + 1;
497 _tmp30_ = _param_index;
498 _tmp31_ = _param_size;
499 if (!(_tmp30_ < _tmp31_)) {
500 break;
501 }
502 _tmp32_ = _param_list;
503 _tmp33_ = vala_list_get ((ValaList*) _tmp32_, _param_index);
504 param = (ValadocApiItem*) ((ValadocApiTypeReference*) _tmp33_);
505 if (!first) {
506 ValadocApiSignatureBuilder* _tmp34_;
507 _tmp34_ = signature;
508 valadoc_api_signature_builder_append (_tmp34_, ",", FALSE);
509 }
510 _tmp35_ = signature;
511 _tmp36_ = param;
512 _tmp37_ = valadoc_api_item_get_signature (_tmp36_);
513 _tmp38_ = _tmp37_;
514 valadoc_api_signature_builder_append_content (_tmp35_, _tmp38_, FALSE);
515 first = FALSE;
516 _g_object_unref0 (param);
517 }
518 _vala_iterable_unref0 (_param_list);
519 }
520 _tmp39_ = signature;
521 valadoc_api_signature_builder_append (_tmp39_, ">", FALSE);
522 }
523 _tmp40_ = self->priv->_is_nullable;
524 if (_tmp40_) {
525 ValadocApiSignatureBuilder* _tmp41_;
526 _tmp41_ = signature;
527 valadoc_api_signature_builder_append (_tmp41_, "?", FALSE);
528 }
529 _tmp42_ = signature;
530 _tmp43_ = valadoc_api_signature_builder_get (_tmp42_);
531 result = (ValadocContentInline*) _tmp43_;
532 _valadoc_api_signature_builder_unref0 (signature);
533 return result;
534 }
535
536 static void
valadoc_api_typereference_class_init(ValadocApiTypeReferenceClass * klass,gpointer klass_data)537 valadoc_api_typereference_class_init (ValadocApiTypeReferenceClass * klass,
538 gpointer klass_data)
539 {
540 valadoc_api_typereference_parent_class = g_type_class_peek_parent (klass);
541 g_type_class_adjust_private_offset (klass, &ValadocApiTypeReference_private_offset);
542 ((ValadocApiItemClass *) klass)->build_signature = (ValadocContentInline* (*) (ValadocApiItem*)) valadoc_api_typereference_real_build_signature;
543 G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_api_typereference_get_property;
544 G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_api_typereference_set_property;
545 G_OBJECT_CLASS (klass)->finalize = valadoc_api_typereference_finalize;
546 /**
547 * The referred data type.
548 */
549 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_TYPEREFERENCE_DATA_TYPE_PROPERTY, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_DATA_TYPE_PROPERTY] = g_param_spec_object ("data-type", "data-type", "data-type", VALADOC_API_TYPE_ITEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
550 /**
551 * Specifies that the expression is owned.
552 */
553 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_TYPEREFERENCE_IS_OWNED_PROPERTY, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_OWNED_PROPERTY] = g_param_spec_boolean ("is-owned", "is-owned", "is-owned", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
554 /**
555 * Specifies that the expression is weak.
556 */
557 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_TYPEREFERENCE_IS_WEAK_PROPERTY, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_WEAK_PROPERTY] = g_param_spec_boolean ("is-weak", "is-weak", "is-weak", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
558 /**
559 * Specifies that the expression is unwoned.
560 */
561 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_TYPEREFERENCE_IS_UNOWNED_PROPERTY, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_UNOWNED_PROPERTY] = g_param_spec_boolean ("is-unowned", "is-unowned", "is-unowned", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
562 /**
563 * Specifies that the expression is dynamic.
564 */
565 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_TYPEREFERENCE_IS_DYNAMIC_PROPERTY, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_DYNAMIC_PROPERTY] = g_param_spec_boolean ("is-dynamic", "is-dynamic", "is-dynamic", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
566 /**
567 * Specifies that the expression may be null.
568 */
569 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_TYPEREFERENCE_IS_NULLABLE_PROPERTY, valadoc_api_typereference_properties[VALADOC_API_TYPEREFERENCE_IS_NULLABLE_PROPERTY] = g_param_spec_boolean ("is-nullable", "is-nullable", "is-nullable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
570 }
571
572 static void
valadoc_api_typereference_instance_init(ValadocApiTypeReference * self,gpointer klass)573 valadoc_api_typereference_instance_init (ValadocApiTypeReference * self,
574 gpointer klass)
575 {
576 GEqualFunc _tmp0_;
577 ValaArrayList* _tmp1_;
578 self->priv = valadoc_api_typereference_get_instance_private (self);
579 _tmp0_ = g_direct_equal;
580 _tmp1_ = vala_array_list_new (VALADOC_API_TYPE_TYPEREFERENCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
581 self->priv->type_arguments = _tmp1_;
582 }
583
584 static void
valadoc_api_typereference_finalize(GObject * obj)585 valadoc_api_typereference_finalize (GObject * obj)
586 {
587 ValadocApiTypeReference * self;
588 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_API_TYPE_TYPEREFERENCE, ValadocApiTypeReference);
589 _vala_iterable_unref0 (self->priv->type_arguments);
590 _g_free0 (self->priv->dbus_type_signature);
591 _g_object_unref0 (self->priv->_data_type);
592 G_OBJECT_CLASS (valadoc_api_typereference_parent_class)->finalize (obj);
593 }
594
595 /**
596 * A reference to a data type.
597 */
598 static GType
valadoc_api_typereference_get_type_once(void)599 valadoc_api_typereference_get_type_once (void)
600 {
601 static const GTypeInfo g_define_type_info = { sizeof (ValadocApiTypeReferenceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_api_typereference_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocApiTypeReference), 0, (GInstanceInitFunc) valadoc_api_typereference_instance_init, NULL };
602 GType valadoc_api_typereference_type_id;
603 valadoc_api_typereference_type_id = g_type_register_static (VALADOC_API_TYPE_ITEM, "ValadocApiTypeReference", &g_define_type_info, 0);
604 ValadocApiTypeReference_private_offset = g_type_add_instance_private (valadoc_api_typereference_type_id, sizeof (ValadocApiTypeReferencePrivate));
605 return valadoc_api_typereference_type_id;
606 }
607
608 GType
valadoc_api_typereference_get_type(void)609 valadoc_api_typereference_get_type (void)
610 {
611 static volatile gsize valadoc_api_typereference_type_id__volatile = 0;
612 if (g_once_init_enter (&valadoc_api_typereference_type_id__volatile)) {
613 GType valadoc_api_typereference_type_id;
614 valadoc_api_typereference_type_id = valadoc_api_typereference_get_type_once ();
615 g_once_init_leave (&valadoc_api_typereference_type_id__volatile, valadoc_api_typereference_type_id);
616 }
617 return valadoc_api_typereference_type_id__volatile;
618 }
619
620 static void
_vala_valadoc_api_typereference_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)621 _vala_valadoc_api_typereference_get_property (GObject * object,
622 guint property_id,
623 GValue * value,
624 GParamSpec * pspec)
625 {
626 ValadocApiTypeReference * self;
627 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_TYPEREFERENCE, ValadocApiTypeReference);
628 switch (property_id) {
629 case VALADOC_API_TYPEREFERENCE_DATA_TYPE_PROPERTY:
630 g_value_set_object (value, valadoc_api_typereference_get_data_type (self));
631 break;
632 case VALADOC_API_TYPEREFERENCE_IS_OWNED_PROPERTY:
633 g_value_set_boolean (value, valadoc_api_typereference_get_is_owned (self));
634 break;
635 case VALADOC_API_TYPEREFERENCE_IS_WEAK_PROPERTY:
636 g_value_set_boolean (value, valadoc_api_typereference_get_is_weak (self));
637 break;
638 case VALADOC_API_TYPEREFERENCE_IS_UNOWNED_PROPERTY:
639 g_value_set_boolean (value, valadoc_api_typereference_get_is_unowned (self));
640 break;
641 case VALADOC_API_TYPEREFERENCE_IS_DYNAMIC_PROPERTY:
642 g_value_set_boolean (value, valadoc_api_typereference_get_is_dynamic (self));
643 break;
644 case VALADOC_API_TYPEREFERENCE_IS_NULLABLE_PROPERTY:
645 g_value_set_boolean (value, valadoc_api_typereference_get_is_nullable (self));
646 break;
647 default:
648 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
649 break;
650 }
651 }
652
653 static void
_vala_valadoc_api_typereference_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)654 _vala_valadoc_api_typereference_set_property (GObject * object,
655 guint property_id,
656 const GValue * value,
657 GParamSpec * pspec)
658 {
659 ValadocApiTypeReference * self;
660 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_TYPEREFERENCE, ValadocApiTypeReference);
661 switch (property_id) {
662 case VALADOC_API_TYPEREFERENCE_DATA_TYPE_PROPERTY:
663 valadoc_api_typereference_set_data_type (self, g_value_get_object (value));
664 break;
665 case VALADOC_API_TYPEREFERENCE_IS_DYNAMIC_PROPERTY:
666 valadoc_api_typereference_set_is_dynamic (self, g_value_get_boolean (value));
667 break;
668 case VALADOC_API_TYPEREFERENCE_IS_NULLABLE_PROPERTY:
669 valadoc_api_typereference_set_is_nullable (self, g_value_get_boolean (value));
670 break;
671 default:
672 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
673 break;
674 }
675 }
676
677