XMMS2
Modules | Functions
Dictionaries

Modules

 Iteration
 

Functions

xmmsv_txmmsv_new_dict (void)
 Allocates a new dict xmmsv_t. More...
 
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). More...
 
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. More...
 
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). More...
 
int xmmsv_dict_clear (xmmsv_t *dictv)
 Empty the dict of all its elements. More...
 
int xmmsv_dict_get_size (xmmsv_t *dictv)
 Return the size of the dict. More...
 
int xmmsv_dict_has_key (xmmsv_t *dictv, const char *key)
 
int xmmsv_dict_entry_get_string (xmmsv_t *val, const char *key, const char **r)
 
int xmmsv_dict_entry_get_int (xmmsv_t *val, const char *key, int32_t *r)
 
int xmmsv_dict_entry_get_coll (xmmsv_t *val, const char *key, xmmsv_coll_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, int32_t el)
 
int xmmsv_dict_set_coll (xmmsv_t *val, const char *key, xmmsv_coll_t *el)
 
xmmsv_type_t xmmsv_dict_entry_get_type (xmmsv_t *val, const char *key)
 Gets the type of a dict entry. More...
 

Detailed Description

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

Definition at line 1833 of file value.c.

◆ xmmsv_dict_entry_get_coll()

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

◆ xmmsv_dict_entry_get_int()

int xmmsv_dict_entry_get_int ( xmmsv_t val,
const char *  key,
int32_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.

Definition at line 508 of file value.c.

◆ 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

Definition at line 1717 of file value.c.

Referenced by xmmsv_dict_entry_get_type(), and xmmsv_dict_has_key().

◆ 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.

Definition at line 1882 of file value.c.

◆ xmmsv_dict_has_key()

int xmmsv_dict_has_key ( xmmsv_t dictv,
const char *  key 
)

Definition at line 2492 of file value.c.

◆ 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

Definition at line 1803 of file value.c.

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

Definition at line 1752 of file value.c.

Referenced by xmms_xform_browse_add_entry_property(), xmmsv_build_dict(), and xmmsv_coll_attribute_set().

◆ xmmsv_dict_set_coll()

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

◆ xmmsv_dict_set_int()

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

◆ xmmsv_dict_set_string()

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

◆ xmmsv_new_dict()

xmmsv_t* xmmsv_new_dict ( void  )

Allocates a new dict xmmsv_t.

Returns
The new xmmsv_t. Must be unreferenced with xmmsv_unref.

Definition at line 268 of file value.c.

Referenced by xmms_xform_browse_add_entry(), xmmsv_build_dict(), xmmsv_coll_new(), and xmmsv_propdict_to_dict().