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

« back to all changes in this revision

Viewing changes to vala/valaenum.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge, Marc-Andre Lureau, Kumar Appaiah, Sebastian Dröge
  • Date: 2007-11-26 08:16:57 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071126081657-pbycv1holrkgalk3
Tags: 0.1.5-1
[ Marc-Andre Lureau ]
* New Upstream Version; closes: #452870.
* debian/libvala-dev.install
  + Rename gidlgen to vala-gen-instrospect
  + Remove deleted .pl files

[ Kumar Appaiah ]
* debian/control:
  + Add Homepage field.
  + Modify XS-Vcs-Git and XS-Vcs-Broswer to Vcs-Git and Vcs-Browser
    respectively, as dpkg now supports them.

[ Sebastian Dröge ]
* debian/libvala-dev.install,
  debian/rules:
  + Also ship vala-gen-project.
* debian/control:
  + Build depend on libgtk2.0-dev (>= 2.10.0) and libglib2.0-dev (>= 2.12.0).
* debian/patches/01_vala-gen-project-paths.patch,
  debian/rules:
  + Adjust the paths in vala-gen-project for the license files, etc.
    Needs again an automake-touch hack for timestamp issues.
* debian/control,
  debian/libvala-dev.install,
  debian/valac.install,
  debian/vala-utils.install:
  + Move vala-gen-introspect/vapigen to valac and vala-gen-project/vapicheck
    to vala-utils.
* debian/patches/01_vala-gen-project-paths.patch,
  debian/control:
  + Fix paths for COPYING and INSTALL files and depend on automake1.10 for
    this.

[ Kumar Appaiah ]
* debian/watch: Fix watch file to point to new download location.
  (Closes: #452870)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <gee/arraylist.h>
25
25
#include <gee/list.h>
26
26
#include <gee/readonlycollection.h>
 
27
#include <vala/valaenumvalue.h>
 
28
#include <vala/valamethod.h>
27
29
#include <vala/valasourcereference.h>
28
30
#include <vala/valasymbol.h>
29
 
#include <vala/valaenumvalue.h>
30
31
#include <vala/valascope.h>
31
 
#include <vala/valamethod.h>
32
32
#include <vala/valacreationmethod.h>
33
33
#include <vala/valareport.h>
34
34
#include <vala/valaformalparameter.h>
37
37
#include <vala/valaattribute.h>
38
38
 
39
39
struct _ValaEnumPrivate {
 
40
        gboolean _is_flags;
40
41
        gboolean _error_domain;
41
42
        GeeList* values;
42
43
        GeeList* methods;
48
49
#define VALA_ENUM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_ENUM, ValaEnumPrivate))
49
50
enum  {
50
51
        VALA_ENUM_DUMMY_PROPERTY,
 
52
        VALA_ENUM_IS_FLAGS,
51
53
        VALA_ENUM_ERROR_DOMAIN
52
54
};
53
55
static void vala_enum_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor);
131
133
 
132
134
 
133
135
/**
 
136
 * Returns a copy of the list of enum values.
 
137
 *
 
138
 * @return list of enum values
 
139
 */
 
140
GeeCollection* vala_enum_get_values (ValaEnum* self) {
 
141
        g_return_val_if_fail (VALA_IS_ENUM (self), NULL);
 
142
        return GEE_COLLECTION (gee_read_only_collection_new (VALA_TYPE_ENUM_VALUE, ((GBoxedCopyFunc) g_object_ref), g_object_unref, GEE_COLLECTION (self->priv->values)));
 
143
}
 
144
 
 
145
 
 
146
/**
134
147
 * Returns a copy of the list of methods.
135
148
 *
136
149
 * @return list of methods
137
150
 */
138
151
GeeCollection* vala_enum_get_methods (ValaEnum* self) {
139
152
        g_return_val_if_fail (VALA_IS_ENUM (self), NULL);
140
 
        return GEE_COLLECTION (gee_read_only_collection_new (g_object_ref, g_object_unref, GEE_COLLECTION (self->priv->methods)));
 
153
        return GEE_COLLECTION (gee_read_only_collection_new (VALA_TYPE_METHOD, ((GBoxedCopyFunc) g_object_ref), g_object_unref, GEE_COLLECTION (self->priv->methods)));
141
154
}
142
155
 
143
156
 
377
390
                                if (g_utf8_collate (vala_attribute_get_name (a), "CCode") == 0) {
378
391
                                        vala_enum_process_ccode_attribute (self, a);
379
392
                                } else {
380
 
                                        if (g_utf8_collate (vala_attribute_get_name (a), "ErrorDomain") == 0) {
381
 
                                                vala_enum_set_error_domain (self, TRUE);
 
393
                                        if (g_utf8_collate (vala_attribute_get_name (a), "Flags") == 0) {
 
394
                                                vala_enum_set_is_flags (self, TRUE);
 
395
                                        } else {
 
396
                                                if (g_utf8_collate (vala_attribute_get_name (a), "ErrorDomain") == 0) {
 
397
                                                        vala_enum_set_error_domain (self, TRUE);
 
398
                                                }
382
399
                                        }
383
400
                                }
384
401
                                (a == NULL ? NULL : (a = (g_object_unref (a), NULL)));
427
444
}
428
445
 
429
446
 
 
447
gboolean vala_enum_get_is_flags (ValaEnum* self) {
 
448
        g_return_val_if_fail (VALA_IS_ENUM (self), FALSE);
 
449
        return self->priv->_is_flags;
 
450
}
 
451
 
 
452
 
 
453
void vala_enum_set_is_flags (ValaEnum* self, gboolean value) {
 
454
        g_return_if_fail (VALA_IS_ENUM (self));
 
455
        self->priv->_is_flags = value;
 
456
}
 
457
 
 
458
 
430
459
gboolean vala_enum_get_error_domain (ValaEnum* self) {
431
460
        g_return_val_if_fail (VALA_IS_ENUM (self), FALSE);
432
461
        return self->priv->_error_domain;
443
472
        ValaEnum * self;
444
473
        self = VALA_ENUM (object);
445
474
        switch (property_id) {
 
475
                case VALA_ENUM_IS_FLAGS:
 
476
                g_value_set_boolean (value, vala_enum_get_is_flags (self));
 
477
                break;
446
478
                case VALA_ENUM_ERROR_DOMAIN:
447
479
                g_value_set_boolean (value, vala_enum_get_error_domain (self));
448
480
                break;
457
489
        ValaEnum * self;
458
490
        self = VALA_ENUM (object);
459
491
        switch (property_id) {
 
492
                case VALA_ENUM_IS_FLAGS:
 
493
                vala_enum_set_is_flags (self, g_value_get_boolean (value));
 
494
                break;
460
495
                case VALA_ENUM_ERROR_DOMAIN:
461
496
                vala_enum_set_error_domain (self, g_value_get_boolean (value));
462
497
                break;
485
520
        VALA_DATA_TYPE_CLASS (klass)->get_get_value_function = vala_enum_real_get_get_value_function;
486
521
        VALA_DATA_TYPE_CLASS (klass)->get_set_value_function = vala_enum_real_get_set_value_function;
487
522
        VALA_DATA_TYPE_CLASS (klass)->get_default_value = vala_enum_real_get_default_value;
 
523
        g_object_class_install_property (G_OBJECT_CLASS (klass), VALA_ENUM_IS_FLAGS, g_param_spec_boolean ("is-flags", "is-flags", "is-flags", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
488
524
        g_object_class_install_property (G_OBJECT_CLASS (klass), VALA_ENUM_ERROR_DOMAIN, g_param_spec_boolean ("error-domain", "error-domain", "error-domain", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
489
525
}
490
526
 
491
527
 
492
528
static void vala_enum_init (ValaEnum * self) {
493
529
        self->priv = VALA_ENUM_GET_PRIVATE (self);
494
 
        self->priv->values = GEE_LIST (gee_array_list_new (g_object_ref, g_object_unref, g_direct_equal));
495
 
        self->priv->methods = GEE_LIST (gee_array_list_new (g_object_ref, g_object_unref, g_direct_equal));
 
530
        self->priv->values = GEE_LIST (gee_array_list_new (VALA_TYPE_ENUM_VALUE, ((GBoxedCopyFunc) g_object_ref), g_object_unref, g_direct_equal));
 
531
        self->priv->methods = GEE_LIST (gee_array_list_new (VALA_TYPE_METHOD, ((GBoxedCopyFunc) g_object_ref), g_object_unref, g_direct_equal));
496
532
}
497
533
 
498
534