Union: rebase them on Boxed type, add rw access to fields and struct -> Union casting
Some big refactory on Boxed type to use templates in order to make possible to use it as a base for other types (ideally I'd like in future to create other types of boxed types so that we can reduce the number of runtime checks and class/instance members).
As per this, it's possible to redefine union's as boxed types, getting advantage of their features such as:
- Read and write fields
- Construction via object properties
As per this, I've fixed couple of bugs:
- we had an issue if a struct / union had a field named the same way of a method, so now if a field has a
.foo
field and a.foo()
method, the method will have priority, while the field will be accessible via._field
. - We always tried to use the object constructor if provided, while we can try to use the property-object constructor in case the constructor does not take an object as argument
Finally, added a UnionType.fromMember()
static method to make possible to initialize a directly-allocable Union from another Boxed type (struct or union) that is the unique field of such type for an Union... So basically create a Gdk.Event
[or Clutter.Event
] from a Gdk.EventKey
[or Clutter.KeyEvent
] (giving access to the union methods and to functions taking the union type).
Fixes: #273
Some tests requires gobject-introspection!348 (merged)