XmmsClient
Modules | Macros | Functions
Dictionaries

Modules

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

Detailed Description

Macro Definition Documentation

#define xmmsv_dict_entry_get_int   xmmsv_dict_entry_get_int32
#define xmmsv_dict_iter_pair_int   xmmsv_dict_iter_pair_int32

Function Documentation

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
int xmmsv_dict_entry_get_coll ( xmmsv_t val,
const char *  key,
xmmsv_t **  coll 
)
int xmmsv_dict_entry_get_float ( xmmsv_t val,
const char *  key,
float *  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_string ( xmmsv_t val,
const char *  key,
const char **  r 
)
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.
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 xmmsv_coll_attribute_get_value(), xmmsv_dict_entry_get_coll(), xmmsv_dict_entry_get_type(), and xmmsv_dict_has_key().

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

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
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 xmmsc_sc_namespace_remove_constant(), and xmmsv_coll_attribute_remove().

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 xmmsc_sc_namespace_add_constant(), 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().

int xmmsv_dict_set_coll ( xmmsv_t val,
const char *  key,
xmmsv_t el 
)
int xmmsv_dict_set_float ( xmmsv_t val,
const char *  key,
float  el 
)
int xmmsv_dict_set_int ( xmmsv_t val,
const char *  key,
int64_t  el 
)
int xmmsv_dict_set_string ( xmmsv_t val,
const char *  key,
const char *  el 
)
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_t* xmmsv_new_dict ( void  )