Class ValueArray

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.ValueArray
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") @Deprecated public class ValueArray extends ProxyInstance
Deprecated.
Use GArray instead, if possible for the given use case, as described above.

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, 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 Details

    • ValueArray

      public ValueArray(MemorySegment address)
      Deprecated.
      Create a ValueArray proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ValueArray

      @Deprecated public ValueArray(int nPrealloced)
      Deprecated.
      Use GArray and g_array_sized_new() instead.
      Allocate and initialize a new GValueArray, optionally preserve space for nPrealloced elements. New arrays always contain 0 elements, regardless of the value of nPrealloced.
      Parameters:
      nPrealloced - number of values to preallocate space for
  • Method Details

    • getType

      public static @Nullable Type getType()
      Deprecated.
      Get the GType of the ValueArray class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      Deprecated.
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readNValues

      public int readNValues()
      Deprecated.
      Read the value of the field n_values.
      Returns:
      The value of the field n_values
    • writeNValues

      public void writeNValues(int nValues)
      Deprecated.
      Write a value in the field n_values.
      Parameters:
      nValues - The new value for the field n_values
    • readValues

      public Value readValues()
      Deprecated.
      Read the value of the field values.
      Returns:
      The value of the field values
    • writeValues

      public void writeValues(Value values)
      Deprecated.
      Write a value in the field values.
      Parameters:
      values - The new value for the field values
    • readNPrealloced

      public int readNPrealloced()
      Deprecated.
      Read the value of the field n_prealloced.
      Returns:
      The value of the field n_prealloced
    • writeNPrealloced

      public void writeNPrealloced(int nPrealloced)
      Deprecated.
      Write a value in the field n_prealloced.
      Parameters:
      nPrealloced - The new value for the field n_prealloced
    • append

      @Deprecated public ValueArray append(@Nullable Value value)
      Deprecated.
      Use GArray and g_array_append_val() instead.
      Insert a copy of value as last element of valueArray. If value is null, an uninitialized value is appended.
      Parameters:
      value - GValue to copy into GValueArray, or null
      Returns:
      the GValueArray passed in as this ValueArray
    • copy

      @Deprecated public ValueArray copy()
      Deprecated.
      Use GArray and g_array_ref() instead.
      Construct an exact copy of a GValueArray by duplicating all its contents.
      Returns:
      Newly allocated copy of GValueArray
    • free

      @Deprecated public void free()
      Deprecated.
      Use GArray and g_array_unref() instead.
      Free a GValueArray including its contents.
    • getNth

      @Deprecated public Value getNth(int index)
      Deprecated.
      Use g_array_index() instead.
      Return a pointer to the value at index contained in valueArray.
      Parameters:
      index - index of the value of interest
      Returns:
      pointer to a value at index in this ValueArray
    • insert

      @Deprecated public ValueArray insert(int index, @Nullable Value value)
      Deprecated.
      Use GArray and g_array_insert_val() instead.
      Insert a copy of value at specified position into valueArray. If value is null, an uninitialized value is inserted.
      Parameters:
      index - insertion position, must be <= value_array->;n_values
      value - GValue to copy into GValueArray, or null
      Returns:
      the GValueArray passed in as this ValueArray
    • prepend

      @Deprecated public ValueArray prepend(@Nullable Value value)
      Deprecated.
      Use GArray and g_array_prepend_val() instead.
      Insert a copy of value as first element of valueArray. If value is null, an uninitialized value is prepended.
      Parameters:
      value - GValue to copy into GValueArray, or null
      Returns:
      the GValueArray passed in as this ValueArray
    • remove

      @Deprecated public ValueArray remove(int index)
      Deprecated.
      Use GArray and g_array_remove_index() instead.
      Remove the value at position index from valueArray.
      Parameters:
      index - position of value to remove, which must be less than valueArray>nValues
      Returns:
      the GValueArray passed in as this ValueArray
    • sort

      @Deprecated public ValueArray sort(@Nullable CompareDataFunc compareFunc)
      Deprecated.
      Use GArray and g_array_sort_with_data().

      Sort this ValueArray using compareFunc to compare the elements according to the semantics of GCompareDataFunc.

      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