Package org.gnome.gobject
Class ValueArray
java.lang.Object
io.github.jwharm.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
ConstructorDescriptionValueArray
(int nPrealloced) Deprecated.ValueArray
(MemorySegment address) Deprecated.Create a ValueArray proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.UseGArray
and g_array_append_val() instead.copy()
Deprecated.UseGArray
and g_array_ref() instead.void
free()
Deprecated.UseGArray
and g_array_unref() instead.static MemoryLayout
Deprecated.The memory layout of the native struct.getNth
(int index) Deprecated.Use g_array_index() instead.static Type
getType()
Deprecated.Get the GType of the ValueArray classDeprecated.UseGArray
and g_array_insert_val() instead.Deprecated.UseGArray
and g_array_prepend_val() instead.int
Deprecated.Read the value of the fieldn_prealloced
.int
Deprecated.Read the value of the fieldn_values
.Deprecated.Read the value of the fieldvalues
.remove
(int index) Deprecated.UseGArray
and g_array_remove_index() instead.sort
(CompareDataFunc compareFunc) Deprecated.UseGArray
and g_array_sort_with_data().void
writeNPrealloced
(int nPrealloced) Deprecated.Write a value in the fieldn_prealloced
.void
writeNValues
(int nValues) Deprecated.Write a value in the fieldn_values
.void
writeValues
(Value values) Deprecated.Write a value in the fieldvalues
.Methods inherited from class io.github.jwharm.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.UseGArray
and g_array_sized_new() instead.Allocate and initialize a newGValueArray
, optionally preserve space fornPrealloced
elements. New arrays always contain 0 elements, regardless of the value ofnPrealloced
.- Parameters:
nPrealloced
- number of values to preallocate space for
-
-
Method Details
-
getType
-
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.UseGArray
and g_array_append_val() instead.Insert a copy ofvalue
as last element of this ValueArray. Ifvalue
isnull
, an uninitialized value is appended.- Parameters:
value
-GValue
to copy intoGValueArray
, ornull
- Returns:
- the
GValueArray
passed in as this ValueArray
-
copy
Deprecated.UseGArray
and g_array_ref() instead.Construct an exact copy of aGValueArray
by duplicating all its contents.- Returns:
- Newly allocated copy of
GValueArray
-
free
Deprecated.UseGArray
and g_array_unref() instead.Free aGValueArray
including its contents. -
getNth
Deprecated.Use g_array_index() instead.Return a pointer to the value atindex
contained in this ValueArray.- Parameters:
index
- index of the value of interest- Returns:
- pointer to a value at
index
in this ValueArray
-
insert
Deprecated.UseGArray
and g_array_insert_val() instead.Insert a copy ofvalue
at specified position into this ValueArray. Ifvalue
isnull
, an uninitialized value is inserted.- Parameters:
index
- insertion position, must be <= value_array->;n_valuesvalue
-GValue
to copy intoGValueArray
, ornull
- Returns:
- the
GValueArray
passed in as this ValueArray
-
prepend
Deprecated.UseGArray
and g_array_prepend_val() instead.Insert a copy ofvalue
as first element of this ValueArray. Ifvalue
isnull
, an uninitialized value is prepended.- Parameters:
value
-GValue
to copy intoGValueArray
, ornull
- Returns:
- the
GValueArray
passed in as this ValueArray
-
remove
Deprecated.UseGArray
and g_array_remove_index() instead.Remove the value at positionindex
from this ValueArray.- Parameters:
index
- position of value to remove, which must be less than this ValueArray->n_values- Returns:
- the
GValueArray
passed in as this ValueArray
-
sort
Deprecated.UseGArray
and g_array_sort_with_data().Sort this ValueArray usingcompareFunc
to 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
GValueArray
passed in as this ValueArray
-
GArray
and g_array_sized_new() instead.