Method

GLibVariantget_fixed_array

since: 2.24

Declaration [src]

gconstpointer
g_variant_get_fixed_array (
  GVariant* value,
  gsize* n_elements,
  gsize element_size
)

Description [src]

Provides access to the serialized data for an array of fixed-sized items.

value 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, as given by the section on serialized data memory.

In particular, arrays of these fixed-sized types can be interpreted as an array of the given C type, with element_size set to the size the appropriate type: - G_VARIANT_TYPE_INT16 (etc.): #gint16 (etc.) - G_VARIANT_TYPE_BOOLEAN: #guchar (not #gboolean!) - G_VARIANT_TYPE_BYTE: #guint8 - G_VARIANT_TYPE_HANDLE: #guint32 - G_VARIANT_TYPE_DOUBLE: #gdouble

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, which must be non-NULL, is set equal to the number of items in the array.

Available since: 2.24

This method is not directly available to language bindings.

Parameters

n_elements

Type: gsize*

A pointer to the location to store the number of items.

The argument will be set by the function.
element_size

Type: gsize

The size of each element.

Return value

Type: An array of gconstpointer

A pointer to the fixed array.

The length of the array is in the n_elements argument.