mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
Dealing with GParamSpec is tedious and less efficient than necessary. GParamSpec is a data type meant to be used to validate GValue, and only incidentally provides us with the facilities to implement properties on GObject. GObject itself requires us to provide accessors functions and then call them from within a huge switch() inside two virtual functions. Property definitions should be able to either directly access a struct field or specify the accessors pair that control a property. On top of that, most of the property and accessor definition can be autogenerated from simple pre-processor directives. So, here's to you GProperty. GProperty is a GParamSpec sub-class that encapsulates all the C fundamental types inside a single, opaque structure (to avoid leaking out implementation details); a GProperty can access the structure member holding the value of the property, or invoke the accessor functions passed to its constructor. Type safety is enforced at compile time through the C type system, and at run time through the GType system. GProperty will try *very* hard to avoid boxing and unboxing fundamental type values into GValues. GObject will recognize whether a GParamSpec used to set or get a property is really a GProperty, and thus will shortcircuit most of the GValue-based marshalled code, preferring the direct C function and direct argument collection instead of boxing/unboxing of GValues. https://bugzilla.gnome.org/show_bug.cgi?id=648526
16 lines
146 B
Plaintext
16 lines
146 B
Plaintext
binding
|
|
boxed
|
|
dynamictests
|
|
enums
|
|
ifaceproperties
|
|
param
|
|
properties
|
|
qdata
|
|
reference
|
|
signals
|
|
threadtests
|
|
valuearray
|
|
private
|
|
marshalers.[ch]
|
|
property
|