Class

GObjectParamSpec

Description

abstract class GObject.ParamSpec : GObject.TypeInstance {
  g_type_instance: GTypeInstance,
  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.

Functions

g_param_spec_internal

Creates a new GParamSpec instance.

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_blurb

Get the short description of a GParamSpec.

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_name

Get the name of a GParamSpec.

g_param_spec_get_name_quark

Gets the GQuark for the name.

since: 2.46

g_param_spec_get_nick

Get the nickname of a GParamSpec.

g_param_spec_get_qdata

Gets back user data pointers stored via g_param_spec_set_qdata().

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_ref

Increments the reference count of pspec.

g_param_spec_ref_sink

Convenience function to ref and sink a GParamSpec.

since: 2.10

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.

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.

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).

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.

g_param_spec_unref

Decrements the reference count of a pspec.

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: GTypeClass

The parent class.

value_type: GType

The GValue type 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.

Virtual methods

GObject.ParamSpecClass.finalize
No description available.

GObject.ParamSpecClass.value_is_valid
No description available.

GObject.ParamSpecClass.value_set_default
No description available.

GObject.ParamSpecClass.value_validate
No description available.

GObject.ParamSpecClass.values_cmp
No description available.