XMMS2
Dictionaries

Topics

 Iteration

Macros

#define xmmsv_dict_entry_get_int   xmmsv_dict_entry_get_int32
#define xmmsv_dict_iter_pair_int   xmmsv_dict_iter_pair_int32

Functions

xmmsv_txmmsv_new_dict (void)
 Allocates a new dict xmmsv_t.
int xmmsv_dict_get (xmmsv_t *dictv, const char *key, xmmsv_t **val)
 Get the element corresponding to the given key in the dict xmmsv_t (if it exists).
int xmmsv_dict_set (xmmsv_t *dictv, const char *key, xmmsv_t *val)
 Insert an element under the given key in the dict xmmsv_t.
int xmmsv_dict_remove (xmmsv_t *dictv, const char *key)
 Remove the element corresponding to a given key in the dict xmmsv_t (if it exists).
int xmmsv_dict_clear (xmmsv_t *dictv)
 Empty the dict of all its elements.
int xmmsv_dict_get_size (xmmsv_t *dictv)
 Return the size of the dict.
int xmmsv_dict_has_key (xmmsv_t *dictv, const char *key)
int xmmsv_dict_keys (xmmsv_t *dictv, xmmsv_t **keys)
 Get a XMMSV_TYPE_LIST of all the keys.
int xmmsv_dict_values (xmmsv_t *dictv, xmmsv_t **values)
 Get a XMMSV_TYPE_LIST of all the values.
int xmmsv_dict_entry_get_string (xmmsv_t *val, const char *key, const char **r)
int xmmsv_dict_entry_get_int32 (xmmsv_t *val, const char *key, int32_t *r)
int xmmsv_dict_entry_get_int64 (xmmsv_t *val, const char *key, int64_t *r)
int xmmsv_dict_entry_get_float (xmmsv_t *val, const char *key, float *r)
int xmmsv_dict_entry_get_coll (xmmsv_t *val, const char *key, xmmsv_t **coll)
int xmmsv_dict_set_string (xmmsv_t *val, const char *key, const char *el)
int xmmsv_dict_set_int (xmmsv_t *val, const char *key, int64_t el)
int xmmsv_dict_set_float (xmmsv_t *val, const char *key, float el)
int xmmsv_dict_set_coll (xmmsv_t *val, const char *key, xmmsv_t *el)
xmmsv_type_t xmmsv_dict_entry_get_type (xmmsv_t *val, const char *key)
 Gets the type of a dict entry.

Detailed Description

Macro Definition Documentation

◆ xmmsv_dict_entry_get_int

◆ xmmsv_dict_iter_pair_int

#define xmmsv_dict_iter_pair_int   xmmsv_dict_iter_pair_int32

Function Documentation

◆ xmmsv_dict_clear()

int xmmsv_dict_clear ( xmmsv_t * dictv)

Empty the dict of all its elements.

Parameters
dictvA xmmsv_t containing a dict.
Returns
1 upon success otherwise 0

◆ xmmsv_dict_entry_get_coll()

int xmmsv_dict_entry_get_coll ( xmmsv_t * val,
const char * key,
xmmsv_t ** coll )

◆ xmmsv_dict_entry_get_float()

int xmmsv_dict_entry_get_float ( xmmsv_t * val,
const char * key,
float * r )

◆ xmmsv_dict_entry_get_int32()

int xmmsv_dict_entry_get_int32 ( xmmsv_t * val,
const char * key,
int32_t * r )

◆ xmmsv_dict_entry_get_int64()

int xmmsv_dict_entry_get_int64 ( xmmsv_t * val,
const char * key,
int64_t * r )

◆ xmmsv_dict_entry_get_string()

int xmmsv_dict_entry_get_string ( xmmsv_t * val,
const char * key,
const char ** r )

◆ xmmsv_dict_entry_get_type()

xmmsv_type_t xmmsv_dict_entry_get_type ( xmmsv_t * val,
const char * key )

Gets the type of a dict entry.

Parameters
valA xmmsv_t containing a dict.
keyThe key in the dict.
Returns
The type of the entry or XMMSV_TYPE_NONE if something goes wrong.

Referenced by xmms_fetch_spec_new().

◆ xmmsv_dict_get()

int xmmsv_dict_get ( xmmsv_t * dictv,
const char * key,
xmmsv_t ** val )

Get the element corresponding to the given key in the dict xmmsv_t (if it exists).

This function does not increase the refcount of the element, the reference is still owned by the dict.

Parameters
dictvA xmmsv_t containing a dict.
keyThe key in the dict.
valPointer set to a borrowed reference to the element corresponding to the given key in the dict.
Returns
1 upon success otherwise 0

Referenced by xmms_collection_restore(), xmmsv_c2c_message_get_payload(), xmmsv_coll_attribute_get_value(), xmmsv_dict_entry_get_coll(), xmmsv_dict_entry_get_type(), xmmsv_dict_has_key(), and xmmsv_sc_argument_get_type().

◆ xmmsv_dict_get_size()

int xmmsv_dict_get_size ( xmmsv_t * dictv)

Return the size of the dict.

Parameters
dictvThe xmmsv_t containing the dict.
Returns
The size of the dict, or -1 if dict is invalid.

◆ xmmsv_dict_has_key()

int xmmsv_dict_has_key ( xmmsv_t * dictv,
const char * key )

◆ xmmsv_dict_keys()

int xmmsv_dict_keys ( xmmsv_t * dictv,
xmmsv_t ** keys )

Get a XMMSV_TYPE_LIST of all the keys.

Parameters
valA xmmsv_t containing a dict.
keysPointer that will own the reference to the new list containing the dict keys.
Returns
1 upon success otherwise 0

◆ xmmsv_dict_remove()

int xmmsv_dict_remove ( xmmsv_t * dictv,
const char * key )

Remove the element corresponding to a given key in the dict xmmsv_t (if it exists).

Parameters
dictvA xmmsv_t containing a dict.
keyThe key in the dict.
Returns
1 upon success otherwise 0

Referenced by xmmsv_coll_attribute_remove().

◆ xmmsv_dict_set()

int xmmsv_dict_set ( xmmsv_t * dictv,
const char * key,
xmmsv_t * val )

Insert an element under the given key in the dict xmmsv_t.

If the key already referenced an element, that element is unref'd and replaced by the new one.

Parameters
dictvA xmmsv_t containing a dict.
keyThe key in the dict.
valThe new element to insert in the dict.
Returns
1 upon success otherwise 0

Referenced by xmms_collection_snapshot(), xmms_medialib_query_to_xmmsv(), xmms_xform_browse_add_entry_property(), xmmsv_build_cluster_dict(), xmmsv_build_cluster_list(), xmmsv_build_dict_va(), xmmsv_build_metadata(), xmmsv_build_organize(), xmmsv_coll_attribute_set_value(), xmmsv_dict_set_coll(), xmmsv_propdict_to_dict(), and xmmsv_sc_argument_new().

◆ xmmsv_dict_set_coll()

int xmmsv_dict_set_coll ( xmmsv_t * val,
const char * key,
xmmsv_t * el )

Referenced by xmmsv_dict_set_coll().

◆ xmmsv_dict_set_float()

int xmmsv_dict_set_float ( xmmsv_t * val,
const char * key,
float el )

◆ xmmsv_dict_set_int()

int xmmsv_dict_set_int ( xmmsv_t * val,
const char * key,
int64_t el )

◆ xmmsv_dict_set_string()

◆ xmmsv_dict_values()

int xmmsv_dict_values ( xmmsv_t * dictv,
xmmsv_t ** values )

Get a XMMSV_TYPE_LIST of all the values.

Parameters
valA xmmsv_t containing a dict.
keysPointer that will own the reference to the new list containing the dict values.
Returns
1 upon success otherwise 0

◆ xmmsv_new_dict()