:right-sidebar: True ValueArray =================================================================== .. currentmodule:: gi.repository.GObject .. deprecated:: 2.32 Use ``GArray`` instead, if possible for the given use case, as described above. .. class:: ValueArray(*args, **kwargs) :no-contents-entry: :Constructors: :: ValueArray() new(n_prealloced:int) -> GObject.ValueArray Constructors ------------ .. rst-class:: interim-class .. class:: ValueArray :no-index: .. classmethod:: new(n_prealloced: int) -> ~gi.repository.GObject.ValueArray Allocate and initialize a new :obj:`~gi.repository.GObject.ValueArray`, optionally preserve space for ``n_prealloced`` elements. New arrays always contain 0 elements, regardless of the value of ``n_prealloced``. .. deprecated:: 2.32 Use ``GArray`` and :func:`~gi.repository.GLib.Array.sized_new` instead. :param n_prealloced: number of values to preallocate space for Methods ------- .. rst-class:: interim-class .. class:: ValueArray :no-index: .. method:: append(value: ~typing.Any | None = None) -> ~gi.repository.GObject.ValueArray Insert a copy of ``value`` as last element of ``value_array``. If ``value`` is :const:`None`, an uninitialized value is appended. .. deprecated:: 2.32 Use ``GArray`` and :func:`~gi.repository.GLib.array_append_val` instead. :param value: :obj:`~gi.repository.GObject.Value` to copy into :obj:`~gi.repository.GObject.ValueArray`, or :const:`None` .. method:: get_nth(index_: int) -> ~typing.Any Return a pointer to the value at @``index_`` containd in ``value_array``. .. deprecated:: 2.32 Use :func:`~gi.repository.GLib.array_index` instead. :param index_: index of the value of interest .. method:: insert(index_: int, value: ~typing.Any | None = None) -> ~gi.repository.GObject.ValueArray Insert a copy of ``value`` at specified position into ``value_array``. If ``value`` is :const:`None`, an uninitialized value is inserted. .. deprecated:: 2.32 Use ``GArray`` and :func:`~gi.repository.GLib.array_insert_val` instead. :param index_: insertion position, must be <= value_array->;n_values :param value: :obj:`~gi.repository.GObject.Value` to copy into :obj:`~gi.repository.GObject.ValueArray`, or :const:`None` .. method:: prepend(value: ~typing.Any | None = None) -> ~gi.repository.GObject.ValueArray Insert a copy of ``value`` as first element of ``value_array``. If ``value`` is :const:`None`, an uninitialized value is prepended. .. deprecated:: 2.32 Use ``GArray`` and :func:`~gi.repository.GLib.array_prepend_val` instead. :param value: :obj:`~gi.repository.GObject.Value` to copy into :obj:`~gi.repository.GObject.ValueArray`, or :const:`None` .. method:: remove(index_: int) -> ~gi.repository.GObject.ValueArray Remove the value at position @``index_`` from ``value_array``. .. deprecated:: 2.32 Use ``GArray`` and :func:`~gi.repository.GLib.Array.remove_index` instead. :param index_: position of value to remove, which must be less than ``value_array``->n_values .. method:: sort(compare_func: ~typing.Callable[[...], int], *user_data: ~typing.Any) -> ~gi.repository.GObject.ValueArray Sort ``value_array`` using ``compare_func`` to compare the elements according to the semantics of :obj:`~gi.repository.GLib.CompareFunc`. The current implementation uses the same sorting algorithm as standard C qsort() function. .. deprecated:: 2.32 Use ``GArray`` and :func:`~gi.repository.GLib.Array.sort`. :param compare_func: function to compare elements :param user_data: Fields ------ .. rst-class:: interim-class .. class:: ValueArray :no-index: .. attribute:: n_prealloced .. attribute:: n_values Number of values contained in the array .. attribute:: values Array of values