Top |
GrlRelatedKeys * | grl_related_keys_new () |
GrlRelatedKeys * | grl_related_keys_new_valist () |
GrlRelatedKeys * | grl_related_keys_new_with_keys () |
GrlRelatedKeys * | grl_related_keys_dup () |
const GValue * | grl_related_keys_get () |
const guint8 * | grl_related_keys_get_binary () |
gboolean | grl_related_keys_get_boolean () |
gconstpointer | grl_related_keys_get_boxed () |
gfloat | grl_related_keys_get_float () |
gint | grl_related_keys_get_int () |
GList * | grl_related_keys_get_keys () |
const gchar * | grl_related_keys_get_string () |
gboolean | grl_related_keys_has_key () |
void | grl_related_keys_set () |
void | grl_related_keys_set_binary () |
void | grl_related_keys_set_boolean () |
void | grl_related_keys_set_boxed () |
void | grl_related_keys_set_float () |
void | grl_related_keys_set_int () |
void | grl_related_keys_set_string () |
void | grl_related_keys_remove () |
When handling media keys, like artist, URI, mime-type, and so on, some of these keys are somewhat related: they do not make sense if they are not accompanied by other keys.
For instance, media URI and and mime-type are related keys: mime-type does not make sense if it is not accompanied by an URI. Moreover, for each URI value, there is a corresponding mime-type value.
GrlRelatedKeys stores related keys and their values in one place, so user can handle them in one shot.
GrlRelatedKeys *
grl_related_keys_new (void
);
Creates a new GrlRelatedKeys instance that can be used to store related keys and their values.
Since: 0.1.10
GrlRelatedKeys * grl_related_keys_new_valist (GrlKeyID key
,va_list args
);
Creates a new GrlRelatedKeys containing pairs of (key, value). Finish the
list with NULL
.
In case of a binary-type key, the expected element is (key, value, size).
value type will be extracted from key information.
Since: 0.1.10
GrlRelatedKeys * grl_related_keys_new_with_keys (GrlKeyID key
,...
);
Creates a initial GrlRelatedKeys containing the list of (key, value)
pairs. Finish the list with NULL
.
For more information see grl_related_keys_new_valist.
[skip]
Since: 0.1.10
GrlRelatedKeys *
grl_related_keys_dup (GrlRelatedKeys *relkeys
);
Makes a deep copy of relkeys
and its contents.
Since: 0.1.10
const GValue * grl_related_keys_get (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Get the value associated with key
from relkeys
. If it does not contain any
value, NULL
will be returned.
Since: 0.1.10
const guint8 * grl_related_keys_get_binary (GrlRelatedKeys *relkeys
,GrlKeyID key
,gsize *size
);
Returns the value associated with key
from relkeys
. If key
has no value,
or value is not a binary, or key
is not in relkeys
, then 0 is returned.
relkeys |
set of related keys to inspect |
|
key |
key to use. |
[type GrlKeyID] |
size |
location to store the buffer size. |
[out] |
buffer location associated with key
, or NULL
in other case. If
successful size
will be set to the buffer size.
Since: 0.1.10
gboolean grl_related_keys_get_boolean (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Returns the value associated with key
from relkeys
. If key
has no value,
or value is not a gboolean, or key
is not in relkeys
, then FALSE
is
returned.
Since: 0.2.3
gconstpointer grl_related_keys_get_boxed (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Returns the value associated with key
from relkeys
. If key
has no value,
the value is not of a boxed type, or key
is not in relkeys
, then NULL
is
returned.
the GBoxed value associated with key
if
possible, or NULL
in other case. The caller should not change nor free the
value.
[transfer none]
Since: 0.2.0
gfloat grl_related_keys_get_float (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Returns the value associated with key
from relkeys
. If key
has no value,
or value is not a gfloat, or key
is not in relkeys
, then 0 is returned.
Since: 0.1.10
gint grl_related_keys_get_int (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Returns the value associated with key
from relkeys
. If key
has no value,
or value is not a gint, or key
is not in relkeys
, then 0 is returned.
Since: 0.1.10
GList *
grl_related_keys_get_keys (GrlRelatedKeys *relkeys
);
Returns a list with keys contained in relkeys
.
a list 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 GrlKeyID]
Since: 0.1.13
const gchar * grl_related_keys_get_string (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Returns the value associated with key
from relkeys
. If key
has no value,
or value is not string, or key
is not in relkeys
, then NULL
is returned.
string associated with key
, or NULL
in other case. Caller should
not change nor free the value.
Since: 0.1.10
gboolean grl_related_keys_has_key (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Checks if key
is in relkeys
.
Since: 0.1.10
void grl_related_keys_set (GrlRelatedKeys *relkeys
,GrlKeyID key
,const GValue *value
);
Sets the value associated with key
into relkeys
. 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.
relkeys |
set of related keys to modify |
|
key |
key to change or add. |
[type GrlKeyID] |
value |
the new value |
Since: 0.1.10
void grl_related_keys_set_binary (GrlRelatedKeys *relkeys
,GrlKeyID key
,const guint8 *buf
,gsize size
);
Sets the value associated with key
into relkeys
. key
must have been
registered as a binary-type key. Old value is replaced by the new one.
relkeys |
set of related keys to change |
|
key |
key to change or add. |
[type GrlKeyID] |
buf |
buffer holding the relkeys |
|
size |
size of the buffer |
Since: 0.1.10
void grl_related_keys_set_boolean (GrlRelatedKeys *relkeys
,GrlKeyID key
,gboolean booleanvalue
);
Sets the value associated with key
into relkeys
. key
must have been
registered as a boolean-type key. Old value is replaced by the new one.
relkeys |
set of related keys to change |
|
key |
key to change or add. |
[type GrlKeyID] |
booleanvalue |
the new value |
Since: 0.2.3
void grl_related_keys_set_boxed (GrlRelatedKeys *relkeys
,GrlKeyID key
,gconstpointer boxed
);
Sets the value associated with key
into relkeys
. key
must have been
registered as a boxed-type key. Old value is freed and the new one is set.
Since: 0.2.0
void grl_related_keys_set_float (GrlRelatedKeys *relkeys
,GrlKeyID key
,gfloat floatvalue
);
Sets the value associated with key
into relkeys
. key
must have been
registered as a float-type key. Old value is replaced by the new one.
relkeys |
set of related keys to change |
|
key |
key to change or add. |
[type GrlKeyID] |
floatvalue |
the new value |
Since: 0.1.10
void grl_related_keys_set_int (GrlRelatedKeys *relkeys
,GrlKeyID key
,gint intvalue
);
Sets the value associated with key
into relkeys
. key
must have been
registered as an int-type key. Old value is replaced by the new one.
relkeys |
set of related keys to change |
|
key |
key to change or add. |
[type GrlKeyID] |
intvalue |
the new value |
Since: 0.1.10
void grl_related_keys_set_string (GrlRelatedKeys *relkeys
,GrlKeyID key
,const gchar *strvalue
);
Sets the value associated with key
into relkeys
. key
must have been
registered as a strying-type key. Old value is freed and the new one is set.
relkeys |
set of related keys to modify |
|
key |
key to change or add. |
[type GrlKeyID] |
strvalue |
the new value |
Since: 0.1.10
void grl_related_keys_remove (GrlRelatedKeys *relkeys
,GrlKeyID key
);
Removes key
from relkeys
set.
Since: 0.2.3