~ubuntu-branches/ubuntu/hardy/vala/hardy

« back to all changes in this revision

Viewing changes to vala/valaswitchstatement.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge, Marc-Andre Lureau, Sebastian Dröge
  • Date: 2007-10-15 14:37:51 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071015143751-zy7hqcyjutdyfkg3
Tags: 0.1.4-1
[ Marc-Andre Lureau ]
* New Upstream Version
* debian/patches:
  + Remove patch no longer needed in 0.1.4
* debian/rules
  + Add xsltproc build dependency for the Vala manual.
  + Add libenchant-dev build dependency for enchant test case.
* debian/control, debian/vala-doc.install:
  + Add a "vala-doc" documentation package.

[ Sebastian Dröge ]
* debian/control:
  + Let vala-doc suggest valac/devhelp and don't depend on libvala0.
* debian/libvala-dev.install:
  + Add the new vapicheck utility.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 * This library is free software; you can redistribute it and/or
6
6
 * modify it under the terms of the GNU Lesser General Public
7
7
 * License as published by the Free Software Foundation; either
8
 
 * version 2 of the License, or (at your option) any later version.
 
8
 * version 2.1 of the License, or (at your option) any later version.
9
9
 
10
10
 * This library is distributed in the hope that it will be useful,
11
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
20
 *      Jürg Billeter <j@bitron.ch>
21
21
 */
22
22
 
23
 
#include "valaswitchstatement.h"
 
23
#include <vala/valaswitchstatement.h>
24
24
#include <gee/arraylist.h>
25
25
#include <gee/list.h>
26
26
#include <gee/readonlycollection.h>
27
27
#include <vala/valaexpression.h>
28
28
#include <vala/valasourcereference.h>
29
 
#include <vala/valaswitchstatement.h>
30
29
#include <vala/valaswitchsection.h>
31
30
#include <vala/valacodevisitor.h>
32
31
 
53
52
 * @param source_reference reference to source code
54
53
 * @return                 newly created switch statement
55
54
 */
56
 
ValaSwitchStatement* vala_switch_statement_new (ValaExpression* expression, ValaSourceReference* source_reference)
57
 
{
 
55
ValaSwitchStatement* vala_switch_statement_new (ValaExpression* expression, ValaSourceReference* source_reference) {
58
56
        GParameter * __params;
59
57
        GParameter * __params_it;
60
58
        ValaSwitchStatement * self;
79
77
 *
80
78
 * @param section a switch section
81
79
 */
82
 
void vala_switch_statement_add_section (ValaSwitchStatement* self, ValaSwitchSection* section)
83
 
{
 
80
void vala_switch_statement_add_section (ValaSwitchStatement* self, ValaSwitchSection* section) {
84
81
        g_return_if_fail (VALA_IS_SWITCH_STATEMENT (self));
85
82
        g_return_if_fail (VALA_IS_SWITCH_SECTION (section));
 
83
        vala_code_node_set_parent_node (VALA_CODE_NODE (section), VALA_CODE_NODE (self));
86
84
        gee_collection_add (GEE_COLLECTION (self->priv->sections), section);
87
85
}
88
86
 
92
90
 *
93
91
 * @return section list
94
92
 */
95
 
GeeCollection* vala_switch_statement_get_sections (ValaSwitchStatement* self)
96
 
{
 
93
GeeCollection* vala_switch_statement_get_sections (ValaSwitchStatement* self) {
97
94
        g_return_val_if_fail (VALA_IS_SWITCH_STATEMENT (self), NULL);
98
95
        return GEE_COLLECTION (gee_read_only_collection_new (g_object_ref, g_object_unref, GEE_COLLECTION (self->priv->sections)));
99
96
}
100
97
 
101
98
 
102
 
static void vala_switch_statement_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor)
103
 
{
 
99
static void vala_switch_statement_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor) {
104
100
        ValaSwitchStatement * self;
105
 
        self = ((ValaSwitchStatement*) base);
 
101
        self = VALA_SWITCH_STATEMENT (base);
106
102
        g_return_if_fail (VALA_IS_CODE_VISITOR (visitor));
107
103
        vala_code_node_accept (VALA_CODE_NODE (vala_switch_statement_get_expression (self)), visitor);
108
104
        vala_code_visitor_visit_end_full_expression (visitor, vala_switch_statement_get_expression (self));
125
121
}
126
122
 
127
123
 
128
 
static void vala_switch_statement_real_replace (ValaCodeNode* base, ValaCodeNode* old_node, ValaCodeNode* new_node)
129
 
{
 
124
static void vala_switch_statement_real_replace (ValaCodeNode* base, ValaCodeNode* old_node, ValaCodeNode* new_node) {
130
125
        ValaSwitchStatement * self;
131
 
        self = ((ValaSwitchStatement*) base);
 
126
        self = VALA_SWITCH_STATEMENT (base);
132
127
        g_return_if_fail (VALA_IS_CODE_NODE (old_node));
133
128
        g_return_if_fail (VALA_IS_CODE_NODE (new_node));
134
129
        if (VALA_CODE_NODE (vala_switch_statement_get_expression (self)) == old_node) {
137
132
}
138
133
 
139
134
 
140
 
ValaExpression* vala_switch_statement_get_expression (ValaSwitchStatement* self)
141
 
{
 
135
ValaExpression* vala_switch_statement_get_expression (ValaSwitchStatement* self) {
142
136
        g_return_val_if_fail (VALA_IS_SWITCH_STATEMENT (self), NULL);
143
137
        return self->priv->_expression;
144
138
}
145
139
 
146
140
 
147
 
void vala_switch_statement_set_expression (ValaSwitchStatement* self, ValaExpression* value)
148
 
{
149
 
        ValaExpression* __temp2;
 
141
void vala_switch_statement_set_expression (ValaSwitchStatement* self, ValaExpression* value) {
 
142
        ValaExpression* _tmp1;
150
143
        g_return_if_fail (VALA_IS_SWITCH_STATEMENT (self));
151
 
        __temp2 = NULL;
152
 
        self->priv->_expression = (__temp2 = g_object_ref (value), (self->priv->_expression == NULL ? NULL : (self->priv->_expression = (g_object_unref (self->priv->_expression), NULL))), __temp2);
 
144
        _tmp1 = NULL;
 
145
        self->priv->_expression = (_tmp1 = g_object_ref (value), (self->priv->_expression == NULL ? NULL : (self->priv->_expression = (g_object_unref (self->priv->_expression), NULL))), _tmp1);
153
146
        vala_code_node_set_parent_node (VALA_CODE_NODE (self->priv->_expression), VALA_CODE_NODE (self));
154
147
}
155
148
 
156
149
 
157
 
static void vala_switch_statement_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec)
158
 
{
 
150
static void vala_switch_statement_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
159
151
        ValaSwitchStatement * self;
160
152
        self = VALA_SWITCH_STATEMENT (object);
161
153
        switch (property_id) {
162
154
                case VALA_SWITCH_STATEMENT_EXPRESSION:
163
155
                g_value_set_object (value, vala_switch_statement_get_expression (self));
164
156
                break;
 
157
                default:
 
158
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
159
                break;
165
160
        }
166
161
}
167
162
 
168
163
 
169
 
static void vala_switch_statement_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec)
170
 
{
 
164
static void vala_switch_statement_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
171
165
        ValaSwitchStatement * self;
172
166
        self = VALA_SWITCH_STATEMENT (object);
173
167
        switch (property_id) {
174
168
                case VALA_SWITCH_STATEMENT_EXPRESSION:
175
169
                vala_switch_statement_set_expression (self, g_value_get_object (value));
176
170
                break;
 
171
                default:
 
172
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
173
                break;
177
174
        }
178
175
}
179
176
 
180
177
 
181
 
static void vala_switch_statement_class_init (ValaSwitchStatementClass * klass)
182
 
{
 
178
static void vala_switch_statement_class_init (ValaSwitchStatementClass * klass) {
183
179
        vala_switch_statement_parent_class = g_type_class_peek_parent (klass);
184
180
        g_type_class_add_private (klass, sizeof (ValaSwitchStatementPrivate));
185
181
        G_OBJECT_CLASS (klass)->get_property = vala_switch_statement_get_property;
187
183
        G_OBJECT_CLASS (klass)->dispose = vala_switch_statement_dispose;
188
184
        VALA_CODE_NODE_CLASS (klass)->accept = vala_switch_statement_real_accept;
189
185
        VALA_CODE_NODE_CLASS (klass)->replace = vala_switch_statement_real_replace;
190
 
        g_object_class_install_property (G_OBJECT_CLASS (klass), VALA_SWITCH_STATEMENT_EXPRESSION, g_param_spec_object ("expression", "foo", "bar", VALA_TYPE_EXPRESSION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
 
186
        g_object_class_install_property (G_OBJECT_CLASS (klass), VALA_SWITCH_STATEMENT_EXPRESSION, g_param_spec_object ("expression", "expression", "expression", VALA_TYPE_EXPRESSION, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
191
187
}
192
188
 
193
189
 
194
 
static void vala_switch_statement_vala_statement_interface_init (ValaStatementIface * iface)
195
 
{
 
190
static void vala_switch_statement_vala_statement_interface_init (ValaStatementIface * iface) {
196
191
        vala_switch_statement_vala_statement_parent_iface = g_type_interface_peek_parent (iface);
197
192
}
198
193
 
199
194
 
200
 
static void vala_switch_statement_init (ValaSwitchStatement * self)
201
 
{
 
195
static void vala_switch_statement_init (ValaSwitchStatement * self) {
202
196
        self->priv = VALA_SWITCH_STATEMENT_GET_PRIVATE (self);
203
197
        self->priv->sections = GEE_LIST (gee_array_list_new (g_object_ref, g_object_unref, g_direct_equal));
204
198
}
205
199
 
206
200
 
207
 
static void vala_switch_statement_dispose (GObject * obj)
208
 
{
 
201
static void vala_switch_statement_dispose (GObject * obj) {
209
202
        ValaSwitchStatement * self;
210
 
        ValaSwitchStatementClass * klass;
211
 
        GObjectClass * parent_class;
212
203
        self = VALA_SWITCH_STATEMENT (obj);
213
204
        (self->priv->_expression == NULL ? NULL : (self->priv->_expression = (g_object_unref (self->priv->_expression), NULL)));
214
205
        (self->priv->sections == NULL ? NULL : (self->priv->sections = (g_object_unref (self->priv->sections), NULL)));
215
 
        klass = VALA_SWITCH_STATEMENT_CLASS (g_type_class_peek (VALA_TYPE_SWITCH_STATEMENT));
216
 
        parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
217
 
        parent_class->dispose (obj);
 
206
        G_OBJECT_CLASS (vala_switch_statement_parent_class)->dispose (obj);
218
207
}
219
208
 
220
209
 
221
 
GType vala_switch_statement_get_type (void)
222
 
{
 
210
GType vala_switch_statement_get_type (void) {
223
211
        static GType vala_switch_statement_type_id = 0;
224
212
        if (G_UNLIKELY (vala_switch_statement_type_id == 0)) {
225
213
                static const GTypeInfo g_define_type_info = { sizeof (ValaSwitchStatementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_switch_statement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaSwitchStatement), 0, (GInstanceInitFunc) vala_switch_statement_init };