GLib.Variant.prototype.check_format_string

function check_format_string(format_string: String, copy_only: Boolean): Boolean {
    // Gjs wrapper for g_variant_check_format_string()
}
  

Checks if calling GLib.Variant.get with format_string on value 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 GLib.Variant.prototype.unref on value immediately after the call to GLib.Variant.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 GLib.Variant instance). If this check fails then a g_critical() is printed and false is returned.

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

Since 2.34

format_string

a valid GLib.Variant format string

copy_only

true to ensure the format string makes deep copies

Returns

true if format_string is safe to use