XMMS2
Macros | Functions

Macros

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

Functions

xmmsv_txmmsv_decode_url (const xmmsv_t *url)
 Decode an URL-encoded string. More...
 
int xmmsv_utf8_validate (const char *str)
 Check if a string is valid UTF-8. More...
 
xmmsv_txmmsv_make_stringlist (char *array[], int num)
 Helper function to build a list xmmsv_t containing the strings from the input array. More...
 
xmmsv_txmmsv_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. More...
 
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. More...
 
xmmsv_txmmsv_serialize (xmmsv_t *v)
 
xmmsv_txmmsv_deserialize (xmmsv_t *v)
 

Detailed Description

Macro Definition Documentation

◆ xmmsv_check_type

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

Definition at line 33 of file xmmsv_util.h.

Function Documentation

◆ xmmsv_decode_url()

xmmsv_t* xmmsv_decode_url ( const xmmsv_t inv)

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://").

Parameters
urlthe xmmsv_t containing a url-encoded string
Returns
a new xmmsv_t containing the decoded string as a XMMSV_BIN or NULL on failure

Definition at line 2167 of file value.c.

◆ xmmsv_deserialize()

xmmsv_t* xmmsv_deserialize ( xmmsv_t v)

Definition at line 673 of file value_serialize.c.

◆ xmmsv_dict_format()

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.

Parameters
targetA allocated char *
lenLength of target
fmtA format string to use. You can insert items from the dict by using specialformat "${field}".
valThe xmmsv_t that contains the dict.
Returns
The number of chars written to target

Definition at line 2304 of file value.c.

◆ xmmsv_make_stringlist()

xmmsv_t* xmmsv_make_stringlist ( char *  array[],
int  num 
)

Helper function to build a list xmmsv_t containing the strings from the input array.

Parameters
arrayAn array of C strings. Must be NULL-terminated if num is -1.
numThe optional number of elements to read from the array. Set to -1 if the array is NULL-terminated.
Returns
An xmmsv_t containing the list of strings. Must be unreffed manually when done.

Definition at line 483 of file value.c.

◆ xmmsv_propdict_to_dict()

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.

Parameters
propdictA key-source-value dict-of-dict xmmsv_t.
src_prefsA list of source names or patterns. Must be NULL-terminated. If this argument is NULL, the default source preferences is used.
Returns
An xmmsv_t containing a simple key-value dict. Must be unreffed manually when done.

Definition at line 752 of file value.c.

◆ xmmsv_serialize()

xmmsv_t* xmmsv_serialize ( xmmsv_t v)

Definition at line 650 of file value_serialize.c.

◆ xmmsv_utf8_validate()

int xmmsv_utf8_validate ( const char *  str)

Check if a string is valid UTF-8.

Definition at line 2444 of file value.c.

Referenced by xmmsv_new_string().