Struct

GObjectValueArray

deprecated: 2.32 

Description

struct GValueArray {
  guint n_values;
  GValue* values;
}

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 g_value_unset() as the clear function using g_array_set_clear_func(), 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);
Structure members
n_values

Number of values contained in the array.

values

Array of values.

Deprecated since: 2.32

Use GArray instead, if possible for the given use case, as described above.

Constructors

g_value_array_new

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.

deprecated: 2.32 

Instance methods

g_value_array_append

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

deprecated: 2.32 

g_value_array_copy

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

deprecated: 2.32 

g_value_array_free

Free a GValueArray including its contents.

deprecated: 2.32 

g_value_array_get_nth

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

deprecated: 2.32 

g_value_array_insert

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

deprecated: 2.32 

g_value_array_prepend

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

deprecated: 2.32 

g_value_array_remove

Remove the value at position index_ from value_array.

deprecated: 2.32 

g_value_array_sort

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

deprecated: 2.32 

g_value_array_sort_with_data

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

deprecated: 2.32