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

« back to all changes in this revision

Viewing changes to vala/valabooleanliteral.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 "valabooleanliteral.h"
 
23
#include <vala/valabooleanliteral.h>
24
24
#include <vala/valasourcereference.h>
25
 
#include <vala/valabooleanliteral.h>
26
25
#include <vala/valacodevisitor.h>
27
26
 
28
27
struct _ValaBooleanLiteralPrivate {
46
45
 * @param source reference to source code
47
46
 * @return       newly created boolean literal
48
47
 */
49
 
ValaBooleanLiteral* vala_boolean_literal_new (gboolean b, ValaSourceReference* source)
50
 
{
 
48
ValaBooleanLiteral* vala_boolean_literal_new (gboolean b, ValaSourceReference* source) {
51
49
        ValaBooleanLiteral * self;
52
50
        g_return_val_if_fail (source == NULL || VALA_IS_SOURCE_REFERENCE (source), NULL);
53
51
        self = g_object_newv (VALA_TYPE_BOOLEAN_LITERAL, 0, NULL);
57
55
}
58
56
 
59
57
 
60
 
static void vala_boolean_literal_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor)
61
 
{
 
58
static void vala_boolean_literal_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor) {
62
59
        ValaBooleanLiteral * self;
63
 
        self = ((ValaBooleanLiteral*) base);
 
60
        self = VALA_BOOLEAN_LITERAL (base);
64
61
        g_return_if_fail (VALA_IS_CODE_VISITOR (visitor));
65
62
        vala_code_visitor_visit_boolean_literal (visitor, self);
66
63
}
67
64
 
68
65
 
69
 
static char* vala_boolean_literal_real_to_string (ValaCodeNode* base)
70
 
{
 
66
static char* vala_boolean_literal_real_to_string (ValaCodeNode* base) {
71
67
        ValaBooleanLiteral * self;
72
 
        self = ((ValaBooleanLiteral*) base);
 
68
        self = VALA_BOOLEAN_LITERAL (base);
73
69
        if (vala_boolean_literal_get_value (self)) {
74
70
                return g_strdup ("true");
75
71
        } else {
78
74
}
79
75
 
80
76
 
81
 
gboolean vala_boolean_literal_get_value (ValaBooleanLiteral* self)
82
 
{
 
77
gboolean vala_boolean_literal_get_value (ValaBooleanLiteral* self) {
83
78
        g_return_val_if_fail (VALA_IS_BOOLEAN_LITERAL (self), FALSE);
84
79
        return self->priv->_value;
85
80
}
86
81
 
87
82
 
88
 
void vala_boolean_literal_set_value (ValaBooleanLiteral* self, gboolean value)
89
 
{
 
83
void vala_boolean_literal_set_value (ValaBooleanLiteral* self, gboolean value) {
90
84
        g_return_if_fail (VALA_IS_BOOLEAN_LITERAL (self));
91
85
        self->priv->_value = value;
92
86
}
93
87
 
94
88
 
95
 
static void vala_boolean_literal_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec)
96
 
{
 
89
static void vala_boolean_literal_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
97
90
        ValaBooleanLiteral * self;
98
91
        self = VALA_BOOLEAN_LITERAL (object);
99
92
        switch (property_id) {
100
93
                case VALA_BOOLEAN_LITERAL_VALUE:
101
94
                g_value_set_boolean (value, vala_boolean_literal_get_value (self));
102
95
                break;
 
96
                default:
 
97
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
98
                break;
103
99
        }
104
100
}
105
101
 
106
102
 
107
 
static void vala_boolean_literal_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec)
108
 
{
 
103
static void vala_boolean_literal_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
109
104
        ValaBooleanLiteral * self;
110
105
        self = VALA_BOOLEAN_LITERAL (object);
111
106
        switch (property_id) {
112
107
                case VALA_BOOLEAN_LITERAL_VALUE:
113
108
                vala_boolean_literal_set_value (self, g_value_get_boolean (value));
114
109
                break;
 
110
                default:
 
111
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
112
                break;
115
113
        }
116
114
}
117
115
 
118
116
 
119
 
static void vala_boolean_literal_class_init (ValaBooleanLiteralClass * klass)
120
 
{
 
117
static void vala_boolean_literal_class_init (ValaBooleanLiteralClass * klass) {
121
118
        vala_boolean_literal_parent_class = g_type_class_peek_parent (klass);
122
119
        g_type_class_add_private (klass, sizeof (ValaBooleanLiteralPrivate));
123
120
        G_OBJECT_CLASS (klass)->get_property = vala_boolean_literal_get_property;
125
122
        G_OBJECT_CLASS (klass)->dispose = vala_boolean_literal_dispose;
126
123
        VALA_CODE_NODE_CLASS (klass)->accept = vala_boolean_literal_real_accept;
127
124
        VALA_CODE_NODE_CLASS (klass)->to_string = vala_boolean_literal_real_to_string;
128
 
        g_object_class_install_property (G_OBJECT_CLASS (klass), VALA_BOOLEAN_LITERAL_VALUE, g_param_spec_boolean ("value", "foo", "bar", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
125
        g_object_class_install_property (G_OBJECT_CLASS (klass), VALA_BOOLEAN_LITERAL_VALUE, g_param_spec_boolean ("value", "value", "value", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
129
126
}
130
127
 
131
128
 
132
 
static void vala_boolean_literal_init (ValaBooleanLiteral * self)
133
 
{
 
129
static void vala_boolean_literal_init (ValaBooleanLiteral * self) {
134
130
        self->priv = VALA_BOOLEAN_LITERAL_GET_PRIVATE (self);
135
131
}
136
132
 
137
133
 
138
 
static void vala_boolean_literal_dispose (GObject * obj)
139
 
{
 
134
static void vala_boolean_literal_dispose (GObject * obj) {
140
135
        ValaBooleanLiteral * self;
141
 
        ValaBooleanLiteralClass * klass;
142
 
        GObjectClass * parent_class;
143
136
        self = VALA_BOOLEAN_LITERAL (obj);
144
 
        klass = VALA_BOOLEAN_LITERAL_CLASS (g_type_class_peek (VALA_TYPE_BOOLEAN_LITERAL));
145
 
        parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
146
 
        parent_class->dispose (obj);
 
137
        G_OBJECT_CLASS (vala_boolean_literal_parent_class)->dispose (obj);
147
138
}
148
139
 
149
140
 
150
 
GType vala_boolean_literal_get_type (void)
151
 
{
 
141
GType vala_boolean_literal_get_type (void) {
152
142
        static GType vala_boolean_literal_type_id = 0;
153
143
        if (G_UNLIKELY (vala_boolean_literal_type_id == 0)) {
154
144
                static const GTypeInfo g_define_type_info = { sizeof (ValaBooleanLiteralClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_boolean_literal_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaBooleanLiteral), 0, (GInstanceInitFunc) vala_boolean_literal_init };