![]() |
![]() |
![]() |
Grilo Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <grilo.h> struct GrlDataClass; GrlData * grl_data_new (void
); void grl_data_set (GrlData *data
,GrlKeyID key
,const GValue *value
); void grl_data_set_string (GrlData *data
,GrlKeyID key
,const gchar *strvalue
); void grl_data_set_int (GrlData *data
,GrlKeyID key
,gint intvalue
); void grl_data_set_float (GrlData *data
,GrlKeyID key
,gfloat floatvalue
); const GValue * grl_data_get (GrlData *data
,GrlKeyID key
); const gchar * grl_data_get_string (GrlData *data
,GrlKeyID key
); gint grl_data_get_int (GrlData *data
,GrlKeyID key
); gfloat grl_data_get_float (GrlData *data
,GrlKeyID key
); void grl_data_remove (GrlData *data
,GrlKeyID key
); gboolean grl_data_has_key (GrlData *data
,GrlKeyID key
); GList * grl_data_get_keys (GrlData *data
);
This class acts as dictionary where keys and their values can be stored. It is suggested to better high level classes, like GrlMedia, which provides functions to access known properties.
GrlData * grl_data_new (void
);
Creates a new data object.
Returns : |
a new data object. |
Since 0.1.4
void grl_data_set (GrlData *data
,GrlKeyID key
,const GValue *value
);
Sets the first value associated with key
in data
. If key already has a
value old value is freed and the new one is set.
Also, checks that value
is compliant with key
specification, modifying it
accordingly. For instance, if key
requires a number between 0 and 10, but
value
is outside this range, it will be adapted accordingly.
|
data to modify |
|
key to change or add. [type GObject.ParamSpec] |
|
the new value |
Since 0.1.4
void grl_data_set_string (GrlData *data
,GrlKeyID key
,const gchar *strvalue
);
Sets the first string value associated with key
in data
. If key
already
has a value old value is freed and the new one is set.
|
data to modify |
|
key to change or add. [type GObject.ParamSpec] |
|
the new value |
Since 0.1.4
void grl_data_set_int (GrlData *data
,GrlKeyID key
,gint intvalue
);
Sets the first int value associated with key
in data
. If key
already has a
first value old value is replaced by the new one.
|
data to change |
|
key to change or add. [type GObject.ParamSpec] |
|
the new value |
Since 0.1.4
void grl_data_set_float (GrlData *data
,GrlKeyID key
,gfloat floatvalue
);
Sets the first float value associated with key
in data
. If key
already has
a first value old value is replaced by the new one.
|
data to change |
|
key to change or add. [type GObject.ParamSpec] |
|
the new value |
Since 0.1.5
const GValue * grl_data_get (GrlData *data
,GrlKeyID key
);
Get the first value from data
associated with key
.
|
data to retrieve value |
|
key to look up. [type GObject.ParamSpec] |
Returns : |
a GValue. This value should not be modified nor freed by user. [transfer none] |
Since 0.1.4
const gchar * grl_data_get_string (GrlData *data
,GrlKeyID key
);
Returns the first string value associated with key
from data
. If key
has
no first value, or value is not string, or key
is not in data
, then NULL
is returned.
|
data to inspect |
|
key to use. [type GObject.ParamSpec] |
Returns : |
string associated with key , or NULL in other case. Caller should
not change nor free the value. |
Since 0.1.4
gint grl_data_get_int (GrlData *data
,GrlKeyID key
);
Returns the first int value associated with key
from data
. If key
has no
first value, or value is not a gint, or key
is not in data, then 0 is
returned.
|
data to inspect |
|
key to use. [type GObject.ParamSpec] |
Returns : |
int value associated with key , or 0 in other case. |
Since 0.1.4
gfloat grl_data_get_float (GrlData *data
,GrlKeyID key
);
Returns the first float value associated with key
from data
. If key
has no
first value, or value is not a gfloat, or key
is not in data, then 0 is
returned.
|
data to inspect |
|
key to use. [type GObject.ParamSpec] |
Returns : |
float value associated with key , or 0 in other case. |
Since 0.1.5
void grl_data_remove (GrlData *data
,GrlKeyID key
);
Removes the first value for key
from data
. If there are other keys related
to key
their values will also be removed from data
.
|
data to change |
|
key to remove. [type GObject.ParamSpec] |
Since 0.1.4
gboolean grl_data_has_key (GrlData *data
,GrlKeyID key
);
Checks if key
is in data
.
|
data to inspect |
|
key to search. [type GObject.ParamSpec] |
Returns : |
TRUE if key is in data , FALSE in other case. |
Since 0.1.4
GList * grl_data_get_keys (GrlData *data
);
Returns a list with keys contained in data
.
|
data to inspect |
Returns : |
an array with the
keys. The content of the list should not be modified or freed. Use
g_list_free() when done using the list. [transfer container][element-type GObject.ParamSpec]
|
Since 0.1.4