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

« back to all changes in this revision

Viewing changes to codegen/valaenumregisterfunction.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
/* valaenumregisterfunction.c generated by valac, the Vala compiler
 
2
 * generated from valaenumregisterfunction.vala, do not modify */
 
3
 
 
4
/* valaenumregisterfunction.vala
 
5
 *
 
6
 * Copyright (C) 2008  Jürg Billeter
 
7
 * Copyright (C) 2010  Marc-Andre Lureau
 
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
 *      Jürg Billeter <j@bitron.ch>
 
25
 */
 
26
 
 
27
#include <glib.h>
 
28
#include <glib-object.h>
 
29
#include <vala.h>
 
30
#include <stdlib.h>
 
31
#include <string.h>
 
32
#include <valaccode.h>
 
33
 
 
34
 
 
35
#define VALA_TYPE_TYPEREGISTER_FUNCTION (vala_typeregister_function_get_type ())
 
36
#define VALA_TYPEREGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_TYPEREGISTER_FUNCTION, ValaTypeRegisterFunction))
 
37
#define VALA_TYPEREGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_TYPEREGISTER_FUNCTION, ValaTypeRegisterFunctionClass))
 
38
#define VALA_IS_TYPEREGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_TYPEREGISTER_FUNCTION))
 
39
#define VALA_IS_TYPEREGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_TYPEREGISTER_FUNCTION))
 
40
#define VALA_TYPEREGISTER_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_TYPEREGISTER_FUNCTION, ValaTypeRegisterFunctionClass))
 
41
 
 
42
typedef struct _ValaTypeRegisterFunction ValaTypeRegisterFunction;
 
43
typedef struct _ValaTypeRegisterFunctionClass ValaTypeRegisterFunctionClass;
 
44
typedef struct _ValaTypeRegisterFunctionPrivate ValaTypeRegisterFunctionPrivate;
 
45
 
 
46
#define VALA_TYPE_ENUM_REGISTER_FUNCTION (vala_enum_register_function_get_type ())
 
47
#define VALA_ENUM_REGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_ENUM_REGISTER_FUNCTION, ValaEnumRegisterFunction))
 
48
#define VALA_ENUM_REGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_ENUM_REGISTER_FUNCTION, ValaEnumRegisterFunctionClass))
 
49
#define VALA_IS_ENUM_REGISTER_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_ENUM_REGISTER_FUNCTION))
 
50
#define VALA_IS_ENUM_REGISTER_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_ENUM_REGISTER_FUNCTION))
 
51
#define VALA_ENUM_REGISTER_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_ENUM_REGISTER_FUNCTION, ValaEnumRegisterFunctionClass))
 
52
 
 
53
typedef struct _ValaEnumRegisterFunction ValaEnumRegisterFunction;
 
54
typedef struct _ValaEnumRegisterFunctionClass ValaEnumRegisterFunctionClass;
 
55
typedef struct _ValaEnumRegisterFunctionPrivate ValaEnumRegisterFunctionPrivate;
 
56
 
 
57
struct _ValaTypeRegisterFunction {
 
58
        GTypeInstance parent_instance;
 
59
        volatile int ref_count;
 
60
        ValaTypeRegisterFunctionPrivate * priv;
 
61
};
 
62
 
 
63
struct _ValaTypeRegisterFunctionClass {
 
64
        GTypeClass parent_class;
 
65
        void (*finalize) (ValaTypeRegisterFunction *self);
 
66
        ValaTypeSymbol* (*get_type_declaration) (ValaTypeRegisterFunction* self);
 
67
        gchar* (*get_type_struct_name) (ValaTypeRegisterFunction* self);
 
68
        gchar* (*get_base_init_func_name) (ValaTypeRegisterFunction* self);
 
69
        gchar* (*get_class_finalize_func_name) (ValaTypeRegisterFunction* self);
 
70
        gchar* (*get_base_finalize_func_name) (ValaTypeRegisterFunction* self);
 
71
        gchar* (*get_class_init_func_name) (ValaTypeRegisterFunction* self);
 
72
        gchar* (*get_instance_struct_size) (ValaTypeRegisterFunction* self);
 
73
        gchar* (*get_instance_init_func_name) (ValaTypeRegisterFunction* self);
 
74
        gchar* (*get_parent_type_name) (ValaTypeRegisterFunction* self);
 
75
        gchar* (*get_gtype_value_table_init_function_name) (ValaTypeRegisterFunction* self);
 
76
        gchar* (*get_gtype_value_table_peek_pointer_function_name) (ValaTypeRegisterFunction* self);
 
77
        gchar* (*get_gtype_value_table_free_function_name) (ValaTypeRegisterFunction* self);
 
78
        gchar* (*get_gtype_value_table_copy_function_name) (ValaTypeRegisterFunction* self);
 
79
        gchar* (*get_gtype_value_table_lcopy_value_function_name) (ValaTypeRegisterFunction* self);
 
80
        gchar* (*get_gtype_value_table_collect_value_function_name) (ValaTypeRegisterFunction* self);
 
81
        gchar* (*get_type_flags) (ValaTypeRegisterFunction* self);
 
82
        ValaCCodeFragment* (*get_type_interface_init_declaration) (ValaTypeRegisterFunction* self);
 
83
        void (*get_type_interface_init_statements) (ValaTypeRegisterFunction* self, ValaCCodeBlock* block, gboolean plugin);
 
84
        ValaSymbolAccessibility (*get_accessibility) (ValaTypeRegisterFunction* self);
 
85
};
 
86
 
 
87
struct _ValaEnumRegisterFunction {
 
88
        ValaTypeRegisterFunction parent_instance;
 
89
        ValaEnumRegisterFunctionPrivate * priv;
 
90
};
 
91
 
 
92
struct _ValaEnumRegisterFunctionClass {
 
93
        ValaTypeRegisterFunctionClass parent_class;
 
94
};
 
95
 
 
96
struct _ValaEnumRegisterFunctionPrivate {
 
97
        ValaEnum* _enum_reference;
 
98
};
 
99
 
 
100
 
 
101
static gpointer vala_enum_register_function_parent_class = NULL;
 
102
 
 
103
gpointer vala_typeregister_function_ref (gpointer instance);
 
104
void vala_typeregister_function_unref (gpointer instance);
 
105
GParamSpec* vala_param_spec_typeregister_function (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
106
void vala_value_set_typeregister_function (GValue* value, gpointer v_object);
 
107
void vala_value_take_typeregister_function (GValue* value, gpointer v_object);
 
108
gpointer vala_value_get_typeregister_function (const GValue* value);
 
109
GType vala_typeregister_function_get_type (void) G_GNUC_CONST;
 
110
GType vala_enum_register_function_get_type (void) G_GNUC_CONST;
 
111
#define VALA_ENUM_REGISTER_FUNCTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_ENUM_REGISTER_FUNCTION, ValaEnumRegisterFunctionPrivate))
 
112
enum  {
 
113
        VALA_ENUM_REGISTER_FUNCTION_DUMMY_PROPERTY
 
114
};
 
115
ValaEnumRegisterFunction* vala_enum_register_function_new (ValaEnum* en, ValaCodeContext* context);
 
116
ValaEnumRegisterFunction* vala_enum_register_function_construct (GType object_type, ValaEnum* en, ValaCodeContext* context);
 
117
ValaTypeRegisterFunction* vala_typeregister_function_construct (GType object_type);
 
118
void vala_enum_register_function_set_enum_reference (ValaEnumRegisterFunction* self, ValaEnum* value);
 
119
void vala_typeregister_function_set_context (ValaTypeRegisterFunction* self, ValaCodeContext* value);
 
120
static ValaTypeSymbol* vala_enum_register_function_real_get_type_declaration (ValaTypeRegisterFunction* base);
 
121
ValaEnum* vala_enum_register_function_get_enum_reference (ValaEnumRegisterFunction* self);
 
122
static ValaSymbolAccessibility vala_enum_register_function_real_get_accessibility (ValaTypeRegisterFunction* base);
 
123
static void vala_enum_register_function_finalize (ValaTypeRegisterFunction* obj);
 
124
 
 
125
 
 
126
/**
 
127
 * Creates a new C function to register the specified enum at runtime.
 
128
 *
 
129
 * @param en an enum
 
130
 * @return   newly created enum register function
 
131
 */
 
132
ValaEnumRegisterFunction* vala_enum_register_function_construct (GType object_type, ValaEnum* en, ValaCodeContext* context) {
 
133
        ValaEnumRegisterFunction* self = NULL;
 
134
        ValaEnum* _tmp0_;
 
135
        ValaCodeContext* _tmp1_;
 
136
        g_return_val_if_fail (en != NULL, NULL);
 
137
        g_return_val_if_fail (context != NULL, NULL);
 
138
        self = (ValaEnumRegisterFunction*) vala_typeregister_function_construct (object_type);
 
139
        _tmp0_ = en;
 
140
        vala_enum_register_function_set_enum_reference (self, _tmp0_);
 
141
        _tmp1_ = context;
 
142
        vala_typeregister_function_set_context ((ValaTypeRegisterFunction*) self, _tmp1_);
 
143
        return self;
 
144
}
 
145
 
 
146
 
 
147
ValaEnumRegisterFunction* vala_enum_register_function_new (ValaEnum* en, ValaCodeContext* context) {
 
148
        return vala_enum_register_function_construct (VALA_TYPE_ENUM_REGISTER_FUNCTION, en, context);
 
149
}
 
150
 
 
151
 
 
152
static gpointer _vala_code_node_ref0 (gpointer self) {
 
153
        return self ? vala_code_node_ref (self) : NULL;
 
154
}
 
155
 
 
156
 
 
157
static ValaTypeSymbol* vala_enum_register_function_real_get_type_declaration (ValaTypeRegisterFunction* base) {
 
158
        ValaEnumRegisterFunction * self;
 
159
        ValaTypeSymbol* result = NULL;
 
160
        ValaEnum* _tmp0_;
 
161
        ValaTypeSymbol* _tmp1_;
 
162
        self = (ValaEnumRegisterFunction*) base;
 
163
        _tmp0_ = self->priv->_enum_reference;
 
164
        _tmp1_ = _vala_code_node_ref0 ((ValaTypeSymbol*) _tmp0_);
 
165
        result = _tmp1_;
 
166
        return result;
 
167
}
 
168
 
 
169
 
 
170
static ValaSymbolAccessibility vala_enum_register_function_real_get_accessibility (ValaTypeRegisterFunction* base) {
 
171
        ValaEnumRegisterFunction * self;
 
172
        ValaSymbolAccessibility result = 0;
 
173
        ValaEnum* _tmp0_;
 
174
        ValaSymbolAccessibility _tmp1_;
 
175
        ValaSymbolAccessibility _tmp2_;
 
176
        self = (ValaEnumRegisterFunction*) base;
 
177
        _tmp0_ = self->priv->_enum_reference;
 
178
        _tmp1_ = vala_symbol_get_access ((ValaSymbol*) _tmp0_);
 
179
        _tmp2_ = _tmp1_;
 
180
        result = _tmp2_;
 
181
        return result;
 
182
}
 
183
 
 
184
 
 
185
ValaEnum* vala_enum_register_function_get_enum_reference (ValaEnumRegisterFunction* self) {
 
186
        ValaEnum* result;
 
187
        ValaEnum* _tmp0_;
 
188
        g_return_val_if_fail (self != NULL, NULL);
 
189
        _tmp0_ = self->priv->_enum_reference;
 
190
        result = _tmp0_;
 
191
        return result;
 
192
}
 
193
 
 
194
 
 
195
void vala_enum_register_function_set_enum_reference (ValaEnumRegisterFunction* self, ValaEnum* value) {
 
196
        ValaEnum* _tmp0_;
 
197
        g_return_if_fail (self != NULL);
 
198
        _tmp0_ = value;
 
199
        self->priv->_enum_reference = _tmp0_;
 
200
}
 
201
 
 
202
 
 
203
static void vala_enum_register_function_class_init (ValaEnumRegisterFunctionClass * klass) {
 
204
        vala_enum_register_function_parent_class = g_type_class_peek_parent (klass);
 
205
        VALA_TYPEREGISTER_FUNCTION_CLASS (klass)->finalize = vala_enum_register_function_finalize;
 
206
        g_type_class_add_private (klass, sizeof (ValaEnumRegisterFunctionPrivate));
 
207
        VALA_TYPEREGISTER_FUNCTION_CLASS (klass)->get_type_declaration = vala_enum_register_function_real_get_type_declaration;
 
208
        VALA_TYPEREGISTER_FUNCTION_CLASS (klass)->get_accessibility = vala_enum_register_function_real_get_accessibility;
 
209
}
 
210
 
 
211
 
 
212
static void vala_enum_register_function_instance_init (ValaEnumRegisterFunction * self) {
 
213
        self->priv = VALA_ENUM_REGISTER_FUNCTION_GET_PRIVATE (self);
 
214
}
 
215
 
 
216
 
 
217
static void vala_enum_register_function_finalize (ValaTypeRegisterFunction* obj) {
 
218
        ValaEnumRegisterFunction * self;
 
219
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_ENUM_REGISTER_FUNCTION, ValaEnumRegisterFunction);
 
220
        VALA_TYPEREGISTER_FUNCTION_CLASS (vala_enum_register_function_parent_class)->finalize (obj);
 
221
}
 
222
 
 
223
 
 
224
/**
 
225
 * C function to register an enum at runtime.
 
226
 */
 
227
GType vala_enum_register_function_get_type (void) {
 
228
        static volatile gsize vala_enum_register_function_type_id__volatile = 0;
 
229
        if (g_once_init_enter (&vala_enum_register_function_type_id__volatile)) {
 
230
                static const GTypeInfo g_define_type_info = { sizeof (ValaEnumRegisterFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_enum_register_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaEnumRegisterFunction), 0, (GInstanceInitFunc) vala_enum_register_function_instance_init, NULL };
 
231
                GType vala_enum_register_function_type_id;
 
232
                vala_enum_register_function_type_id = g_type_register_static (VALA_TYPE_TYPEREGISTER_FUNCTION, "ValaEnumRegisterFunction", &g_define_type_info, 0);
 
233
                g_once_init_leave (&vala_enum_register_function_type_id__volatile, vala_enum_register_function_type_id);
 
234
        }
 
235
        return vala_enum_register_function_type_id__volatile;
 
236
}
 
237
 
 
238
 
 
239