glib.DataList.DataList Class Reference

List of all members.

Detailed Description

Description Keyed data lists provide lists of arbitrary data elements which can be accessed either with a string or with a GQuark corresponding to the string.

The GQuark methods are quicker, since the strings have to be converted to GQuarks anyway. Data lists are used for associating arbitrary data with GObjects, using g_object_set_data() and related functions. To create a datalist, use g_datalist_init(). To add data elements to a datalist use g_datalist_id_set_data(), g_datalist_id_set_data_full(), g_datalist_set_data() and g_datalist_set_data_full(). To get data elements from a datalist use g_datalist_id_get_data() and g_datalist_get_data(). To iterate over all data elements in a datalist use g_datalist_foreach() (not thread-safe). To remove data elements from a datalist use g_datalist_id_remove_data() and g_datalist_remove_data(). To remove all data elements from a datalist, use g_datalist_clear().


Public Member Functions

GDatagetDataListStruct ()
 this (GData *gData)
 Sets our main struct and passes it to the parent class.

Static Public Member Functions

static void init (GData **datalist)
 Resets the datalist to NULL.
static void idSetDataFull (GData **datalist, GQuark keyId, void *data, GDestroyNotify destroyFunc)
 Sets the data corresponding to the given GQuark id, and the function to be called when the element is removed from the datalist.
static void * idGetData (GData **datalist, GQuark keyId)
 Retrieves the data element corresponding to key_id.
static void * idRemoveNoNotify (GData **datalist, GQuark keyId)
 Removes an element, without calling its destroy notification function.
static void foreac (GData **datalist, GDataForeachFunc func, void *userData)
 Calls the given function for each data element of the datalist.
static void clear (GData **datalist)
 Frees all the data elements of the datalist.
static void setFlags (GData **datalist, uint flags)
 Turns on flag values for a data list.
static void unsetFlags (GData **datalist, uint flags)
 Turns off flag values for a data list.
static uint getFlags (GData **datalist)
 Gets flags values packed in together with the datalist.

Protected Member Functions

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

Protected Attributes

GDatagData
 the main Gtk struct


Constructor & Destructor Documentation

glib.DataList.DataList.this ( GData gData  ) 

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


Member Function Documentation

static void glib.DataList.DataList.clear ( GData **  datalist  )  [static]

Frees all the data elements of the datalist.

The data elements' destroy functions are called if they have been set. datalist: a datalist.

static void glib.DataList.DataList.foreac ( GData **  datalist,
GDataForeachFunc  func,
void *  userData 
) [static]

Calls the given function for each data element of the datalist.

The function is called with each data element's GQuark id and data, together with the given user_data parameter. Note that this function is NOT thread-safe. So unless datalist can be protected from any modifications during invocation of this function, it should not be called. datalist: a datalist. func: the function to call for each data element. user_data: user data to pass to the function.

GData* glib.DataList.DataList.getDataListStruct (  ) 

static uint glib.DataList.DataList.getFlags ( GData **  datalist  )  [static]

Gets flags values packed in together with the datalist.

See g_datalist_set_flags(). datalist: pointer to the location that holds a list Returns: the flags of the datalist Since 2.8

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

the main Gtk struct as a void*

static void* glib.DataList.DataList.idGetData ( GData **  datalist,
GQuark  keyId 
) [static]

Retrieves the data element corresponding to key_id.

datalist: a datalist. key_id: the GQuark identifying a data element. Returns: the data element, or NULL if it is not found.

static void* glib.DataList.DataList.idRemoveNoNotify ( GData **  datalist,
GQuark  keyId 
) [static]

Removes an element, without calling its destroy notification function.

datalist: a datalist. key_id: the GQuark identifying a data element. Returns: the data previously stored at key_id, or NULL if none.

static void glib.DataList.DataList.idSetDataFull ( GData **  datalist,
GQuark  keyId,
void *  data,
GDestroyNotify  destroyFunc 
) [static]

Sets the data corresponding to the given GQuark id, and the function to be called when the element is removed from the datalist.

Any previous data with the same key is removed, and its destroy function is called. datalist: a datalist. key_id: the GQuark to identify the data element. data: the data element or NULL to remove any previous element corresponding to key_id. destroy_func: the function to call when the data element is removed. This function will be called with the data element and can be used to free any memory allocated for it. If data is NULL, then destroy_func must also be NULL.

static void glib.DataList.DataList.init ( GData **  datalist  )  [static]

Resets the datalist to NULL.

It does not free any memory or call any destroy functions. datalist: a pointer to a pointer to a datalist.

static void glib.DataList.DataList.setFlags ( GData **  datalist,
uint  flags 
) [static]

Turns on flag values for a data list.

This function is used to keep a small number of boolean flags in an object with a data list without using any additional space. It is not generally useful except in circumstances where space is very tight. (It is used in the base GObject type, for example.) datalist: pointer to the location that holds a list flags: the flags to turn on. The values of the flags are restricted by G_DATALIST_FLAGS_MASK (currently 3; giving two possible boolean flags). A value for flags that doesn't fit within the mask is an error. Since 2.8

static void glib.DataList.DataList.unsetFlags ( GData **  datalist,
uint  flags 
) [static]

Turns off flag values for a data list.

See g_datalist_unset_flags() datalist: pointer to the location that holds a list flags: the flags to turn off. The values of the flags are restricted by G_DATALIST_FLAGS_MASK (currently 3: giving two possible boolean flags). A value for flags that doesn't fit within the mask is an error. Since 2.8


Member Data Documentation

GData* glib.DataList.DataList.gData [protected]

the main Gtk struct


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