![]() |
![]() |
![]() |
Grilo Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <grilo.h> 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_add (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
); gboolean grl_data_key_is_known (GrlData *data
,GrlKeyID key
); void grl_data_set_overwrite (GrlData *data
,gboolean overwrite
); gboolean grl_data_get_overwrite (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.
typedef struct { GObjectClass parent_class; } GrlDataClass;
Grilo Data class
GObjectClass |
the parent class structure |
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 value associated with the key. If key already has a value and overwrite is TRUE, old value is freed and the new one is set.
Also, checks that value is compliant with the key specification, modifying it accordingly. For instance, if the 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 value associated with the key. If key already has a value and overwrite is TRUE, 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 value associated with the key. If key already has a value and overwrite is TRUE, 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 value associated with the key. If key already has a value and overwrite is TRUE, 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 value associated with the key. If it does not contain any value, NULL will be returned.
|
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 value associated with the key. If key has no 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 value associated with the key. If key has no 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 value associated with the key. If key has no 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_add (GrlData *data
,GrlKeyID key
);
Adds a new key to data, with no value. If key already exists, it does nothing.
|
data to change |
|
key to add. [type GObject.ParamSpec] |
Since 0.1.4
void grl_data_remove (GrlData *data
,GrlKeyID key
);
Removes key from data, freeing its value. If key is not in data, then it does nothing.
|
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
gboolean grl_data_key_is_known (GrlData *data
,GrlKeyID key
);
Checks if the key has a value.
|
data to inspect |
|
key to search. [type GObject.ParamSpec] |
Returns : |
TRUE if key has a value. |
Since 0.1.4
void grl_data_set_overwrite (GrlData *data
,gboolean overwrite
);
This controls if grl_data_set will overwrite current value of a property with the new one.
Set it to TRUE so old values are overwritten, or FALSE in other case (default is FALSE).
|
data to change |
|
if data can be overwritten |
Since 0.1.4
gboolean grl_data_get_overwrite (GrlData *data
);
Checks if old values are replaced when calling grl_data_set.
|
data to inspect |
Returns : |
TRUE if values will be overwritten. |
Since 0.1.4