XMMS2
|
Macros | |
#define | xmmsv_check_type(type) ((type) > XMMSV_TYPE_NONE && (type) < XMMSV_TYPE_END) |
Functions | |
xmmsv_t * | xmmsv_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_t * | xmmsv_make_stringlist (char *array[], int num) |
Helper function to build a list xmmsv_t containing the strings from the input array. More... | |
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. 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_t * | xmmsv_serialize (xmmsv_t *v) |
xmmsv_t * | xmmsv_deserialize (xmmsv_t *v) |
#define xmmsv_check_type | ( | type | ) | ((type) > XMMSV_TYPE_NONE && (type) < XMMSV_TYPE_END) |
Definition at line 33 of file xmmsv_util.h.
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 |
Definition at line 673 of file value_serialize.c.
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. |
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. |
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. |
Definition at line 650 of file value_serialize.c.
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().