ValueArray

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

Constructors

this
this(uint nPrealloced)

Allocate and initialize a new #GValueArray, optionally preserve space for n_prealloced elements. New arrays always contain 0 elements, regardless of the value of n_prealloced.

Members

Functions

append
gobject.value_array.ValueArray append(gobject.value.Value value)

Insert a copy of value as last element of value_array. If value is null, an uninitialized value is appended.

copy
gobject.value_array.ValueArray copy()

Construct an exact copy of a #GValueArray by duplicating all its contents.

getNth
gobject.value.Value getNth(uint index)

Return a pointer to the value at index_ containd in value_array.

insert
gobject.value_array.ValueArray insert(uint index, gobject.value.Value value)

Insert a copy of value at specified position into value_array. If value is null, an uninitialized value is inserted.

prepend
gobject.value_array.ValueArray prepend(gobject.value.Value value)

Insert a copy of value as first element of value_array. If value is null, an uninitialized value is prepended.

remove
gobject.value_array.ValueArray remove(uint index)

Remove the value at position index_ from value_array.

sort
gobject.value_array.ValueArray sort(glib.types.CompareDataFunc compareFunc)

Sort value_array using compare_func to compare the elements according to the semantics of #GCompareDataFunc.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.

Detailed Description

Deprecated: Use glib.array.Array instead, if possible for the given use case, as described above.