Parameters and Values

G-Golf GObject Parameters and Values low level API.
Parameters and Values — Standard Parameter and Value Types

Procedures and Methods

g-value-type
g-value-type-tag
g-value-type-name
g-value-ref
g-value-set!
g-param-spec-boolean
g-value-get-boolean
g-value-set-boolean
g-param-spec-int
g-value-get-int
g-value-set-int
g-param-spec-uint
g-value-get-uint
g-value-set-uint
g-param-spec-float
g-value-get-float
g-value-set-float
g-param-spec-double
g-value-get-double
g-value-set-double
g-param-spec-enum
g-value-get-enum
g-value-set-enum
g-param-spec-flags
g-value-get-flags
g-value-set-flags
g-param-spec-string
g-value-get-string
g-value-set-string
g-param-spec-param
g-value-get-param
g-value-set-param
g-param-spec-boxed
g-value-get-boxed
g-value-set-boxed
g-value-get-pointer
g-value-set-pointer
g-param-spec-object
g-value-get-object
g-value-set-object
g-value-get-variant

Types and Values

g-type-param-boolean
g-type-param-char
g-type-param-uchar
g-type-param-int
g-type-param-uint
g-type-param-long
g-type-param-ulong
g-type-param-int64
g-type-param-uint64
g-type-param-float
g-type-param-double
g-type-param-enum
g-type-param-flags
g-type-param-string
g-type-param-param
g-type-param-boxed
g-type-param-pointer
g-type-param-object
g-type-param-unichar
g-type-param-override
g-type-param-gtype
g-type-param-variant

Description

GValue provides an abstract container structure which can be copied, transformed and compared while holding a value of any (derived) type, which is registered as a GType with a GTypeValueTable in its GTypeInfo structure. Parameter specifications for most value types can be created as GParamSpec derived instances, to implement e.g. GObject properties which operate on GValue containers.

Parameter names need to start with a letter (a-z or A-Z). Subsequent characters can be letters, numbers or a ’-’. All other characters are replaced by a ’-’ during construction.

Procedures and Methods

Note: in this section, the g-value argument is [must be] a pointer to a GValue.

Procedure: g-value-type g-value
Procedure: g-value-type-tag g-value
Procedure: g-value-type-name g-value

Returns an integer, a symbol or a string, respectively.

Obtains and returns the GType, the GType tag (see %g-type-fundamental-types) or the GType name (see g-type-name for g-value, respectively.

Procedure: g-value-ref g-value

Returns the content of g-value.

Obtains and returns the content of g-value. Supported GType (their scheme representaion) for g-value are: boolean, uint, int, float, double, enum, flags, string, boxed, pointer, object, interface.

Procedure: g-value-set! g-value value

Returns nothing.

Sets the content of g-value to value. Supported GType (their scheme representaion) for g-value are: boolean, uint, int, float, double, enum, flags, string, boxed, pointer, object, interface.

Note that this procedure cannot cope with invalid values (the type of value must correspond to the GType for g-value, otherwise it will most likely lead to a crash.

Procedure: g-param-spec-boolean name nick blurb default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecBoolean instance specifying a G_TYPE_BOOLEAN property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-boolean g-value

Returns #t or #f.

Obtains the content of g-value and returns #f if it is 0, otherwise it returns #t.

Procedure: g-value-set-boolean g-value val

Returns nothing.

Sets the content of g-value to 0 if val is #f, otherwise sets the content to 1.

Procedure: g-param-spec-int name nick blurb minimum maximum default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecInt instance specifying a G_TYPE_INT property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, minimum the minimum value, maximum the maximum value, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-int g-value

Returns a integer.

Obtains and returns the content of g-value.

Procedure: g-value-set-int g-value int

Returns nothing.

Sets the content of g-value to int.

Procedure: g-param-spec-uint name nick blurb minimum maximum default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecUInt instance specifying a G_TYPE_UINT property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, minimum the minimum value, maximum the maximum value, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-uint g-value

Returns an unsigned integer.

Obtains and returns the content of g-value.

Procedure: g-value-set-uint g-value uint

Returns nothing.

Sets the content of g-value to uint.

Procedure: g-param-spec-float name nick blurb minimum maximum default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecFloat instance specifying a G_TYPE_FLOAT property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, minimum the minimum value, maximum the maximum value, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-float g-value

Returns a float.

Obtains and returns the content of g-value.

Procedure: g-value-set-float g-value float

Returns nothing.

Sets the content of g-value to float.

Procedure: g-param-spec-double name nick blurb minimum maximum default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecDouble instance specifying a G_TYPE_DOUBLE property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, minimum the minimum value, maximum the maximum value, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-double g-value

Returns a double.

Obtains and returns the content of g-value.

Procedure: g-value-set-double g-value double

Returns nothing.

Sets the content of g-value to double.

Procedure: g-param-spec-enum name nick blurb type default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecEnum instance specifying a G_TYPE_ENUM property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, type a <gi-enum> instance, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-enum g-value

Returns a symbol.

Obtains and returns the (registered) enum type info symbol for g-value.

Method: g-value-set-enum g-value (id <integer>)
Method: g-value-set-enum g-value (sym <symbol>)

Returns nothing.

Sets the content of g-value to id, or to the id corresponding to sym respectively. The id or the sym must be valid (as in being a valid member of the (registered) enum type info for g-value), otherwise an exception is raised.

Procedure: g-param-spec-flags name nick blurb type default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecFlags instance specifying a G_TYPE_FLAGS property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, type a <gi-flags> instance, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-flags g-value

Returns a list.

Obtains and returns the (registered) list of flags for g-value.

Method: g-value-set-flags g-value (val <integer>)
Method: g-value-set-flags g-value (flags <list>)

Returns nothing.

Sets the content of g-value to val, or to the value given by calling flags->integer upon the list of flags, respectively. The val or the flags must be valid (as in being a valid member of the (registered) gi-flags type for g-value), otherwise an exception is raised.

Procedure: g-param-spec-string name nick blurb default flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecString instance specifying a G_TYPE_STRING property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, default the default value and flags the flags - for the property specified.

Procedure: g-value-get-string g-value

Returns a string or #f.

Obtains and returns the content of g-value, a string or #f if the g-value content is the %null-pointer.

Procedure: g-value-set-string g-value str

Returns nothing.

Sets the content of g-value to str.

Procedure: g-param-spec-param name nick blurb type flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecParam instance specifying a G_TYPE_PARAM property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, type a GType derived from G_TYPE_PARAM and flags the flags - for the property specified.

Procedure: g-value-get-param g-value

Returns a (pointer to) GParamSpec or #f.

Obtains and returns the content of g-value, a (pointer to) GParamSpec or #f if the g-value content is the %null-pointer.

Procedure: g-value-set-param g-value param

Returns nothing.

Sets the content of g-value to param.

Procedure: g-param-spec-boxed name nick blurb type flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecBoxed instance specifying a G_TYPE_BOXED derived property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, type a GType derived from G_TYPE_BOXED and flags the flags - for the property specified.

Procedure: g-value-get-boxed g-value

Returns either a list of values, or a pointer.

Obtains and returns the content of g-value. If the boxed type !is-opaque? or !is-semi-opaque?, it ‘blindingly’ returns the boxed instance g-value pointer. Otherwise, the boxed instance is ‘decoded’, and a list of its field values is returned.

Procedure: g-value-set-boxed g-value boxed

Returns nothing.

Sets the content of g-value to boxed. If the boxed type !is-opaque? or !is-semi-opaque?, then boxed is (supposed to be) a pointer, used to ‘blindingly’ set g-value. Otherwise, the boxed instance is (supposed to be) a list of values, that are ‘encoded’, and its (newly created) pointer is used to set g-value.

Procedure: g-value-get-pointer g-value

Returns a pointer.

Obtains and returns the content of g-value.

Procedure: g-value-set-pointer g-value pointer

Returns nothing.

Sets the content of g-value to pointer.

Procedure: g-param-spec-object name nick blurb type flags

Returns a pointer.

Creates and returns a pointer to a new GParamSpecBoxed instance specifying a G_TYPE_OBJECT derived property.

The name is the canonical name of the property specified, nick its nick name, blurb its description, type a <gobject> derived type of this property and flags the flags - for the property specified.

Procedure: g-value-get-object g-value

Returns a pointer.

Obtains and returns the content of g-value.

Procedure: g-value-set-object g-value object

Returns nothing.

Sets the content of g-value to object (a pointer to a GObject instance) and increases the object reference count.

Procedure: g-value-get-variant g-value

Returns a pointer or #f.

Obtains and returns content of a variant g-value, or #f (may be NULL).

Types and Values

Note: in GObject, G_TYPE_PARAM_BOOLEAN, G_TYPE_PARAM_CHAR, etc., are defined as macros. In G-Golf, we define a procedure for each of those types, which binds a libg-golf function which merely invoques the macro, the expansion of which returns the corresponding (dynamic - runtime) GType value.

Procedure: g-type-param-boolean
Procedure: g-type-param-char
Procedure: g-type-param-uchar
Procedure: g-type-param-int
Procedure: g-type-param-uint
Procedure: g-type-param-long
Procedure: g-type-param-ulong
Procedure: g-type-param-int64
Procedure: g-type-param-uint64
Procedure: g-type-param-float
Procedure: g-type-param-double
Procedure: g-type-param-enum
Procedure: g-type-param-flags
Procedure: g-type-param-string
Procedure: g-type-param-param
Procedure: g-type-param-boxed
Procedure: g-type-param-pointer
Procedure: g-type-param-object
Procedure: g-type-param-unichar
Procedure: g-type-param-override
Procedure: g-type-param-gtype
Procedure: g-type-param-variant

Returns a GType.

Obtains and returns the GType of GParamSpecBoolean, GParamSpecChar, etc.