XMMS2
Typedefs | Functions
Iteration

Typedefs

typedef void(* xmmsv_dict_foreach_func )(const char *key, xmmsv_t *value, void *user_data)
 
typedef struct xmmsv_dict_iter_St xmmsv_dict_iter_t
 

Functions

int xmmsv_dict_foreach (xmmsv_t *dictv, xmmsv_dict_foreach_func func, void *user_data)
 Apply a function to each key-element pair in the list. More...
 
int xmmsv_get_dict_iter (const xmmsv_t *val, xmmsv_dict_iter_t **it)
 Retrieves a dict iterator from a dict xmmsv_t. More...
 
void xmmsv_dict_iter_explicit_destroy (xmmsv_dict_iter_t *it)
 Explicitly free dict iterator. More...
 
int xmmsv_dict_iter_pair (xmmsv_dict_iter_t *it, const char **key, xmmsv_t **val)
 Get the key-element pair currently pointed at by the iterator. More...
 
int xmmsv_dict_iter_valid (xmmsv_dict_iter_t *it)
 Check whether the iterator is valid and points to a valid pair. More...
 
void xmmsv_dict_iter_first (xmmsv_dict_iter_t *it)
 Rewind the iterator to the start of the dict. More...
 
void xmmsv_dict_iter_next (xmmsv_dict_iter_t *it)
 Advance the iterator to the next pair in the dict. More...
 
int xmmsv_dict_iter_find (xmmsv_dict_iter_t *it, const char *key)
 Move the iterator to the pair with the given key (if it exists) or move it to the position where the key would have to be put (if it doesn't exist yet). More...
 
int xmmsv_dict_iter_set (xmmsv_dict_iter_t *it, xmmsv_t *val)
 Replace the element of the pair currently pointed to by the iterator. More...
 
int xmmsv_dict_iter_remove (xmmsv_dict_iter_t *it)
 Remove the pair in the dict pointed at by the iterator. More...
 
int xmmsv_dict_iter_pair_string (xmmsv_dict_iter_t *it, const char **key, const char **r)
 
int xmmsv_dict_iter_pair_int32 (xmmsv_dict_iter_t *it, const char **key, int32_t *r)
 
int xmmsv_dict_iter_pair_int64 (xmmsv_dict_iter_t *it, const char **key, int64_t *r)
 
int xmmsv_dict_iter_pair_float (xmmsv_dict_iter_t *it, const char **key, float *r)
 
int xmmsv_dict_iter_pair_coll (xmmsv_dict_iter_t *it, const char **key, xmmsv_t **r)
 
int xmmsv_dict_iter_set_string (xmmsv_dict_iter_t *it, const char *elem)
 
int xmmsv_dict_iter_set_int (xmmsv_dict_iter_t *it, int64_t elem)
 
int xmmsv_dict_iter_set_float (xmmsv_dict_iter_t *it, float elem)
 
int xmmsv_dict_iter_set_coll (xmmsv_dict_iter_t *it, xmmsv_t *elem)
 

Detailed Description

Typedef Documentation

typedef void(* xmmsv_dict_foreach_func)(const char *key, xmmsv_t *value, void *user_data)
typedef struct xmmsv_dict_iter_St xmmsv_dict_iter_t

Function Documentation

int xmmsv_dict_foreach ( xmmsv_t dictv,
xmmsv_dict_foreach_func  func,
void *  user_data 
)

Apply a function to each key-element pair in the list.

No particular order is assumed.

Parameters
dictvA xmmsv_t containing a dict.
functionThe function to apply to each key-element pair.
user_dataUser data passed to the foreach function.
Returns
1 upon success otherwise 0

Referenced by xmms_collection_restore(), and xmmsv_encode_url_full().

void xmmsv_dict_iter_explicit_destroy ( xmmsv_dict_iter_t it)

Explicitly free dict iterator.

Immediately frees any resources used by this iterator. The iterator is freed automatically when the dict is freed, but this function is useful when the dict can be long lived.

Parameters
ititerator to free

Referenced by xmmsv_dict_keys(), and xmmsv_dict_values().

int xmmsv_dict_iter_find ( xmmsv_dict_iter_t it,
const char *  key 
)

Move the iterator to the pair with the given key (if it exists) or move it to the position where the key would have to be put (if it doesn't exist yet).

Parameters
itA xmmsv_dict_iter_t.
keyThe key to seek for.
Returns
1 upon success otherwise 0

Referenced by xmmsv_dict_format().

void xmmsv_dict_iter_first ( xmmsv_dict_iter_t it)

Rewind the iterator to the start of the dict.

Parameters
itA xmmsv_dict_iter_t.
Returns
1 upon success otherwise 0

Referenced by xmmsv_dict_iter_find().

void xmmsv_dict_iter_next ( xmmsv_dict_iter_t it)

Advance the iterator to the next pair in the dict.

Parameters
itA xmmsv_dict_iter_t.
Returns
1 upon success otherwise 0

Referenced by xmmsv_dict_foreach(), xmmsv_dict_iter_find(), xmmsv_dict_iter_remove(), xmmsv_dict_keys(), xmmsv_dict_values(), xmmsv_encode_url_full(), and xmmsv_propdict_to_dict().

int xmmsv_dict_iter_pair ( xmmsv_dict_iter_t it,
const char **  key,
xmmsv_t **  val 
)

Get the key-element pair currently pointed at by the iterator.

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

Parameters
itA xmmsv_dict_iter_t.
keyPointer set to the key pointed at by the iterator.
valPointer set to a borrowed reference to the element pointed at by the iterator.
Returns
1 upon success otherwise 0

Referenced by xmmsv_dict_foreach(), xmmsv_dict_format(), xmmsv_dict_iter_find(), xmmsv_dict_iter_pair_coll(), xmmsv_dict_keys(), xmmsv_dict_values(), xmmsv_encode_url_full(), and xmmsv_propdict_to_dict().

int xmmsv_dict_iter_pair_coll ( xmmsv_dict_iter_t it,
const char **  key,
xmmsv_t **  r 
)
int xmmsv_dict_iter_pair_float ( xmmsv_dict_iter_t it,
const char **  key,
float *  r 
)
int xmmsv_dict_iter_pair_int32 ( xmmsv_dict_iter_t it,
const char **  key,
int32_t *  r 
)
int xmmsv_dict_iter_pair_int64 ( xmmsv_dict_iter_t it,
const char **  key,
int64_t *  r 
)
int xmmsv_dict_iter_pair_string ( xmmsv_dict_iter_t it,
const char **  key,
const char **  r 
)
int xmmsv_dict_iter_remove ( xmmsv_dict_iter_t it)

Remove the pair in the dict pointed at by the iterator.

Parameters
itA xmmsv_dict_iter_t.
Returns
1 upon success otherwise 0
int xmmsv_dict_iter_set ( xmmsv_dict_iter_t it,
xmmsv_t val 
)

Replace the element of the pair currently pointed to by the iterator.

Parameters
itA xmmsv_dict_iter_t.
valThe element to set in the pair.
Returns
1 upon success otherwise 0

Referenced by xmmsv_dict_iter_set_coll().

int xmmsv_dict_iter_set_coll ( xmmsv_dict_iter_t it,
xmmsv_t elem 
)
int xmmsv_dict_iter_set_float ( xmmsv_dict_iter_t it,
float  elem 
)
int xmmsv_dict_iter_set_int ( xmmsv_dict_iter_t it,
int64_t  elem 
)
int xmmsv_dict_iter_set_string ( xmmsv_dict_iter_t it,
const char *  elem 
)
int xmmsv_dict_iter_valid ( xmmsv_dict_iter_t it)

Check whether the iterator is valid and points to a valid pair.

Parameters
itA xmmsv_dict_iter_t.
Returns
1 if the iterator is valid, 0 otherwise

Referenced by xmmsv_dict_iter_find(), xmmsv_dict_iter_pair(), xmmsv_dict_iter_remove(), and xmmsv_dict_iter_set().

int xmmsv_get_dict_iter ( const xmmsv_t val,
xmmsv_dict_iter_t **  it 
)

Retrieves a dict iterator from a dict xmmsv_t.

Parameters
vala xmmsv_t containing a dict.
itAn xmmsv_dict_iter_t that can be used to access the dict data. The iterator will be freed when the value is freed.
Returns
1 upon success otherwise 0

Referenced by xmmsv_dict_foreach(), xmmsv_dict_format(), xmmsv_dict_keys(), xmmsv_dict_values(), xmmsv_encode_url_full(), and xmmsv_propdict_to_dict().