Function

GLibVariantnew_parsed_va

Declaration

GVariant*
g_variant_new_parsed_va (
  const gchar* format,
  va_list* app
)

Description

Parses format and returns the result.

This is the version of g_variant_new_parsed() intended to be used from libraries.

The return value will be floating if it was a newly created GVariant instance. In the case that format simply specified the collection of a GVariant pointer (eg: format was “%*”) then the collected GVariant pointer will be returned unmodified, without adding any additional references.

Note that the arguments in app must be of the correct width for their types specified in format when collected into the #va_list. See the [GVariant varargs documentation][gvariant-varargs].

In order to behave correctly in all cases it is necessary for the calling function to g_variant_ref_sink() the return result before returning control to the user that originally provided the pointer. At this point, the caller will have their own full reference to the result. This can also be done by adding the result to a container, or by passing it to another g_variant_new() call.

Parameters

format const gchar*
 

A text format GVariant.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
app va_list*
 

A pointer to a #va_list.

 The data is owned by the caller of the function.

Return value

Returns: GVariant
 

A new, usually floating, GVariant.

 The caller of the function takes ownership of the data, and is responsible for freeing it.