Blame docs/reference/glib/html/glib-Keyed-Data-Lists.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>Keyed Data Lists: GLib Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GLib Reference Manual">
Packit ae235b
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
Packit ae235b
<link rel="prev" href="glib-Quarks.html" title="Quarks">
Packit ae235b
<link rel="next" href="glib-Datasets.html" title="Datasets">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Keyed Data Lists

Packit ae235b

Keyed Data Lists — lists of data elements which are accessible by a

Packit ae235b
                    string or GQuark identifier

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_init ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_datalist_id_set_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_id_set_data_full ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_id_get_data ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_datalist_id_remove_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_id_remove_no_notify ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
(*GDuplicateFunc) ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_id_dup_data ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_id_replace_data ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_datalist_set_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_datalist_set_data_full()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_get_data ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_datalist_remove_data()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
g_datalist_remove_no_notify()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_foreach ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_clear ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_set_flags ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_unset_flags ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
Packit ae235b
Packit ae235b
g_datalist_get_flags ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GData
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_DATALIST_FLAGS_MASK
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gmodule.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

Keyed data lists provide lists of arbitrary data elements which can

Packit ae235b
be accessed either with a string or with a GQuark corresponding to
Packit ae235b
the string.

Packit ae235b

The GQuark methods are quicker, since the strings have to be

Packit ae235b
converted to GQuarks anyway.

Packit ae235b

Data lists are used for associating arbitrary data with GObjects,

Packit ae235b
using g_object_set_data() and related functions.

Packit ae235b

To create a datalist, use g_datalist_init().

Packit ae235b

To add data elements to a datalist use g_datalist_id_set_data(),

Packit ae235b
g_datalist_id_set_data_full(), g_datalist_set_data() and
Packit ae235b
g_datalist_set_data_full().

Packit ae235b

To get data elements from a datalist use g_datalist_id_get_data()

Packit ae235b
and g_datalist_get_data().

Packit ae235b

To iterate over all data elements in a datalist use

Packit ae235b
g_datalist_foreach() (not thread-safe).

Packit ae235b

To remove data elements from a datalist use

Packit ae235b
g_datalist_id_remove_data() and g_datalist_remove_data().

Packit ae235b

To remove all data elements from a datalist, use g_datalist_clear().

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_datalist_init ()

Packit ae235b
void
Packit ae235b
g_datalist_init (GData **datalist);
Packit ae235b

Resets the datalist to NULL. It does not free any memory or call

Packit ae235b
any destroy functions.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a pointer to a pointer to a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_set_data()

Packit ae235b
#define             g_datalist_id_set_data(dl, q, d)
Packit ae235b

Sets the data corresponding to the given GQuark id. Any previous

Packit ae235b
data with the same key is removed, and its destroy function is
Packit ae235b
called.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dl

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

q

Packit ae235b

the GQuark to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

d

Packit ae235b

the data element, or NULL to remove any previous element

Packit ae235b
corresponding to q
Packit ae235b
. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_set_data_full ()

Packit ae235b
void
Packit ae235b
g_datalist_id_set_data_full (GData **datalist,
Packit ae235b
                             GQuark key_id,
Packit ae235b
                             gpointer data,
Packit ae235b
                             GDestroyNotify destroy_func);
Packit ae235b

Sets the data corresponding to the given GQuark id, and the

Packit ae235b
function to be called when the element is removed from the datalist.
Packit ae235b
Any previous data with the same key is removed, and its destroy
Packit ae235b
function is called.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

the data element or NULL to remove any previous element

Packit ae235b
corresponding to key_id
Packit ae235b
. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

destroy_func

Packit ae235b

the function to call when the data element is

Packit ae235b
removed. This function will be called with the data
Packit ae235b
element and can be used to free any memory allocated
Packit ae235b
for it. If data
Packit ae235b
is NULL, then destroy_func
Packit ae235b
must
Packit ae235b
also be NULL. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_get_data ()

Packit ae235b
gpointer
Packit ae235b
g_datalist_id_get_data (GData **datalist,
Packit ae235b
                        GQuark key_id);
Packit ae235b

Retrieves the data element corresponding to key_id

Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark identifying a data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the data element, or NULL if

Packit ae235b
it is not found. 

Packit ae235b

[transfer none][nullable]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_remove_data()

Packit ae235b
#define             g_datalist_id_remove_data(dl, q)
Packit ae235b

Removes an element, using its GQuark identifier.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dl

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

q

Packit ae235b

the GQuark identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_remove_no_notify ()

Packit ae235b
gpointer
Packit ae235b
g_datalist_id_remove_no_notify (GData **datalist,
Packit ae235b
                                GQuark key_id);
Packit ae235b

Removes an element, without calling its destroy notification

Packit ae235b
function.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark identifying a data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the data previously stored at key_id

Packit ae235b
,
Packit ae235b
or NULL if none. 

Packit ae235b

[nullable]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

GDuplicateFunc ()

Packit ae235b
gpointer
Packit ae235b
(*GDuplicateFunc) (gpointer data,
Packit ae235b
                   gpointer user_data);
Packit ae235b

The type of functions that are used to 'duplicate' an object.

Packit ae235b
What this means depends on the context, it could just be
Packit ae235b
incrementing the reference count, if data
Packit ae235b
 is a ref-counted
Packit ae235b
object.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

the data to duplicate

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data that was specified in

Packit ae235b
g_datalist_id_dup_data(). 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a duplicate of data

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_dup_data ()

Packit ae235b
gpointer
Packit ae235b
g_datalist_id_dup_data (GData **datalist,
Packit ae235b
                        GQuark key_id,
Packit ae235b
                        GDuplicateFunc dup_func,
Packit ae235b
                        gpointer user_data);
Packit ae235b

This is a variant of g_datalist_id_get_data() which

Packit ae235b
returns a 'duplicate' of the value. dup_func
Packit ae235b
 defines the
Packit ae235b
meaning of 'duplicate' in this context, it could e.g.
Packit ae235b
take a reference on a ref-counted object.

Packit ae235b

If the key_id

Packit ae235b
 is not set in the datalist then dup_func
Packit ae235b
Packit ae235b
will be called with a NULL argument.

Packit ae235b

Note that dup_func

Packit ae235b
 is called while the datalist is locked, so it
Packit ae235b
is not allowed to read or modify the datalist.

Packit ae235b

This function can be useful to avoid races when multiple

Packit ae235b
threads are using the same datalist and the same key.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

location of a datalist

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark identifying a data element

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

dup_func

Packit ae235b

function to duplicate the old value.

Packit ae235b
[nullable][scope call]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

passed as user_data to dup_func

Packit ae235b
. 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the result of calling dup_func

Packit ae235b
on the value
Packit ae235b
associated with key_id
Packit ae235b
in datalist
Packit ae235b
, or NULL if not set.
Packit ae235b
If dup_func
Packit ae235b
is NULL, the value is returned unmodified. 

Packit ae235b

[nullable]

Packit ae235b
Packit ae235b

Since: 2.34

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_id_replace_data ()

Packit ae235b
gboolean
Packit ae235b
g_datalist_id_replace_data (GData **datalist,
Packit ae235b
                            GQuark key_id,
Packit ae235b
                            gpointer oldval,
Packit ae235b
                            gpointer newval,
Packit ae235b
                            GDestroyNotify destroy,
Packit ae235b
                            GDestroyNotify *old_destroy);
Packit ae235b

Compares the member that is associated with key_id

Packit ae235b
 in
Packit ae235b
datalist
Packit ae235b
 to oldval
Packit ae235b
, and if they are the same, replace
Packit ae235b
oldval
Packit ae235b
 with newval
Packit ae235b
.

Packit ae235b

This is like a typical atomic compare-and-exchange

Packit ae235b
operation, for a member of datalist
Packit ae235b
.

Packit ae235b

If the previous value was replaced then ownership of the

Packit ae235b
old value (oldval
Packit ae235b
) is passed to the caller, including
Packit ae235b
the registered destroy notify for it (passed out in old_destroy
Packit ae235b
).
Packit ae235b
Its up to the caller to free this as he wishes, which may
Packit ae235b
or may not include using old_destroy
Packit ae235b
 as sometimes replacement
Packit ae235b
should not destroy the object in the normal way.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

location of a datalist

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

key_id

Packit ae235b

the GQuark identifying a data element

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

oldval

Packit ae235b

the old value to compare against.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

newval

Packit ae235b

the new value to replace it with.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

destroy

Packit ae235b

destroy notify for the new value.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

old_destroy

Packit ae235b

destroy notify for the existing value.

Packit ae235b
[out][optional]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

TRUE if the existing value for key_id

Packit ae235b
was replaced
Packit ae235b
by newval
Packit ae235b
, FALSE otherwise.

Packit ae235b
Packit ae235b

Since: 2.34

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_set_data()

Packit ae235b
#define             g_datalist_set_data(dl, k, d)
Packit ae235b

Sets the data element corresponding to the given string identifier.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dl

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

d

Packit ae235b

the data element, or NULL to remove any previous element

Packit ae235b
corresponding to k
Packit ae235b
. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_set_data_full()

Packit ae235b
#define             g_datalist_set_data_full(dl, k, d, f)
Packit ae235b

Sets the data element corresponding to the given string identifier,

Packit ae235b
and the function to be called when the data element is removed.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dl

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string to identify the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

d

Packit ae235b

the data element, or NULL to remove any previous element

Packit ae235b
corresponding to k
Packit ae235b
. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

f

Packit ae235b

the function to call when the data element is removed.

Packit ae235b
This function will be called with the data element and can be used to
Packit ae235b
free any memory allocated for it. If d
Packit ae235b
is NULL, then f
Packit ae235b
must
Packit ae235b
also be NULL. 

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_get_data ()

Packit ae235b
gpointer
Packit ae235b
g_datalist_get_data (GData **datalist,
Packit ae235b
                     const gchar *key);
Packit ae235b

Gets a data element, using its string identifier. This is slower than

Packit ae235b
g_datalist_id_get_data() because it compares strings.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

key

Packit ae235b

the string identifying a data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the data element, or NULL if it

Packit ae235b
is not found. 

Packit ae235b

[transfer none][nullable]

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_remove_data()

Packit ae235b
#define             g_datalist_remove_data(dl, k)
Packit ae235b

Removes an element using its string identifier. The data element's

Packit ae235b
destroy function is called if it has been set.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dl

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_remove_no_notify()

Packit ae235b
#define             g_datalist_remove_no_notify(dl, k)
Packit ae235b

Removes an element, without calling its destroy notifier.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

dl

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

k

Packit ae235b

the string identifying the data element.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_foreach ()

Packit ae235b
void
Packit ae235b
g_datalist_foreach (GData **datalist,
Packit ae235b
                    GDataForeachFunc func,
Packit ae235b
                    gpointer user_data);
Packit ae235b

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

Packit ae235b
function is called with each data element's GQuark id and data,
Packit ae235b
together with the given user_data
Packit ae235b
 parameter. Note that this
Packit ae235b
function is NOT thread-safe. So unless datalist
Packit ae235b
 can be protected
Packit ae235b
from any modifications during invocation of this function, it should
Packit ae235b
not be called.

Packit ae235b

func

Packit ae235b
 can make changes to datalist
Packit ae235b
, but the iteration will not
Packit ae235b
reflect changes made during the g_datalist_foreach() call, other
Packit ae235b
than skipping over elements that are removed.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

func

Packit ae235b

the function to call for each data element.

Packit ae235b
[scope call]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data to pass to the function.

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_clear ()

Packit ae235b
void
Packit ae235b
g_datalist_clear (GData **datalist);
Packit ae235b

Frees all the data elements of the datalist.

Packit ae235b
The data elements' destroy functions are called
Packit ae235b
if they have been set.

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

a datalist.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_set_flags ()

Packit ae235b
void
Packit ae235b
g_datalist_set_flags (GData **datalist,
Packit ae235b
                      guint flags);
Packit ae235b

Turns on flag values for a data list. This function is used

Packit ae235b
to keep a small number of boolean flags in an object with
Packit ae235b
a data list without using any additional space. It is
Packit ae235b
not generally useful except in circumstances where space
Packit ae235b
is very tight. (It is used in the base GObject type, for
Packit ae235b
example.)

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

pointer to the location that holds a list

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

flags

Packit ae235b

the flags to turn on. The values of the flags are

Packit ae235b
restricted by G_DATALIST_FLAGS_MASK (currently
Packit ae235b
3; giving two possible boolean flags).
Packit ae235b
A value for flags
Packit ae235b
that doesn't fit within the mask is
Packit ae235b
an error.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.8

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_unset_flags ()

Packit ae235b
void
Packit ae235b
g_datalist_unset_flags (GData **datalist,
Packit ae235b
                        guint flags);
Packit ae235b

Turns off flag values for a data list. See g_datalist_unset_flags()

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

pointer to the location that holds a list

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

flags

Packit ae235b

the flags to turn off. The values of the flags are

Packit ae235b
restricted by G_DATALIST_FLAGS_MASK (currently
Packit ae235b
3: giving two possible boolean flags).
Packit ae235b
A value for flags
Packit ae235b
that doesn't fit within the mask is
Packit ae235b
an error.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.8

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_datalist_get_flags ()

Packit ae235b
guint
Packit ae235b
g_datalist_get_flags (GData **datalist);
Packit ae235b

Gets flags values packed in together with the datalist.

Packit ae235b
See g_datalist_set_flags().

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

datalist

Packit ae235b

pointer to the location that holds a list

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the flags of the datalist

Packit ae235b
Packit ae235b

Since: 2.8

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

GData

Packit ae235b
typedef struct _GData GData;
Packit ae235b

The GData struct is an opaque data structure to represent a

Packit ae235b
Keyed Data List. It should only be
Packit ae235b
accessed via the following functions.

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

G_DATALIST_FLAGS_MASK

Packit ae235b
#define G_DATALIST_FLAGS_MASK 0x3
Packit ae235b
Packit ae235b

A bitmask that restricts the possible flags passed to

Packit ae235b
g_datalist_set_flags(). Passing a flags value where
Packit ae235b
flags & ~G_DATALIST_FLAGS_MASK != 0 is an error.

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>