1 /* text.c generated by valac, the Vala compiler
2  * generated from text.vala, do not modify */
3 
4 /* text.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 <stdlib.h>
29 #include <string.h>
30 #include <glib.h>
31 
32 enum  {
33 	VALADOC_CONTENT_TEXT_0_PROPERTY,
34 	VALADOC_CONTENT_TEXT_CONTENT_PROPERTY,
35 	VALADOC_CONTENT_TEXT_NUM_PROPERTIES
36 };
37 static GParamSpec* valadoc_content_text_properties[VALADOC_CONTENT_TEXT_NUM_PROPERTIES];
38 #define _g_free0(var) (var = (g_free (var), NULL))
39 
40 struct _ValadocContentTextPrivate {
41 	gchar* _content;
42 };
43 
44 static gint ValadocContentText_private_offset;
45 static gpointer valadoc_content_text_parent_class = NULL;
46 static ValadocContentInlineIface * valadoc_content_text_valadoc_content_inline_parent_iface = NULL;
47 
48 G_GNUC_INTERNAL ValadocContentText* valadoc_content_text_new (const gchar* text);
49 G_GNUC_INTERNAL ValadocContentText* valadoc_content_text_construct (GType object_type,
50                                                     const gchar* text);
51 static void valadoc_content_text_real_check (ValadocContentContentElement* base,
52                                       ValadocApiTree* api_root,
53                                       ValadocApiNode* container,
54                                       const gchar* file_path,
55                                       ValadocErrorReporter* reporter,
56                                       ValadocSettings* settings);
57 static void valadoc_content_text_real_accept (ValadocContentContentElement* base,
58                                        ValadocContentContentVisitor* visitor);
59 static gboolean valadoc_content_text_real_is_empty (ValadocContentContentElement* base);
60 static ValadocContentContentElement* valadoc_content_text_real_copy (ValadocContentContentElement* base,
61                                                               ValadocContentContentElement* new_parent);
62 G_GNUC_INTERNAL void valadoc_content_content_element_set_parent (ValadocContentContentElement* self,
63                                                  ValadocContentContentElement* value);
64 static GObject * valadoc_content_text_constructor (GType type,
65                                             guint n_construct_properties,
66                                             GObjectConstructParam * construct_properties);
67 static void valadoc_content_text_finalize (GObject * obj);
68 static GType valadoc_content_text_get_type_once (void);
69 static void _vala_valadoc_content_text_get_property (GObject * object,
70                                               guint property_id,
71                                               GValue * value,
72                                               GParamSpec * pspec);
73 static void _vala_valadoc_content_text_set_property (GObject * object,
74                                               guint property_id,
75                                               const GValue * value,
76                                               GParamSpec * pspec);
77 
78 static inline gpointer
valadoc_content_text_get_instance_private(ValadocContentText * self)79 valadoc_content_text_get_instance_private (ValadocContentText* self)
80 {
81 	return G_STRUCT_MEMBER_P (self, ValadocContentText_private_offset);
82 }
83 
84 const gchar*
valadoc_content_text_get_content(ValadocContentText * self)85 valadoc_content_text_get_content (ValadocContentText* self)
86 {
87 	const gchar* result;
88 	const gchar* _tmp0_;
89 	g_return_val_if_fail (self != NULL, NULL);
90 	_tmp0_ = self->priv->_content;
91 	result = _tmp0_;
92 	return result;
93 }
94 
95 void
valadoc_content_text_set_content(ValadocContentText * self,const gchar * value)96 valadoc_content_text_set_content (ValadocContentText* self,
97                                   const gchar* value)
98 {
99 	gchar* old_value;
100 	g_return_if_fail (self != NULL);
101 	old_value = valadoc_content_text_get_content (self);
102 	if (g_strcmp0 (value, old_value) != 0) {
103 		gchar* _tmp0_;
104 		_tmp0_ = g_strdup (value);
105 		_g_free0 (self->priv->_content);
106 		self->priv->_content = _tmp0_;
107 		g_object_notify_by_pspec ((GObject *) self, valadoc_content_text_properties[VALADOC_CONTENT_TEXT_CONTENT_PROPERTY]);
108 	}
109 }
110 
111 G_GNUC_INTERNAL ValadocContentText*
valadoc_content_text_construct(GType object_type,const gchar * text)112 valadoc_content_text_construct (GType object_type,
113                                 const gchar* text)
114 {
115 	ValadocContentText * self = NULL;
116 	self = (ValadocContentText*) valadoc_content_content_element_construct (object_type);
117 	if (text != NULL) {
118 		gchar* _tmp0_;
119 		_tmp0_ = g_strdup (text);
120 		_g_free0 (self->priv->_content);
121 		self->priv->_content = _tmp0_;
122 	}
123 	return self;
124 }
125 
126 G_GNUC_INTERNAL ValadocContentText*
valadoc_content_text_new(const gchar * text)127 valadoc_content_text_new (const gchar* text)
128 {
129 	return valadoc_content_text_construct (VALADOC_CONTENT_TYPE_TEXT, text);
130 }
131 
132 static void
valadoc_content_text_real_check(ValadocContentContentElement * base,ValadocApiTree * api_root,ValadocApiNode * container,const gchar * file_path,ValadocErrorReporter * reporter,ValadocSettings * settings)133 valadoc_content_text_real_check (ValadocContentContentElement* base,
134                                  ValadocApiTree* api_root,
135                                  ValadocApiNode* container,
136                                  const gchar* file_path,
137                                  ValadocErrorReporter* reporter,
138                                  ValadocSettings* settings)
139 {
140 	ValadocContentText * self;
141 	self = (ValadocContentText*) base;
142 	g_return_if_fail (api_root != NULL);
143 	g_return_if_fail (container != NULL);
144 	g_return_if_fail (file_path != NULL);
145 	g_return_if_fail (reporter != NULL);
146 	g_return_if_fail (settings != NULL);
147 }
148 
149 static void
valadoc_content_text_real_accept(ValadocContentContentElement * base,ValadocContentContentVisitor * visitor)150 valadoc_content_text_real_accept (ValadocContentContentElement* base,
151                                   ValadocContentContentVisitor* visitor)
152 {
153 	ValadocContentText * self;
154 	self = (ValadocContentText*) base;
155 	g_return_if_fail (visitor != NULL);
156 	valadoc_content_content_visitor_visit_text (visitor, self);
157 }
158 
159 static gboolean
valadoc_content_text_real_is_empty(ValadocContentContentElement * base)160 valadoc_content_text_real_is_empty (ValadocContentContentElement* base)
161 {
162 	ValadocContentText * self;
163 	const gchar* _tmp0_;
164 	gboolean result = FALSE;
165 	self = (ValadocContentText*) base;
166 	_tmp0_ = self->priv->_content;
167 	result = g_strcmp0 (_tmp0_, "") == 0;
168 	return result;
169 }
170 
171 static ValadocContentContentElement*
valadoc_content_text_real_copy(ValadocContentContentElement * base,ValadocContentContentElement * new_parent)172 valadoc_content_text_real_copy (ValadocContentContentElement* base,
173                                 ValadocContentContentElement* new_parent)
174 {
175 	ValadocContentText * self;
176 	ValadocContentText* text = NULL;
177 	const gchar* _tmp0_;
178 	ValadocContentText* _tmp1_;
179 	ValadocContentContentElement* result = NULL;
180 	self = (ValadocContentText*) base;
181 	_tmp0_ = self->priv->_content;
182 	_tmp1_ = valadoc_content_text_new (_tmp0_);
183 	text = _tmp1_;
184 	valadoc_content_content_element_set_parent ((ValadocContentContentElement*) text, new_parent);
185 	result = (ValadocContentContentElement*) text;
186 	return result;
187 }
188 
189 static GObject *
valadoc_content_text_constructor(GType type,guint n_construct_properties,GObjectConstructParam * construct_properties)190 valadoc_content_text_constructor (GType type,
191                                   guint n_construct_properties,
192                                   GObjectConstructParam * construct_properties)
193 {
194 	GObject * obj;
195 	GObjectClass * parent_class;
196 	ValadocContentText * self;
197 	gchar* _tmp0_;
198 	parent_class = G_OBJECT_CLASS (valadoc_content_text_parent_class);
199 	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
200 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_CONTENT_TYPE_TEXT, ValadocContentText);
201 	_tmp0_ = g_strdup ("");
202 	_g_free0 (self->priv->_content);
203 	self->priv->_content = _tmp0_;
204 	return obj;
205 }
206 
207 static void
valadoc_content_text_class_init(ValadocContentTextClass * klass,gpointer klass_data)208 valadoc_content_text_class_init (ValadocContentTextClass * klass,
209                                  gpointer klass_data)
210 {
211 	valadoc_content_text_parent_class = g_type_class_peek_parent (klass);
212 	g_type_class_adjust_private_offset (klass, &ValadocContentText_private_offset);
213 	((ValadocContentContentElementClass *) klass)->check = (void (*) (ValadocContentContentElement*, ValadocApiTree*, ValadocApiNode*, const gchar*, ValadocErrorReporter*, ValadocSettings*)) valadoc_content_text_real_check;
214 	((ValadocContentContentElementClass *) klass)->accept = (void (*) (ValadocContentContentElement*, ValadocContentContentVisitor*)) valadoc_content_text_real_accept;
215 	((ValadocContentContentElementClass *) klass)->is_empty = (gboolean (*) (ValadocContentContentElement*)) valadoc_content_text_real_is_empty;
216 	((ValadocContentContentElementClass *) klass)->copy = (ValadocContentContentElement* (*) (ValadocContentContentElement*, ValadocContentContentElement*)) valadoc_content_text_real_copy;
217 	G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_content_text_get_property;
218 	G_OBJECT_CLASS (klass)->set_property = _vala_valadoc_content_text_set_property;
219 	G_OBJECT_CLASS (klass)->constructor = valadoc_content_text_constructor;
220 	G_OBJECT_CLASS (klass)->finalize = valadoc_content_text_finalize;
221 	g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_CONTENT_TEXT_CONTENT_PROPERTY, valadoc_content_text_properties[VALADOC_CONTENT_TEXT_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
222 }
223 
224 static void
valadoc_content_text_valadoc_content_inline_interface_init(ValadocContentInlineIface * iface,gpointer iface_data)225 valadoc_content_text_valadoc_content_inline_interface_init (ValadocContentInlineIface * iface,
226                                                             gpointer iface_data)
227 {
228 	valadoc_content_text_valadoc_content_inline_parent_iface = g_type_interface_peek_parent (iface);
229 }
230 
231 static void
valadoc_content_text_instance_init(ValadocContentText * self,gpointer klass)232 valadoc_content_text_instance_init (ValadocContentText * self,
233                                     gpointer klass)
234 {
235 	self->priv = valadoc_content_text_get_instance_private (self);
236 }
237 
238 static void
valadoc_content_text_finalize(GObject * obj)239 valadoc_content_text_finalize (GObject * obj)
240 {
241 	ValadocContentText * self;
242 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_CONTENT_TYPE_TEXT, ValadocContentText);
243 	_g_free0 (self->priv->_content);
244 	G_OBJECT_CLASS (valadoc_content_text_parent_class)->finalize (obj);
245 }
246 
247 static GType
valadoc_content_text_get_type_once(void)248 valadoc_content_text_get_type_once (void)
249 {
250 	static const GTypeInfo g_define_type_info = { sizeof (ValadocContentTextClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_content_text_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocContentText), 0, (GInstanceInitFunc) valadoc_content_text_instance_init, NULL };
251 	static const GInterfaceInfo valadoc_content_inline_info = { (GInterfaceInitFunc) valadoc_content_text_valadoc_content_inline_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
252 	GType valadoc_content_text_type_id;
253 	valadoc_content_text_type_id = g_type_register_static (VALADOC_CONTENT_TYPE_CONTENT_ELEMENT, "ValadocContentText", &g_define_type_info, 0);
254 	g_type_add_interface_static (valadoc_content_text_type_id, VALADOC_CONTENT_TYPE_INLINE, &valadoc_content_inline_info);
255 	ValadocContentText_private_offset = g_type_add_instance_private (valadoc_content_text_type_id, sizeof (ValadocContentTextPrivate));
256 	return valadoc_content_text_type_id;
257 }
258 
259 GType
valadoc_content_text_get_type(void)260 valadoc_content_text_get_type (void)
261 {
262 	static volatile gsize valadoc_content_text_type_id__volatile = 0;
263 	if (g_once_init_enter (&valadoc_content_text_type_id__volatile)) {
264 		GType valadoc_content_text_type_id;
265 		valadoc_content_text_type_id = valadoc_content_text_get_type_once ();
266 		g_once_init_leave (&valadoc_content_text_type_id__volatile, valadoc_content_text_type_id);
267 	}
268 	return valadoc_content_text_type_id__volatile;
269 }
270 
271 static void
_vala_valadoc_content_text_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)272 _vala_valadoc_content_text_get_property (GObject * object,
273                                          guint property_id,
274                                          GValue * value,
275                                          GParamSpec * pspec)
276 {
277 	ValadocContentText * self;
278 	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_CONTENT_TYPE_TEXT, ValadocContentText);
279 	switch (property_id) {
280 		case VALADOC_CONTENT_TEXT_CONTENT_PROPERTY:
281 		g_value_set_string (value, valadoc_content_text_get_content (self));
282 		break;
283 		default:
284 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
285 		break;
286 	}
287 }
288 
289 static void
_vala_valadoc_content_text_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)290 _vala_valadoc_content_text_set_property (GObject * object,
291                                          guint property_id,
292                                          const GValue * value,
293                                          GParamSpec * pspec)
294 {
295 	ValadocContentText * self;
296 	self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_CONTENT_TYPE_TEXT, ValadocContentText);
297 	switch (property_id) {
298 		case VALADOC_CONTENT_TEXT_CONTENT_PROPERTY:
299 		valadoc_content_text_set_content (self, g_value_get_string (value));
300 		break;
301 		default:
302 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
303 		break;
304 	}
305 }
306 
307