glib.Quark.Quark Class Reference

List of all members.

Detailed Description

Description Quarks 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 g_quark_from_string() or g_quark_from_static_string(). To find the string corresponding to a given GQuark, use g_quark_to_string(). To find the GQuark corresponding to a given string, use g_quark_try_string(). Another use for the string pool maintained for the quark functions is string interning, using g_intern_string() or g_intern_static_string(). An interned string is a canonical representation for a string. One important advantage of interned strings is that they can be compared for equality by a simple pointer comparision, rather than using strcmp().


Public Member Functions

GQuarkgetQuarkStruct ()
 this (GQuark *gQuark)
 Sets our main struct and passes it to the parent class.

Static Public Member Functions

static GQuark fromString (char[] string)
 Gets the GQuark identifying the given string.
static GQuark fromStaticString (char[] string)
 Gets the GQuark identifying the given (static) string.
static char[] toString (GQuark quark)
 Gets the string associated with the given GQuark.
static GQuark tryString (char[] string)
 Gets the GQuark associated with the given string, or 0 if the string has no associated GQuark.
static char[] gInternString (char[] string)
 Returns a canonical representation for string.
static char[] gInternStaticString (char[] string)
 Returns a canonical representation for string.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GQuarkgQuark
 the main Gtk struct


Constructor & Destructor Documentation

glib.Quark.Quark.this ( GQuark gQuark  ) 

Sets our main struct and passes it to the parent class.


Member Function Documentation

static GQuark glib.Quark.Quark.fromStaticString ( char[]  string  )  [static]

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_from_string() except that if a new GQuark is created the string itself is used rather than a copy. This saves memory, but can only be used if the string will always exist. It can be used with statically allocated strings in the main program, but not with statically allocated memory in dynamically loaded modules, if you expect to ever unload the module again (e.g. do not use this function in GTK+ theme engines). string: a string. Returns: the GQuark identifying the string.

static GQuark glib.Quark.Quark.fromString ( char[]  string  )  [static]

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. string: a string. Returns: the GQuark identifying the string.

GQuark* glib.Quark.Quark.getQuarkStruct (  ) 

void* glib.Quark.Quark.getStruct (  )  [protected]

the main Gtk struct as a void*

static char [] glib.Quark.Quark.gInternStaticString ( char[]  string  )  [static]

Returns a canonical representation for string.

Interned strings can be compared for equality by comparing the pointers, instead of using strcmp(). g_intern_static_string() does not copy the string, therefore string must not be freed or modified. string: a static string Returns: a canonical representation for the string Since 2.10

static char [] glib.Quark.Quark.gInternString ( char[]  string  )  [static]

Returns a canonical representation for string.

Interned strings can be compared for equality by comparing the pointers, instead of using strcmp(). string: a string Returns: a canonical representation for the string Since 2.10

static char [] glib.Quark.Quark.toString ( GQuark  quark  )  [static]

Gets the string associated with the given GQuark.

quark: a GQuark. Returns: the string associated with the GQuark.

static GQuark glib.Quark.Quark.tryString ( char[]  string  )  [static]

Gets the GQuark associated with the given string, or 0 if the string has no associated GQuark.

If you want the GQuark to be created if it doesn't already exist, use g_quark_from_string() or g_quark_from_static_string(). string: a string. Returns: the GQuark associated with the string, or 0 if there is no GQuark associated with the string.


Member Data Documentation

GQuark* glib.Quark.Quark.gQuark [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo