XMMS2
Macros | Functions
xmmsv_list.c File Reference
#include <stdlib.h>
#include <string.h>
#include <xmmscpriv/xmmsv.h>
#include <xmmscpriv/xmms_list.h>
#include <xmmsc/xmmsv.h>

Macros

#define GEN_LIST_EXTRACTOR_FUNC(typename, type)
 
#define GEN_LIST_SET_FUNC(typename, type)
 
#define GEN_LIST_INSERT_FUNC(typename, type)
 
#define GEN_LIST_APPEND_FUNC(typename, type)
 
#define GEN_LIST_ITER_EXTRACTOR_FUNC(typename, type)
 
#define GEN_LIST_ITER_INSERT_FUNC(typename, type)
 

Functions

void _xmmsv_list_free (xmmsv_list_internal_t *l)
 
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_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_append (xmmsv_t *listv, xmmsv_t *val)
 Append an element to the end of the list xmmsv_t. 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_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_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_get_type (xmmsv_t *listv, xmmsv_type_t *type)
 Gets the current type restriction of a list. More...
 
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_index_of (xmmsv_t *listv, xmmsv_t *val)
 Get the index of an element in the list. 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...
 
xmmsv_txmmsv_list_flatten (xmmsv_t *list, int depth)
 Flattens a list of lists. More...
 
int xmmsv_list_get_string (xmmsv_t *val, int pos, const char **r)
 
int xmmsv_list_get_int32 (xmmsv_t *val, int pos, int32_t *r)
 
int xmmsv_list_get_int64 (xmmsv_t *val, int pos, int64_t *r)
 
int xmmsv_list_get_float (xmmsv_t *val, int pos, float *r)
 
int xmmsv_list_get_coll (xmmsv_t *val, int pos, xmmsv_t **r)
 
int xmmsv_list_set_string (xmmsv_t *list, int pos, const char *elem)
 
int xmmsv_list_set_int (xmmsv_t *list, int pos, int64_t elem)
 
int xmmsv_list_set_float (xmmsv_t *list, int pos, float elem)
 
int xmmsv_list_set_coll (xmmsv_t *list, int pos, xmmsv_t *elem)
 
int xmmsv_list_insert_string (xmmsv_t *list, int pos, const char *elem)
 
int xmmsv_list_insert_int (xmmsv_t *list, int pos, int64_t elem)
 
int xmmsv_list_insert_float (xmmsv_t *list, int pos, float elem)
 
int xmmsv_list_insert_coll (xmmsv_t *list, int pos, xmmsv_t *elem)
 
int xmmsv_list_append_string (xmmsv_t *list, const char *elem)
 
int xmmsv_list_append_int (xmmsv_t *list, int64_t elem)
 
int xmmsv_list_append_float (xmmsv_t *list, float elem)
 
int xmmsv_list_append_coll (xmmsv_t *list, xmmsv_t *elem)
 
int xmmsv_list_iter_entry_string (xmmsv_list_iter_t *it, const char **r)
 
int xmmsv_list_iter_entry_int32 (xmmsv_list_iter_t *it, int32_t *r)
 
int xmmsv_list_iter_entry_int64 (xmmsv_list_iter_t *it, int64_t *r)
 
int xmmsv_list_iter_entry_float (xmmsv_list_iter_t *it, float *r)
 
int xmmsv_list_iter_entry_coll (xmmsv_list_iter_t *it, xmmsv_t **r)
 
int xmmsv_list_iter_insert_string (xmmsv_list_iter_t *it, const char *elem)
 
int xmmsv_list_iter_insert_int (xmmsv_list_iter_t *it, int64_t elem)
 
int xmmsv_list_iter_insert_float (xmmsv_list_iter_t *it, float elem)
 
int xmmsv_list_iter_insert_coll (xmmsv_list_iter_t *it, xmmsv_t *elem)
 

Macro Definition Documentation

#define GEN_LIST_APPEND_FUNC (   typename,
  type 
)
Value:
int \
xmmsv_list_append_##typename (xmmsv_t *list, type elem) \
{ \
int ret; \
xmmsv_t *v; \
\
v = xmmsv_new_##typename (elem); \
ret = xmmsv_list_append (list, v); \
\
return ret; \
}
#define GEN_LIST_EXTRACTOR_FUNC (   typename,
  type 
)
Value:
int \
xmmsv_list_get_##typename (xmmsv_t *val, int pos, type *r) \
{ \
xmmsv_t *v; \
if (!xmmsv_list_get (val, pos, &v)) { \
return 0; \
} \
return xmmsv_get_##typename (v, r); \
}
#define GEN_LIST_INSERT_FUNC (   typename,
  type 
)
Value:
int \
xmmsv_list_insert_##typename (xmmsv_t *list, int pos, type elem) \
{ \
int ret; \
xmmsv_t *v; \
\
v = xmmsv_new_##typename (elem); \
ret = xmmsv_list_insert (list, pos, v); \
\
return ret; \
}
#define GEN_LIST_ITER_EXTRACTOR_FUNC (   typename,
  type 
)
Value:
int \
xmmsv_list_iter_entry_##typename (xmmsv_list_iter_t *it, type *r) \
{ \
xmmsv_t *v; \
if (!xmmsv_list_iter_entry (it, &v)) { \
return 0; \
} \
return xmmsv_get_##typename (v, r); \
}
#define GEN_LIST_ITER_INSERT_FUNC (   typename,
  type 
)
Value:
int \
xmmsv_list_iter_insert_##typename (xmmsv_list_iter_t *it, type elem) \
{ \
int ret; \
xmmsv_t *v; \
\
v = xmmsv_new_##typename (elem); \
ret = xmmsv_list_iter_insert (it, v); \
\
return ret; \
}
#define GEN_LIST_SET_FUNC (   typename,
  type 
)
Value:
int \
xmmsv_list_set_##typename (xmmsv_t *list, int pos, type elem) \
{ \
int ret; \
xmmsv_t *v; \
\
v = xmmsv_new_##typename (elem); \
ret = xmmsv_list_set (list, pos, v); \
\
return ret; \
}

Function Documentation

void _xmmsv_list_free ( xmmsv_list_internal_t *  l)