Synopsis#include <glib.h> typedef GQuark; GQuark g_quark_from_string (const gchar *string); GQuark g_quark_from_static_string (const gchar *string); const gchar* g_quark_to_string (GQuark quark); GQuark g_quark_try_string (const gchar *string); const gchar* g_intern_string (const gchar *string); const gchar* g_intern_static_string (const gchar *string); DescriptionQuarks are associations between strings and integer identifiers. Given either the string or the GQuark identifier it is possible to retrieve the other. Quarks are used for both Datasets and Keyed Data Lists.
To create a new quark from a string, use
To find the string corresponding to a given GQuark, use
To find the GQuark corresponding to a given string, use
Another use for the string pool maintained for the quark functions is string
interning, using DetailsGQuark
A GQuark is a non-zero integer which uniquely identifies a particular string.
A GQuark value of zero is associated to g_quark_from_string ()GQuark g_quark_from_string (const gchar *string); Gets the GQuark identifying the given string. If the string does not currently have an associated GQuark, a new GQuark is created, using a copy of the string. g_quark_from_static_string ()GQuark g_quark_from_static_string (const gchar *string); Gets the GQuark identifying the given (static) string. If the string does not currently have an associated GQuark, a new GQuark is created, linked to the given string.
Note that this function is identical to g_quark_to_string ()const gchar* g_quark_to_string (GQuark quark); Gets the string associated with the given GQuark. g_quark_try_string ()GQuark g_quark_try_string (const gchar *string);
Gets the GQuark associated with the given string, or 0 if string is
If you want the GQuark to be created if it doesn't already exist, use
g_intern_string ()const gchar* g_intern_string (const gchar *string);
Returns a canonical representation for
Since 2.10 g_intern_static_string ()const gchar* g_intern_static_string (const gchar *string);
Returns a canonical representation for
Since 2.10 | ||||||||||||||||||