| GObject Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <glib-object.h>
GValueArray;
GValue* g_value_array_get_nth (GValueArray *value_array,
guint index_);
GValueArray* g_value_array_new (guint n_prealloced);
GValueArray* g_value_array_copy (const GValueArray *value_array);
void g_value_array_free (GValueArray *value_array);
GValueArray* g_value_array_append (GValueArray *value_array,
const GValue *value);
GValueArray* g_value_array_prepend (GValueArray *value_array,
const GValue *value);
GValueArray* g_value_array_insert (GValueArray *value_array,
guint index_,
const GValue *value);
GValueArray* g_value_array_remove (GValueArray *value_array,
guint index_);
GValueArray* g_value_array_sort (GValueArray *value_array,
GCompareFunc compare_func);
GValueArray* g_value_array_sort_with_data (GValueArray *value_array,
GCompareDataFunc compare_func,
gpointer user_data);
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.
typedef struct {
guint n_values;
GValue *values;
} GValueArray;
A GValueArray contains an array of GValue elements.
GValue* g_value_array_get_nth (GValueArray *value_array,guint index_);
Return a pointer to the value at index_ containd in value_array.
|
GValueArray to get a value from |
|
index of the value of interest |
Returns : |
pointer to a value at index_ in value_array. [transfer none]
|
GValueArray* g_value_array_new (guint n_prealloced);
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.
|
number of values to preallocate space for |
Returns : |
a newly allocated GValueArray with 0 values |
GValueArray* g_value_array_copy (const GValueArray *value_array);
Construct an exact copy of a GValueArray by duplicating all its contents.
|
GValueArray to copy |
Returns : |
Newly allocated copy of GValueArray. [transfer full] |
void g_value_array_free (GValueArray *value_array);
Free a GValueArray including its contents.
|
GValueArray to free |
GValueArray* g_value_array_append (GValueArray *value_array,const GValue *value);
Insert a copy of value as last element of value_array. If value is
NULL, an uninitialized value is appended.
|
GValueArray to add an element to |
|
GValue to copy into GValueArray, or NULL. [allow-none]
|
Returns : |
the GValueArray passed in as value_array. [transfer none]
|
GValueArray* g_value_array_prepend (GValueArray *value_array,const GValue *value);
Insert a copy of value as first element of value_array. If value is
NULL, an uninitialized value is prepended.
|
GValueArray to add an element to |
|
GValue to copy into GValueArray, or NULL. [allow-none]
|
Returns : |
the GValueArray passed in as value_array. [transfer none]
|
GValueArray* g_value_array_insert (GValueArray *value_array,guint index_,const GValue *value);
Insert a copy of value at specified position into value_array. If value
is NULL, an uninitialized value is inserted.
|
GValueArray to add an element to |
|
insertion position, must be <= value_array->n_values |
|
GValue to copy into GValueArray, or NULL. [allow-none]
|
Returns : |
the GValueArray passed in as value_array. [transfer none]
|
GValueArray* g_value_array_remove (GValueArray *value_array,guint index_);
Remove the value at position index_ from value_array.
|
GValueArray to remove an element from |
|
position of value to remove, must be < value_array->n_values |
Returns : |
the GValueArray passed in as value_array. [transfer none]
|
GValueArray* g_value_array_sort (GValueArray *value_array,GCompareFunc compare_func);
Sort value_array using compare_func to compare the elements accoring to
the semantics of GCompareFunc.
The current implementation uses Quick-Sort as sorting algorithm.
|
GValueArray to sort |
|
function to compare elements. [scope call] |
Returns : |
the GValueArray passed in as value_array. [transfer none]
|
GValueArray* g_value_array_sort_with_data (GValueArray *value_array,GCompareDataFunc compare_func,gpointer user_data);
Sort value_array using compare_func to compare the elements accoring
to the semantics of GCompareDataFunc.
The current implementation uses Quick-Sort as sorting algorithm.
Rename to: g_value_array_sort
|
GValueArray to sort |
|
function to compare elements. [scope call] |
|
extra data argument provided for compare_func. [closure]
|
Returns : |
the GValueArray passed in as value_array. [transfer none]
|