XMMS2
|
Macros | |
#define | xmmsv_check_type(type) ((type) > XMMSV_TYPE_NONE && (type) < XMMSV_TYPE_END) |
Functions | |
char * | xmmsv_encode_url (const char *url) |
Encodes an url. More... | |
char * | xmmsv_encode_url_full (const char *url, xmmsv_t *args) |
Encodes an url with arguments stored in dict args. More... | |
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_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) |
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 |
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. |
char* xmmsv_encode_url | ( | const char * | url | ) |
Encodes an url.
The encoded url is allocated using malloc and has to be freed by the user.
url | The url to encode. |
char* xmmsv_encode_url_full | ( | const char * | url, |
xmmsv_t * | args | ||
) |
Encodes an url with arguments stored in dict args.
The encoded url is allocated using malloc and has to be freed by the user.
url | The url to encode. |
args | The dict with arguments, or NULL. |
Referenced by xmmsv_encode_url().
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. |
int xmmsv_utf8_validate | ( | const char * | str | ) |
Check if a string is valid UTF-8.
Referenced by xmmsv_new_string().