diff options
author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2022-07-15 02:49:37 +0200 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2022-11-21 02:48:44 +0000 |
commit | c2d6e0bc2478b63d0e07c004e38da6162a5ca988 (patch) | |
tree | 52a0d497cbc5a000882e4bd975d57c6446122788 /tests/gimarshallingtests.h | |
parent | 5112dff728bbc60ab3a807e647e12a88070a8f4b (diff) | |
download | gobject-introspection-c2d6e0bc2478b63d0e07c004e38da6162a5ca988.tar.gz |
gimarshallingtests: Add Structured Union types, unions with struct fields
This allows to perform more introspection tests in gjs and other
implementations when it comes to set/get fields or "cast" an union
member to the main union type
Diffstat (limited to 'tests/gimarshallingtests.h')
-rw-r--r-- | tests/gimarshallingtests.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index d4901987..5d0656d7 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -1327,6 +1327,12 @@ typedef union { glong long_; } GIMarshallingTestsUnion; +typedef union { + glong long_; + gsize size; + const gchar *str; +} GIMarshallingTestsUnregisteredUnion; + _GI_TEST_EXTERN GType gi_marshalling_tests_union_get_type (void) G_GNUC_CONST; @@ -1343,6 +1349,79 @@ void gi_marshalling_tests_union_inv (GIMarshallingTestsUnion *union_); _GI_TEST_EXTERN void gi_marshalling_tests_union_method (GIMarshallingTestsUnion *union_); +typedef enum +{ + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NONE, + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SIMPLE_STRUCT, + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_NESTED_STRUCT, + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_POINTER_STRUCT, + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT, + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_BOXED_STRUCT_PTR, + GI_MARSHALLING_TESTS_STRUCTURED_UNION_TYPE_SINGLE_UNION, +} GIMarshallingTestsStructuredUnionType; + +typedef struct { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsSimpleStruct parent; +} GIMarshallingTestsStructuredUnionSimpleStruct; + +typedef struct { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsNestedStruct parent; +} GIMarshallingTestsStructuredUnionNestedStruct; + +typedef struct { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsPointerStruct parent; +} GIMarshallingTestsStructuredUnionPointerStruct; + +typedef struct { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsBoxedStruct parent; +} GIMarshallingTestsStructuredUnionBoxedStruct; + +typedef struct { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsBoxedStruct *parent; +} GIMarshallingTestsStructuredUnionBoxedStructPtr; + +typedef struct { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsUnion union_; +} GIMarshallingTestsStructuredUnionUnionStruct; + +typedef union { + GIMarshallingTestsStructuredUnionUnionStruct parent; +} GIMarshallingTestsStructuredUnionSingleUnion; + +typedef union { + /*< private >*/ + GIMarshallingTestsStructuredUnionType type; + + GIMarshallingTestsStructuredUnionSimpleStruct simple_struct; + GIMarshallingTestsStructuredUnionNestedStruct nested_struct; + GIMarshallingTestsStructuredUnionPointerStruct pointer_struct; + GIMarshallingTestsStructuredUnionBoxedStruct boxed_struct; + GIMarshallingTestsStructuredUnionBoxedStructPtr boxed_struct_ptr; + GIMarshallingTestsStructuredUnionSingleUnion single_union; +} GIMarshallingTestsStructuredUnion; + +_GI_TEST_EXTERN +GType gi_marshalling_tests_structured_union_get_type (void) G_GNUC_CONST; + +_GI_TEST_EXTERN +GIMarshallingTestsStructuredUnion *gi_marshalling_tests_structured_union_new (GIMarshallingTestsStructuredUnionType type); + +/* we want this to clash with a field value name */ +_GI_TEST_EXTERN +GIMarshallingTestsStructuredUnionType gi_marshalling_tests_structured_union_type (GIMarshallingTestsStructuredUnion *structured_union); + +typedef union { + GIMarshallingTestsStructuredUnionType type; + GIMarshallingTestsStructuredUnionSimpleStruct simple_struct1; + GIMarshallingTestsStructuredUnionSimpleStruct simple_struct2; +} GIMarshallingTestsStructuredUnionSingleType; + /* Object */ #define GI_MARSHALLING_TESTS_TYPE_OBJECT (gi_marshalling_tests_object_get_type ()) |