XMMS2
|
The API to be used to work with value objects. More...
Defines | |
#define | GEN_DICT_EXTRACTOR_FUNC(typename, type) |
#define | GEN_DICT_SET_FUNC(typename, type) |
#define | GEN_DICT_ITER_EXTRACTOR_FUNC(typename, type) |
#define | GEN_DICT_ITER_SET_FUNC(typename, type) |
#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 | |
xmmsv_t * | xmmsv_new_none (void) |
Allocates a new empty xmmsv_t. | |
xmmsv_t * | xmmsv_new_error (const char *errstr) |
Allocates a new error xmmsv_t. | |
xmmsv_t * | xmmsv_new_int (int32_t i) |
Allocates a new integer xmmsv_t. | |
xmmsv_t * | xmmsv_new_string (const char *s) |
Allocates a new string xmmsv_t. | |
xmmsv_t * | xmmsv_new_coll (xmmsv_coll_t *c) |
Allocates a new collection xmmsv_t. | |
xmmsv_t * | xmmsv_new_bin (unsigned char *data, unsigned int len) |
Allocates a new binary data xmmsv_t. | |
xmmsv_t * | xmmsv_new_list (void) |
Allocates a new list xmmsv_t. | |
xmmsv_t * | xmmsv_new_dict (void) |
Allocates a new dict xmmsv_t. | |
xmmsv_t * | xmmsv_ref (xmmsv_t *val) |
References the xmmsv_t. | |
void | xmmsv_unref (xmmsv_t *val) |
Decreases the references for the xmmsv_t When the number of references reaches 0 it will be freed. | |
xmmsv_type_t | xmmsv_get_type (const xmmsv_t *val) |
Get the type of the value. | |
int | xmmsv_is_type (const xmmsv_t *val, xmmsv_type_t t) |
Check if value is of specified type. | |
int | xmmsv_is_error (const xmmsv_t *val) |
Check if the value stores an error. | |
int | xmmsv_is_list (const xmmsv_t *val) |
Check if the value stores a list. | |
int | xmmsv_is_dict (const xmmsv_t *val) |
Check if the value stores a dict. | |
const char * | xmmsv_get_error_old (const xmmsv_t *val) |
Legacy alias to retrieve the error string from an xmmsv_t. | |
xmmsv_t * | xmmsv_make_stringlist (char *array[], int num) |
Helper function to build a list xmmsv_t containing the strings from the input array. | |
xmmsv_type_t | xmmsv_dict_entry_get_type (xmmsv_t *val, const char *key) |
Gets the type of a dict entry. | |
xmmsv_t * | xmmsv_propdict_to_dict (xmmsv_t *propdict, const char **src_prefs) |
Helper function to transform a key-source-value dict-of-dict xmmsv_t (formerly a propdict) to a regular key-value dict, given a list of source preference. | |
int | xmmsv_get_error (const xmmsv_t *val, const char **r) |
Retrieves an error string describing the server error from the value. | |
int | xmmsv_get_int (const xmmsv_t *val, int32_t *r) |
Retrieves a signed integer from the value. | |
int | xmmsv_get_uint (const xmmsv_t *val, uint32_t *r) |
Retrieves a unsigned integer from the value. | |
int | xmmsv_get_string (const xmmsv_t *val, const char **r) |
Retrieves a string from the value. | |
int | xmmsv_get_coll (const xmmsv_t *val, xmmsv_coll_t **c) |
Retrieves a collection from the value. | |
int | xmmsv_get_bin (const xmmsv_t *val, const unsigned char **r, unsigned int *rlen) |
Retrieves binary data from the value. | |
int | xmmsv_get_list_iter (const xmmsv_t *val, xmmsv_list_iter_t **it) |
Retrieves a list iterator from a list xmmsv_t. | |
int | xmmsv_get_dict_iter (const xmmsv_t *val, xmmsv_dict_iter_t **it) |
Retrieves a dict iterator from a dict xmmsv_t. | |
int | xmmsv_list_get (xmmsv_t *listv, int pos, xmmsv_t **val) |
Get the element at the given position in the list xmmsv_t. | |
int | xmmsv_list_set (xmmsv_t *listv, int pos, xmmsv_t *val) |
Set the element at the given position in the list xmmsv_t. | |
int | xmmsv_list_insert (xmmsv_t *listv, int pos, xmmsv_t *val) |
Insert an element at the given position in the list xmmsv_t. | |
int | xmmsv_list_remove (xmmsv_t *listv, int pos) |
Remove the element at the given position from the list xmmsv_t. | |
int | xmmsv_list_move (xmmsv_t *listv, int old_pos, int new_pos) |
Move the element from position #old to position #new. | |
int | xmmsv_list_append (xmmsv_t *listv, xmmsv_t *val) |
Append an element to the end of the list xmmsv_t. | |
int | xmmsv_list_clear (xmmsv_t *listv) |
Empty the list from all its elements. | |
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. | |
int | xmmsv_list_get_size (xmmsv_t *listv) |
Return the size of the list. | |
int | xmmsv_list_restrict_type (xmmsv_t *listv, xmmsv_type_t type) |
void | xmmsv_list_iter_explicit_destroy (xmmsv_list_iter_t *it) |
Explicitly free list iterator. | |
int | xmmsv_list_iter_entry (xmmsv_list_iter_t *it, xmmsv_t **val) |
Get the element currently pointed at by the iterator. | |
int | xmmsv_list_iter_valid (xmmsv_list_iter_t *it) |
Check whether the iterator is valid and points to a valid element. | |
void | xmmsv_list_iter_first (xmmsv_list_iter_t *it) |
Rewind the iterator to the start of the list. | |
void | xmmsv_list_iter_last (xmmsv_list_iter_t *it) |
Move the iterator to end of the list. | |
void | xmmsv_list_iter_next (xmmsv_list_iter_t *it) |
Advance the iterator to the next element in the list. | |
void | xmmsv_list_iter_prev (xmmsv_list_iter_t *it) |
Move the iterator to the previous element in the list. | |
int | xmmsv_list_iter_seek (xmmsv_list_iter_t *it, int pos) |
Move the iterator to the n-th element in the list. | |
int | xmmsv_list_iter_tell (const xmmsv_list_iter_t *it) |
Tell the position of the iterator. | |
xmmsv_t * | xmmsv_list_iter_get_parent (const xmmsv_list_iter_t *it) |
Return the parent xmmsv_t of an iterator. | |
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. | |
int | xmmsv_list_iter_remove (xmmsv_list_iter_t *it) |
Remove the element in the list at the position pointed at by the iterator. | |
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). | |
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. | |
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). | |
int | xmmsv_dict_clear (xmmsv_t *dictv) |
Empty the dict of all its elements. | |
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. | |
int | xmmsv_dict_get_size (xmmsv_t *dictv) |
Return the size of the dict. | |
void | xmmsv_dict_iter_explicit_destroy (xmmsv_dict_iter_t *it) |
Explicitly free dict iterator. | |
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. | |
int | xmmsv_dict_iter_valid (xmmsv_dict_iter_t *it) |
Check whether the iterator is valid and points to a valid pair. | |
void | xmmsv_dict_iter_first (xmmsv_dict_iter_t *it) |
Rewind the iterator to the start of the dict. | |
void | xmmsv_dict_iter_next (xmmsv_dict_iter_t *it) |
Advance the iterator to the next pair in the dict. | |
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). | |
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. | |
int | xmmsv_dict_iter_remove (xmmsv_dict_iter_t *it) |
Remove the pair in the dict pointed at by the iterator. | |
xmmsv_t * | xmmsv_decode_url (const xmmsv_t *inv) |
Decode an URL-encoded string. | |
xmmsv_t * | xmmsv_build_dict (const char *firstkey,...) |
xmmsv_t * | xmmsv_build_list_va (xmmsv_t *first_entry, va_list ap) |
xmmsv_t * | xmmsv_build_list (xmmsv_t *first_entry,...) |
int | xmmsv_dict_format (char *target, int len, const char *fmt, xmmsv_t *val) |
This function will make a pretty string about the information in xmmsv dict. | |
int | xmmsv_utf8_validate (const char *str) |
Check if a string is valid UTF-8. |
The API to be used to work with value objects.
#define GEN_DICT_EXTRACTOR_FUNC | ( | typename, | |
type | |||
) |
int \ xmmsv_dict_entry_get_##typename (xmmsv_t *val, const char *key, \ type *r) \ { \ xmmsv_t *v; \ if (!xmmsv_dict_get (val, key, &v)) { \ return 0; \ } \ return xmmsv_get_##typename (v, r); \ }
#define GEN_DICT_ITER_EXTRACTOR_FUNC | ( | typename, | |
type | |||
) |
int \ xmmsv_dict_iter_pair_##typename (xmmsv_dict_iter_t *it, \ const char **key, \ type *r) \ { \ xmmsv_t *v; \ if (!xmmsv_dict_iter_pair (it, key, &v)) { \ return 0; \ } \ if (r) { \ return xmmsv_get_##typename (v, r); \ } else { \ return 1; \ } \ }
#define GEN_DICT_ITER_SET_FUNC | ( | typename, | |
type | |||
) |
int \ xmmsv_dict_iter_set_##typename (xmmsv_dict_iter_t *it, type elem) \ { \ int ret; \ xmmsv_t *v; \ \ v = xmmsv_new_##typename (elem); \ ret = xmmsv_dict_iter_set (it, v); \ xmmsv_unref (v); \ \ return ret; \ }
#define GEN_DICT_SET_FUNC | ( | typename, | |
type | |||
) |
int \ xmmsv_dict_set_##typename (xmmsv_t *dict, const char *key, type elem) \ { \ int ret; \ xmmsv_t *v; \ \ v = xmmsv_new_##typename (elem); \ ret = xmmsv_dict_set (dict, key, v); \ xmmsv_unref (v); \ \ return ret; \ }
#define GEN_LIST_APPEND_FUNC | ( | typename, | |
type | |||
) |
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); \ xmmsv_unref (v); \ \ return ret; \ }
#define GEN_LIST_EXTRACTOR_FUNC | ( | typename, | |
type | |||
) |
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 | |||
) |
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); \ xmmsv_unref (v); \ \ return ret; \ }
#define GEN_LIST_ITER_EXTRACTOR_FUNC | ( | typename, | |
type | |||
) |
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 | |||
) |
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); \ xmmsv_unref (v); \ \ return ret; \ }
#define GEN_LIST_SET_FUNC | ( | typename, | |
type | |||
) |
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); \ xmmsv_unref (v); \ \ return ret; \ }
Definition at line 2244 of file value.c.
Referenced by xmmsv_build_list().
Decode an URL-encoded string.
Some strings (currently only the url of media) has no known encoding, and must be encoded in an UTF-8 clean way. This is done similar to the url encoding web browsers do. This functions decodes a string encoded in that way. OBSERVE that the decoded string HAS NO KNOWN ENCODING and you cannot display it on screen in a 100% guaranteed correct way (a good heuristic is to try to validate the decoded string as UTF-8, and if it validates assume that it is an UTF-8 encoded string, and otherwise fall back to some other encoding).
Do not use this function if you don't understand the implications. The best thing is not to try to display the url at all.
Note that the fact that the string has NO KNOWN ENCODING and CAN NOT BE DISPLAYED does not stop you from open the file if it is a local file (if it starts with "file://").
url | the xmmsv_t containing a url-encoded string |
int xmmsv_dict_clear | ( | xmmsv_t * | dictv | ) |
xmmsv_type_t xmmsv_dict_entry_get_type | ( | xmmsv_t * | val, |
const char * | key | ||
) |
Gets the type of a dict entry.
val | A xmmsv_t containing a dict. |
key | The key in the dict. |
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.
dictv | A xmmsv_t containing a dict. |
function | The function to apply to each key-element pair. |
user_data | User data passed to the foreach function. |
Definition at line 1845 of file value.c.
Referenced by xmmsv_coll_attribute_foreach().
int xmmsv_dict_format | ( | char * | target, |
int | len, | ||
const char * | fmt, | ||
xmmsv_t * | val | ||
) |
This function will make a pretty string about the information in xmmsv dict.
target | A allocated char * |
len | Length of target |
fmt | A format string to use. You can insert items from the dict by using specialformat "${field}". |
val | The xmmsv_t that contains the dict. |
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.
dictv | A xmmsv_t containing a dict. |
key | The key in the dict. |
val | Pointer set to a borrowed reference to the element corresponding to the given key in the dict. |
Definition at line 1709 of file value.c.
Referenced by xmms_collection_query_ids(), xmmsv_dict_entry_get_type(), and xmmsv_dict_has_key().
int xmmsv_dict_get_size | ( | xmmsv_t * | dictv | ) |
void xmmsv_dict_iter_explicit_destroy | ( | xmmsv_dict_iter_t * | it | ) |
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).
it | A xmmsv_dict_iter_t. |
key | The key to seek for. |
Definition at line 2020 of file value.c.
Referenced by xmmsv_dict_format(), xmmsv_dict_get(), xmmsv_dict_remove(), and xmmsv_dict_set().
void xmmsv_dict_iter_first | ( | xmmsv_dict_iter_t * | it | ) |
Rewind the iterator to the start of the dict.
it | A xmmsv_dict_iter_t. |
void xmmsv_dict_iter_next | ( | xmmsv_dict_iter_t * | it | ) |
Advance the iterator to the next pair in the dict.
it | A xmmsv_dict_iter_t. |
Definition at line 2001 of file value.c.
Referenced by xmmsv_dict_foreach(), 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.
it | A xmmsv_dict_iter_t. |
key | Pointer set to the key pointed at by the iterator. |
val | Pointer set to a borrowed reference to the element pointed at by the iterator. |
Definition at line 1940 of file value.c.
Referenced by xmmsv_dict_foreach(), xmmsv_dict_format(), xmmsv_dict_get(), and xmmsv_propdict_to_dict().
int xmmsv_dict_iter_remove | ( | xmmsv_dict_iter_t * | it | ) |
Remove the pair in the dict pointed at by the iterator.
it | A xmmsv_dict_iter_t. |
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.
it | A xmmsv_dict_iter_t. |
val | The element to set in the pair. |
Definition at line 2093 of file value.c.
Referenced by xmmsv_dict_set().
int xmmsv_dict_iter_valid | ( | xmmsv_dict_iter_t * | it | ) |
Check whether the iterator is valid and points to a valid pair.
it | A xmmsv_dict_iter_t. |
Definition at line 1975 of file value.c.
Referenced by xmmsv_dict_foreach(), xmmsv_dict_iter_pair(), xmmsv_dict_iter_set(), and xmmsv_propdict_to_dict().
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).
dictv | A xmmsv_t containing a dict. |
key | The key in the dict. |
Definition at line 1795 of file value.c.
Referenced by xmmsv_coll_attribute_remove().
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.
dictv | A xmmsv_t containing a dict. |
key | The key in the dict. |
val | The new element to insert in the dict. |
Definition at line 1744 of file value.c.
Referenced by xmms_sqlite_query_table(), xmms_xform_browse_add_entry_property(), xmmsv_build_dict(), xmmsv_coll_attribute_set(), and xmmsv_propdict_to_dict().
int xmmsv_get_bin | ( | const xmmsv_t * | val, |
const unsigned char ** | r, | ||
unsigned int * | rlen | ||
) |
Retrieves binary data from the value.
val | a xmmsv_t containing a string. |
r | the return data. This data is owned by the value and will be freed when the value is freed. |
rlen | the return length of data. |
Definition at line 896 of file value.c.
Referenced by xmms_bin_to_gstring(), xmms_ipc_msg_put_value(), and xmms_xform_auxdata_get_bin().
int xmmsv_get_coll | ( | const xmmsv_t * | val, |
xmmsv_coll_t ** | c | ||
) |
Retrieves a collection from the value.
val | a xmmsv_t containing a collection. |
c | the return collection. This collection is owned by the value and will be unref'd when the value is freed. |
Definition at line 875 of file value.c.
Referenced by xmms_ipc_msg_put_value().
int xmmsv_get_dict_iter | ( | const xmmsv_t * | val, |
xmmsv_dict_iter_t ** | it | ||
) |
Retrieves a dict iterator from a dict xmmsv_t.
val | a xmmsv_t containing a dict. |
it | An xmmsv_dict_iter_t that can be used to access the dict data. The iterator will be freed when the value is freed. |
Definition at line 947 of file value.c.
Referenced by xmmsv_dict_foreach(), xmmsv_dict_format(), xmmsv_dict_get(), xmmsv_dict_remove(), xmmsv_dict_set(), and xmmsv_propdict_to_dict().
int xmmsv_get_error | ( | const xmmsv_t * | val, |
const char ** | r | ||
) |
Retrieves an error string describing the server error from the value.
val | a xmmsv_t containing a integer. |
r | the return error. |
Definition at line 796 of file value.c.
Referenced by xmms_ipc_msg_put_value().
const char* xmmsv_get_error_old | ( | const xmmsv_t * | val | ) |
Legacy alias to retrieve the error string from an xmmsv_t.
Obsolete now, use xmmsv_get_error instead!
val | an error xmmsv_t |
int xmmsv_get_int | ( | const xmmsv_t * | val, |
int32_t * | r | ||
) |
Retrieves a signed integer from the value.
val | a xmmsv_t containing an integer. |
r | the return integer. |
Definition at line 815 of file value.c.
Referenced by xmms_collection_get_random_media(), xmms_collection_query_ids(), xmms_ipc_msg_put_value(), xmms_playlist_changed_msg_send(), xmms_xform_auxdata_get_int(), xmms_xform_metadata_get_int(), and xmmsv_dict_format().
int xmmsv_get_list_iter | ( | const xmmsv_t * | val, |
xmmsv_list_iter_t ** | it | ||
) |
Retrieves a list iterator from a list xmmsv_t.
val | a xmmsv_t containing a list. |
it | An xmmsv_list_iter_t that can be used to access the list data. The iterator will be freed when the value is freed. |
Definition at line 918 of file value.c.
Referenced by check_string_list(), xmmsv_coll_add_operand(), xmmsv_coll_remove_operand(), xmmsv_list_foreach(), and xmmsv_list_restrict_type().
int xmmsv_get_string | ( | const xmmsv_t * | val, |
const char ** | r | ||
) |
Retrieves a string from the value.
val | a xmmsv_t containing a string. |
r | the return string. This string is owned by the value and will be freed when the value is freed. |
Definition at line 855 of file value.c.
Referenced by xmms_ipc_msg_put_value(), xmms_playlist_changed_msg_send(), xmms_xform_auxdata_get_str(), xmms_xform_metadata_get_str(), xmmsv_decode_url(), xmmsv_dict_format(), xmmsv_dict_iter_find(), and xmmsv_dict_iter_pair().
xmmsv_type_t xmmsv_get_type | ( | const xmmsv_t * | val | ) |
Get the type of the value.
val | a xmmsv_t to get the type from. |
Definition at line 384 of file value.c.
Referenced by check_string_list(), xmms_ipc_msg_put_value(), xmms_xform_auxdata_get_bin(), xmms_xform_auxdata_get_int(), xmms_xform_auxdata_get_str(), xmms_xform_metadata_get_int(), xmms_xform_metadata_get_str(), xmmsv_dict_entry_get_type(), xmmsv_dict_format(), and xmmsv_is_type().
int xmmsv_get_uint | ( | const xmmsv_t * | val, |
uint32_t * | r | ||
) |
Retrieves a unsigned integer from the value.
val | a xmmsv_t containing an unsigned integer. |
r | the return unsigned integer. |
Definition at line 834 of file value.c.
Referenced by xmmsv_dict_format().
int xmmsv_is_dict | ( | const xmmsv_t * | val | ) |
int xmmsv_is_error | ( | const xmmsv_t * | val | ) |
int xmmsv_is_list | ( | const xmmsv_t * | val | ) |
int xmmsv_is_type | ( | const xmmsv_t * | val, |
xmmsv_type_t | t | ||
) |
Check if value is of specified type.
val | xmmsv_t to check. |
t | xmmsv_type_t to check for. |
Definition at line 400 of file value.c.
Referenced by xmmsv_dict_clear(), xmmsv_dict_foreach(), xmmsv_dict_get(), xmmsv_dict_get_size(), xmmsv_dict_remove(), xmmsv_dict_set(), xmmsv_is_dict(), xmmsv_is_error(), xmmsv_is_list(), xmmsv_list_append(), xmmsv_list_clear(), xmmsv_list_foreach(), xmmsv_list_get(), xmmsv_list_get_size(), xmmsv_list_insert(), xmmsv_list_move(), xmmsv_list_remove(), xmmsv_list_restrict_type(), and xmmsv_list_set().
Append an element to the end of the list xmmsv_t.
The list will hold a reference to the element until it's removed.
listv | A xmmsv_t containing a list. |
val | The element to append. |
Definition at line 1332 of file value.c.
Referenced by xmms_collection_get_random_media(), xmms_collection_query_ids(), xmmsv_build_list_va(), xmmsv_coll_add_operand(), and xmmsv_make_stringlist().
int xmmsv_list_clear | ( | xmmsv_t * | listv | ) |
int xmmsv_list_foreach | ( | xmmsv_t * | listv, |
xmmsv_list_foreach_func | func, | ||
void * | user_data | ||
) |
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.
listv | A xmmsv_t containing a list. |
pos | The position in the list. If negative, start counting from the end (-1 is the last element, etc). |
val | Pointer set to a borrowed reference to the element at the given position in the list. |
int xmmsv_list_get_size | ( | xmmsv_t * | listv | ) |
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.
listv | A xmmsv_t containing a list. |
pos | The position in the list. If negative, start counting from the end (-1 is the last element, etc). |
val | The element to insert. |
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.
it | A xmmsv_list_iter_t. |
val | Pointer set to a borrowed reference to the element pointed at by the iterator. |
Definition at line 1487 of file value.c.
Referenced by check_string_list(), xmmsv_dict_iter_find(), xmmsv_dict_iter_pair(), xmmsv_list_foreach(), and xmmsv_list_restrict_type().
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.
it | iterator to free |
Definition at line 1470 of file value.c.
Referenced by xmmsv_coll_add_operand(), and xmmsv_coll_remove_operand().
void xmmsv_list_iter_first | ( | xmmsv_list_iter_t * | it | ) |
Rewind the iterator to the start of the list.
it | A xmmsv_list_iter_t. |
Definition at line 1515 of file value.c.
Referenced by xmmsv_dict_iter_first().
xmmsv_t* xmmsv_list_iter_get_parent | ( | const xmmsv_list_iter_t * | it | ) |
Return the parent xmmsv_t of an iterator.
it | A xmmsv_list_iter_t. |
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.
it | A xmmsv_list_iter_t. |
val | The element to insert. |
Definition at line 1628 of file value.c.
Referenced by xmmsv_dict_iter_set(), and xmmsv_dict_set().
void xmmsv_list_iter_last | ( | xmmsv_list_iter_t * | it | ) |
Move the iterator to end of the list.
listv | A xmmsv_list_iter_t. |
void xmmsv_list_iter_next | ( | xmmsv_list_iter_t * | it | ) |
Advance the iterator to the next element in the list.
it | A xmmsv_list_iter_t. |
Definition at line 1545 of file value.c.
Referenced by check_string_list(), xmmsv_dict_iter_find(), xmmsv_dict_iter_next(), xmmsv_dict_iter_pair(), xmmsv_dict_iter_set(), xmmsv_dict_set(), xmmsv_list_foreach(), and xmmsv_list_restrict_type().
void xmmsv_list_iter_prev | ( | xmmsv_list_iter_t * | it | ) |
Move the iterator to the previous element in the list.
listv | A xmmsv_list_iter_t. |
int xmmsv_list_iter_remove | ( | xmmsv_list_iter_t * | it | ) |
Remove the element in the list at the position pointed at by the iterator.
it | A xmmsv_list_iter_t. |
Definition at line 1644 of file value.c.
Referenced by xmmsv_coll_remove_operand(), xmmsv_dict_iter_remove(), xmmsv_dict_iter_set(), xmmsv_dict_remove(), and xmmsv_dict_set().
int xmmsv_list_iter_seek | ( | xmmsv_list_iter_t * | it, |
int | pos | ||
) |
Move the iterator to the n-th element in the list.
it | A xmmsv_list_iter_t. |
pos | The position in the list. If negative, start counting from the end (-1 is the last element, etc). |
Definition at line 1579 of file value.c.
Referenced by xmmsv_dict_iter_find().
int xmmsv_list_iter_tell | ( | const xmmsv_list_iter_t * | it | ) |
Tell the position of the iterator.
it | A xmmsv_list_iter_t. |
int xmmsv_list_iter_valid | ( | xmmsv_list_iter_t * | it | ) |
Check whether the iterator is valid and points to a valid element.
it | A xmmsv_list_iter_t. |
Definition at line 1504 of file value.c.
Referenced by check_string_list(), xmmsv_dict_iter_valid(), xmmsv_list_foreach(), xmmsv_list_iter_entry(), and xmmsv_list_restrict_type().
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).
listv | A xmmsv_t containing a list |
old | The original position in the list. If negative, start counting from the end (-1 is the last element, etc.) |
new | The 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. |
int xmmsv_list_remove | ( | xmmsv_t * | listv, |
int | pos | ||
) |
int xmmsv_list_restrict_type | ( | xmmsv_t * | listv, |
xmmsv_type_t | type | ||
) |
Definition at line 1405 of file value.c.
Referenced by xmmsv_coll_new().
xmmsv_t* xmmsv_make_stringlist | ( | char * | array[], |
int | num | ||
) |
Helper function to build a list xmmsv_t containing the strings from the input array.
array | An array of C strings. Must be NULL-terminated if num is -1. |
num | The optional number of elements to read from the array. Set to -1 if the array is NULL-terminated. |
xmmsv_t* xmmsv_new_bin | ( | unsigned char * | data, |
unsigned int | len | ||
) |
Allocates a new binary data xmmsv_t.
data | The data to store in the xmmsv_t. |
len | The size of the data. |
Definition at line 223 of file value.c.
Referenced by xmms_xform_auxdata_set_bin(), and xmmsv_decode_url().
xmmsv_t* xmmsv_new_coll | ( | xmmsv_coll_t * | c | ) |
Allocates a new collection xmmsv_t.
s | The value to store in the xmmsv_t. |
Definition at line 200 of file value.c.
Referenced by xmmsv_coll_add_operand().
xmmsv_t* xmmsv_new_dict | ( | void | ) |
Allocates a new dict xmmsv_t.
Definition at line 266 of file value.c.
Referenced by xmms_sqlite_query_table(), xmms_xform_browse_add_entry(), xmmsv_build_dict(), xmmsv_coll_new(), and xmmsv_propdict_to_dict().
xmmsv_t* xmmsv_new_error | ( | const char * | errstr | ) |
xmmsv_t* xmmsv_new_int | ( | int32_t | i | ) |
Allocates a new integer xmmsv_t.
i | The value to store in the xmmsv_t. |
Definition at line 159 of file value.c.
Referenced by xmms_collection_changed_msg_new(), xmms_collection_query_ids(), xmms_medialib_entry_property_get_value(), xmms_object_emit_f(), xmms_playlist_add_entry_unlocked(), xmms_playlist_changed_msg_new(), xmms_playlist_insert_entry(), xmms_xform_auxdata_set_int(), xmms_xform_browse_add_entry_property_int(), and xmms_xform_metadata_set_int().
xmmsv_t* xmmsv_new_list | ( | void | ) |
Allocates a new list xmmsv_t.
Definition at line 248 of file value.c.
Referenced by xmms_collection_get_random_media(), xmms_collection_query_ids(), xmmsv_build_list_va(), xmmsv_coll_new(), and xmmsv_make_stringlist().
xmmsv_t* xmmsv_new_none | ( | void | ) |
Allocates a new empty xmmsv_t.
Definition at line 127 of file value.c.
Referenced by xmms_object_emit_f(), and xmms_xform_auxdata_barrier().
xmmsv_t* xmmsv_new_string | ( | const char * | s | ) |
Allocates a new string xmmsv_t.
s | The value to store in the xmmsv_t. The string is copied in the value. |
Definition at line 178 of file value.c.
Referenced by xmms_collection_changed_msg_new(), xmms_collection_get_random_media(), xmms_collection_query_ids(), xmms_config_property_set_data(), xmms_convert_and_kill_string(), xmms_object_emit_f(), xmms_playlist_changed_msg_new(), xmms_xform_auxdata_set_str(), xmms_xform_browse_add_entry_property_str(), xmms_xform_metadata_set_str(), xmmsv_coll_attribute_set(), xmmsv_dict_set(), and xmmsv_make_stringlist().
Helper function to transform a key-source-value dict-of-dict xmmsv_t (formerly a propdict) to a regular key-value dict, given a list of source preference.
propdict | A key-source-value dict-of-dict xmmsv_t. |
src_prefs | A list of source names or patterns. Must be NULL-terminated. If this argument is NULL, the default source preferences is used. |
References the xmmsv_t.
val | the value to reference. |
Definition at line 286 of file value.c.
Referenced by xmmsv_list_set().
void xmmsv_unref | ( | xmmsv_t * | val | ) |
Decreases the references for the xmmsv_t When the number of references reaches 0 it will be freed.
And thus all data you extracted from it will be deallocated.
Definition at line 301 of file value.c.
Referenced by xmms_collection_changed_msg_new(), xmms_collection_dag_restore(), xmms_collection_get_random_media(), xmms_collection_query_ids(), xmms_config_property_set_data(), xmms_object_emit_f(), xmms_playlist_changed_msg_new(), xmms_sqlite_query_table(), xmms_xform_browse_add_entry_property_int(), xmms_xform_browse_add_entry_property_str(), xmms_xform_new(), xmms_xform_this_seek(), xmmsv_build_dict(), xmmsv_build_list_va(), xmmsv_coll_add_operand(), xmmsv_coll_attribute_set(), xmmsv_dict_set(), xmmsv_list_set(), and xmmsv_make_stringlist().
int xmmsv_utf8_validate | ( | const char * | str | ) |
Check if a string is valid UTF-8.
Definition at line 2436 of file value.c.
Referenced by xmmsv_new_string().