gobject.value_array

Module for [ValueArray] class

Types 1

A [gobject.value_array.ValueArray] is a container structure to hold an array of generic values.

The prime purpose of a [gobject.value_array.ValueArray] is for it to be used as an object property that holds an array of values. A [gobject.value_array.ValueArray] wraps an array of [gobject.value.Value] elements in order for it to be used as a boxed type through G_TYPE_VALUE_ARRAY.

[gobject.value_array.ValueArray] is deprecated in favour of [glib.array.Array] since GLib 2.32. It is possible to create a [glib.array.Array] that behaves like a [gobject.value_array.ValueArray] by using the size of [gobject.value.Value] as the element size, and by setting [gobject.value.Value.unset] as the clear function using [glib.array.Array.setClearFunc], for instance, the following code:

GValueArray *array = g_value_array_new (10);

can be replaced by:

GArray *array = g_array_sized_new (FALSE, TRUE, sizeof (GValue), 10);
 g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);

Deprecated

Use [glib.array.Array] instead, if possible for the given use case,

as described above.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
ValueArray self()Returns `this`, for use in `with` statements.
uint nValues() @propertyGet `nValues` field. Returns: number of values contained in the array
void nValues(uint propval) @propertySet `nValues` field. Params: propval = number of values contained in the array
gobject.value.Value values() @propertyGet `values` field. Returns: array of values
void values(gobject.value.Value propval) @propertySet `values` field. Params: propval = array of values
gobject.value_array.ValueArray append(gobject.value.Value value = null)Insert a copy of value as last element of value_array. If value is null, an uninitialized value is appended.
gobject.value_array.ValueArray copy()Construct an exact copy of a #GValueArray by duplicating all its contents. Returns: Newly allocated copy of #GValueArray
gobject.value.Value getNth(uint index)Return a pointer to the value at index containd in valuearray.
gobject.value_array.ValueArray insert(uint index, gobject.value.Value value = null)Insert a copy of value at specified position into value_array. If value is null, an uninitialized value is inserted.
gobject.value_array.ValueArray prepend(gobject.value.Value value = null)Insert a copy of value as first element of value_array. If value is null, an uninitialized value is prepended.
gobject.value_array.ValueArray remove(uint index)Remove the value at position index from valuearray.
gobject.value_array.ValueArray sort(glib.types.CompareDataFunc compareFunc)Sort valuearray using comparefunc to compare the elements according to the semantics of #GCompareDataFunc.
Constructors
this(void * ptr, Flag!"Take" take)
this(uint nPrealloced)Allocate and initialize a new #GValueArray, optionally preserve space for nprealloced elements. New arrays always contain 0 elements, regardless of the value of nprealloced.