Class
GObjectParamSpec
since: 2.0
Description
abstract class GObject.ParamSpec : GObject.TypeInstance
{
name: const gchar*,
flags: GParamFlags,
value_type: GType,
owner_type: GType
}
GParamSpec encapsulates the metadata required to specify parameters, such as GObject properties.
Parameter names
A property name consists of one or more segments consisting of ASCII letters
and digits, separated by either the - or _ character. The first
character of a property name must be a letter. These are the same rules as
for signal naming (see g_signal_new()).
When creating and looking up a GParamSpec, either separator can be
used, but they cannot be mixed. Using - is considerably more
efficient, and is the ‘canonical form’. Using _ is discouraged.
Available since: 2.0
Descendants
- GParamSpecBoolean
- GParamSpecBoxed
- GParamSpecChar
- GParamSpecDouble
- GParamSpecEnum
- GParamSpecFlags
- GParamSpecFloat
- GParamSpecGType
- GParamSpecInt
- GParamSpecInt64
- GParamSpecLong
- GParamSpecObject
- GParamSpecOverride
- GParamSpecParam
- GParamSpecPointer
- GParamSpecString
- GParamSpecUChar
- GParamSpecUInt
- GParamSpecUInt64
- GParamSpecULong
- GParamSpecUnichar
- GParamSpecValueArray
- GParamSpecVariant
Functions
g_param_spec_is_valid_name
Validate a property name for a GParamSpec. This can be useful for
dynamically-generated properties which need to be validated at run-time
before actually trying to create them.
since: 2.66
Instance methods
g_param_spec_get_default_value
Gets the default value of pspec as a pointer to a GValue.
since: 2.38
g_param_spec_get_redirect_target
If the paramspec redirects operations to another paramspec,
returns that paramspec. Redirect is used typically for
providing a new implementation of a property in a derived
type while preserving all the properties from the parent
type. Redirection is established by creating a property
of type GParamSpecOverride. See g_object_class_override_property()
for an example of the use of this capability.
since: 2.4
g_param_spec_set_qdata
Sets an opaque, named pointer on a GParamSpec. The name is
specified through a GQuark (retrieved e.g. via
g_quark_from_static_string()), and the pointer can be gotten back
from the pspec with g_param_spec_get_qdata(). Setting a
previously set user data pointer, overrides (frees) the old pointer
set, using NULL as pointer essentially removes the data stored.
since: 2.0
g_param_spec_set_qdata_full
This function works like g_param_spec_set_qdata(), but in addition,
a void (*destroy) (gpointer) function may be
specified which is called with data as argument when the pspec is
finalized, or the data is being overwritten by a call to
g_param_spec_set_qdata() with the same quark.
since: 2.0
g_param_spec_sink
The initial reference count of a newly created GParamSpec is 1,
even though no one has explicitly called g_param_spec_ref() on it
yet. So the initial reference count is flagged as “floating”, until
someone calls g_param_spec_ref (pspec); g_param_spec_sink
(pspec); in sequence on it, taking over the initial
reference count (thus ending up with a pspec that has a reference
count of 1 still, but is not flagged “floating” anymore).
since: 2.0
g_param_spec_steal_qdata
Gets back user data pointers stored via g_param_spec_set_qdata()
and removes the data from pspec without invoking its destroy()
function (if any was set). Usually, calling this function is only
required to update user data pointers with a destroy notifier.
since: 2.0
Class structure
struct GObjectParamSpecClass {
GTypeClass g_type_class;
GType value_type;
void (* finalize) (
GParamSpec* pspec
);
void (* value_set_default) (
GParamSpec* pspec,
GValue* value
);
gboolean (* value_validate) (
GParamSpec* pspec,
GValue* value
);
gint (* values_cmp) (
GParamSpec* pspec,
const GValue* value1,
const GValue* value2
);
gboolean (* value_is_valid) (
GParamSpec* pspec,
const GValue* value
);
}
The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by g_param_type_register_static().
Class members
g_type_class: GTypeClassThe parent class.
value_type: GTypeThe
GValuetype for this parameter.finalize: void (* finalize) ( GParamSpec* pspec )- No description available.
value_set_default: void (* value_set_default) ( GParamSpec* pspec, GValue* value )- No description available.
value_validate: gboolean (* value_validate) ( GParamSpec* pspec, GValue* value )- No description available.
values_cmp: gint (* values_cmp) ( GParamSpec* pspec, const GValue* value1, const GValue* value2 )- No description available.
value_is_valid: gboolean (* value_is_valid) ( GParamSpec* pspec, const GValue* value )- No description available.