1 /* tablerow.c generated by valac, the Vala compiler
2  * generated from tablerow.vala, do not modify */
3 
4 /* tablerow.vala
5  *
6  * Copyright (C) 2008-2009 Didier Villevalois
7  * Copyright (C) 2008-2012 Florian Brosch
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
22  *
23  * Author:
24  * 	Didier 'Ptitjes Villevalois <ptitjes@free.fr>
25  */
26 
27 #include "valadoc.h"
28 #include <valagee.h>
29 #include <glib-object.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <glib.h>
33 
34 enum  {
35 	VALADOC_CONTENT_TABLE_ROW_0_PROPERTY,
36 	VALADOC_CONTENT_TABLE_ROW_CELLS_PROPERTY,
37 	VALADOC_CONTENT_TABLE_ROW_NUM_PROPERTIES
38 };
39 static GParamSpec* valadoc_content_table_row_properties[VALADOC_CONTENT_TABLE_ROW_NUM_PROPERTIES];
40 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
41 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
42 
43 struct _ValadocContentTableRowPrivate {
44 	ValaList* _cells;
45 };
46 
47 static gint ValadocContentTableRow_private_offset;
48 static gpointer valadoc_content_table_row_parent_class = NULL;
49 
50 G_GNUC_INTERNAL ValadocContentTableRow* valadoc_content_table_row_new (void);
51 G_GNUC_INTERNAL ValadocContentTableRow* valadoc_content_table_row_construct (GType object_type);
52 static void valadoc_content_table_row_real_check (ValadocContentContentElement* base,
53                                            ValadocApiTree* api_root,
54                                            ValadocApiNode* container,
55                                            const gchar* file_path,
56                                            ValadocErrorReporter* reporter,
57                                            ValadocSettings* settings);
58 G_GNUC_INTERNAL void valadoc_content_content_element_set_parent (ValadocContentContentElement* self,
59                                                  ValadocContentContentElement* value);
60 static void valadoc_content_table_row_real_accept (ValadocContentContentElement* base,
61                                             ValadocContentContentVisitor* visitor);
62 static void valadoc_content_table_row_real_accept_children (ValadocContentContentElement* base,
63                                                      ValadocContentContentVisitor* visitor);
64 static gboolean valadoc_content_table_row_real_is_empty (ValadocContentContentElement* base);
65 static ValadocContentContentElement* valadoc_content_table_row_real_copy (ValadocContentContentElement* base,
66                                                                    ValadocContentContentElement* new_parent);
67 static void valadoc_content_table_row_finalize (GObject * obj);
68 static GType valadoc_content_table_row_get_type_once (void);
69 static void _vala_valadoc_content_table_row_get_property (GObject * object,
70                                                    guint property_id,
71                                                    GValue * value,
72                                                    GParamSpec * pspec);
73 
74 static inline gpointer
valadoc_content_table_row_get_instance_private(ValadocContentTableRow * self)75 valadoc_content_table_row_get_instance_private (ValadocContentTableRow* self)
76 {
77 	return G_STRUCT_MEMBER_P (self, ValadocContentTableRow_private_offset);
78 }
79 
80 ValaList*
valadoc_content_table_row_get_cells(ValadocContentTableRow * self)81 valadoc_content_table_row_get_cells (ValadocContentTableRow* self)
82 {
83 	ValaList* result;
84 	ValaList* _tmp0_;
85 	g_return_val_if_fail (self != NULL, NULL);
86 	_tmp0_ = self->priv->_cells;
87 	result = _tmp0_;
88 	return result;
89 }
90 
91 G_GNUC_INTERNAL ValadocContentTableRow*
valadoc_content_table_row_construct(GType object_type)92 valadoc_content_table_row_construct (GType object_type)
93 {
94 	ValadocContentTableRow * self = NULL;
95 	GEqualFunc _tmp0_;
96 	ValaArrayList* _tmp1_;
97 	self = (ValadocContentTableRow*) valadoc_content_content_element_construct (object_type);
98 	_tmp0_ = g_direct_equal;
99 	_tmp1_ = vala_array_list_new (VALADOC_CONTENT_TYPE_TABLE_CELL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
100 	_vala_iterable_unref0 (self->priv->_cells);
101 	self->priv->_cells = (ValaList*) _tmp1_;
102 	return self;
103 }
104 
105 G_GNUC_INTERNAL ValadocContentTableRow*
valadoc_content_table_row_new(void)106 valadoc_content_table_row_new (void)
107 {
108 	return valadoc_content_table_row_construct (VALADOC_CONTENT_TYPE_TABLE_ROW);
109 }
110 
111 static gpointer
_vala_iterable_ref0(gpointer self)112 _vala_iterable_ref0 (gpointer self)
113 {
114 	return self ? vala_iterable_ref (self) : NULL;
115 }
116 
117 static void
valadoc_content_table_row_real_check(ValadocContentContentElement * base,ValadocApiTree * api_root,ValadocApiNode * container,const gchar * file_path,ValadocErrorReporter * reporter,ValadocSettings * settings)118 valadoc_content_table_row_real_check (ValadocContentContentElement* base,
119                                       ValadocApiTree* api_root,
120                                       ValadocApiNode* container,
121                                       const gchar* file_path,
122                                       ValadocErrorReporter* reporter,
123                                       ValadocSettings* settings)
124 {
125 	ValadocContentTableRow * self;
126 	self = (ValadocContentTableRow*) base;
127 	g_return_if_fail (api_root != NULL);
128 	g_return_if_fail (container != NULL);
129 	g_return_if_fail (file_path != NULL);
130 	g_return_if_fail (reporter != NULL);
131 	g_return_if_fail (settings != NULL);
132 	{
133 		ValaList* _cell_list = NULL;
134 		ValaList* _tmp0_;
135 		ValaList* _tmp1_;
136 		gint _cell_size = 0;
137 		ValaList* _tmp2_;
138 		gint _tmp3_;
139 		gint _tmp4_;
140 		gint _cell_index = 0;
141 		_tmp0_ = self->priv->_cells;
142 		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
143 		_cell_list = _tmp1_;
144 		_tmp2_ = _cell_list;
145 		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
146 		_tmp4_ = _tmp3_;
147 		_cell_size = _tmp4_;
148 		_cell_index = -1;
149 		while (TRUE) {
150 			gint _tmp5_;
151 			gint _tmp6_;
152 			ValadocContentTableCell* cell = NULL;
153 			ValaList* _tmp7_;
154 			gpointer _tmp8_;
155 			ValadocContentTableCell* _tmp9_;
156 			ValadocContentTableCell* _tmp10_;
157 			_cell_index = _cell_index + 1;
158 			_tmp5_ = _cell_index;
159 			_tmp6_ = _cell_size;
160 			if (!(_tmp5_ < _tmp6_)) {
161 				break;
162 			}
163 			_tmp7_ = _cell_list;
164 			_tmp8_ = vala_list_get (_tmp7_, _cell_index);
165 			cell = (ValadocContentTableCell*) _tmp8_;
166 			_tmp9_ = cell;
167 			valadoc_content_content_element_set_parent ((ValadocContentContentElement*) _tmp9_, (ValadocContentContentElement*) self);
168 			_tmp10_ = cell;
169 			valadoc_content_content_element_check ((ValadocContentContentElement*) _tmp10_, api_root, container, file_path, reporter, settings);
170 			_g_object_unref0 (cell);
171 		}
172 		_vala_iterable_unref0 (_cell_list);
173 	}
174 }
175 
176 static void
valadoc_content_table_row_real_accept(ValadocContentContentElement * base,ValadocContentContentVisitor * visitor)177 valadoc_content_table_row_real_accept (ValadocContentContentElement* base,
178                                        ValadocContentContentVisitor* visitor)
179 {
180 	ValadocContentTableRow * self;
181 	self = (ValadocContentTableRow*) base;
182 	g_return_if_fail (visitor != NULL);
183 	valadoc_content_content_visitor_visit_table_row (visitor, self);
184 }
185 
186 static void
valadoc_content_table_row_real_accept_children(ValadocContentContentElement * base,ValadocContentContentVisitor * visitor)187 valadoc_content_table_row_real_accept_children (ValadocContentContentElement* base,
188                                                 ValadocContentContentVisitor* visitor)
189 {
190 	ValadocContentTableRow * self;
191 	self = (ValadocContentTableRow*) base;
192 	g_return_if_fail (visitor != NULL);
193 	{
194 		ValaList* _element_list = NULL;
195 		ValaList* _tmp0_;
196 		ValaList* _tmp1_;
197 		gint _element_size = 0;
198 		ValaList* _tmp2_;
199 		gint _tmp3_;
200 		gint _tmp4_;
201 		gint _element_index = 0;
202 		_tmp0_ = self->priv->_cells;
203 		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
204 		_element_list = _tmp1_;
205 		_tmp2_ = _element_list;
206 		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
207 		_tmp4_ = _tmp3_;
208 		_element_size = _tmp4_;
209 		_element_index = -1;
210 		while (TRUE) {
211 			gint _tmp5_;
212 			gint _tmp6_;
213 			ValadocContentTableCell* element = NULL;
214 			ValaList* _tmp7_;
215 			gpointer _tmp8_;
216 			ValadocContentTableCell* _tmp9_;
217 			_element_index = _element_index + 1;
218 			_tmp5_ = _element_index;
219 			_tmp6_ = _element_size;
220 			if (!(_tmp5_ < _tmp6_)) {
221 				break;
222 			}
223 			_tmp7_ = _element_list;
224 			_tmp8_ = vala_list_get (_tmp7_, _element_index);
225 			element = (ValadocContentTableCell*) _tmp8_;
226 			_tmp9_ = element;
227 			valadoc_content_content_element_accept ((ValadocContentContentElement*) _tmp9_, visitor);
228 			_g_object_unref0 (element);
229 		}
230 		_vala_iterable_unref0 (_element_list);
231 	}
232 }
233 
234 static gboolean
valadoc_content_table_row_real_is_empty(ValadocContentContentElement * base)235 valadoc_content_table_row_real_is_empty (ValadocContentContentElement* base)
236 {
237 	ValadocContentTableRow * self;
238 	gboolean result = FALSE;
239 	self = (ValadocContentTableRow*) base;
240 	result = FALSE;
241 	return result;
242 }
243 
244 static ValadocContentContentElement*
valadoc_content_table_row_real_copy(ValadocContentContentElement * base,ValadocContentContentElement * new_parent)245 valadoc_content_table_row_real_copy (ValadocContentContentElement* base,
246                                      ValadocContentContentElement* new_parent)
247 {
248 	ValadocContentTableRow * self;
249 	ValadocContentTableRow* row = NULL;
250 	ValadocContentTableRow* _tmp0_;
251 	ValadocContentTableRow* _tmp1_;
252 	ValadocContentContentElement* result = NULL;
253 	self = (ValadocContentTableRow*) base;
254 	_tmp0_ = valadoc_content_table_row_new ();
255 	row = _tmp0_;
256 	_tmp1_ = row;
257 	valadoc_content_content_element_set_parent ((ValadocContentContentElement*) _tmp1_, new_parent);
258 	{
259 		ValaList* _cell_list = NULL;
260 		ValaList* _tmp2_;
261 		ValaList* _tmp3_;
262 		gint _cell_size = 0;
263 		ValaList* _tmp4_;
264 		gint _tmp5_;
265 		gint _tmp6_;
266 		gint _cell_index = 0;
267 		_tmp2_ = self->priv->_cells;
268 		_tmp3_ = _vala_iterable_ref0 (_tmp2_);
269 		_cell_list = _tmp3_;
270 		_tmp4_ = _cell_list;
271 		_tmp5_ = vala_collection_get_size ((ValaCollection*) _tmp4_);
272 		_tmp6_ = _tmp5_;
273 		_cell_size = _tmp6_;
274 		_cell_index = -1;
275 		while (TRUE) {
276 			gint _tmp7_;
277 			gint _tmp8_;
278 			ValadocContentTableCell* cell = NULL;
279 			ValaList* _tmp9_;
280 			gpointer _tmp10_;
281 			ValadocContentTableCell* copy = NULL;
282 			ValadocContentTableCell* _tmp11_;
283 			ValadocContentTableRow* _tmp12_;
284 			ValadocContentContentElement* _tmp13_;
285 			ValadocContentTableCell* _tmp14_;
286 			ValadocContentTableRow* _tmp15_;
287 			ValaList* _tmp16_;
288 			ValaList* _tmp17_;
289 			ValadocContentTableCell* _tmp18_;
290 			_cell_index = _cell_index + 1;
291 			_tmp7_ = _cell_index;
292 			_tmp8_ = _cell_size;
293 			if (!(_tmp7_ < _tmp8_)) {
294 				break;
295 			}
296 			_tmp9_ = _cell_list;
297 			_tmp10_ = vala_list_get (_tmp9_, _cell_index);
298 			cell = (ValadocContentTableCell*) _tmp10_;
299 			_tmp11_ = cell;
300 			_tmp12_ = row;
301 			_tmp13_ = valadoc_content_content_element_copy ((ValadocContentContentElement*) _tmp11_, (ValadocContentContentElement*) _tmp12_);
302 			_tmp14_ = VALADOC_CONTENT_IS_TABLE_CELL (_tmp13_) ? ((ValadocContentTableCell*) _tmp13_) : NULL;
303 			if (_tmp14_ == NULL) {
304 				_g_object_unref0 (_tmp13_);
305 			}
306 			copy = _tmp14_;
307 			_tmp15_ = row;
308 			_tmp16_ = valadoc_content_table_row_get_cells (_tmp15_);
309 			_tmp17_ = _tmp16_;
310 			_tmp18_ = copy;
311 			vala_collection_add ((ValaCollection*) _tmp17_, _tmp18_);
312 			_g_object_unref0 (copy);
313 			_g_object_unref0 (cell);
314 		}
315 		_vala_iterable_unref0 (_cell_list);
316 	}
317 	result = (ValadocContentContentElement*) row;
318 	return result;
319 }
320 
321 static void
valadoc_content_table_row_class_init(ValadocContentTableRowClass * klass,gpointer klass_data)322 valadoc_content_table_row_class_init (ValadocContentTableRowClass * klass,
323                                       gpointer klass_data)
324 {
325 	valadoc_content_table_row_parent_class = g_type_class_peek_parent (klass);
326 	g_type_class_adjust_private_offset (klass, &ValadocContentTableRow_private_offset);
327 	((ValadocContentContentElementClass *) klass)->check = (void (*) (ValadocContentContentElement*, ValadocApiTree*, ValadocApiNode*, const gchar*, ValadocErrorReporter*, ValadocSettings*)) valadoc_content_table_row_real_check;
328 	((ValadocContentContentElementClass *) klass)->accept = (void (*) (ValadocContentContentElement*, ValadocContentContentVisitor*)) valadoc_content_table_row_real_accept;
329 	((ValadocContentContentElementClass *) klass)->accept_children = (void (*) (ValadocContentContentElement*, ValadocContentContentVisitor*)) valadoc_content_table_row_real_accept_children;
330 	((ValadocContentContentElementClass *) klass)->is_empty = (gboolean (*) (ValadocContentContentElement*)) valadoc_content_table_row_real_is_empty;
331 	((ValadocContentContentElementClass *) klass)->copy = (ValadocContentContentElement* (*) (ValadocContentContentElement*, ValadocContentContentElement*)) valadoc_content_table_row_real_copy;
332 	G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_content_table_row_get_property;
333 	G_OBJECT_CLASS (klass)->finalize = valadoc_content_table_row_finalize;
334 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_TABLE_ROW_CELLS_PROPERTY, valadoc_content_table_row_properties[VALADOC_CONTENT_TABLE_ROW_CELLS_PROPERTY] = vala_param_spec_iterable ("cells", "cells", "cells", VALA_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
335 }
336 
337 static void
valadoc_content_table_row_instance_init(ValadocContentTableRow * self,gpointer klass)338 valadoc_content_table_row_instance_init (ValadocContentTableRow * self,
339                                          gpointer klass)
340 {
341 	self->priv = valadoc_content_table_row_get_instance_private (self);
342 }
343 
344 static void
valadoc_content_table_row_finalize(GObject * obj)345 valadoc_content_table_row_finalize (GObject * obj)
346 {
347 	ValadocContentTableRow * self;
348 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_CONTENT_TYPE_TABLE_ROW, ValadocContentTableRow);
349 	_vala_iterable_unref0 (self->priv->_cells);
350 	G_OBJECT_CLASS (valadoc_content_table_row_parent_class)->finalize (obj);
351 }
352 
353 static GType
valadoc_content_table_row_get_type_once(void)354 valadoc_content_table_row_get_type_once (void)
355 {
356 	static const GTypeInfo g_define_type_info = { sizeof (ValadocContentTableRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_content_table_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocContentTableRow), 0, (GInstanceInitFunc) valadoc_content_table_row_instance_init, NULL };
357 	GType valadoc_content_table_row_type_id;
358 	valadoc_content_table_row_type_id = g_type_register_static (VALADOC_CONTENT_TYPE_CONTENT_ELEMENT, "ValadocContentTableRow", &g_define_type_info, 0);
359 	ValadocContentTableRow_private_offset = g_type_add_instance_private (valadoc_content_table_row_type_id, sizeof (ValadocContentTableRowPrivate));
360 	return valadoc_content_table_row_type_id;
361 }
362 
363 GType
valadoc_content_table_row_get_type(void)364 valadoc_content_table_row_get_type (void)
365 {
366 	static volatile gsize valadoc_content_table_row_type_id__volatile = 0;
367 	if (g_once_init_enter (&valadoc_content_table_row_type_id__volatile)) {
368 		GType valadoc_content_table_row_type_id;
369 		valadoc_content_table_row_type_id = valadoc_content_table_row_get_type_once ();
370 		g_once_init_leave (&valadoc_content_table_row_type_id__volatile, valadoc_content_table_row_type_id);
371 	}
372 	return valadoc_content_table_row_type_id__volatile;
373 }
374 
375 static void
_vala_valadoc_content_table_row_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)376 _vala_valadoc_content_table_row_get_property (GObject * object,
377                                               guint property_id,
378                                               GValue * value,
379                                               GParamSpec * pspec)
380 {
381 	ValadocContentTableRow * self;
382 	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_CONTENT_TYPE_TABLE_ROW, ValadocContentTableRow);
383 	switch (property_id) {
384 		case VALADOC_CONTENT_TABLE_ROW_CELLS_PROPERTY:
385 		vala_value_set_iterable (value, valadoc_content_table_row_get_cells (self));
386 		break;
387 		default:
388 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
389 		break;
390 	}
391 }
392 
393