Function

GLibVariantnew_array

Declaration

GVariant*
g_variant_new_array (
  const GVariantType* child_type,
  GVariant* const* children,
  gsize n_children
)

Description

Creates a new GVariant array from children.

child_type must be non-NULL if n_children is zero. Otherwise, the child type is determined by inspecting the first element of the children array. If child_type is non-NULL then it must be a definite type.

The items of the array are taken from the children array. No entry in the children array may be NULL.

All items in the array must have the same type, which must be the same as child_type, if given.

If the children are floating references (see g_variant_ref_sink()), the new instance takes ownership of them as if via g_variant_ref_sink().

Available since:2.24

Parameters

child_type GVariantType
 

The element type of the new array.

 The argument can be NULL.
 The data is owned by the caller of the function.
children An array of GVariant*
 

An array of GVariant pointers, the children.

 The argument can be NULL.
 The length of the array is specified in the n_children argument.
 The data is owned by the caller of the function.
n_children gsize
 

The length of children.

Return value

Returns: GVariant
 

A floating reference to a new GVariant array.

 The data is owned by the called function.