1 /* girsourcecomment.c generated by valac, the Vala compiler
2  * generated from girsourcecomment.vala, do not modify */
3 
4 /* sourcecomment.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 <valagee.h>
28 #include <glib-object.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <glib.h>
32 
33 #define _vala_map_unref0(var) ((var == NULL) ? NULL : (var = (vala_map_unref (var), NULL)))
34 #define _g_free0(var) (var = (g_free (var), NULL))
35 #define _valadoc_api_source_comment_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_source_comment_unref (var), NULL)))
36 
37 struct _ValadocApiGirSourceCommentPrivate {
38 	ValaMap* parameters;
39 	gchar* _instance_param_name;
40 	ValadocApiSourceComment* _return_comment;
41 	ValadocApiSourceComment* _deprecated_comment;
42 	ValadocApiSourceComment* _version_comment;
43 	ValadocApiSourceComment* _stability_comment;
44 };
45 
46 static gint ValadocApiGirSourceComment_private_offset;
47 static gpointer valadoc_api_gir_source_comment_parent_class = NULL;
48 
49 static void valadoc_api_gir_source_comment_finalize (ValadocApiSourceComment * obj);
50 static GType valadoc_api_gir_source_comment_get_type_once (void);
51 
52 static inline gpointer
valadoc_api_gir_source_comment_get_instance_private(ValadocApiGirSourceComment * self)53 valadoc_api_gir_source_comment_get_instance_private (ValadocApiGirSourceComment* self)
54 {
55 	return G_STRUCT_MEMBER_P (self, ValadocApiGirSourceComment_private_offset);
56 }
57 
58 const gchar*
valadoc_api_gir_source_comment_get_instance_param_name(ValadocApiGirSourceComment * self)59 valadoc_api_gir_source_comment_get_instance_param_name (ValadocApiGirSourceComment* self)
60 {
61 	const gchar* result;
62 	const gchar* _tmp0_;
63 	g_return_val_if_fail (self != NULL, NULL);
64 	_tmp0_ = self->priv->_instance_param_name;
65 	result = _tmp0_;
66 	return result;
67 }
68 
69 void
valadoc_api_gir_source_comment_set_instance_param_name(ValadocApiGirSourceComment * self,const gchar * value)70 valadoc_api_gir_source_comment_set_instance_param_name (ValadocApiGirSourceComment* self,
71                                                         const gchar* value)
72 {
73 	gchar* _tmp0_;
74 	g_return_if_fail (self != NULL);
75 	_tmp0_ = g_strdup (value);
76 	_g_free0 (self->priv->_instance_param_name);
77 	self->priv->_instance_param_name = _tmp0_;
78 }
79 
80 ValadocApiSourceComment*
valadoc_api_gir_source_comment_get_return_comment(ValadocApiGirSourceComment * self)81 valadoc_api_gir_source_comment_get_return_comment (ValadocApiGirSourceComment* self)
82 {
83 	ValadocApiSourceComment* result;
84 	ValadocApiSourceComment* _tmp0_;
85 	g_return_val_if_fail (self != NULL, NULL);
86 	_tmp0_ = self->priv->_return_comment;
87 	result = _tmp0_;
88 	return result;
89 }
90 
91 static gpointer
_valadoc_api_source_comment_ref0(gpointer self)92 _valadoc_api_source_comment_ref0 (gpointer self)
93 {
94 	return self ? valadoc_api_source_comment_ref (self) : NULL;
95 }
96 
97 void
valadoc_api_gir_source_comment_set_return_comment(ValadocApiGirSourceComment * self,ValadocApiSourceComment * value)98 valadoc_api_gir_source_comment_set_return_comment (ValadocApiGirSourceComment* self,
99                                                    ValadocApiSourceComment* value)
100 {
101 	ValadocApiSourceComment* _tmp0_;
102 	g_return_if_fail (self != NULL);
103 	_tmp0_ = _valadoc_api_source_comment_ref0 (value);
104 	_valadoc_api_source_comment_unref0 (self->priv->_return_comment);
105 	self->priv->_return_comment = _tmp0_;
106 }
107 
108 ValadocApiSourceComment*
valadoc_api_gir_source_comment_get_deprecated_comment(ValadocApiGirSourceComment * self)109 valadoc_api_gir_source_comment_get_deprecated_comment (ValadocApiGirSourceComment* self)
110 {
111 	ValadocApiSourceComment* result;
112 	ValadocApiSourceComment* _tmp0_;
113 	g_return_val_if_fail (self != NULL, NULL);
114 	_tmp0_ = self->priv->_deprecated_comment;
115 	result = _tmp0_;
116 	return result;
117 }
118 
119 void
valadoc_api_gir_source_comment_set_deprecated_comment(ValadocApiGirSourceComment * self,ValadocApiSourceComment * value)120 valadoc_api_gir_source_comment_set_deprecated_comment (ValadocApiGirSourceComment* self,
121                                                        ValadocApiSourceComment* value)
122 {
123 	ValadocApiSourceComment* _tmp0_;
124 	g_return_if_fail (self != NULL);
125 	_tmp0_ = _valadoc_api_source_comment_ref0 (value);
126 	_valadoc_api_source_comment_unref0 (self->priv->_deprecated_comment);
127 	self->priv->_deprecated_comment = _tmp0_;
128 }
129 
130 ValadocApiSourceComment*
valadoc_api_gir_source_comment_get_version_comment(ValadocApiGirSourceComment * self)131 valadoc_api_gir_source_comment_get_version_comment (ValadocApiGirSourceComment* self)
132 {
133 	ValadocApiSourceComment* result;
134 	ValadocApiSourceComment* _tmp0_;
135 	g_return_val_if_fail (self != NULL, NULL);
136 	_tmp0_ = self->priv->_version_comment;
137 	result = _tmp0_;
138 	return result;
139 }
140 
141 void
valadoc_api_gir_source_comment_set_version_comment(ValadocApiGirSourceComment * self,ValadocApiSourceComment * value)142 valadoc_api_gir_source_comment_set_version_comment (ValadocApiGirSourceComment* self,
143                                                     ValadocApiSourceComment* value)
144 {
145 	ValadocApiSourceComment* _tmp0_;
146 	g_return_if_fail (self != NULL);
147 	_tmp0_ = _valadoc_api_source_comment_ref0 (value);
148 	_valadoc_api_source_comment_unref0 (self->priv->_version_comment);
149 	self->priv->_version_comment = _tmp0_;
150 }
151 
152 ValadocApiSourceComment*
valadoc_api_gir_source_comment_get_stability_comment(ValadocApiGirSourceComment * self)153 valadoc_api_gir_source_comment_get_stability_comment (ValadocApiGirSourceComment* self)
154 {
155 	ValadocApiSourceComment* result;
156 	ValadocApiSourceComment* _tmp0_;
157 	g_return_val_if_fail (self != NULL, NULL);
158 	_tmp0_ = self->priv->_stability_comment;
159 	result = _tmp0_;
160 	return result;
161 }
162 
163 void
valadoc_api_gir_source_comment_set_stability_comment(ValadocApiGirSourceComment * self,ValadocApiSourceComment * value)164 valadoc_api_gir_source_comment_set_stability_comment (ValadocApiGirSourceComment* self,
165                                                       ValadocApiSourceComment* value)
166 {
167 	ValadocApiSourceComment* _tmp0_;
168 	g_return_if_fail (self != NULL);
169 	_tmp0_ = _valadoc_api_source_comment_ref0 (value);
170 	_valadoc_api_source_comment_unref0 (self->priv->_stability_comment);
171 	self->priv->_stability_comment = _tmp0_;
172 }
173 
174 ValaMapIterator*
valadoc_api_gir_source_comment_parameter_iterator(ValadocApiGirSourceComment * self)175 valadoc_api_gir_source_comment_parameter_iterator (ValadocApiGirSourceComment* self)
176 {
177 	ValaMap* _tmp0_;
178 	ValaMapIterator* _tmp1_;
179 	ValaMapIterator* result = NULL;
180 	g_return_val_if_fail (self != NULL, NULL);
181 	_tmp0_ = self->priv->parameters;
182 	_tmp1_ = vala_map_map_iterator (_tmp0_);
183 	result = _tmp1_;
184 	return result;
185 }
186 
187 void
valadoc_api_gir_source_comment_add_parameter_content(ValadocApiGirSourceComment * self,const gchar * param_name,ValadocApiSourceComment * comment)188 valadoc_api_gir_source_comment_add_parameter_content (ValadocApiGirSourceComment* self,
189                                                       const gchar* param_name,
190                                                       ValadocApiSourceComment* comment)
191 {
192 	ValaMap* _tmp0_;
193 	g_return_if_fail (self != NULL);
194 	g_return_if_fail (param_name != NULL);
195 	g_return_if_fail (comment != NULL);
196 	_tmp0_ = self->priv->parameters;
197 	vala_map_set (_tmp0_, param_name, comment);
198 }
199 
200 ValadocApiSourceComment*
valadoc_api_gir_source_comment_get_parameter_comment(ValadocApiGirSourceComment * self,const gchar * param_name)201 valadoc_api_gir_source_comment_get_parameter_comment (ValadocApiGirSourceComment* self,
202                                                       const gchar* param_name)
203 {
204 	ValaMap* _tmp0_;
205 	ValaMap* _tmp1_;
206 	gpointer _tmp2_;
207 	ValadocApiSourceComment* result = NULL;
208 	g_return_val_if_fail (self != NULL, NULL);
209 	g_return_val_if_fail (param_name != NULL, NULL);
210 	_tmp0_ = self->priv->parameters;
211 	if (_tmp0_ == NULL) {
212 		result = NULL;
213 		return result;
214 	}
215 	_tmp1_ = self->priv->parameters;
216 	_tmp2_ = vala_map_get (_tmp1_, param_name);
217 	result = (ValadocApiSourceComment*) _tmp2_;
218 	return result;
219 }
220 
221 ValadocApiGirSourceComment*
valadoc_api_gir_source_comment_construct(GType object_type,const gchar * content,ValadocApiSourceFile * file,gint first_line,gint first_column,gint last_line,gint last_column)222 valadoc_api_gir_source_comment_construct (GType object_type,
223                                           const gchar* content,
224                                           ValadocApiSourceFile* file,
225                                           gint first_line,
226                                           gint first_column,
227                                           gint last_line,
228                                           gint last_column)
229 {
230 	ValadocApiGirSourceComment* self = NULL;
231 	g_return_val_if_fail (content != NULL, NULL);
232 	g_return_val_if_fail (file != NULL, NULL);
233 	self = (ValadocApiGirSourceComment*) valadoc_api_source_comment_construct (object_type, content, file, first_line, first_column, last_line, last_column);
234 	return self;
235 }
236 
237 ValadocApiGirSourceComment*
valadoc_api_gir_source_comment_new(const gchar * content,ValadocApiSourceFile * file,gint first_line,gint first_column,gint last_line,gint last_column)238 valadoc_api_gir_source_comment_new (const gchar* content,
239                                     ValadocApiSourceFile* file,
240                                     gint first_line,
241                                     gint first_column,
242                                     gint last_line,
243                                     gint last_column)
244 {
245 	return valadoc_api_gir_source_comment_construct (VALADOC_API_TYPE_GIR_SOURCE_COMMENT, content, file, first_line, first_column, last_line, last_column);
246 }
247 
248 static void
valadoc_api_gir_source_comment_class_init(ValadocApiGirSourceCommentClass * klass,gpointer klass_data)249 valadoc_api_gir_source_comment_class_init (ValadocApiGirSourceCommentClass * klass,
250                                            gpointer klass_data)
251 {
252 	valadoc_api_gir_source_comment_parent_class = g_type_class_peek_parent (klass);
253 	((ValadocApiSourceCommentClass *) klass)->finalize = valadoc_api_gir_source_comment_finalize;
254 	g_type_class_adjust_private_offset (klass, &ValadocApiGirSourceComment_private_offset);
255 }
256 
257 static void
valadoc_api_gir_source_comment_instance_init(ValadocApiGirSourceComment * self,gpointer klass)258 valadoc_api_gir_source_comment_instance_init (ValadocApiGirSourceComment * self,
259                                               gpointer klass)
260 {
261 	GHashFunc _tmp0_;
262 	GEqualFunc _tmp1_;
263 	GEqualFunc _tmp2_;
264 	ValaHashMap* _tmp3_;
265 	self->priv = valadoc_api_gir_source_comment_get_instance_private (self);
266 	_tmp0_ = g_str_hash;
267 	_tmp1_ = g_str_equal;
268 	_tmp2_ = g_direct_equal;
269 	_tmp3_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, VALADOC_API_TYPE_SOURCE_COMMENT, (GBoxedCopyFunc) valadoc_api_source_comment_ref, (GDestroyNotify) valadoc_api_source_comment_unref, _tmp0_, _tmp1_, _tmp2_);
270 	self->priv->parameters = (ValaMap*) _tmp3_;
271 }
272 
273 static void
valadoc_api_gir_source_comment_finalize(ValadocApiSourceComment * obj)274 valadoc_api_gir_source_comment_finalize (ValadocApiSourceComment * obj)
275 {
276 	ValadocApiGirSourceComment * self;
277 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_API_TYPE_GIR_SOURCE_COMMENT, ValadocApiGirSourceComment);
278 	_vala_map_unref0 (self->priv->parameters);
279 	_g_free0 (self->priv->_instance_param_name);
280 	_valadoc_api_source_comment_unref0 (self->priv->_return_comment);
281 	_valadoc_api_source_comment_unref0 (self->priv->_deprecated_comment);
282 	_valadoc_api_source_comment_unref0 (self->priv->_version_comment);
283 	_valadoc_api_source_comment_unref0 (self->priv->_stability_comment);
284 	VALADOC_API_SOURCE_COMMENT_CLASS (valadoc_api_gir_source_comment_parent_class)->finalize (obj);
285 }
286 
287 /**
288  * A documentation comment used by valadoc
289  */
290 static GType
valadoc_api_gir_source_comment_get_type_once(void)291 valadoc_api_gir_source_comment_get_type_once (void)
292 {
293 	static const GTypeInfo g_define_type_info = { sizeof (ValadocApiGirSourceCommentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_api_gir_source_comment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocApiGirSourceComment), 0, (GInstanceInitFunc) valadoc_api_gir_source_comment_instance_init, NULL };
294 	GType valadoc_api_gir_source_comment_type_id;
295 	valadoc_api_gir_source_comment_type_id = g_type_register_static (VALADOC_API_TYPE_SOURCE_COMMENT, "ValadocApiGirSourceComment", &g_define_type_info, 0);
296 	ValadocApiGirSourceComment_private_offset = g_type_add_instance_private (valadoc_api_gir_source_comment_type_id, sizeof (ValadocApiGirSourceCommentPrivate));
297 	return valadoc_api_gir_source_comment_type_id;
298 }
299 
300 GType
valadoc_api_gir_source_comment_get_type(void)301 valadoc_api_gir_source_comment_get_type (void)
302 {
303 	static volatile gsize valadoc_api_gir_source_comment_type_id__volatile = 0;
304 	if (g_once_init_enter (&valadoc_api_gir_source_comment_type_id__volatile)) {
305 		GType valadoc_api_gir_source_comment_type_id;
306 		valadoc_api_gir_source_comment_type_id = valadoc_api_gir_source_comment_get_type_once ();
307 		g_once_init_leave (&valadoc_api_gir_source_comment_type_id__volatile, valadoc_api_gir_source_comment_type_id);
308 	}
309 	return valadoc_api_gir_source_comment_type_id__volatile;
310 }
311 
312