1 /* parameter.c generated by valac, the Vala compiler
2  * generated from parameter.vala, do not modify */
3 
4 /* parameter.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 <stdlib.h>
28 #include <string.h>
29 #include <glib.h>
30 #include <vala.h>
31 
32 enum  {
33 	VALADOC_API_PARAMETER_0_PROPERTY,
34 	VALADOC_API_PARAMETER_DEFAULT_VALUE_PROPERTY,
35 	VALADOC_API_PARAMETER_IMPLICIT_ARRAY_LENGTH_CPARAMETER_NAME_PROPERTY,
36 	VALADOC_API_PARAMETER_IMPLICIT_CLOSURE_CPARAMETER_NAME_PROPERTY,
37 	VALADOC_API_PARAMETER_IMPLICIT_DESTROY_CPARAMETER_NAME_PROPERTY,
38 	VALADOC_API_PARAMETER_IS_OUT_PROPERTY,
39 	VALADOC_API_PARAMETER_IS_REF_PROPERTY,
40 	VALADOC_API_PARAMETER_HAS_DEFAULT_VALUE_PROPERTY,
41 	VALADOC_API_PARAMETER_PARAMETER_TYPE_PROPERTY,
42 	VALADOC_API_PARAMETER_ELLIPSIS_PROPERTY,
43 	VALADOC_API_PARAMETER_NODE_TYPE_PROPERTY,
44 	VALADOC_API_PARAMETER_NUM_PROPERTIES
45 };
46 static GParamSpec* valadoc_api_parameter_properties[VALADOC_API_PARAMETER_NUM_PROPERTIES];
47 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
48 #define _g_free0(var) (var = (g_free (var), NULL))
49 #define _valadoc_api_signature_builder_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_signature_builder_unref (var), NULL)))
50 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
51 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
52 #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
53 #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
54 
55 struct _ValadocApiParameterPrivate {
56 	ValadocContentRun* _default_value;
57 	gchar* _implicit_array_length_cparameter_name;
58 	gchar* _implicit_closure_cparameter_name;
59 	gchar* _implicit_destroy_cparameter_name;
60 	ValaParameterDirection type;
61 	ValadocApiTypeReference* _parameter_type;
62 	gboolean _ellipsis;
63 };
64 
65 static gint ValadocApiParameter_private_offset;
66 static gpointer valadoc_api_parameter_parent_class = NULL;
67 
68 G_GNUC_INTERNAL const gchar* valadoc_api_parameter_get_implicit_array_length_cparameter_name (ValadocApiParameter* self);
69 G_GNUC_INTERNAL void valadoc_api_parameter_set_implicit_array_length_cparameter_name (ValadocApiParameter* self,
70                                                                       const gchar* value);
71 G_GNUC_INTERNAL const gchar* valadoc_api_parameter_get_implicit_closure_cparameter_name (ValadocApiParameter* self);
72 G_GNUC_INTERNAL void valadoc_api_parameter_set_implicit_closure_cparameter_name (ValadocApiParameter* self,
73                                                                  const gchar* value);
74 G_GNUC_INTERNAL const gchar* valadoc_api_parameter_get_implicit_destroy_cparameter_name (ValadocApiParameter* self);
75 G_GNUC_INTERNAL void valadoc_api_parameter_set_implicit_destroy_cparameter_name (ValadocApiParameter* self,
76                                                                  const gchar* value);
77 static void valadoc_api_parameter_set_ellipsis (ValadocApiParameter* self,
78                                          gboolean value);
79 static void valadoc_api_parameter_real_accept (ValadocApiNode* base,
80                                         ValadocApiVisitor* visitor);
81 static ValadocContentInline* valadoc_api_parameter_real_build_signature (ValadocApiItem* base);
82 static void valadoc_api_parameter_finalize (GObject * obj);
83 static GType valadoc_api_parameter_get_type_once (void);
84 static void _vala_valadoc_api_parameter_get_property (GObject * object,
85                                                guint property_id,
86                                                GValue * value,
87                                                GParamSpec * pspec);
88 static void _vala_valadoc_api_parameter_set_property (GObject * object,
89                                                guint property_id,
90                                                const GValue * value,
91                                                GParamSpec * pspec);
92 
93 static inline gpointer
valadoc_api_parameter_get_instance_private(ValadocApiParameter * self)94 valadoc_api_parameter_get_instance_private (ValadocApiParameter* self)
95 {
96 	return G_STRUCT_MEMBER_P (self, ValadocApiParameter_private_offset);
97 }
98 
99 ValadocContentRun*
valadoc_api_parameter_get_default_value(ValadocApiParameter * self)100 valadoc_api_parameter_get_default_value (ValadocApiParameter* self)
101 {
102 	ValadocContentRun* result;
103 	ValadocContentRun* _tmp0_;
104 	g_return_val_if_fail (self != NULL, NULL);
105 	_tmp0_ = self->priv->_default_value;
106 	result = _tmp0_;
107 	return result;
108 }
109 
110 static gpointer
_g_object_ref0(gpointer self)111 _g_object_ref0 (gpointer self)
112 {
113 	return self ? g_object_ref (self) : NULL;
114 }
115 
116 void
valadoc_api_parameter_set_default_value(ValadocApiParameter * self,ValadocContentRun * value)117 valadoc_api_parameter_set_default_value (ValadocApiParameter* self,
118                                          ValadocContentRun* value)
119 {
120 	ValadocContentRun* old_value;
121 	g_return_if_fail (self != NULL);
122 	old_value = valadoc_api_parameter_get_default_value (self);
123 	if (old_value != value) {
124 		ValadocContentRun* _tmp0_;
125 		_tmp0_ = _g_object_ref0 (value);
126 		_g_object_unref0 (self->priv->_default_value);
127 		self->priv->_default_value = _tmp0_;
128 		g_object_notify_by_pspec ((GObject *) self, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_DEFAULT_VALUE_PROPERTY]);
129 	}
130 }
131 
132 G_GNUC_INTERNAL const gchar*
valadoc_api_parameter_get_implicit_array_length_cparameter_name(ValadocApiParameter * self)133 valadoc_api_parameter_get_implicit_array_length_cparameter_name (ValadocApiParameter* self)
134 {
135 	const gchar* result;
136 	const gchar* _tmp0_;
137 	g_return_val_if_fail (self != NULL, NULL);
138 	_tmp0_ = self->priv->_implicit_array_length_cparameter_name;
139 	result = _tmp0_;
140 	return result;
141 }
142 
143 G_GNUC_INTERNAL void
valadoc_api_parameter_set_implicit_array_length_cparameter_name(ValadocApiParameter * self,const gchar * value)144 valadoc_api_parameter_set_implicit_array_length_cparameter_name (ValadocApiParameter* self,
145                                                                  const gchar* value)
146 {
147 	gchar* old_value;
148 	g_return_if_fail (self != NULL);
149 	old_value = valadoc_api_parameter_get_implicit_array_length_cparameter_name (self);
150 	if (g_strcmp0 (value, old_value) != 0) {
151 		gchar* _tmp0_;
152 		_tmp0_ = g_strdup (value);
153 		_g_free0 (self->priv->_implicit_array_length_cparameter_name);
154 		self->priv->_implicit_array_length_cparameter_name = _tmp0_;
155 		g_object_notify_by_pspec ((GObject *) self, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IMPLICIT_ARRAY_LENGTH_CPARAMETER_NAME_PROPERTY]);
156 	}
157 }
158 
159 G_GNUC_INTERNAL const gchar*
valadoc_api_parameter_get_implicit_closure_cparameter_name(ValadocApiParameter * self)160 valadoc_api_parameter_get_implicit_closure_cparameter_name (ValadocApiParameter* self)
161 {
162 	const gchar* result;
163 	const gchar* _tmp0_;
164 	g_return_val_if_fail (self != NULL, NULL);
165 	_tmp0_ = self->priv->_implicit_closure_cparameter_name;
166 	result = _tmp0_;
167 	return result;
168 }
169 
170 G_GNUC_INTERNAL void
valadoc_api_parameter_set_implicit_closure_cparameter_name(ValadocApiParameter * self,const gchar * value)171 valadoc_api_parameter_set_implicit_closure_cparameter_name (ValadocApiParameter* self,
172                                                             const gchar* value)
173 {
174 	gchar* old_value;
175 	g_return_if_fail (self != NULL);
176 	old_value = valadoc_api_parameter_get_implicit_closure_cparameter_name (self);
177 	if (g_strcmp0 (value, old_value) != 0) {
178 		gchar* _tmp0_;
179 		_tmp0_ = g_strdup (value);
180 		_g_free0 (self->priv->_implicit_closure_cparameter_name);
181 		self->priv->_implicit_closure_cparameter_name = _tmp0_;
182 		g_object_notify_by_pspec ((GObject *) self, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IMPLICIT_CLOSURE_CPARAMETER_NAME_PROPERTY]);
183 	}
184 }
185 
186 G_GNUC_INTERNAL const gchar*
valadoc_api_parameter_get_implicit_destroy_cparameter_name(ValadocApiParameter * self)187 valadoc_api_parameter_get_implicit_destroy_cparameter_name (ValadocApiParameter* self)
188 {
189 	const gchar* result;
190 	const gchar* _tmp0_;
191 	g_return_val_if_fail (self != NULL, NULL);
192 	_tmp0_ = self->priv->_implicit_destroy_cparameter_name;
193 	result = _tmp0_;
194 	return result;
195 }
196 
197 G_GNUC_INTERNAL void
valadoc_api_parameter_set_implicit_destroy_cparameter_name(ValadocApiParameter * self,const gchar * value)198 valadoc_api_parameter_set_implicit_destroy_cparameter_name (ValadocApiParameter* self,
199                                                             const gchar* value)
200 {
201 	gchar* old_value;
202 	g_return_if_fail (self != NULL);
203 	old_value = valadoc_api_parameter_get_implicit_destroy_cparameter_name (self);
204 	if (g_strcmp0 (value, old_value) != 0) {
205 		gchar* _tmp0_;
206 		_tmp0_ = g_strdup (value);
207 		_g_free0 (self->priv->_implicit_destroy_cparameter_name);
208 		self->priv->_implicit_destroy_cparameter_name = _tmp0_;
209 		g_object_notify_by_pspec ((GObject *) self, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IMPLICIT_DESTROY_CPARAMETER_NAME_PROPERTY]);
210 	}
211 }
212 
213 ValadocApiParameter*
valadoc_api_parameter_construct(GType object_type,ValadocApiNode * parent,ValadocApiSourceFile * file,const gchar * name,ValaSymbolAccessibility accessibility,ValaParameterDirection type,gboolean ellipsis,ValaParameter * data)214 valadoc_api_parameter_construct (GType object_type,
215                                  ValadocApiNode* parent,
216                                  ValadocApiSourceFile* file,
217                                  const gchar* name,
218                                  ValaSymbolAccessibility accessibility,
219                                  ValaParameterDirection type,
220                                  gboolean ellipsis,
221                                  ValaParameter* data)
222 {
223 	ValadocApiParameter * self = NULL;
224 	gboolean _tmp0_ = FALSE;
225 	gboolean _tmp1_ = FALSE;
226 	g_return_val_if_fail (parent != NULL, NULL);
227 	g_return_val_if_fail (file != NULL, NULL);
228 	g_return_val_if_fail (data != NULL, NULL);
229 	self = (ValadocApiParameter*) valadoc_api_symbol_construct (object_type, parent, file, name, accessibility, NULL, (ValaSymbol*) data);
230 	if (name == NULL) {
231 		_tmp1_ = ellipsis;
232 	} else {
233 		_tmp1_ = FALSE;
234 	}
235 	if (_tmp1_) {
236 		_tmp0_ = TRUE;
237 	} else {
238 		gboolean _tmp2_ = FALSE;
239 		if (name != NULL) {
240 			_tmp2_ = !ellipsis;
241 		} else {
242 			_tmp2_ = FALSE;
243 		}
244 		_tmp0_ = _tmp2_;
245 	}
246 	_vala_assert (_tmp0_, "(name == null && ellipsis) || (name != null && !ellipsis)");
247 	valadoc_api_parameter_set_ellipsis (self, ellipsis);
248 	self->priv->type = type;
249 	return self;
250 }
251 
252 ValadocApiParameter*
valadoc_api_parameter_new(ValadocApiNode * parent,ValadocApiSourceFile * file,const gchar * name,ValaSymbolAccessibility accessibility,ValaParameterDirection type,gboolean ellipsis,ValaParameter * data)253 valadoc_api_parameter_new (ValadocApiNode* parent,
254                            ValadocApiSourceFile* file,
255                            const gchar* name,
256                            ValaSymbolAccessibility accessibility,
257                            ValaParameterDirection type,
258                            gboolean ellipsis,
259                            ValaParameter* data)
260 {
261 	return valadoc_api_parameter_construct (VALADOC_API_TYPE_PARAMETER, parent, file, name, accessibility, type, ellipsis, data);
262 }
263 
264 gboolean
valadoc_api_parameter_get_is_out(ValadocApiParameter * self)265 valadoc_api_parameter_get_is_out (ValadocApiParameter* self)
266 {
267 	gboolean result;
268 	ValaParameterDirection _tmp0_;
269 	g_return_val_if_fail (self != NULL, FALSE);
270 	_tmp0_ = self->priv->type;
271 	result = _tmp0_ == VALA_PARAMETER_DIRECTION_OUT;
272 	return result;
273 }
274 
275 gboolean
valadoc_api_parameter_get_is_ref(ValadocApiParameter * self)276 valadoc_api_parameter_get_is_ref (ValadocApiParameter* self)
277 {
278 	gboolean result;
279 	ValaParameterDirection _tmp0_;
280 	g_return_val_if_fail (self != NULL, FALSE);
281 	_tmp0_ = self->priv->type;
282 	result = _tmp0_ == VALA_PARAMETER_DIRECTION_REF;
283 	return result;
284 }
285 
286 gboolean
valadoc_api_parameter_get_has_default_value(ValadocApiParameter * self)287 valadoc_api_parameter_get_has_default_value (ValadocApiParameter* self)
288 {
289 	gboolean result;
290 	ValadocContentRun* _tmp0_;
291 	g_return_val_if_fail (self != NULL, FALSE);
292 	_tmp0_ = self->priv->_default_value;
293 	result = _tmp0_ != NULL;
294 	return result;
295 }
296 
297 ValadocApiTypeReference*
valadoc_api_parameter_get_parameter_type(ValadocApiParameter * self)298 valadoc_api_parameter_get_parameter_type (ValadocApiParameter* self)
299 {
300 	ValadocApiTypeReference* result;
301 	ValadocApiTypeReference* _tmp0_;
302 	g_return_val_if_fail (self != NULL, NULL);
303 	_tmp0_ = self->priv->_parameter_type;
304 	result = _tmp0_;
305 	return result;
306 }
307 
308 void
valadoc_api_parameter_set_parameter_type(ValadocApiParameter * self,ValadocApiTypeReference * value)309 valadoc_api_parameter_set_parameter_type (ValadocApiParameter* self,
310                                           ValadocApiTypeReference* value)
311 {
312 	ValadocApiTypeReference* old_value;
313 	g_return_if_fail (self != NULL);
314 	old_value = valadoc_api_parameter_get_parameter_type (self);
315 	if (old_value != value) {
316 		ValadocApiTypeReference* _tmp0_;
317 		_tmp0_ = _g_object_ref0 (value);
318 		_g_object_unref0 (self->priv->_parameter_type);
319 		self->priv->_parameter_type = _tmp0_;
320 		g_object_notify_by_pspec ((GObject *) self, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_PARAMETER_TYPE_PROPERTY]);
321 	}
322 }
323 
324 gboolean
valadoc_api_parameter_get_ellipsis(ValadocApiParameter * self)325 valadoc_api_parameter_get_ellipsis (ValadocApiParameter* self)
326 {
327 	gboolean result;
328 	g_return_val_if_fail (self != NULL, FALSE);
329 	result = self->priv->_ellipsis;
330 	return result;
331 }
332 
333 static void
valadoc_api_parameter_set_ellipsis(ValadocApiParameter * self,gboolean value)334 valadoc_api_parameter_set_ellipsis (ValadocApiParameter* self,
335                                     gboolean value)
336 {
337 	gboolean old_value;
338 	g_return_if_fail (self != NULL);
339 	old_value = valadoc_api_parameter_get_ellipsis (self);
340 	if (old_value != value) {
341 		self->priv->_ellipsis = value;
342 		g_object_notify_by_pspec ((GObject *) self, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_ELLIPSIS_PROPERTY]);
343 	}
344 }
345 
346 static ValadocApiNodeType
valadoc_api_parameter_real_get_node_type(ValadocApiNode * base)347 valadoc_api_parameter_real_get_node_type (ValadocApiNode* base)
348 {
349 	ValadocApiNodeType result;
350 	ValadocApiParameter* self;
351 	self = (ValadocApiParameter*) base;
352 	result = VALADOC_API_NODE_TYPE_FORMAL_PARAMETER;
353 	return result;
354 }
355 
356 /**
357  * {@inheritDoc}
358  */
359 static void
valadoc_api_parameter_real_accept(ValadocApiNode * base,ValadocApiVisitor * visitor)360 valadoc_api_parameter_real_accept (ValadocApiNode* base,
361                                    ValadocApiVisitor* visitor)
362 {
363 	ValadocApiParameter * self;
364 	self = (ValadocApiParameter*) base;
365 	g_return_if_fail (visitor != NULL);
366 	valadoc_api_visitor_visit_formal_parameter (visitor, self);
367 }
368 
369 /**
370  * {@inheritDoc}
371  */
372 static ValadocContentInline*
valadoc_api_parameter_real_build_signature(ValadocApiItem * base)373 valadoc_api_parameter_real_build_signature (ValadocApiItem* base)
374 {
375 	ValadocApiParameter * self;
376 	ValadocApiSignatureBuilder* signature = NULL;
377 	ValadocApiSignatureBuilder* _tmp0_;
378 	gboolean _tmp1_;
379 	ValadocApiSignatureBuilder* _tmp21_;
380 	ValadocContentRun* _tmp22_;
381 	ValadocContentInline* result = NULL;
382 	self = (ValadocApiParameter*) base;
383 	_tmp0_ = valadoc_api_signature_builder_new ();
384 	signature = _tmp0_;
385 	_tmp1_ = self->priv->_ellipsis;
386 	if (_tmp1_) {
387 		ValadocApiSignatureBuilder* _tmp2_;
388 		_tmp2_ = signature;
389 		valadoc_api_signature_builder_append (_tmp2_, "...", TRUE);
390 	} else {
391 		gboolean _tmp3_;
392 		gboolean _tmp4_;
393 		ValadocApiSignatureBuilder* _tmp9_;
394 		ValadocApiTypeReference* _tmp10_;
395 		ValadocContentInline* _tmp11_;
396 		ValadocContentInline* _tmp12_;
397 		ValadocApiSignatureBuilder* _tmp13_;
398 		const gchar* _tmp14_;
399 		const gchar* _tmp15_;
400 		gboolean _tmp16_;
401 		gboolean _tmp17_;
402 		_tmp3_ = valadoc_api_parameter_get_is_out (self);
403 		_tmp4_ = _tmp3_;
404 		if (_tmp4_) {
405 			ValadocApiSignatureBuilder* _tmp5_;
406 			_tmp5_ = signature;
407 			valadoc_api_signature_builder_append_keyword (_tmp5_, "out", TRUE);
408 		} else {
409 			gboolean _tmp6_;
410 			gboolean _tmp7_;
411 			_tmp6_ = valadoc_api_parameter_get_is_ref (self);
412 			_tmp7_ = _tmp6_;
413 			if (_tmp7_) {
414 				ValadocApiSignatureBuilder* _tmp8_;
415 				_tmp8_ = signature;
416 				valadoc_api_signature_builder_append_keyword (_tmp8_, "ref", TRUE);
417 			}
418 		}
419 		_tmp9_ = signature;
420 		_tmp10_ = self->priv->_parameter_type;
421 		_tmp11_ = valadoc_api_item_get_signature ((ValadocApiItem*) _tmp10_);
422 		_tmp12_ = _tmp11_;
423 		valadoc_api_signature_builder_append_content (_tmp9_, _tmp12_, TRUE);
424 		_tmp13_ = signature;
425 		_tmp14_ = valadoc_api_node_get_name ((ValadocApiNode*) self);
426 		_tmp15_ = _tmp14_;
427 		valadoc_api_signature_builder_append (_tmp13_, _tmp15_, TRUE);
428 		_tmp16_ = valadoc_api_parameter_get_has_default_value (self);
429 		_tmp17_ = _tmp16_;
430 		if (_tmp17_) {
431 			ValadocApiSignatureBuilder* _tmp18_;
432 			ValadocApiSignatureBuilder* _tmp19_;
433 			ValadocContentRun* _tmp20_;
434 			_tmp18_ = signature;
435 			valadoc_api_signature_builder_append (_tmp18_, "=", TRUE);
436 			_tmp19_ = signature;
437 			_tmp20_ = self->priv->_default_value;
438 			valadoc_api_signature_builder_append_content (_tmp19_, (ValadocContentInline*) _tmp20_, TRUE);
439 		}
440 	}
441 	_tmp21_ = signature;
442 	_tmp22_ = valadoc_api_signature_builder_get (_tmp21_);
443 	result = (ValadocContentInline*) _tmp22_;
444 	_valadoc_api_signature_builder_unref0 (signature);
445 	return result;
446 }
447 
448 static void
valadoc_api_parameter_class_init(ValadocApiParameterClass * klass,gpointer klass_data)449 valadoc_api_parameter_class_init (ValadocApiParameterClass * klass,
450                                   gpointer klass_data)
451 {
452 	valadoc_api_parameter_parent_class = g_type_class_peek_parent (klass);
453 	g_type_class_adjust_private_offset (klass, &ValadocApiParameter_private_offset);
454 	((ValadocApiNodeClass *) klass)->accept = (void (*) (ValadocApiNode*, ValadocApiVisitor*)) valadoc_api_parameter_real_accept;
455 	((ValadocApiItemClass *) klass)->build_signature = (ValadocContentInline* (*) (ValadocApiItem*)) valadoc_api_parameter_real_build_signature;
456 	VALADOC_API_NODE_CLASS (klass)->get_node_type = valadoc_api_parameter_real_get_node_type;
457 	G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_api_parameter_get_property;
458 	G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_api_parameter_set_property;
459 	G_OBJECT_CLASS (klass)->finalize = valadoc_api_parameter_finalize;
460 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_DEFAULT_VALUE_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_DEFAULT_VALUE_PROPERTY] = g_param_spec_object ("default-value", "default-value", "default-value", VALADOC_CONTENT_TYPE_RUN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
461 	/**
462 	 * Used to translate imported C-documentation
463 	 */
464 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_IMPLICIT_ARRAY_LENGTH_CPARAMETER_NAME_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IMPLICIT_ARRAY_LENGTH_CPARAMETER_NAME_PROPERTY] = g_param_spec_string ("implicit-array-length-cparameter-name", "implicit-array-length-cparameter-name", "implicit-array-length-cparameter-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
465 	/**
466 	 * Used to translate imported C-documentation
467 	 */
468 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_IMPLICIT_CLOSURE_CPARAMETER_NAME_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IMPLICIT_CLOSURE_CPARAMETER_NAME_PROPERTY] = g_param_spec_string ("implicit-closure-cparameter-name", "implicit-closure-cparameter-name", "implicit-closure-cparameter-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
469 	/**
470 	 * Used to translate imported C-documentation
471 	 */
472 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_IMPLICIT_DESTROY_CPARAMETER_NAME_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IMPLICIT_DESTROY_CPARAMETER_NAME_PROPERTY] = g_param_spec_string ("implicit-destroy-cparameter-name", "implicit-destroy-cparameter-name", "implicit-destroy-cparameter-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
473 	/**
474 	 * Specifies whether the parameter direction is out
475 	 */
476 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_IS_OUT_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IS_OUT_PROPERTY] = g_param_spec_boolean ("is-out", "is-out", "is-out", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
477 	/**
478 	 * Specifies whether the parameter direction is ref
479 	 */
480 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_IS_REF_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_IS_REF_PROPERTY] = g_param_spec_boolean ("is-ref", "is-ref", "is-ref", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
481 	/**
482 	 * Specifies whether the parameter has a default value
483 	 */
484 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_HAS_DEFAULT_VALUE_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_HAS_DEFAULT_VALUE_PROPERTY] = g_param_spec_boolean ("has-default-value", "has-default-value", "has-default-value", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
485 	/**
486 	 * The parameter type.
487 	 */
488 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_PARAMETER_TYPE_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_PARAMETER_TYPE_PROPERTY] = g_param_spec_object ("parameter-type", "parameter-type", "parameter-type", VALADOC_API_TYPE_TYPEREFERENCE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
489 	/**
490 	 * Specifies whether the methods accepts a variable number of arguments
491 	 */
492 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_ELLIPSIS_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_ELLIPSIS_PROPERTY] = g_param_spec_boolean ("ellipsis", "ellipsis", "ellipsis", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
493 	/**
494 	 * {@inheritDoc}
495 	 */
496 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_API_PARAMETER_NODE_TYPE_PROPERTY, valadoc_api_parameter_properties[VALADOC_API_PARAMETER_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));
497 }
498 
499 static void
valadoc_api_parameter_instance_init(ValadocApiParameter * self,gpointer klass)500 valadoc_api_parameter_instance_init (ValadocApiParameter * self,
501                                      gpointer klass)
502 {
503 	self->priv = valadoc_api_parameter_get_instance_private (self);
504 }
505 
506 static void
valadoc_api_parameter_finalize(GObject * obj)507 valadoc_api_parameter_finalize (GObject * obj)
508 {
509 	ValadocApiParameter * self;
510 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_API_TYPE_PARAMETER, ValadocApiParameter);
511 	_g_object_unref0 (self->priv->_default_value);
512 	_g_free0 (self->priv->_implicit_array_length_cparameter_name);
513 	_g_free0 (self->priv->_implicit_closure_cparameter_name);
514 	_g_free0 (self->priv->_implicit_destroy_cparameter_name);
515 	_g_object_unref0 (self->priv->_parameter_type);
516 	G_OBJECT_CLASS (valadoc_api_parameter_parent_class)->finalize (obj);
517 }
518 
519 /**
520  * Represents a parameter in method, signal and delegate signatures.
521  */
522 static GType
valadoc_api_parameter_get_type_once(void)523 valadoc_api_parameter_get_type_once (void)
524 {
525 	static const GTypeInfo g_define_type_info = { sizeof (ValadocApiParameterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_api_parameter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocApiParameter), 0, (GInstanceInitFunc) valadoc_api_parameter_instance_init, NULL };
526 	GType valadoc_api_parameter_type_id;
527 	valadoc_api_parameter_type_id = g_type_register_static (VALADOC_API_TYPE_SYMBOL, "ValadocApiParameter", &g_define_type_info, 0);
528 	ValadocApiParameter_private_offset = g_type_add_instance_private (valadoc_api_parameter_type_id, sizeof (ValadocApiParameterPrivate));
529 	return valadoc_api_parameter_type_id;
530 }
531 
532 GType
valadoc_api_parameter_get_type(void)533 valadoc_api_parameter_get_type (void)
534 {
535 	static volatile gsize valadoc_api_parameter_type_id__volatile = 0;
536 	if (g_once_init_enter (&valadoc_api_parameter_type_id__volatile)) {
537 		GType valadoc_api_parameter_type_id;
538 		valadoc_api_parameter_type_id = valadoc_api_parameter_get_type_once ();
539 		g_once_init_leave (&valadoc_api_parameter_type_id__volatile, valadoc_api_parameter_type_id);
540 	}
541 	return valadoc_api_parameter_type_id__volatile;
542 }
543 
544 static void
_vala_valadoc_api_parameter_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)545 _vala_valadoc_api_parameter_get_property (GObject * object,
546                                           guint property_id,
547                                           GValue * value,
548                                           GParamSpec * pspec)
549 {
550 	ValadocApiParameter * self;
551 	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_PARAMETER, ValadocApiParameter);
552 	switch (property_id) {
553 		case VALADOC_API_PARAMETER_DEFAULT_VALUE_PROPERTY:
554 		g_value_set_object (value, valadoc_api_parameter_get_default_value (self));
555 		break;
556 		case VALADOC_API_PARAMETER_IMPLICIT_ARRAY_LENGTH_CPARAMETER_NAME_PROPERTY:
557 		g_value_set_string (value, valadoc_api_parameter_get_implicit_array_length_cparameter_name (self));
558 		break;
559 		case VALADOC_API_PARAMETER_IMPLICIT_CLOSURE_CPARAMETER_NAME_PROPERTY:
560 		g_value_set_string (value, valadoc_api_parameter_get_implicit_closure_cparameter_name (self));
561 		break;
562 		case VALADOC_API_PARAMETER_IMPLICIT_DESTROY_CPARAMETER_NAME_PROPERTY:
563 		g_value_set_string (value, valadoc_api_parameter_get_implicit_destroy_cparameter_name (self));
564 		break;
565 		case VALADOC_API_PARAMETER_IS_OUT_PROPERTY:
566 		g_value_set_boolean (value, valadoc_api_parameter_get_is_out (self));
567 		break;
568 		case VALADOC_API_PARAMETER_IS_REF_PROPERTY:
569 		g_value_set_boolean (value, valadoc_api_parameter_get_is_ref (self));
570 		break;
571 		case VALADOC_API_PARAMETER_HAS_DEFAULT_VALUE_PROPERTY:
572 		g_value_set_boolean (value, valadoc_api_parameter_get_has_default_value (self));
573 		break;
574 		case VALADOC_API_PARAMETER_PARAMETER_TYPE_PROPERTY:
575 		g_value_set_object (value, valadoc_api_parameter_get_parameter_type (self));
576 		break;
577 		case VALADOC_API_PARAMETER_ELLIPSIS_PROPERTY:
578 		g_value_set_boolean (value, valadoc_api_parameter_get_ellipsis (self));
579 		break;
580 		case VALADOC_API_PARAMETER_NODE_TYPE_PROPERTY:
581 		g_value_set_enum (value, valadoc_api_node_get_node_type ((ValadocApiNode*) self));
582 		break;
583 		default:
584 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
585 		break;
586 	}
587 }
588 
589 static void
_vala_valadoc_api_parameter_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)590 _vala_valadoc_api_parameter_set_property (GObject * object,
591                                           guint property_id,
592                                           const GValue * value,
593                                           GParamSpec * pspec)
594 {
595 	ValadocApiParameter * self;
596 	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_API_TYPE_PARAMETER, ValadocApiParameter);
597 	switch (property_id) {
598 		case VALADOC_API_PARAMETER_DEFAULT_VALUE_PROPERTY:
599 		valadoc_api_parameter_set_default_value (self, g_value_get_object (value));
600 		break;
601 		case VALADOC_API_PARAMETER_IMPLICIT_ARRAY_LENGTH_CPARAMETER_NAME_PROPERTY:
602 		valadoc_api_parameter_set_implicit_array_length_cparameter_name (self, g_value_get_string (value));
603 		break;
604 		case VALADOC_API_PARAMETER_IMPLICIT_CLOSURE_CPARAMETER_NAME_PROPERTY:
605 		valadoc_api_parameter_set_implicit_closure_cparameter_name (self, g_value_get_string (value));
606 		break;
607 		case VALADOC_API_PARAMETER_IMPLICIT_DESTROY_CPARAMETER_NAME_PROPERTY:
608 		valadoc_api_parameter_set_implicit_destroy_cparameter_name (self, g_value_get_string (value));
609 		break;
610 		case VALADOC_API_PARAMETER_PARAMETER_TYPE_PROPERTY:
611 		valadoc_api_parameter_set_parameter_type (self, g_value_get_object (value));
612 		break;
613 		case VALADOC_API_PARAMETER_ELLIPSIS_PROPERTY:
614 		valadoc_api_parameter_set_ellipsis (self, g_value_get_boolean (value));
615 		break;
616 		default:
617 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
618 		break;
619 	}
620 }
621 
622