Function

GLibVariantnew_fixed_array

since: 2.32

Declaration

GVariant*
g_variant_new_fixed_array (
  const GVariantType* element_type,
  gconstpointer elements,
  gsize n_elements,
  gsize element_size
)

Description

Constructs a new array GVariant instance, where the elements are of element_type type.

elements must be an array with fixed-sized elements. Numeric types are fixed-size as are tuples containing only other fixed-sized types.

element_size must be the size of a single element in the array. For example, if calling this function for an array of 32-bit integers, you might say sizeof(gint32). This value isn’t used except for the purpose of a double-check that the form of the serialized data matches the caller’s expectation.

n_elements must be the length of the elements array.

Available since: 2.32

Parameters

element_type

Type: GVariantType

The GVariantType of each element.

The data is owned by the caller of the function.
elements

Type: gconstpointer

A pointer to the fixed array of contiguous elements.

The argument can be NULL.
The data is owned by the caller of the function.
n_elements

Type: gsize

The number of elements.

element_size

Type: gsize

The size of each element.

Return value

Type: GVariant

A floating reference to a new array GVariant instance.

The data is owned by the called function.