Class (GI Struct)

GLib-2.0GLibArray

Contains the public fields of a GLib.Array.

Index

Constructors

Properties

Methods

Constructors

Properties

data: string
len: number
$gtype: GType<GLib.Array>

Methods

  • Creates a shallow copy of a GLib.Array. If the array elements consist of pointers to data, the pointers are copied but the actual data is not.

    Parameters

    • array: any[]

      an array

    Returns any[]

  • Frees the memory allocated for the GLib.Array. If free_segment is true it frees the memory block holding the elements as well. Pass false if you want to free the GLib.Array wrapper but preserve the underlying array for use elsewhere. If the reference count of array is greater than one, the GLib.Array wrapper is preserved but the size of array will be set to zero.

    If array contents point to dynamically-allocated memory, they should be freed separately if free_segment is true and no clear_func function has been set for array.

    This function is not thread-safe. If using a GLib.Array from multiple threads, use only the atomic GLib.Array.ref and GLib.Array.unref functions.

    Parameters

    • array: any[]

      an array

    • free_segment: boolean

      if true, the actual element data is freed as well

    Returns string

  • Atomically increments the reference count of array by one. This function is thread-safe and may be called from any thread.

    Parameters

    • array: any[]

      an array

    Returns any[]

  • Atomically decrements the reference count of array by one. If the reference count drops to 0, the effect is the same as calling GLib.Array.free with free_segment set to true. This function is thread-safe and may be called from any thread.

    Parameters

    • array: any[]

      an array

    Returns void