~ubuntu-branches/ubuntu/raring/vala-0.20/raring-proposed

« back to all changes in this revision

Viewing changes to ccode/valaccodeparameter.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-04-05 13:45:05 UTC
  • Revision ID: package-import@ubuntu.com-20130405134505-yyk3rec9904i7p8o
Tags: upstream-0.20.1
ImportĀ upstreamĀ versionĀ 0.20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* valaccodeparameter.c generated by valac, the Vala compiler
 
2
 * generated from valaccodeparameter.vala, do not modify */
 
3
 
 
4
/* valaccodeparameter.vala
 
5
 *
 
6
 * Copyright (C) 2006-2008  JĆ¼rg Billeter
 
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
 *      JĆ¼rg Billeter <j@bitron.ch>
 
24
 */
 
25
 
 
26
#include <glib.h>
 
27
#include <glib-object.h>
 
28
#include <stdlib.h>
 
29
#include <string.h>
 
30
 
 
31
 
 
32
#define VALA_TYPE_CCODE_NODE (vala_ccode_node_get_type ())
 
33
#define VALA_CCODE_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CCODE_NODE, ValaCCodeNode))
 
34
#define VALA_CCODE_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CCODE_NODE, ValaCCodeNodeClass))
 
35
#define VALA_IS_CCODE_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CCODE_NODE))
 
36
#define VALA_IS_CCODE_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CCODE_NODE))
 
37
#define VALA_CCODE_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CCODE_NODE, ValaCCodeNodeClass))
 
38
 
 
39
typedef struct _ValaCCodeNode ValaCCodeNode;
 
40
typedef struct _ValaCCodeNodeClass ValaCCodeNodeClass;
 
41
typedef struct _ValaCCodeNodePrivate ValaCCodeNodePrivate;
 
42
 
 
43
#define VALA_TYPE_CCODE_WRITER (vala_ccode_writer_get_type ())
 
44
#define VALA_CCODE_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CCODE_WRITER, ValaCCodeWriter))
 
45
#define VALA_CCODE_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CCODE_WRITER, ValaCCodeWriterClass))
 
46
#define VALA_IS_CCODE_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CCODE_WRITER))
 
47
#define VALA_IS_CCODE_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CCODE_WRITER))
 
48
#define VALA_CCODE_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CCODE_WRITER, ValaCCodeWriterClass))
 
49
 
 
50
typedef struct _ValaCCodeWriter ValaCCodeWriter;
 
51
typedef struct _ValaCCodeWriterClass ValaCCodeWriterClass;
 
52
 
 
53
#define VALA_TYPE_CCODE_PARAMETER (vala_ccode_parameter_get_type ())
 
54
#define VALA_CCODE_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CCODE_PARAMETER, ValaCCodeParameter))
 
55
#define VALA_CCODE_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CCODE_PARAMETER, ValaCCodeParameterClass))
 
56
#define VALA_IS_CCODE_PARAMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CCODE_PARAMETER))
 
57
#define VALA_IS_CCODE_PARAMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CCODE_PARAMETER))
 
58
#define VALA_CCODE_PARAMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CCODE_PARAMETER, ValaCCodeParameterClass))
 
59
 
 
60
typedef struct _ValaCCodeParameter ValaCCodeParameter;
 
61
typedef struct _ValaCCodeParameterClass ValaCCodeParameterClass;
 
62
typedef struct _ValaCCodeParameterPrivate ValaCCodeParameterPrivate;
 
63
#define _g_free0(var) (var = (g_free (var), NULL))
 
64
 
 
65
struct _ValaCCodeNode {
 
66
        GTypeInstance parent_instance;
 
67
        volatile int ref_count;
 
68
        ValaCCodeNodePrivate * priv;
 
69
};
 
70
 
 
71
struct _ValaCCodeNodeClass {
 
72
        GTypeClass parent_class;
 
73
        void (*finalize) (ValaCCodeNode *self);
 
74
        void (*write) (ValaCCodeNode* self, ValaCCodeWriter* writer);
 
75
        void (*write_declaration) (ValaCCodeNode* self, ValaCCodeWriter* writer);
 
76
        void (*write_combined) (ValaCCodeNode* self, ValaCCodeWriter* writer);
 
77
};
 
78
 
 
79
struct _ValaCCodeParameter {
 
80
        ValaCCodeNode parent_instance;
 
81
        ValaCCodeParameterPrivate * priv;
 
82
};
 
83
 
 
84
struct _ValaCCodeParameterClass {
 
85
        ValaCCodeNodeClass parent_class;
 
86
};
 
87
 
 
88
struct _ValaCCodeParameterPrivate {
 
89
        gchar* _name;
 
90
        gchar* _type_name;
 
91
        gboolean _ellipsis;
 
92
};
 
93
 
 
94
 
 
95
static gpointer vala_ccode_parameter_parent_class = NULL;
 
96
 
 
97
gpointer vala_ccode_node_ref (gpointer instance);
 
98
void vala_ccode_node_unref (gpointer instance);
 
99
GParamSpec* vala_param_spec_ccode_node (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
100
void vala_value_set_ccode_node (GValue* value, gpointer v_object);
 
101
void vala_value_take_ccode_node (GValue* value, gpointer v_object);
 
102
gpointer vala_value_get_ccode_node (const GValue* value);
 
103
GType vala_ccode_node_get_type (void) G_GNUC_CONST;
 
104
gpointer vala_ccode_writer_ref (gpointer instance);
 
105
void vala_ccode_writer_unref (gpointer instance);
 
106
GParamSpec* vala_param_spec_ccode_writer (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
107
void vala_value_set_ccode_writer (GValue* value, gpointer v_object);
 
108
void vala_value_take_ccode_writer (GValue* value, gpointer v_object);
 
109
gpointer vala_value_get_ccode_writer (const GValue* value);
 
110
GType vala_ccode_writer_get_type (void) G_GNUC_CONST;
 
111
GType vala_ccode_parameter_get_type (void) G_GNUC_CONST;
 
112
#define VALA_CCODE_PARAMETER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_CCODE_PARAMETER, ValaCCodeParameterPrivate))
 
113
enum  {
 
114
        VALA_CCODE_PARAMETER_DUMMY_PROPERTY
 
115
};
 
116
ValaCCodeParameter* vala_ccode_parameter_new (const gchar* n, const gchar* type);
 
117
ValaCCodeParameter* vala_ccode_parameter_construct (GType object_type, const gchar* n, const gchar* type);
 
118
ValaCCodeNode* vala_ccode_node_construct (GType object_type);
 
119
void vala_ccode_parameter_set_name (ValaCCodeParameter* self, const gchar* value);
 
120
void vala_ccode_parameter_set_type_name (ValaCCodeParameter* self, const gchar* value);
 
121
ValaCCodeParameter* vala_ccode_parameter_new_with_ellipsis (void);
 
122
ValaCCodeParameter* vala_ccode_parameter_construct_with_ellipsis (GType object_type);
 
123
void vala_ccode_parameter_set_ellipsis (ValaCCodeParameter* self, gboolean value);
 
124
static void vala_ccode_parameter_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer);
 
125
gboolean vala_ccode_parameter_get_ellipsis (ValaCCodeParameter* self);
 
126
void vala_ccode_writer_write_string (ValaCCodeWriter* self, const gchar* s);
 
127
const gchar* vala_ccode_parameter_get_type_name (ValaCCodeParameter* self);
 
128
const gchar* vala_ccode_parameter_get_name (ValaCCodeParameter* self);
 
129
static void vala_ccode_parameter_finalize (ValaCCodeNode* obj);
 
130
 
 
131
 
 
132
ValaCCodeParameter* vala_ccode_parameter_construct (GType object_type, const gchar* n, const gchar* type) {
 
133
        ValaCCodeParameter* self = NULL;
 
134
        const gchar* _tmp0_;
 
135
        const gchar* _tmp1_;
 
136
        g_return_val_if_fail (n != NULL, NULL);
 
137
        g_return_val_if_fail (type != NULL, NULL);
 
138
        self = (ValaCCodeParameter*) vala_ccode_node_construct (object_type);
 
139
        _tmp0_ = n;
 
140
        vala_ccode_parameter_set_name (self, _tmp0_);
 
141
        _tmp1_ = type;
 
142
        vala_ccode_parameter_set_type_name (self, _tmp1_);
 
143
        return self;
 
144
}
 
145
 
 
146
 
 
147
ValaCCodeParameter* vala_ccode_parameter_new (const gchar* n, const gchar* type) {
 
148
        return vala_ccode_parameter_construct (VALA_TYPE_CCODE_PARAMETER, n, type);
 
149
}
 
150
 
 
151
 
 
152
ValaCCodeParameter* vala_ccode_parameter_construct_with_ellipsis (GType object_type) {
 
153
        ValaCCodeParameter* self = NULL;
 
154
        self = (ValaCCodeParameter*) vala_ccode_node_construct (object_type);
 
155
        vala_ccode_parameter_set_ellipsis (self, TRUE);
 
156
        return self;
 
157
}
 
158
 
 
159
 
 
160
ValaCCodeParameter* vala_ccode_parameter_new_with_ellipsis (void) {
 
161
        return vala_ccode_parameter_construct_with_ellipsis (VALA_TYPE_CCODE_PARAMETER);
 
162
}
 
163
 
 
164
 
 
165
static void vala_ccode_parameter_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
 
166
        ValaCCodeParameter * self;
 
167
        gboolean _tmp0_;
 
168
        self = (ValaCCodeParameter*) base;
 
169
        g_return_if_fail (writer != NULL);
 
170
        _tmp0_ = self->priv->_ellipsis;
 
171
        if (!_tmp0_) {
 
172
                ValaCCodeWriter* _tmp1_;
 
173
                const gchar* _tmp2_;
 
174
                ValaCCodeWriter* _tmp3_;
 
175
                ValaCCodeWriter* _tmp4_;
 
176
                const gchar* _tmp5_;
 
177
                _tmp1_ = writer;
 
178
                _tmp2_ = self->priv->_type_name;
 
179
                vala_ccode_writer_write_string (_tmp1_, _tmp2_);
 
180
                _tmp3_ = writer;
 
181
                vala_ccode_writer_write_string (_tmp3_, " ");
 
182
                _tmp4_ = writer;
 
183
                _tmp5_ = self->priv->_name;
 
184
                vala_ccode_writer_write_string (_tmp4_, _tmp5_);
 
185
        } else {
 
186
                ValaCCodeWriter* _tmp6_;
 
187
                _tmp6_ = writer;
 
188
                vala_ccode_writer_write_string (_tmp6_, "...");
 
189
        }
 
190
}
 
191
 
 
192
 
 
193
const gchar* vala_ccode_parameter_get_name (ValaCCodeParameter* self) {
 
194
        const gchar* result;
 
195
        const gchar* _tmp0_;
 
196
        g_return_val_if_fail (self != NULL, NULL);
 
197
        _tmp0_ = self->priv->_name;
 
198
        result = _tmp0_;
 
199
        return result;
 
200
}
 
201
 
 
202
 
 
203
void vala_ccode_parameter_set_name (ValaCCodeParameter* self, const gchar* value) {
 
204
        const gchar* _tmp0_;
 
205
        gchar* _tmp1_;
 
206
        g_return_if_fail (self != NULL);
 
207
        _tmp0_ = value;
 
208
        _tmp1_ = g_strdup (_tmp0_);
 
209
        _g_free0 (self->priv->_name);
 
210
        self->priv->_name = _tmp1_;
 
211
}
 
212
 
 
213
 
 
214
const gchar* vala_ccode_parameter_get_type_name (ValaCCodeParameter* self) {
 
215
        const gchar* result;
 
216
        const gchar* _tmp0_;
 
217
        g_return_val_if_fail (self != NULL, NULL);
 
218
        _tmp0_ = self->priv->_type_name;
 
219
        result = _tmp0_;
 
220
        return result;
 
221
}
 
222
 
 
223
 
 
224
void vala_ccode_parameter_set_type_name (ValaCCodeParameter* self, const gchar* value) {
 
225
        const gchar* _tmp0_;
 
226
        gchar* _tmp1_;
 
227
        g_return_if_fail (self != NULL);
 
228
        _tmp0_ = value;
 
229
        _tmp1_ = g_strdup (_tmp0_);
 
230
        _g_free0 (self->priv->_type_name);
 
231
        self->priv->_type_name = _tmp1_;
 
232
}
 
233
 
 
234
 
 
235
gboolean vala_ccode_parameter_get_ellipsis (ValaCCodeParameter* self) {
 
236
        gboolean result;
 
237
        gboolean _tmp0_;
 
238
        g_return_val_if_fail (self != NULL, FALSE);
 
239
        _tmp0_ = self->priv->_ellipsis;
 
240
        result = _tmp0_;
 
241
        return result;
 
242
}
 
243
 
 
244
 
 
245
void vala_ccode_parameter_set_ellipsis (ValaCCodeParameter* self, gboolean value) {
 
246
        gboolean _tmp0_;
 
247
        g_return_if_fail (self != NULL);
 
248
        _tmp0_ = value;
 
249
        self->priv->_ellipsis = _tmp0_;
 
250
}
 
251
 
 
252
 
 
253
static void vala_ccode_parameter_class_init (ValaCCodeParameterClass * klass) {
 
254
        vala_ccode_parameter_parent_class = g_type_class_peek_parent (klass);
 
255
        VALA_CCODE_NODE_CLASS (klass)->finalize = vala_ccode_parameter_finalize;
 
256
        g_type_class_add_private (klass, sizeof (ValaCCodeParameterPrivate));
 
257
        VALA_CCODE_NODE_CLASS (klass)->write = vala_ccode_parameter_real_write;
 
258
}
 
259
 
 
260
 
 
261
static void vala_ccode_parameter_instance_init (ValaCCodeParameter * self) {
 
262
        self->priv = VALA_CCODE_PARAMETER_GET_PRIVATE (self);
 
263
}
 
264
 
 
265
 
 
266
static void vala_ccode_parameter_finalize (ValaCCodeNode* obj) {
 
267
        ValaCCodeParameter * self;
 
268
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_CCODE_PARAMETER, ValaCCodeParameter);
 
269
        _g_free0 (self->priv->_name);
 
270
        _g_free0 (self->priv->_type_name);
 
271
        VALA_CCODE_NODE_CLASS (vala_ccode_parameter_parent_class)->finalize (obj);
 
272
}
 
273
 
 
274
 
 
275
/**
 
276
 * Represents a formal parameter in a C method signature.
 
277
 */
 
278
GType vala_ccode_parameter_get_type (void) {
 
279
        static volatile gsize vala_ccode_parameter_type_id__volatile = 0;
 
280
        if (g_once_init_enter (&vala_ccode_parameter_type_id__volatile)) {
 
281
                static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeParameterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_parameter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeParameter), 0, (GInstanceInitFunc) vala_ccode_parameter_instance_init, NULL };
 
282
                GType vala_ccode_parameter_type_id;
 
283
                vala_ccode_parameter_type_id = g_type_register_static (VALA_TYPE_CCODE_NODE, "ValaCCodeParameter", &g_define_type_info, 0);
 
284
                g_once_init_leave (&vala_ccode_parameter_type_id__volatile, vala_ccode_parameter_type_id);
 
285
        }
 
286
        return vala_ccode_parameter_type_id__volatile;
 
287
}
 
288
 
 
289
 
 
290