Variant.checkFormatString
bool checkFormatString(string formatString, bool copyOnly)Checks if calling [glib.variant.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.Variant.unref] on value immediately after the call to [glib.variant.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 #GVariant 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 #GVariant values of uncertain values (eg: [glib.variant.Variant.lookup] or [gio.menu_model.MenuModel.getItemAttribute]).
Parameters
formatString | a valid #GVariant format string |
copyOnly | true to ensure the format string makes deep copies |