43 XMMSV_TYPE_UINT32_IS_DEPRECATED (
void)
47 #define XMMSV_TYPE_UINT32 XMMSV_TYPE_UINT32_IS_DEPRECATED()
187 #define xmmsv_check_type(type) ((type) > XMMSV_TYPE_NONE && (type) < XMMSV_TYPE_END)
197 static inline const char *__xmmsv_identity_const_charp (
const char *v) {
return v;}
198 static inline xmmsv_t *__xmmsv_identity_xmmsv (
xmmsv_t *v) {
return v;}
199 #define XMMSV_DICT_ENTRY(k, v) __xmmsv_identity_const_charp (k), __xmmsv_identity_xmmsv (v)
200 #define XMMSV_DICT_ENTRY_STR(k, v) XMMSV_DICT_ENTRY (k, xmmsv_new_string (v))
201 #define XMMSV_DICT_ENTRY_INT(k, v) XMMSV_DICT_ENTRY (k, xmmsv_new_int (v))
202 #define XMMSV_DICT_END NULL
205 #define XMMSV_LIST_ENTRY(v) __xmmsv_identity_xmmsv (v)
206 #define XMMSV_LIST_ENTRY_STR(v) XMMSV_LIST_ENTRY (xmmsv_new_string (v))
207 #define XMMSV_LIST_ENTRY_INT(v) XMMSV_LIST_ENTRY (xmmsv_new_int (v))
208 #define XMMSV_LIST_ENTRY_COLL(v) XMMSV_LIST_ENTRY (xmmsv_new_coll (v))
209 #define XMMSV_LIST_END NULL
xmmsv_t * xmmsv_new_dict(void)
Allocates a new dict xmmsv_t.
int xmmsv_dict_iter_pair_coll(xmmsv_dict_iter_t *it, const char **key, xmmsv_coll_t **r)
int xmmsv_dict_iter_remove(xmmsv_dict_iter_t *it)
Remove the pair in the dict pointed at by the iterator.
int xmmsv_dict_entry_get_int(xmmsv_t *val, const char *key, int32_t *r)
int xmmsv_list_set(xmmsv_t *listv, int pos, xmmsv_t *val)
Set the element at the given position in the list 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...
int xmmsv_list_iter_entry_int(xmmsv_list_iter_t *it, int32_t *val)
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_list_insert(xmmsv_t *listv, int pos, xmmsv_t *val)
Insert an element at the given position in the list xmmsv_t.
int xmmsv_dict_set_int(xmmsv_t *val, const char *key, int32_t el)
int xmmsv_dict_entry_get_string(xmmsv_t *val, const char *key, const char **r)
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_dict_iter_valid(xmmsv_dict_iter_t *it)
Check whether the iterator is valid and points to a valid pair.
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_list_iter_insert_string(xmmsv_list_iter_t *it, const char *val)
int xmmsv_list_insert_int(xmmsv_t *v, int pos, int32_t val)
xmmsv_t * xmmsv_new_error(const char *errstr)
Allocates a new error 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_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_get_string(xmmsv_t *v, int pos, const char **val)
int xmmsv_dict_entry_get_coll(xmmsv_t *val, const char *key, xmmsv_coll_t **coll)
xmmsv_t * xmmsv_new_none(void)
Allocates a new empty xmmsv_t.
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_set_coll(xmmsv_t *v, int pos, xmmsv_coll_t *val)
xmmsv_t * xmmsv_new_string(const char *s)
Allocates a new string xmmsv_t.
void xmmsv_list_iter_first(xmmsv_list_iter_t *it)
Rewind the iterator to the start of the list.
int xmmsv_get_int(const xmmsv_t *val, int32_t *r)
Retrieves a signed integer from the value.
xmmsv_t * xmmsv_build_list(xmmsv_t *first_entry,...)
int xmmsv_list_append(xmmsv_t *listv, xmmsv_t *val)
Append an element to the end of the list xmmsv_t.
int xmmsv_list_iter_entry_string(xmmsv_list_iter_t *it, const char **val)
xmmsv_t * xmmsv_build_list_va(xmmsv_t *first_entry, va_list ap)
void xmmsv_list_iter_last(xmmsv_list_iter_t *it)
Move the iterator to end of the list.
int xmmsv_list_get_int(xmmsv_t *v, int pos, int32_t *val)
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_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_foreach(xmmsv_t *dictv, xmmsv_dict_foreach_func func, void *user_data)
Apply a function to each key-element pair in the list.
void xmmsv_dict_iter_explicit_destroy(xmmsv_dict_iter_t *it)
Explicitly free dict iterator.
int xmmsv_list_get_coll(xmmsv_t *v, int pos, xmmsv_coll_t **val)
void xmmsv_list_iter_explicit_destroy(xmmsv_list_iter_t *it)
Explicitly free list iterator.
int xmmsv_get_coll(const xmmsv_t *val, xmmsv_coll_t **coll)
Retrieves a collection from the value.
xmmsv_type_t xmmsv_dict_entry_get_type(xmmsv_t *val, const char *key)
Gets the type of a dict entry.
int xmmsv_list_append_int(xmmsv_t *v, int32_t val)
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.
xmmsv_t * xmmsv_new_coll(xmmsv_coll_t *coll)
Allocates a new collection xmmsv_t.
int xmmsv_dict_set_coll(xmmsv_t *val, const char *key, xmmsv_coll_t *el)
int xmmsv_dict_has_key(xmmsv_t *dictv, const char *key)
int xmmsv_list_iter_insert_int(xmmsv_list_iter_t *it, int32_t val)
int xmmsv_is_type(const xmmsv_t *val, xmmsv_type_t t)
Check if value is of specified type.
int xmmsv_list_set_string(xmmsv_t *v, int pos, const char *val)
struct xmmsv_coll_St xmmsv_coll_t
int xmmsv_list_iter_entry_coll(xmmsv_list_iter_t *it, xmmsv_coll_t **val)
int xmmsv_list_get_size(xmmsv_t *listv)
Return the size of 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_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_list_iter_remove(xmmsv_list_iter_t *it)
Remove the element in the list at the position pointed at by the iterator.
void xmmsv_list_iter_next(xmmsv_list_iter_t *it)
Advance the iterator to the next element in the list.
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 regul...
int xmmsv_list_iter_insert_coll(xmmsv_list_iter_t *it, xmmsv_coll_t *val)
int xmmsv_list_append_coll(xmmsv_t *v, xmmsv_coll_t *val)
int xmmsv_list_insert_string(xmmsv_t *v, int pos, const char *val)
int xmmsv_list_clear(xmmsv_t *listv)
Empty the list from all its elements.
xmmsv_type_t xmmsv_get_type(const xmmsv_t *val)
Get the type of the value.
int xmmsv_list_remove(xmmsv_t *listv, int pos)
Remove the element at the given position from the list 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.
int xmmsv_list_append_string(xmmsv_t *v, const char *val)
int xmmsv_dict_iter_set_string(xmmsv_dict_iter_t *it, const char *elem)
int xmmsv_is_list(const xmmsv_t *val) XMMS_DEPRECATED
Check if the value stores a list.
xmmsv_t * xmmsv_new_int(int32_t i)
Allocates a new integer xmmsv_t.
int xmmsv_list_move(xmmsv_t *listv, int old_pos, int new_pos)
Move the element from position #old to position #new.
xmmsv_t * xmmsv_ref(xmmsv_t *val)
References the xmmsv_t.
int xmmsv_get_error(const xmmsv_t *val, const char **r)
Retrieves an error string describing the server error from the value.
void xmmsv_dict_iter_next(xmmsv_dict_iter_t *it)
Advance the iterator to the next pair in the dict.
int xmmsv_dict_iter_pair_int(xmmsv_dict_iter_t *it, const char **key, int32_t *r)
xmmsv_t * xmmsv_list_iter_get_parent(const xmmsv_list_iter_t *it)
Return the parent xmmsv_t of an iterator.
const char * xmmsv_get_error_old(const xmmsv_t *val) XMMS_DEPRECATED
Legacy alias to retrieve the error string from an xmmsv_t.
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 ...
int xmmsv_list_insert_coll(xmmsv_t *v, int pos, xmmsv_coll_t *val)
xmmsv_t * xmmsv_decode_url(const xmmsv_t *url)
Decode an URL-encoded string.
xmmsv_t * xmmsv_new_bin(unsigned char *data, unsigned int len)
Allocates a new binary data 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_dict_set_string(xmmsv_t *val, const char *key, const char *el)
int xmmsv_dict_iter_set_coll(xmmsv_dict_iter_t *it, xmmsv_coll_t *elem)
int xmmsv_is_dict(const xmmsv_t *val) XMMS_DEPRECATED
Check if the value stores a dict.
int xmmsv_get_bin(const xmmsv_t *val, const unsigned char **r, unsigned int *rlen)
Retrieves binary data from the value.
xmmsv_t * xmmsv_new_list(void)
Allocates a new list xmmsv_t.
int xmmsv_list_iter_tell(const xmmsv_list_iter_t *it)
Tell the position of the iterator.
int xmmsv_get_uint(const xmmsv_t *val, uint32_t *r) XMMS_DEPRECATED
Retrieves a unsigned integer from the value.
void(* xmmsv_dict_foreach_func)(const char *key, xmmsv_t *value, void *user_data)
int xmmsv_get_string(const xmmsv_t *val, const char **r)
Retrieves a string from the value.
int xmmsv_is_error(const xmmsv_t *val)
Check if the value stores an error.
int xmmsv_dict_get_size(xmmsv_t *dictv)
Return the size of the dict.
int xmmsv_list_restrict_type(xmmsv_t *listv, xmmsv_type_t type)
int xmmsv_list_set_int(xmmsv_t *v, int pos, int32_t val)
int xmmsv_dict_iter_set_int(xmmsv_dict_iter_t *it, int32_t elem)
void xmmsv_dict_iter_first(xmmsv_dict_iter_t *it)
Rewind the iterator to the start of the dict.
xmmsv_t * xmmsv_build_dict(const char *firstkey,...)
void xmmsv_list_iter_prev(xmmsv_list_iter_t *it)
Move the iterator to the previous element in the list.
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.
struct xmmsv_list_iter_St 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.
int xmmsv_utf8_validate(const char *str)
Check if a string is valid UTF-8.
void(* xmmsv_list_foreach_func)(xmmsv_t *value, void *user_data)
int xmmsv_dict_iter_pair_string(xmmsv_dict_iter_t *it, const char **key, const char **r)
struct xmmsv_dict_iter_St xmmsv_dict_iter_t
int xmmsv_dict_clear(xmmsv_t *dictv)
Empty the dict of all its elements.