check_format_string


Description:

[ Version ( since = "2.34" ) ]
public bool check_format_string (string format_string, bool copy_only)

Checks if calling @get with format_string on this would be valid from a type-compatibility standpoint.

format_string is assumed to be a valid format string (from a syntactic standpoint).

If copy_only is true then this function additionally checks that it would be safe to call g_variant_unref on this immediately after the call to @get without invalidating the result. This is only possible if deep copies are made (ie: there are no pointers to the data inside of the soon-to-be-freed Variant instance). If this check fails then a critical is printed and false is returned.

This function is meant to be used by functions that wish to provide varargs accessors to Variant values of uncertain values (eg: lookup or g_menu_model_get_item_attribute).

Parameters:

this

a Variant

format_string

a valid Variant format string

copy_only

true to ensure the format string makes deep copies

Returns:

true if format_string is safe to use