PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/glib/library/data_types/glib_keyed_data_list.e

http://github.com/tybor/Liberty
Specman e | 213 lines | 7 code | 59 blank | 147 comment | 0 complexity | b6c5d762b52c6a32810f3e0e630f17e0 MD5 | raw file
  1indexing
  2	copyright: "(C) 2005 Paolo Redaelli "
  3	license: "LGPL v2 or later"
  4	date: "$Date:$"
  5	revision: "$REvision:$"
  6
  7class GLIB_KEYED_DATA_LIST
  8-- Prev 	Up 	Home 	GLib Reference Manual 	Next
  9-- Top  |  Description
 10-- Keyed Data Lists
 11
 12-- Keyed Data Lists %G รข€”%@ lists of data elements which are accessible by a string or GQuark identifier.
 13	
 14-- Synopsis
 15
 16-- #include <glib.h>
 17
 18
 19--             GData;
 20-- void        g_datalist_init                 (GData **datalist);
 21
 22-- #define     g_datalist_id_set_data          (dl, q, d)
 23-- void        g_datalist_id_set_data_full     (GData **datalist,
 24--                                              GQuark key_id,
 25--                                              gpointer data,
 26--                                              GDestroyNotify destroy_func);
 27-- gpointer    g_datalist_id_get_data          (GData **datalist,
 28--                                              GQuark key_id);
 29-- #define     g_datalist_id_remove_data       (dl, q)
 30-- gpointer    g_datalist_id_remove_no_notify  (GData **datalist,
 31--                                              GQuark key_id);
 32
 33-- #define     g_datalist_set_data             (dl, k, d)
 34-- #define     g_datalist_set_data_full        (dl, k, d, f)
 35-- #define     g_datalist_get_data             (dl, k)
 36-- #define     g_datalist_remove_data          (dl, k)
 37-- #define     g_datalist_remove_no_notify     (dl, k)
 38
 39-- void        g_datalist_foreach              (GData **datalist,
 40--                                              GDataForeachFunc func,
 41--                                              gpointer user_data);
 42-- void        g_datalist_clear                (GData **datalist);
 43-- void        g_datalist_set_flags            (GData **datalist,
 44--                                              guint flags);
 45-- void        g_datalist_unset_flags          (GData **datalist,
 46--                                              guint flags);
 47-- guint       g_datalist_get_flags            (GData **datalist);
 48-- #define     G_DATALIST_FLAGS_MASK
 49
 50-- Description
 51
 52-- 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.
 53
 54-- The GQuark methods are quicker, since the strings have to be converted to GQuarks anyway.
 55
 56-- Data lists are used for associating arbitrary data with GObjects, using g_object_set_data() and related functions.
 57
 58-- To create a datalist, use g_datalist_init().
 59
 60-- 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().
 61
 62-- To get data elements from a datalist use g_datalist_id_get_data() and g_datalist_get_data().
 63
 64-- To iterate over all data elements in a datalist use g_datalist_foreach() (not thread-safe).
 65
 66-- To remove data elements from a datalist use g_datalist_id_remove_data() and g_datalist_remove_data().
 67
 68-- To remove all data elements from a datalist, use g_datalist_clear().
 69-- Details
 70-- GData
 71
 72-- typedef struct _GData GData;
 73
 74-- The GData struct is an opaque data structure to represent a Keyed Data List. It should only be accessed via the following functions.
 75-- g_datalist_init ()
 76
 77-- void        g_datalist_init                 (GData **datalist);
 78
 79-- Resets the datalist to NULL. It does not free any memory or call any destroy functions.
 80-- datalist : 	a pointer to a pointer to a datalist.
 81-- g_datalist_id_set_data()
 82
 83-- #define     g_datalist_id_set_data(dl, q, d)
 84
 85-- Sets the data corresponding to the given GQuark id. Any previous data with the same key is removed, and its destroy function is called.
 86-- dl : 	a datalist.
 87-- q : 	the GQuark to identify the data element.
 88-- d : 	the data element, or NULL to remove any previous element corresponding to q.
 89-- g_datalist_id_set_data_full ()
 90
 91-- void        g_datalist_id_set_data_full     (GData **datalist,
 92--                                              GQuark key_id,
 93--                                              gpointer data,
 94--                                              GDestroyNotify destroy_func);
 95
 96-- 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.
 97-- datalist : 	a datalist.
 98-- key_id : 	the GQuark to identify the data element.
 99-- data : 	the data element or NULL to remove any previous element corresponding to key_id.
100-- 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.
101-- g_datalist_id_get_data ()
102
103-- gpointer    g_datalist_id_get_data          (GData **datalist,
104--                                              GQuark key_id);
105
106-- Retrieves the data element corresponding to key_id.
107-- datalist : 	a datalist.
108-- key_id : 	the GQuark identifying a data element.
109-- Returns : 	the data element, or NULL if it is not found.
110-- g_datalist_id_remove_data()
111
112-- #define     g_datalist_id_remove_data(dl, q)
113
114-- Removes an element, using its GQuark identifier.
115-- dl : 	a datalist.
116-- q : 	the GQuark identifying the data element.
117-- g_datalist_id_remove_no_notify ()
118
119-- gpointer    g_datalist_id_remove_no_notify  (GData **datalist,
120--                                              GQuark key_id);
121
122-- Removes an element, without calling its destroy notification function.
123-- datalist : 	a datalist.
124-- key_id : 	the GQuark identifying a data element.
125-- Returns : 	the data previously stored at key_id, or NULL if none.
126-- g_datalist_set_data()
127
128-- #define     g_datalist_set_data(dl, k, d)
129
130-- Sets the data element corresponding to the given string identifier.
131-- dl : 	a datalist.
132-- k : 	the string to identify the data element.
133-- d : 	the data element, or NULL to remove any previous element corresponding to k.
134-- g_datalist_set_data_full()
135
136-- #define     g_datalist_set_data_full(dl, k, d, f)
137
138-- Sets the data element corresponding to the given string identifier, and the function to be called when the data element is removed.
139-- dl : 	a datalist.
140-- k : 	the string to identify the data element.
141-- d : 	the data element, or NULL to remove any previous element corresponding to k.
142-- f : 	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 d is NULL, then f must also be NULL.
143-- g_datalist_get_data()
144
145-- #define     g_datalist_get_data(dl, k)
146
147-- Gets a data element, using its string identifer. This is slower than g_datalist_id_get_data() because the string is first converted to a GQuark.
148-- dl : 	a datalist.
149-- k : 	the string identifying a data element.
150-- Returns : 	the data element, or NULL if it is not found.
151-- g_datalist_remove_data()
152
153-- #define     g_datalist_remove_data(dl, k)
154
155-- Removes an element using its string identifier. The data element's destroy function is called if it has been set.
156-- dl : 	a datalist.
157-- k : 	the string identifying the data element.
158-- g_datalist_remove_no_notify()
159
160-- #define     g_datalist_remove_no_notify(dl, k)
161
162-- Removes an element, without calling its destroy notifier.
163-- dl : 	a datalist.
164-- k : 	the string identifying the data element.
165-- g_datalist_foreach ()
166
167-- void        g_datalist_foreach              (GData **datalist,
168--                                              GDataForeachFunc func,
169--                                              gpointer user_data);
170
171-- 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.
172-- datalist : 	a datalist.
173-- func : 	the function to call for each data element.
174-- user_data : 	user data to pass to the function.
175-- g_datalist_clear ()
176
177-- void        g_datalist_clear                (GData **datalist);
178
179-- Frees all the data elements of the datalist. The data elements' destroy functions are called if they have been set.
180-- datalist : 	a datalist.
181-- g_datalist_set_flags ()
182
183-- void        g_datalist_set_flags            (GData **datalist,
184--                                              guint flags);
185
186-- 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.)
187
188-- datalist : 	pointer to the location that holds a list
189-- 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.
190-- g_datalist_unset_flags ()
191
192-- void        g_datalist_unset_flags          (GData **datalist,
193--                                              guint flags);
194
195-- Turns off flag values for a data list. See g_datalist_unset_flags()
196
197-- datalist : 	pointer to the location that holds a list
198-- 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.
199-- g_datalist_get_flags ()
200
201-- guint       g_datalist_get_flags            (GData **datalist);
202
203-- Gets flags values packed in together with the datalist. See g_datalist_set_flags().
204
205-- datalist : 	pointer to the location that holds a list
206-- Returns : 	the flags of the datalist
207-- G_DATALIST_FLAGS_MASK
208
209-- #define G_DATALIST_FLAGS_MASK 0x3
210
211-- A bitmask that restricts the possible flags passed to g_datalist_set_flags(). Passing a flags value where flags & ~G_DATALIST_FLAGS_MASK != 0 is an error.
212
213end