ValueArray
Object Hierarchy:
Description:
[ CCode ( copy_function = "g_value_array_copy" , free_function = "g_value_array_free" , type_id = "G_TYPE_VALUE_ARRAY" ) ]
[ Compact ]
[ Version ( deprecated = true , deprecated_since = "2.32" ) ]
public class ValueArray
Warning: ValueArray is deprecated since 2.32.
A ValueArray contains an array of Value elements.
Example: Value arrays:
private inline Value create_string_value (string str) {
Value val = Value (typeof (string));
val.set_string (str);
return val;
}
public static int main (string[] args) {
ValueArray array = new ValueArray (10);
array.append (create_string_value ("BB"));
array.append (create_string_value ("DD"));
array.prepend (create_string_value ("AA"));
// Output: ``Len: 3``
print ("Len: %u\n", array.n_values);
array.insert (2, create_string_value ("CC"));
array.remove (3);
// Output:
// ``AA``
// ``BB``
// ``CC``
foreach (Value val in array.values) {
print ("%s\n", val.get_string ());
}
return 0;
}
valac --pkg gobject-2.0 GLib.ValueArray.vala
Content:
Creation methods:
Methods:
- public void append (Value value)
Insert a copy of value
as last element of
this.
- public ValueArray copy ()
Construct an exact copy of a ValueArray by
duplicating all its contents.
- public unowned Value? get_nth (uint index_)
Return a pointer to the value at index_
containd in
this.
- public void insert (uint index_, Value value)
Insert a copy of value
at specified position into
this.
- public void prepend (Value value)
Insert a copy of value
as first element of
this.
- public void remove (uint index_)
Remove the value at position index_
from
this.
- public void sort (CompareFunc<Value?> compare_func)
Sort this using compare_func
to compare the elements according to the semantics of SearchFunc.
- public void sort_with_data (CompareDataFunc<Value?> compare_func)
Sort this using compare_func
to compare the elements according to the semantics of CompareDataFunc.
Fields: