include/xmmsc/xmmsv.h File Reference

#include <stdarg.h>
#include "xmmsc/xmmsc_compiler.h"
#include "xmmsc/xmmsc_stdint.h"
#include "xmmsc/xmmsv_coll.h"

Go to the source code of this file.


#define xmmsv_check_type(type)   ((type) > XMMSV_TYPE_NONE && (type) < XMMSV_TYPE_END)
#define XMMSV_DICT_ENTRY(k, v)   __xmmsv_identity_const_charp (k), __xmmsv_identity_xmmsv (v)
#define XMMSV_DICT_ENTRY_STR(k, v)   XMMSV_DICT_ENTRY (k, xmmsv_new_string (v))
#define XMMSV_DICT_ENTRY_INT(k, v)   XMMSV_DICT_ENTRY (k, xmmsv_new_int (v))
#define XMMSV_LIST_ENTRY(v)   __xmmsv_identity_xmmsv (v)
#define XMMSV_LIST_ENTRY_STR(v)   XMMSV_LIST_ENTRY (xmmsv_new_string (v))
#define XMMSV_LIST_ENTRY_INT(v)   XMMSV_LIST_ENTRY (xmmsv_new_int (v))
#define XMMSV_LIST_ENTRY_COLL(v)   XMMSV_LIST_ENTRY (xmmsv_new_coll (v))


typedef struct xmmsv_list_iter_St xmmsv_list_iter_t
typedef struct xmmsv_dict_iter_St xmmsv_dict_iter_t
typedef void(* xmmsv_list_foreach_func )(xmmsv_t *value, void *user_data)
typedef void(* xmmsv_dict_foreach_func )(const char *key, xmmsv_t *value, void *user_data)


enum  xmmsv_type_t {


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 *coll)
 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) XMMS_DEPRECATED
 Check if the value stores a list.
int xmmsv_is_dict (const xmmsv_t *val) XMMS_DEPRECATED
 Check if the value stores a dict.
const char * xmmsv_get_error_old (const xmmsv_t *val) XMMS_DEPRECATED
 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) XMMS_DEPRECATED
 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 **coll)
 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.
void xmmsv_list_iter_explicit_destroy (xmmsv_list_iter_t *it)
 Explicitly free list iterator.
void xmmsv_dict_iter_explicit_destroy (xmmsv_dict_iter_t *it)
 Explicitly free dict iterator.
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_append (xmmsv_t *listv, xmmsv_t *val)
 Append an element to the end of 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_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)
int xmmsv_list_get_string (xmmsv_t *v, int pos, const char **val)
int xmmsv_list_get_int (xmmsv_t *v, int pos, int32_t *val)
int xmmsv_list_get_coll (xmmsv_t *v, int pos, xmmsv_coll_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, int32_t val)
int xmmsv_list_set_coll (xmmsv_t *v, int pos, xmmsv_coll_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, int32_t val)
int xmmsv_list_insert_coll (xmmsv_t *v, int pos, xmmsv_coll_t *val)
int xmmsv_list_append_string (xmmsv_t *v, const char *val)
int xmmsv_list_append_int (xmmsv_t *v, int32_t val)
int xmmsv_list_append_coll (xmmsv_t *v, xmmsv_coll_t *val)
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_list_iter_entry_string (xmmsv_list_iter_t *it, const char **val)
int xmmsv_list_iter_entry_int (xmmsv_list_iter_t *it, int32_t *val)
int xmmsv_list_iter_entry_coll (xmmsv_list_iter_t *it, xmmsv_coll_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, int32_t val)
int xmmsv_list_iter_insert_coll (xmmsv_list_iter_t *it, xmmsv_coll_t *val)
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.
int xmmsv_dict_has_key (xmmsv_t *dictv, const char *key)
int xmmsv_dict_entry_get_string (xmmsv_t *val, const char *key, const char **r)
int xmmsv_dict_entry_get_int (xmmsv_t *val, const char *key, int32_t *r)
int xmmsv_dict_entry_get_coll (xmmsv_t *val, const char *key, xmmsv_coll_t **coll)
int xmmsv_dict_set_string (xmmsv_t *val, const char *key, const char *el)
int xmmsv_dict_set_int (xmmsv_t *val, const char *key, int32_t el)
int xmmsv_dict_set_coll (xmmsv_t *val, const char *key, xmmsv_coll_t *el)
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.
int xmmsv_dict_iter_pair_string (xmmsv_dict_iter_t *it, const char **key, const char **r)
int xmmsv_dict_iter_pair_int (xmmsv_dict_iter_t *it, const char **key, int32_t *r)
int xmmsv_dict_iter_pair_coll (xmmsv_dict_iter_t *it, const char **key, xmmsv_coll_t **r)
int xmmsv_dict_iter_set_string (xmmsv_dict_iter_t *it, const char *elem)
int xmmsv_dict_iter_set_int (xmmsv_dict_iter_t *it, int32_t elem)
int xmmsv_dict_iter_set_coll (xmmsv_dict_iter_t *it, xmmsv_coll_t *elem)
xmmsv_t * xmmsv_decode_url (const xmmsv_t *url)
 Decode an URL-encoded string.
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.
xmmsv_t * xmmsv_build_dict (const char *firstkey,...)
xmmsv_t * xmmsv_build_list (xmmsv_t *first_entry,...)
xmmsv_t * xmmsv_build_list_va (xmmsv_t *first_entry, va_list ap)

Define Documentation

#define xmmsv_check_type ( type   )     ((type) > XMMSV_TYPE_NONE && (type) < XMMSV_TYPE_END)

Definition at line 187 of file xmmsv.h.


Definition at line 202 of file xmmsv.h.

#define XMMSV_DICT_ENTRY ( k,
 )     __xmmsv_identity_const_charp (k), __xmmsv_identity_xmmsv (v)

Definition at line 199 of file xmmsv.h.

 )     XMMSV_DICT_ENTRY (k, xmmsv_new_int (v))

Definition at line 201 of file xmmsv.h.

 )     XMMSV_DICT_ENTRY (k, xmmsv_new_string (v))

Definition at line 200 of file xmmsv.h.


Definition at line 209 of file xmmsv.h.

Referenced by setup_shm_prepare(), setup_udp_prepare(), xmmsc_bindata_add(), xmmsc_bindata_list(), xmmsc_bindata_remove(), xmmsc_bindata_retrieve(), xmmsc_coll_find(), xmmsc_coll_get(), xmmsc_coll_idlist_from_playlist_file(), xmmsc_coll_list(), xmmsc_coll_query_ids(), xmmsc_coll_query_infos(), xmmsc_coll_remove(), xmmsc_coll_rename(), xmmsc_coll_save(), xmmsc_coll_sync(), xmmsc_config_get_value(), xmmsc_config_register_value(), xmmsc_config_set_value(), xmmsc_main_list_plugins(), xmmsc_medialib_entry_property_remove_with_source(), xmmsc_medialib_entry_property_set_int_with_source(), xmmsc_medialib_entry_property_set_str_with_source(), xmmsc_medialib_get_info(), xmmsc_medialib_move_entry(), xmmsc_medialib_rehash(), xmmsc_medialib_remove_entry(), xmmsc_playback_seek_ms(), xmmsc_playback_seek_ms_abs(), xmmsc_playback_seek_ms_rel(), xmmsc_playback_seek_samples(), xmmsc_playback_seek_samples_abs(), xmmsc_playback_seek_samples_rel(), xmmsc_playback_volume_set(), xmmsc_playlist_add_collection(), xmmsc_playlist_add_encoded(), xmmsc_playlist_add_id(), xmmsc_playlist_add_idlist(), xmmsc_playlist_clear(), xmmsc_playlist_current_pos(), xmmsc_playlist_insert_collection(), xmmsc_playlist_insert_encoded(), xmmsc_playlist_insert_id(), xmmsc_playlist_list_entries(), xmmsc_playlist_load(), xmmsc_playlist_move_entry(), xmmsc_playlist_radd_encoded(), xmmsc_playlist_remove_entry(), xmmsc_playlist_rinsert_encoded(), xmmsc_playlist_set_next(), xmmsc_playlist_set_next_rel(), xmmsc_playlist_shuffle(), xmmsc_playlist_sort(), xmmsc_send_broadcast_msg(), xmmsc_send_signal_msg(), xmmsc_visualization_properties_set(), xmmsc_visualization_property_set(), xmmsc_visualization_shutdown(), xmmsc_visualization_start_handle(), xmmsc_write_signal_msg(), and xmmsc_xform_media_browse_encoded().

#define XMMSV_LIST_ENTRY (  )     __xmmsv_identity_xmmsv (v)
#define XMMSV_LIST_ENTRY_COLL (  )     XMMSV_LIST_ENTRY (xmmsv_new_coll (v))
#define XMMSV_LIST_ENTRY_INT (  )     XMMSV_LIST_ENTRY (xmmsv_new_int (v))
#define XMMSV_LIST_ENTRY_STR (  )     XMMSV_LIST_ENTRY (xmmsv_new_string (v))

Referenced by xmmsv_dict_format().

Typedef Documentation

typedef void(* xmmsv_dict_foreach_func)(const char *key, xmmsv_t *value, void *user_data)

Definition at line 81 of file xmmsv.h.

typedef struct xmmsv_dict_iter_St xmmsv_dict_iter_t

Definition at line 54 of file xmmsv.h.

typedef void(* xmmsv_list_foreach_func)(xmmsv_t *value, void *user_data)

Definition at line 80 of file xmmsv.h.

typedef struct xmmsv_list_iter_St xmmsv_list_iter_t

Definition at line 53 of file xmmsv.h.

Enumeration Type Documentation


Definition at line 29 of file xmmsv.h.

Function Documentation

int xmmsv_dict_entry_get_coll ( xmmsv_t *  val,
const char *  key,
xmmsv_coll_t **  coll 
int xmmsv_dict_entry_get_int ( xmmsv_t *  val,
const char *  key,
int32_t *  r 
int xmmsv_dict_entry_get_string ( xmmsv_t *  val,
const char *  key,
const char **  r 
int xmmsv_dict_has_key ( xmmsv_t *  dictv,
const char *  key 

Definition at line 2486 of file value.c.

int xmmsv_dict_iter_pair_coll ( xmmsv_dict_iter_t it,
const char **  key,
xmmsv_coll_t **  r 
int xmmsv_dict_iter_pair_int ( xmmsv_dict_iter_t it,
const char **  key,
int32_t *  r 
int xmmsv_dict_iter_pair_string ( xmmsv_dict_iter_t it,
const char **  key,
const char **  r 
int xmmsv_dict_iter_set_coll ( xmmsv_dict_iter_t it,
xmmsv_coll_t elem 
int xmmsv_dict_iter_set_int ( xmmsv_dict_iter_t it,
int32_t  elem 
int xmmsv_dict_iter_set_string ( xmmsv_dict_iter_t it,
const char *  elem 
int xmmsv_dict_set_coll ( xmmsv_t *  val,
const char *  key,
xmmsv_coll_t el 
int xmmsv_dict_set_int ( xmmsv_t *  val,
const char *  key,
int32_t  el 
int xmmsv_dict_set_string ( xmmsv_t *  val,
const char *  key,
const char *  el 
int xmmsv_list_append_coll ( xmmsv_t *  v,
xmmsv_coll_t val 
int xmmsv_list_append_int ( xmmsv_t *  v,
int32_t  val 
int xmmsv_list_append_string ( xmmsv_t *  v,
const char *  val 
int xmmsv_list_get_coll ( xmmsv_t *  v,
int  pos,
xmmsv_coll_t **  val 
int xmmsv_list_get_int ( xmmsv_t *  v,
int  pos,
int32_t *  val 
int xmmsv_list_get_string ( xmmsv_t *  v,
int  pos,
const char **  val 
int xmmsv_list_insert_coll ( xmmsv_t *  v,
int  pos,
xmmsv_coll_t val 
int xmmsv_list_insert_int ( xmmsv_t *  v,
int  pos,
int32_t  val 
int xmmsv_list_insert_string ( xmmsv_t *  v,
int  pos,
const char *  val 
int xmmsv_list_iter_entry_coll ( xmmsv_list_iter_t it,
xmmsv_coll_t **  val 
int xmmsv_list_iter_entry_int ( xmmsv_list_iter_t it,
int32_t *  val 
int xmmsv_list_iter_entry_string ( xmmsv_list_iter_t it,
const char **  val 
int xmmsv_list_iter_insert_coll ( xmmsv_list_iter_t it,
xmmsv_coll_t val 
int xmmsv_list_iter_insert_int ( xmmsv_list_iter_t it,
int32_t  val 
int xmmsv_list_iter_insert_string ( xmmsv_list_iter_t it,
const char *  val 
int xmmsv_list_set_coll ( xmmsv_t *  v,
int  pos,
xmmsv_coll_t val 
int xmmsv_list_set_int ( xmmsv_t *  v,
int  pos,
int32_t  val 
int xmmsv_list_set_string ( xmmsv_t *  v,
int  pos,
const char *  val 

Generated on Tue Feb 23 18:17:57 2010 for XmmsClient by  doxygen 1.6.1