GObject.ValueArray¶
record (struct)
:::warning Deprecated since 2.32 This API is deprecated. :::
A GValueArray is a container structure to hold an array of generic values.
The prime purpose of a GValueArray is for it to be used as an
object property that holds an array of values. A GValueArray wraps
an array of GValue elements in order for it to be used as a boxed
type through G_TYPE_VALUE_ARRAY.
GValueArray is deprecated in favour of GArray since GLib 2.32.
It is possible to create a GArray that behaves like a GValueArray
by using the size of GValue as the element size, and by setting
Value.unset as the clear function using
GLib.Array.set_clear_func, for instance, the following code:
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);
Constructors¶
new¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Allocate and initialize a new ValueArray, optionally preserve space
for n_prealloced elements. New arrays always contain 0 elements,
regardless of the value of n_prealloced.
Parameters:
n_prealloced— number of values to preallocate space for
Methods¶
append¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Insert a copy of value as last element of value_array. If value is
None, an uninitialized value is appended.
Parameters:
value—Valueto copy intoValueArray, orNone
copy¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Construct an exact copy of a ValueArray by duplicating all its
contents.
get_nth¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Return a pointer to the value at index_ contained in value_array.
Parameters:
index_— index of the value of interest
insert¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Insert a copy of value at specified position into value_array. If value
is None, an uninitialized value is inserted.
Parameters:
index_— insertion position, must be <= value_array->;n_valuesvalue—Valueto copy intoValueArray, orNone
prepend¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Insert a copy of value as first element of value_array. If value is
None, an uninitialized value is prepended.
Parameters:
value—Valueto copy intoValueArray, orNone
remove¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Remove the value at position index_ from value_array.
Parameters:
index_— position of value to remove, which must be less thanvalue_array->n_values
sort¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Sort value_array using compare_func to compare the elements according to
the semantics of GCompareFunc.
The current implementation uses the same sorting algorithm as standard C qsort() function.
Parameters:
compare_func— function to compare elements
sort_with_data¶
:::warning Deprecated since 2.32 This API is deprecated. :::
Sort value_array using compare_func to compare the elements according
to the semantics of GCompareDataFunc.
The current implementation uses the same sorting algorithm as standard C qsort() function.
Parameters:
compare_func— function to compare elements