XMMS2
Modules | Macros | Typedefs | Functions

Modules

 Iteration
 

Macros

#define xmmsv_list_get_int   xmmsv_list_get_int32
 
#define xmmsv_list_iter_entry_int   xmmsv_list_iter_entry_int32
 

Typedefs

typedef int(* xmmsv_list_compare_func_t )(xmmsv_t **, xmmsv_t **)
 

Functions

xmmsv_txmmsv_new_list (void)
 Allocates a new list xmmsv_t. More...
 
int xmmsv_list_get (xmmsv_t *listv, int pos, xmmsv_t **val)
 Get the element at the given position in the list xmmsv_t. More...
 
int xmmsv_list_set (xmmsv_t *listv, int pos, xmmsv_t *val)
 Set the element at the given position in the list xmmsv_t. More...
 
int xmmsv_list_append (xmmsv_t *listv, xmmsv_t *val)
 Append an element to the end of the list xmmsv_t. More...
 
int xmmsv_list_insert (xmmsv_t *listv, int pos, xmmsv_t *val)
 Insert an element at the given position in the list xmmsv_t. More...
 
int xmmsv_list_remove (xmmsv_t *listv, int pos)
 Remove the element at the given position from the list xmmsv_t. More...
 
int xmmsv_list_move (xmmsv_t *listv, int old_pos, int new_pos)
 Move the element from position #old to position #new. More...
 
int xmmsv_list_clear (xmmsv_t *listv)
 Empty the list from all its elements. More...
 
int xmmsv_list_sort (xmmsv_t *listv, xmmsv_list_compare_func_t comparator)
 Sort the list using the supplied comparator. More...
 
int xmmsv_list_get_size (xmmsv_t *listv)
 Return the size of the list. More...
 
int xmmsv_list_restrict_type (xmmsv_t *listv, xmmsv_type_t type)
 
int xmmsv_list_has_type (xmmsv_t *listv, xmmsv_type_t type)
 Checks if all elements in the list has the given type. More...
 
int xmmsv_list_get_type (xmmsv_t *listv, xmmsv_type_t *type)
 Gets the current type restriction of a list. More...
 
int xmmsv_list_index_of (xmmsv_t *listv, xmmsv_t *val)
 Get the index of an element in the list. More...
 
int xmmsv_list_get_string (xmmsv_t *v, int pos, const char **val)
 
int xmmsv_list_get_int32 (xmmsv_t *v, int pos, int32_t *val)
 
int xmmsv_list_get_int64 (xmmsv_t *v, int pos, int64_t *val)
 
int xmmsv_list_get_float (xmmsv_t *v, int pos, float *val)
 
int xmmsv_list_get_coll (xmmsv_t *v, int pos, xmmsv_t **val)
 
int xmmsv_list_set_string (xmmsv_t *v, int pos, const char *val)
 
int xmmsv_list_set_int (xmmsv_t *v, int pos, int64_t val)
 
int xmmsv_list_set_float (xmmsv_t *v, int pos, float val)
 
int xmmsv_list_set_coll (xmmsv_t *v, int pos, xmmsv_t *val)
 
int xmmsv_list_insert_string (xmmsv_t *v, int pos, const char *val)
 
int xmmsv_list_insert_int (xmmsv_t *v, int pos, int64_t val)
 
int xmmsv_list_insert_float (xmmsv_t *v, int pos, float val)
 
int xmmsv_list_insert_coll (xmmsv_t *v, int pos, xmmsv_t *val)
 
int xmmsv_list_append_string (xmmsv_t *v, const char *val)
 
int xmmsv_list_append_int (xmmsv_t *v, int64_t val)
 
int xmmsv_list_append_float (xmmsv_t *v, float val)
 
int xmmsv_list_append_coll (xmmsv_t *v, xmmsv_t *val)
 
xmmsv_txmmsv_list_flatten (xmmsv_t *list, int depth)
 Flattens a list of lists. More...
 

Detailed Description

Macro Definition Documentation

#define xmmsv_list_get_int   xmmsv_list_get_int32
#define xmmsv_list_iter_entry_int   xmmsv_list_iter_entry_int32

Typedef Documentation

typedef int(* xmmsv_list_compare_func_t)(xmmsv_t **, xmmsv_t **)

Function Documentation

int xmmsv_list_append ( xmmsv_t listv,
xmmsv_t val 
)

Append an element to the end of the list xmmsv_t.

The list will hold a reference to the element until it's removed.

Parameters
listvA xmmsv_t containing a list.
valThe element to append.
Returns
1 upon success otherwise 0

Referenced by xmms_medialib_query_to_xmmsv(), xmms_medialib_session_track_garbage(), xmms_xform_browse_add_entry(), xmmsv_build_list_va(), xmmsv_build_metadata(), xmmsv_coll_add_operand(), xmmsv_dict_values(), xmmsv_list_append_coll(), and xmmsv_make_stringlist().

int xmmsv_list_append_coll ( xmmsv_t v,
xmmsv_t val 
)
int xmmsv_list_append_float ( xmmsv_t v,
float  val 
)
int xmmsv_list_append_int ( xmmsv_t v,
int64_t  val 
)
int xmmsv_list_append_string ( xmmsv_t v,
const char *  val 
)

Referenced by xmmsv_dict_keys().

int xmmsv_list_clear ( xmmsv_t listv)

Empty the list from all its elements.

Parameters
listvA xmmsv_t containing a list.
Returns
1 upon success otherwise 0

Referenced by xmmsv_coll_idlist_clear(), and xmmsv_coll_set_idlist().

xmmsv_t* xmmsv_list_flatten ( xmmsv_t list,
int  depth 
)

Flattens a list of lists.

Parameters
listThe list to flatten
depthThe level of lists to flatten.
Returns
A new flattened list, or NULL on error.
int xmmsv_list_get ( xmmsv_t listv,
int  pos,
xmmsv_t **  val 
)

Get the element at the given position in the list xmmsv_t.

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

Parameters
listvA xmmsv_t containing a list.
posThe position in the list. If negative, start counting from the end (-1 is the last element, etc).
valPointer set to a borrowed reference to the element at the given position in the list.
Returns
1 upon success otherwise 0

Referenced by xmmsv_list_get_coll().

int xmmsv_list_get_coll ( xmmsv_t v,
int  pos,
xmmsv_t **  val 
)
int xmmsv_list_get_float ( xmmsv_t v,
int  pos,
float *  val 
)
int xmmsv_list_get_int32 ( xmmsv_t v,
int  pos,
int32_t *  val 
)
int xmmsv_list_get_int64 ( xmmsv_t v,
int  pos,
int64_t *  val 
)
int xmmsv_list_get_size ( xmmsv_t listv)

Return the size of the list.

Parameters
listvThe xmmsv_t containing the list.
Returns
The size of the list, or -1 if listv is invalid.

Referenced by xmmsv_coll_idlist_get_size().

int xmmsv_list_get_string ( xmmsv_t v,
int  pos,
const char **  val 
)
int xmmsv_list_get_type ( xmmsv_t listv,
xmmsv_type_t type 
)

Gets the current type restriction of a list.

Parameters
listvThe list to Check
Returns
the xmmsv_type_t of the restricted type, or XMMSV_TYPE_NONE if no restriction.
int xmmsv_list_has_type ( xmmsv_t listv,
xmmsv_type_t  type 
)

Checks if all elements in the list has the given type.

Parameters
listvThe list to check
typeThe type to check for
Returns
non-zero if all elements in the list has the type, 0 otherwise

Referenced by xmmsv_list_restrict_type().

int xmmsv_list_index_of ( xmmsv_t listv,
xmmsv_t val 
)

Get the index of an element in the list.

This function compares the pointers and not the actual values contained in the elements.

Parameters
listvThe xmmsv_t containing the list
valThe element to find
Returns
The index of the element if found, -1 otherwise
int xmmsv_list_insert ( xmmsv_t listv,
int  pos,
xmmsv_t val 
)

Insert an element at the given position in the list xmmsv_t.

The list will hold a reference to the element until it's removed.

Parameters
listvA xmmsv_t containing a list.
posThe position in the list. If negative, start counting from the end (-1 is the last element, etc).
valThe element to insert.
Returns
1 upon success otherwise 0

Referenced by xmmsv_list_insert_coll().

int xmmsv_list_insert_coll ( xmmsv_t v,
int  pos,
xmmsv_t val 
)
int xmmsv_list_insert_float ( xmmsv_t v,
int  pos,
float  val 
)
int xmmsv_list_insert_int ( xmmsv_t v,
int  pos,
int64_t  val 
)
int xmmsv_list_insert_string ( xmmsv_t v,
int  pos,
const char *  val 
)
int xmmsv_list_move ( xmmsv_t listv,
int  old_pos,
int  new_pos 
)

Move the element from position #old to position #new.

xmmsv_list_iter_t's remain pointing at their element (which might or might not be at a different position).

Parameters
listvA xmmsv_t containing a list
oldThe original position in the list. If negative, start counting from the end (-1 is the last element, etc.)
newThe new position in the list. If negative start counting from the end (-1 is the last element, etc.) For the sake of counting the element to be moved is still at its old position.
Returns
1 upon success otherwise 0

Referenced by xmmsv_coll_idlist_move().

int xmmsv_list_remove ( xmmsv_t listv,
int  pos 
)

Remove the element at the given position from the list xmmsv_t.

Parameters
listvA xmmsv_t containing a list.
posThe position in the list. If negative, start counting from the end (-1 is the last element, etc).
Returns
1 upon success otherwise 0

Referenced by xmmsv_coll_idlist_remove().

int xmmsv_list_restrict_type ( xmmsv_t listv,
xmmsv_type_t  type 
)
int xmmsv_list_set ( xmmsv_t listv,
int  pos,
xmmsv_t val 
)

Set the element at the given position in the list xmmsv_t.

Parameters
listvA xmmsv_t containing a list.
posThe position in the list. If negative, start counting from the end (-1 is the last element, etc).
valThe element to put at the given position in the list.
Returns
1 upon success otherwise 0

Referenced by xmmsv_list_iter_set(), and xmmsv_list_set_coll().

int xmmsv_list_set_coll ( xmmsv_t v,
int  pos,
xmmsv_t val 
)
int xmmsv_list_set_float ( xmmsv_t v,
int  pos,
float  val 
)
int xmmsv_list_set_int ( xmmsv_t v,
int  pos,
int64_t  val 
)
int xmmsv_list_set_string ( xmmsv_t v,
int  pos,
const char *  val 
)
int xmmsv_list_sort ( xmmsv_t listv,
xmmsv_list_compare_func_t  comparator 
)

Sort the list using the supplied comparator.

Parameters
listvA xmmsv_t containing a list.
Returns
1 upon success otherwise 0

Referenced by xmms_xform_browse_method().

xmmsv_t* xmmsv_new_list ( void  )