Package org.gnome.gobject
Class ValueArray
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.ValueArray
- All Implemented Interfaces:
Proxy
Deprecated.
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
Value.unset() as the clear function using
Array.setClearFunc(java.lang.foreign.MemorySegment[]), 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);
-
Constructor Summary
ConstructorsConstructorDescriptionValueArray(int nPrealloced) Deprecated.UseGArrayand g_array_sized_new() instead.ValueArray(MemorySegment address) Deprecated.Create a ValueArray proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.UseGArrayand g_array_append_val() instead.copy()Deprecated.UseGArrayand g_array_ref() instead.voidfree()Deprecated.UseGArrayand g_array_unref() instead.static MemoryLayoutDeprecated.The memory layout of the native struct.getNth(int index) Deprecated.Use g_array_index() instead.static @Nullable TypegetType()Deprecated.Get the GType of the ValueArray classDeprecated.UseGArrayand g_array_insert_val() instead.Deprecated.UseGArrayand g_array_prepend_val() instead.intDeprecated.Read the value of the fieldn_prealloced.intDeprecated.Read the value of the fieldn_values.Deprecated.Read the value of the fieldvalues.remove(int index) Deprecated.UseGArrayand g_array_remove_index() instead.sort(@Nullable CompareDataFunc compareFunc) Deprecated.UseGArrayand g_array_sort_with_data().voidwriteNPrealloced(int nPrealloced) Deprecated.Write a value in the fieldn_prealloced.voidwriteNValues(int nValues) Deprecated.Write a value in the fieldn_values.voidwriteValues(Value values) Deprecated.Write a value in the fieldvalues.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ValueArray
Deprecated.Create a ValueArray proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ValueArray
Deprecated.UseGArrayand g_array_sized_new() instead.Allocate and initialize a newGValueArray, optionally preserve space fornPreallocedelements. New arrays always contain 0 elements, regardless of the value ofnPrealloced.- Parameters:
nPrealloced- number of values to preallocate space for
-
-
Method Details
-
getType
Deprecated.Get the GType of the ValueArray class- Returns:
- the GType
-
getMemoryLayout
Deprecated.The memory layout of the native struct.- Returns:
- the memory layout
-
readNValues
public int readNValues()Deprecated.Read the value of the fieldn_values.- Returns:
- The value of the field
n_values
-
writeNValues
public void writeNValues(int nValues) Deprecated.Write a value in the fieldn_values.- Parameters:
nValues- The new value for the fieldn_values
-
readValues
Deprecated.Read the value of the fieldvalues.- Returns:
- The value of the field
values
-
writeValues
Deprecated.Write a value in the fieldvalues.- Parameters:
values- The new value for the fieldvalues
-
readNPrealloced
public int readNPrealloced()Deprecated.Read the value of the fieldn_prealloced.- Returns:
- The value of the field
n_prealloced
-
writeNPrealloced
public void writeNPrealloced(int nPrealloced) Deprecated.Write a value in the fieldn_prealloced.- Parameters:
nPrealloced- The new value for the fieldn_prealloced
-
append
Deprecated.UseGArrayand g_array_append_val() instead.Insert a copy ofvalueas last element ofvalueArray.Ifvalueisnull, an uninitialized value is appended.- Parameters:
value-GValueto copy intoGValueArray, ornull- Returns:
- the
GValueArraypassed in as this ValueArray
-
copy
Deprecated.UseGArrayand g_array_ref() instead.Construct an exact copy of aGValueArrayby duplicating all its contents.- Returns:
- Newly allocated copy of
GValueArray
-
free
Deprecated.UseGArrayand g_array_unref() instead.Free aGValueArrayincluding its contents. -
getNth
Deprecated.Use g_array_index() instead.Return a pointer to the value atindexcontained invalueArray.- Parameters:
index- index of the value of interest- Returns:
- pointer to a value at
indexin this ValueArray
-
insert
Deprecated.UseGArrayand g_array_insert_val() instead.Insert a copy ofvalueat specified position intovalueArray.Ifvalueisnull, an uninitialized value is inserted.- Parameters:
index- insertion position, must be <= value_array->;n_valuesvalue-GValueto copy intoGValueArray, ornull- Returns:
- the
GValueArraypassed in as this ValueArray
-
prepend
Deprecated.UseGArrayand g_array_prepend_val() instead.Insert a copy ofvalueas first element ofvalueArray.Ifvalueisnull, an uninitialized value is prepended.- Parameters:
value-GValueto copy intoGValueArray, ornull- Returns:
- the
GValueArraypassed in as this ValueArray
-
remove
Deprecated.UseGArrayand g_array_remove_index() instead.Remove the value at positionindexfromvalueArray.- Parameters:
index- position of value to remove, which must be less thanvalueArray>nValues- Returns:
- the
GValueArraypassed in as this ValueArray
-
sort
Deprecated.UseGArrayand g_array_sort_with_data().Sort this ValueArray usingcompareFuncto compare the elements according to the semantics ofGCompareDataFunc.The current implementation uses the same sorting algorithm as standard C qsort() function.
- Parameters:
compareFunc- function to compare elements- Returns:
- the
GValueArraypassed in as this ValueArray
-
GArrayinstead, if possible for the given use case, as described above.