diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-06-17 13:07:35 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2021-08-05 17:47:29 +0100 |
commit | b058ccaedad3c4d353abf3c1d0b490579e246fd0 (patch) | |
tree | 901cd1f0f85adbc14fbd5023354e1dd27da4738d /docs/reference | |
parent | 63eeaf114b3bf1e946671eaf28312e8c2d3cc891 (diff) | |
download | gobject-introspection-b058ccaedad3c4d353abf3c1d0b490579e246fd0.tar.gz |
Add introspection data for property accessors
A GObject property can be accessed generically through the GObject API,
e.g. g_object_set_property() and g_object_get_property(). Properties
typically also have public accessor functions, which are (according to
our own best practices) called through the generic API.
The introspection data is currently missing the relation between a
property and its public accessor functions. With this information, a
language binding could, for instance, avoid exposing the C API entirely,
thus minimizing the chances of collisions between property names and
accessor functions; alternatively, a binding could call the C API
directly instead of going through the generic GObject API, thus avoiding
the boxing and unboxing from a native type to a GIArgument and finally
into a GValue, and vice versa.
In the GIR, we add two new attributes to the `property` element:
- setter="SYMBOL"
- getter="SYMBOL"
where "symbol" is the C function identifier of the setter and getter
functions, respectively. The `setter` attribute is only applied to
writable, non-construct-only properties; the `getter` attribute is only
applied to readable properties.
We maintain the ABI compatibility of the typelib data by using 20 bits
of the 25 reserved bits inside the PropertyBlob structure. The data is
exposed through two new GIPropertyInfo methods:
- g_property_info_get_setter()
- g_property_info_get_getter()
which return the GIFunctionInfo for the setter and getter functions,
respectively.
Diffstat (limited to 'docs/reference')
-rw-r--r-- | docs/reference/gi-sections.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/reference/gi-sections.txt b/docs/reference/gi-sections.txt index 6b892626..38e1a77a 100644 --- a/docs/reference/gi-sections.txt +++ b/docs/reference/gi-sections.txt @@ -301,6 +301,8 @@ GIPropertyInfo g_property_info_get_flags g_property_info_get_ownership_transfer g_property_info_get_type +g_property_info_get_getter +g_property_info_get_setter </SECTION> <SECTION> |