1 /* valagircomment.c generated by valac, the Vala compiler
2  * generated from valagircomment.vala, do not modify */
3 
4 /* valagircomment.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 "vala.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 _vala_comment_unref0(var) ((var == NULL) ? NULL : (var = (vala_comment_unref (var), NULL)))
35 
36 struct _ValaGirCommentPrivate {
37 	ValaHashMap* parameter_content;
38 	ValaComment* _return_content;
39 };
40 
41 static gint ValaGirComment_private_offset;
42 static gpointer vala_gir_comment_parent_class = NULL;
43 
44 G_GNUC_INTERNAL void vala_gir_comment_add_content_for_parameter (ValaGirComment* self,
45                                                  const gchar* name,
46                                                  ValaComment* comment);
47 static void vala_gir_comment_finalize (ValaComment * obj);
48 static GType vala_gir_comment_get_type_once (void);
49 
50 static inline gpointer
vala_gir_comment_get_instance_private(ValaGirComment * self)51 vala_gir_comment_get_instance_private (ValaGirComment* self)
52 {
53 	return G_STRUCT_MEMBER_P (self, ValaGirComment_private_offset);
54 }
55 
56 ValaMapIterator*
vala_gir_comment_parameter_iterator(ValaGirComment * self)57 vala_gir_comment_parameter_iterator (ValaGirComment* self)
58 {
59 	ValaHashMap* _tmp0_;
60 	ValaMapIterator* _tmp1_;
61 	ValaMapIterator* result = NULL;
62 	g_return_val_if_fail (self != NULL, NULL);
63 	_tmp0_ = self->priv->parameter_content;
64 	_tmp1_ = vala_map_map_iterator ((ValaMap*) _tmp0_);
65 	result = _tmp1_;
66 	return result;
67 }
68 
69 ValaComment*
vala_gir_comment_get_return_content(ValaGirComment * self)70 vala_gir_comment_get_return_content (ValaGirComment* self)
71 {
72 	ValaComment* result;
73 	ValaComment* _tmp0_;
74 	g_return_val_if_fail (self != NULL, NULL);
75 	_tmp0_ = self->priv->_return_content;
76 	result = _tmp0_;
77 	return result;
78 }
79 
80 static gpointer
_vala_comment_ref0(gpointer self)81 _vala_comment_ref0 (gpointer self)
82 {
83 	return self ? vala_comment_ref (self) : NULL;
84 }
85 
86 void
vala_gir_comment_set_return_content(ValaGirComment * self,ValaComment * value)87 vala_gir_comment_set_return_content (ValaGirComment* self,
88                                      ValaComment* value)
89 {
90 	ValaComment* _tmp0_;
91 	g_return_if_fail (self != NULL);
92 	_tmp0_ = _vala_comment_ref0 (value);
93 	_vala_comment_unref0 (self->priv->_return_content);
94 	self->priv->_return_content = _tmp0_;
95 }
96 
97 ValaGirComment*
vala_gir_comment_construct(GType object_type,const gchar * comment,ValaSourceReference * _source_reference)98 vala_gir_comment_construct (GType object_type,
99                             const gchar* comment,
100                             ValaSourceReference* _source_reference)
101 {
102 	ValaGirComment* self = NULL;
103 	const gchar* _tmp0_ = NULL;
104 	g_return_val_if_fail (_source_reference != NULL, NULL);
105 	_tmp0_ = comment;
106 	if (_tmp0_ == NULL) {
107 		_tmp0_ = "";
108 	}
109 	self = (ValaGirComment*) vala_comment_construct (object_type, _tmp0_, _source_reference);
110 	return self;
111 }
112 
113 ValaGirComment*
vala_gir_comment_new(const gchar * comment,ValaSourceReference * _source_reference)114 vala_gir_comment_new (const gchar* comment,
115                       ValaSourceReference* _source_reference)
116 {
117 	return vala_gir_comment_construct (VALA_TYPE_GIR_COMMENT, comment, _source_reference);
118 }
119 
120 G_GNUC_INTERNAL void
vala_gir_comment_add_content_for_parameter(ValaGirComment * self,const gchar * name,ValaComment * comment)121 vala_gir_comment_add_content_for_parameter (ValaGirComment* self,
122                                             const gchar* name,
123                                             ValaComment* comment)
124 {
125 	ValaHashMap* _tmp0_;
126 	g_return_if_fail (self != NULL);
127 	g_return_if_fail (name != NULL);
128 	g_return_if_fail (comment != NULL);
129 	_tmp0_ = self->priv->parameter_content;
130 	vala_map_set ((ValaMap*) _tmp0_, name, comment);
131 }
132 
133 ValaComment*
vala_gir_comment_get_content_for_parameter(ValaGirComment * self,const gchar * name)134 vala_gir_comment_get_content_for_parameter (ValaGirComment* self,
135                                             const gchar* name)
136 {
137 	ValaHashMap* _tmp0_;
138 	gpointer _tmp1_;
139 	ValaComment* result = NULL;
140 	g_return_val_if_fail (self != NULL, NULL);
141 	g_return_val_if_fail (name != NULL, NULL);
142 	_tmp0_ = self->priv->parameter_content;
143 	_tmp1_ = vala_map_get ((ValaMap*) _tmp0_, name);
144 	result = (ValaComment*) _tmp1_;
145 	return result;
146 }
147 
148 static void
vala_gir_comment_class_init(ValaGirCommentClass * klass,gpointer klass_data)149 vala_gir_comment_class_init (ValaGirCommentClass * klass,
150                              gpointer klass_data)
151 {
152 	vala_gir_comment_parent_class = g_type_class_peek_parent (klass);
153 	((ValaCommentClass *) klass)->finalize = vala_gir_comment_finalize;
154 	g_type_class_adjust_private_offset (klass, &ValaGirComment_private_offset);
155 }
156 
157 static void
vala_gir_comment_instance_init(ValaGirComment * self,gpointer klass)158 vala_gir_comment_instance_init (ValaGirComment * self,
159                                 gpointer klass)
160 {
161 	GHashFunc _tmp0_;
162 	GEqualFunc _tmp1_;
163 	GEqualFunc _tmp2_;
164 	ValaHashMap* _tmp3_;
165 	self->priv = vala_gir_comment_get_instance_private (self);
166 	_tmp0_ = g_direct_hash;
167 	_tmp1_ = g_direct_equal;
168 	_tmp2_ = g_direct_equal;
169 	_tmp3_ = vala_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, VALA_TYPE_COMMENT, (GBoxedCopyFunc) vala_comment_ref, (GDestroyNotify) vala_comment_unref, _tmp0_, _tmp1_, _tmp2_);
170 	self->priv->parameter_content = _tmp3_;
171 }
172 
173 static void
vala_gir_comment_finalize(ValaComment * obj)174 vala_gir_comment_finalize (ValaComment * obj)
175 {
176 	ValaGirComment * self;
177 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_GIR_COMMENT, ValaGirComment);
178 	_vala_map_unref0 (self->priv->parameter_content);
179 	_vala_comment_unref0 (self->priv->_return_content);
180 	VALA_COMMENT_CLASS (vala_gir_comment_parent_class)->finalize (obj);
181 }
182 
183 /**
184  * A documentation comment used by valadoc
185  */
186 static GType
vala_gir_comment_get_type_once(void)187 vala_gir_comment_get_type_once (void)
188 {
189 	static const GTypeInfo g_define_type_info = { sizeof (ValaGirCommentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_gir_comment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaGirComment), 0, (GInstanceInitFunc) vala_gir_comment_instance_init, NULL };
190 	GType vala_gir_comment_type_id;
191 	vala_gir_comment_type_id = g_type_register_static (VALA_TYPE_COMMENT, "ValaGirComment", &g_define_type_info, 0);
192 	ValaGirComment_private_offset = g_type_add_instance_private (vala_gir_comment_type_id, sizeof (ValaGirCommentPrivate));
193 	return vala_gir_comment_type_id;
194 }
195 
196 GType
vala_gir_comment_get_type(void)197 vala_gir_comment_get_type (void)
198 {
199 	static volatile gsize vala_gir_comment_type_id__volatile = 0;
200 	if (g_once_init_enter (&vala_gir_comment_type_id__volatile)) {
201 		GType vala_gir_comment_type_id;
202 		vala_gir_comment_type_id = vala_gir_comment_get_type_once ();
203 		g_once_init_leave (&vala_gir_comment_type_id__volatile, vala_gir_comment_type_id);
204 	}
205 	return vala_gir_comment_type_id__volatile;
206 }
207 
208