XMMS2
Typedefs | Functions
Iteration

Typedefs

typedef void(* xmmsv_list_foreach_func )(xmmsv_t *value, void *user_data)
 
typedef struct xmmsv_list_iter_St xmmsv_list_iter_t
 

Functions

int xmmsv_list_foreach (xmmsv_t *listv, xmmsv_list_foreach_func func, void *user_data)
 Apply a function to each element in the list, in sequential order. More...
 
int xmmsv_get_list_iter (const xmmsv_t *val, xmmsv_list_iter_t **it)
 Retrieves a list iterator from a list xmmsv_t. More...
 
void xmmsv_list_iter_explicit_destroy (xmmsv_list_iter_t *it)
 Explicitly free list iterator. More...
 
int xmmsv_list_iter_entry (xmmsv_list_iter_t *it, xmmsv_t **val)
 Get the element currently pointed at by the iterator. More...
 
int xmmsv_list_iter_valid (xmmsv_list_iter_t *it)
 Check whether the iterator is valid and points to a valid element. More...
 
void xmmsv_list_iter_first (xmmsv_list_iter_t *it)
 Rewind the iterator to the start of the list. More...
 
void xmmsv_list_iter_last (xmmsv_list_iter_t *it)
 Move the iterator to end of the list. More...
 
void xmmsv_list_iter_next (xmmsv_list_iter_t *it)
 Advance the iterator to the next element in the list. More...
 
void xmmsv_list_iter_prev (xmmsv_list_iter_t *it)
 Move the iterator to the previous element in the list. More...
 
int xmmsv_list_iter_seek (xmmsv_list_iter_t *it, int pos)
 Move the iterator to the n-th element in the list. More...
 
int xmmsv_list_iter_tell (const xmmsv_list_iter_t *it)
 Tell the position of the iterator. More...
 
xmmsv_txmmsv_list_iter_get_parent (const xmmsv_list_iter_t *it)
 Return the parent xmmsv_t of an iterator. More...
 
int xmmsv_list_iter_set (xmmsv_list_iter_t *it, xmmsv_t *val)
 Replace an element in the list at the position pointed at by the iterator. More...
 
int xmmsv_list_iter_insert (xmmsv_list_iter_t *it, xmmsv_t *val)
 Insert an element in the list at the position pointed at by the iterator. More...
 
int xmmsv_list_iter_remove (xmmsv_list_iter_t *it)
 Remove the element in the list at the position pointed at by the iterator. More...
 
int xmmsv_list_iter_entry_string (xmmsv_list_iter_t *it, const char **val)
 
int xmmsv_list_iter_entry_int32 (xmmsv_list_iter_t *it, int32_t *val)
 
int xmmsv_list_iter_entry_int64 (xmmsv_list_iter_t *it, int64_t *val)
 
int xmmsv_list_iter_entry_float (xmmsv_list_iter_t *it, float *val)
 
int xmmsv_list_iter_entry_coll (xmmsv_list_iter_t *it, xmmsv_t **val)
 
int xmmsv_list_iter_insert_string (xmmsv_list_iter_t *it, const char *val)
 
int xmmsv_list_iter_insert_int (xmmsv_list_iter_t *it, int64_t val)
 
int xmmsv_list_iter_insert_float (xmmsv_list_iter_t *it, float val)
 
int xmmsv_list_iter_insert_coll (xmmsv_list_iter_t *it, xmmsv_t *val)
 

Detailed Description

Typedef Documentation

typedef void(* xmmsv_list_foreach_func)(xmmsv_t *value, void *user_data)
typedef struct xmmsv_list_iter_St xmmsv_list_iter_t

Function Documentation

int xmmsv_get_list_iter ( const xmmsv_t val,
xmmsv_list_iter_t **  it 
)

Retrieves a list iterator from a list xmmsv_t.

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

Referenced by xmmsv_coll_add_operand(), xmmsv_coll_add_order_operators(), xmmsv_coll_remove_operand(), xmmsv_list_foreach(), xmmsv_list_has_type(), and xmmsv_list_index_of().

int xmmsv_list_foreach ( xmmsv_t listv,
xmmsv_list_foreach_func  func,
void *  user_data 
)

Apply a function to each element in the list, in sequential order.

Parameters
listvA xmmsv_t containing a list.
functionThe function to apply to each element.
user_dataUser data passed to the foreach function.
Returns
1 upon success otherwise 0
int xmmsv_list_iter_entry ( xmmsv_list_iter_t it,
xmmsv_t **  val 
)

Get the element currently pointed at by the iterator.

This function does not increase the refcount of the element, the reference is still owned by the list. If iterator does not point on a valid element xmmsv_list_iter_entry returns 0 and leaves val untouched.

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

Referenced by xmmsv_coll_add_order_operators(), xmmsv_list_foreach(), xmmsv_list_has_type(), xmmsv_list_index_of(), and xmmsv_list_iter_entry_coll().

int xmmsv_list_iter_entry_coll ( xmmsv_list_iter_t it,
xmmsv_t **  val 
)
int xmmsv_list_iter_entry_float ( xmmsv_list_iter_t it,
float *  val 
)
int xmmsv_list_iter_entry_int32 ( xmmsv_list_iter_t it,
int32_t *  val 
)
int xmmsv_list_iter_entry_int64 ( xmmsv_list_iter_t it,
int64_t *  val 
)
int xmmsv_list_iter_entry_string ( xmmsv_list_iter_t it,
const char **  val 
)
void xmmsv_list_iter_explicit_destroy ( xmmsv_list_iter_t it)

Explicitly free list iterator.

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

Parameters
ititerator to free

Referenced by xmmsv_coll_add_operand(), xmmsv_coll_remove_operand(), and xmmsv_list_index_of().

void xmmsv_list_iter_first ( xmmsv_list_iter_t it)

Rewind the iterator to the start of the list.

Parameters
itA xmmsv_list_iter_t.
xmmsv_t* xmmsv_list_iter_get_parent ( const xmmsv_list_iter_t it)

Return the parent xmmsv_t of an iterator.

Parameters
itA xmmsv_list_iter_t.
Returns
The parent xmmsv_t of the iterator, or NULL if invalid.
int xmmsv_list_iter_insert ( xmmsv_list_iter_t it,
xmmsv_t val 
)

Insert an element in the list at the position pointed at by the iterator.

Parameters
itA xmmsv_list_iter_t.
valThe element to insert.
Returns
1 upon success otherwise 0

Referenced by xmmsv_list_iter_insert_coll().

int xmmsv_list_iter_insert_coll ( xmmsv_list_iter_t it,
xmmsv_t val 
)
int xmmsv_list_iter_insert_float ( xmmsv_list_iter_t it,
float  val 
)
int xmmsv_list_iter_insert_int ( xmmsv_list_iter_t it,
int64_t  val 
)
int xmmsv_list_iter_insert_string ( xmmsv_list_iter_t it,
const char *  val 
)
void xmmsv_list_iter_last ( xmmsv_list_iter_t it)

Move the iterator to end of the list.

Parameters
listvA xmmsv_list_iter_t.

Referenced by xmmsv_coll_add_order_operators().

void xmmsv_list_iter_next ( xmmsv_list_iter_t it)

Advance the iterator to the next element in the list.

Parameters
itA xmmsv_list_iter_t.

Referenced by xmmsv_list_foreach(), xmmsv_list_has_type(), and xmmsv_list_index_of().

void xmmsv_list_iter_prev ( xmmsv_list_iter_t it)

Move the iterator to the previous element in the list.

Parameters
listvA xmmsv_list_iter_t.

Referenced by xmmsv_coll_add_order_operators().

int xmmsv_list_iter_remove ( xmmsv_list_iter_t it)

Remove the element in the list at the position pointed at by the iterator.

Parameters
itA xmmsv_list_iter_t.
Returns
1 upon success otherwise 0

Referenced by xmmsv_coll_remove_operand().

int xmmsv_list_iter_seek ( xmmsv_list_iter_t it,
int  pos 
)

Move the iterator to the n-th element in the list.

Parameters
itA xmmsv_list_iter_t.
posThe position in the list. If negative, start counting from the end (-1 is the last element, etc).
Returns
1 upon success otherwise 0
int xmmsv_list_iter_set ( xmmsv_list_iter_t it,
xmmsv_t val 
)

Replace an element in the list at the position pointed at by the iterator.

Parameters
itA xmmsv_list_iter_t.
valThe element to insert.
Returns
1 upon success otherwise 0
int xmmsv_list_iter_tell ( const xmmsv_list_iter_t it)

Tell the position of the iterator.

Parameters
itA xmmsv_list_iter_t.
Returns
The position of the iterator, or -1 if invalid.
int xmmsv_list_iter_valid ( xmmsv_list_iter_t it)

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

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

Referenced by xmmsv_list_iter_entry().