a GLib.VariantType, or null
a string containing a GVariant in text form
Optionallimit: stringa pointer to the end of text, or null
Optionalendptr: stringa location to store the end pointer, or null
a non-floating reference to a GLib.Variant, or null
Parses a GLib.Variant from a text representation.
A single GLib.Variant is parsed from the content of
text.The format is described here.
The memory at
limitwill never be accessed and the parser behaves as if the character atlimitis the nul terminator. This has the effect of boundingtext.If
endptris non-nullthentextis permitted to contain data following the value that this function parses andendptrwill be updated to point to the first character past the end of the text parsed by this function. Ifendptrisnulland there is extra data then an error is returned.If
typeis non-nullthen the value will be parsed to have that type. This may result in additional parse errors (in the case that the parsed value doesn't fit the type) but may also result in fewer errors (in the case that the type would have been ambiguous, such as with empty arrays).In the event that the parsing is successful, the resulting GLib.Variant is returned. It is never floating, and must be freed with GLib.Variant.unref.
In case of any error,
nullwill be returned. Iferroris non-nullthen it will be set to reflect the error that occurred.Officially, the language understood by the parser is “any string produced by GLib.Variant.print”. This explicitly includes
g_variant_print()’s annotated types likeint64 -1000.There may be implementation specific restrictions on deeply nested values, which would result in a GLib.VariantParseError.RECURSION error. GLib.Variant is guaranteed to handle nesting up to at least 64 levels.