GenericArray
Object Hierarchy:
Description:
[ Compact ]
[ CCode ( cname = "GPtrArray" , cprefix = "g_ptr_array_" , ref_function = "g_ptr_array_ref" , type_id = "G_TYPE_PTR_ARRAY" , unref_function = "g_ptr_array_unref" ) ]
[ GIR ( name = "PtrArray" ) ]
public class GenericArray<G>
Contains the public fields of a pointer array.
Example: Sort all items (with data):
public static int main (string[] args) {
GenericArray<string> array = new GenericArray<string> ();
array.add ("second entry");
array.add ("third entry");
array.add ("first entry");
bool asc = true;
array.sort_with_data ((a, b) => {
return (asc)? strcmp (a, b) : strcmp (b, a);
});
// Output:
// ``first entry``
// ``second entry``
// ``third entry``
array.foreach ((str) => {
print ("%s\n", str);
});
return 0;
}
valac --pkg glib-2.0 GLib.GenericArray.sort_with_data.vala
Content:
Properties:
Creation methods:
Methods:
- public void @foreach (Func<G> func)
- public unowned G @get (uint index)
- public void @set (uint index, owned G data)
- public void _sort_with_data (CompareDataFunc<unowned G**> compare_func)
- public void add (owned G data)
- public GenericArray<G> copy (CopyFunc<G> func)
- public void extend (GenericArray<G> array, CopyFunc<G> func)
- public void extend_and_steal (owned GenericArray<G> array)
- public bool find (G needle, out uint index = null)
Checks whether needle
exists in haystack
.
- public bool find_custom<T> (T needle, ArraySearchFunc<G,T>? equal_func, out uint index = null)
- public bool find_with_equal_func (G needle, EqualFunc<G>? equal_func, out uint index = null)
Checks whether needle
exists in haystack
,
using the given equal_func
.
- public void insert (int index, owned G data)
- public bool is_null_terminated ()
- public bool remove (G data)
- public bool remove_fast (G data)
- public void remove_index (uint index)
- public void remove_index_fast (uint index)
- public void remove_range (uint index, uint length)
- public void sort (CompareFunc<G> compare_func)
Sorts the array, using compare_func
- public void sort_with_data (CompareDataFunc<G> compare_func)
Sorts the array, using compare_func
- public G[] steal ()
- public G steal_index (uint index)
- public G steal_index_fast (uint index)
Fields: