1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 A #GValueArray is a container structure to maintain an array of #GValue elements.
7 <!-- ##### SECTION Long_Description ##### -->
9 The prime purpose of a #GValueArray is for it to be used as an object property
10 that holds an array of values. A #GValueArray wraps an array of #GValue elements
11 in order for it to be used as a boxed type through %G_TYPE_VALUE_ARRAY.
14 <!-- ##### SECTION See_Also ##### -->
16 #GValue, #GParamSpecValueArray, g_param_spec_value_array()
19 <!-- ##### STRUCT GValueArray ##### -->
23 @n_values: number of values contained in the array
24 @values: array of values
26 <!-- ##### FUNCTION g_value_array_get_nth ##### -->
28 Return a pointer to the value at @index containd in @value_array.
31 @value_array: #GValueArray to get a value from
32 @index: index of the value of interest
33 @Returns: pointer to a value at @index in @value_array
36 <!-- ##### FUNCTION g_value_array_new ##### -->
38 Allocate and initialize a new #GValueArray, optionally preserve space
39 for @n_prealloced elements. New arrays always contain 0 elements,
40 regardless of the value of @n_prealloced.
43 @n_prealloced: number of values to preallocate space for
44 @Returns: a newly allocated #GValueArray with 0 values
47 <!-- ##### FUNCTION g_value_array_copy ##### -->
49 Construct an exact copy of a #GValueArray by duplicating all its
53 @value_array: #GValueArray to copy
54 @Returns: Newly allocated copy of #GValueArray
57 <!-- ##### FUNCTION g_value_array_free ##### -->
59 Free a #GValueArray including its contents.
65 <!-- ##### FUNCTION g_value_array_append ##### -->
67 Insert a copy of @value as last element of @value_array.
70 @value_array: #GValueArray to add an element to
71 @value: #GValue to copy into #GValueArray
72 @Returns: the #GValueArray passed in as @value_array
75 <!-- ##### FUNCTION g_value_array_prepend ##### -->
77 Insert a copy of @value as first element of @value_array.
80 @value_array: #GValueArray to add an element to
81 @value: #GValue to copy into #GValueArray
82 @Returns: the #GValueArray passed in as @value_array
85 <!-- ##### FUNCTION g_value_array_insert ##### -->
87 Insert a copy of @value at specified position into @value_array.
90 @value_array: #GValueArray to add an element to
91 @index: insertion position, must be <= value_array->n_values
92 @value: #GValue to copy into #GValueArray
93 @Returns: the #GValueArray passed in as @value_array
96 <!-- ##### FUNCTION g_value_array_remove ##### -->
98 Remove the value at position @index from @value_array.
101 @value_array: #GValueArray to remove an element from
102 @index: position of value to remove, must be < value_array->n_values
103 @Returns: the #GValueArray passed in as @value_array
106 <!-- ##### FUNCTION g_value_array_sort ##### -->
108 Sort @value_array using @compare_func to compare the elements accoring to
109 the semantics of #GCompareFunc.
113 The current implementation uses Quick-Sort as sorting algorithm.
116 @value_array: #GValueArray to sort
117 @compare_func: function to compare elements
118 @Returns: the #GValueArray passed in as @value_array
121 <!-- ##### FUNCTION g_value_array_sort_with_data ##### -->
123 Sort @value_array using @compare_func to compare the elements accoring
124 to the semantics of #GCompareDataFunc.
128 The current implementation uses Quick-Sort as sorting algorithm.
131 @value_array: #GValueArray to sort
132 @compare_func: function to compare elements
133 @user_data: extra data argument provided for @compare_func
134 @Returns: the #GValueArray passed in as @value_array