src/lib/xmmstypes/value.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "xmmsc/xmmsv.h"
#include "xmmsc/xmmsc_idnumbers.h"
#include "xmmsc/xmmsc_errorcodes.h"
#include "xmmsc/xmmsc_stdbool.h"
#include "xmmsc/xmmsc_util.h"
#include "xmmspriv/xmms_list.h"

Go to the source code of this file.

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)

Typedefs

typedef struct xmmsv_list_St xmmsv_list_t
typedef struct xmmsv_dict_St xmmsv_dict_t
typedef struct xmmsv_bin_St xmmsv_bin_t

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.
int xmmsv_dict_has_key (xmmsv_t *dictv, const char *key)

Variables

const char * default_source_pref []

Typedef Documentation

typedef struct xmmsv_bin_St xmmsv_bin_t
typedef struct xmmsv_dict_St xmmsv_dict_t

Definition at line 45 of file value.c.

typedef struct xmmsv_list_St xmmsv_list_t

Definition at line 44 of file value.c.


Function Documentation

int xmmsv_dict_has_key ( xmmsv_t *  dictv,
const char *  key 
)

Definition at line 2486 of file value.c.


Variable Documentation

const char* default_source_pref[]
Initial value:
 {
    "server",
    "client/*",
    "plugin/id3v2",
    "plugin/segment",
    "plugin/*",
    "*",
    NULL
}

Definition at line 33 of file value.c.

Referenced by xmmsv_propdict_to_dict().


Generated on Tue Feb 23 18:14:36 2010 for XMMS2 by  doxygen 1.6.1