gobject-introspection r111 - in trunk: . tests/parser
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r111 - in trunk: . tests/parser
- Date: Sun, 10 Feb 2008 21:54:32 +0000 (GMT)
Author: johan
Date: Sun Feb 10 21:54:31 2008
New Revision: 111
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=111&view=rev
Log:
2008-02-10 Johan Dahlin <johan gnome org>
* tests/parser/Foo-expected.gidl:
* tests/parser/foo-object.h:
* tests/parser/foo.c: (foo_enum_get_type), (foo_flags_get_type):
Add enum and flags test.
Modified:
trunk/ChangeLog
trunk/tests/parser/Foo-expected.gidl
trunk/tests/parser/foo-object.h
trunk/tests/parser/foo.c
Modified: trunk/tests/parser/Foo-expected.gidl
==============================================================================
--- trunk/tests/parser/Foo-expected.gidl (original)
+++ trunk/tests/parser/Foo-expected.gidl Sun Feb 10 21:54:31 2008
@@ -4,6 +4,16 @@
<function name="init" symbol="foo_init" deprecated="1">
<return-type type="gint"/>
</function>
+ <enum name="FooEnumType">
+ <member name="FOO_ENUM_ALPHA" value="0"/>
+ <member name="FOO_ENUM_BETA" value="1"/>
+ <member name="FOO_ENUM_DELTA" value="2"/>
+ </enum>
+ <flags name="FooFlagsType">
+ <member name="FOO_FLAGS_FIRST" value="1"/>
+ <member name="FOO_FLAGS_SECOND" value="2"/>
+ <member name="FOO_FLAGS_THIRD" value="4"/>
+ </flags>
<object name="FooObject" parent="GLib.Object" type-name="FooObject" get-type="foo_object_get_type">
<method name="method" symbol="foo_object_method">
<return-type type="gint"/>
Modified: trunk/tests/parser/foo-object.h
==============================================================================
--- trunk/tests/parser/foo-object.h (original)
+++ trunk/tests/parser/foo-object.h Sun Feb 10 21:54:31 2008
@@ -61,6 +61,24 @@
GType foo_subobject_get_type (void) G_GNUC_CONST;
FooSubobject* foo_subobject_new ();
+typedef enum
+{
+ FOO_ENUM_ALPHA,
+ FOO_ENUM_BETA,
+ FOO_ENUM_DELTA
+} FooEnumType;
+
+GType foo_enum_get_type (void);
+
+typedef enum
+{
+ FOO_FLAGS_FIRST = 1 << 0,
+ FOO_FLAGS_SECOND = 1 << 1,
+ FOO_FLAGS_THIRD = 1 << 2
+} FooFlagsType;
+
+GType foo_flags_get_type (void);
+
/* Invalid comments, should be ignored */
/* @ */
Modified: trunk/tests/parser/foo.c
==============================================================================
--- trunk/tests/parser/foo.c (original)
+++ trunk/tests/parser/foo.c Sun Feb 10 21:54:31 2008
@@ -62,3 +62,36 @@
{
return FOO_SUCCESS_INT;
}
+
+GType
+foo_enum_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const GEnumValue values[] = {
+ { FOO_ENUM_ALPHA, "FOO_ENUM_ALPHA", "alpha" },
+ { FOO_ENUM_BETA, "FOO_ENUM_BETA", "beta" },
+ { FOO_ENUM_DELTA, "FOO_ENUM_DELTA", "delta" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static (g_intern_static_string ("FooEnumType"), values);
+ }
+ return etype;
+}
+
+GType
+foo_flags_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const GFlagsValue values[] = {
+ { FOO_FLAGS_FIRST, "FOO_FLAGS_FIRST", "first" },
+ { FOO_FLAGS_SECOND, "FOO_FLAGS_SECOND", "second" },
+ { FOO_FLAGS_THIRD, "FOO_FLAGS_THIRD", "third" },
+ { 0, NULL, NULL }
+ };
+ etype = g_flags_register_static (g_intern_static_string ("FooFlagsType"), values);
+ }
+ return etype;
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]