+2008-11-18 Owen Taylor <otaylor@redhat.com>
+
+ Add enums to the Everything test module
+
+ * tests/everything/everything.[ch]: Add TestEnum and TestFlags to the Everything
+ test module and register them as GTypes.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=561296
+
2008-11-18 Johan Dahlin <jdahlin@async.com.br>
* giscanner/cachestore.py:
/* ghash? */
/* error? */
+/* enums / flags */
+
+GType
+test_enum_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const GEnumValue values[] = {
+ { TEST_VALUE1, "TEST_VALUE1", "value1" },
+ { TEST_VALUE2, "TEST_VALUE2", "value2" },
+ { TEST_VALUE3, "TEST_VALUE3", "value3" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static (g_intern_static_string ("TestEnum"), values);
+ }
+
+ return etype;
+}
+
+GType
+test_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const GFlagsValue values[] = {
+ { TEST_FLAG1, "TEST_FLAG1", "flag1" },
+ { TEST_FLAG2, "TEST_FLAG2", "flag2" },
+ { TEST_FLAG3, "TEST_FLAG3", "flag2" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static (g_intern_static_string ("TestFlags"), values);
+ }
+
+ return etype;
+}
+
/* structures */
/**
/* ghash? */
/* error? */
+/* enums / flags */
+
+typedef enum
+{
+ TEST_VALUE1,
+ TEST_VALUE2,
+ TEST_VALUE3 = 42
+} TestEnum;
+
+typedef enum
+{
+ TEST_FLAG1 = 1 << 0,
+ TEST_FLAG2 = 1 << 1,
+ TEST_FLAG3 = 1 << 2,
+} TestFlags;
+
+GType test_enum_get_type (void) G_GNUC_CONST;
+#define TEST_TYPE_ENUM (test_enum_get_type ())
+GType test_flags_get_type (void) G_GNUC_CONST;
+#define TES_TYPE_FLAGS (test_flags_get_type ())
+
/* structures */
typedef struct _TestStructA TestStructA;
typedef struct _TestStructB TestStructB;
gint some_int;
gint8 some_int8;
gdouble some_double;
+ TestEnum some_enum;
};
void test_struct_a_clone (TestStructA *a,
gint some_int;
gint8 some_int8;
gdouble some_double;
+ TestEnum some_enum;
};
GType test_simple_boxed_a_get_type (void);