XmmsClient
Macros | Functions

Macros

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

Functions

char * xmmsv_encode_url (const char *url) XMMS_PUBLIC
 Encodes an url. More...
 
char * xmmsv_encode_url_full (const char *url, xmmsv_t *args) XMMS_PUBLIC
 Encodes an url with arguments stored in dict args. More...
 
xmmsv_txmmsv_decode_url (const xmmsv_t *url) XMMS_PUBLIC
 Decode an URL-encoded string. More...
 
int xmmsv_utf8_validate (const char *str) XMMS_PUBLIC
 Check if a string is valid UTF-8. More...
 
xmmsv_txmmsv_propdict_to_dict (xmmsv_t *propdict, const char **src_prefs) XMMS_PUBLIC
 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) XMMS_PUBLIC
 This function will make a pretty string about the information in xmmsv dict. More...
 
xmmsv_txmmsv_serialize (xmmsv_t *v) XMMS_PUBLIC
 
xmmsv_txmmsv_deserialize (xmmsv_t *v) XMMS_PUBLIC
 

Detailed Description

Macro Definition Documentation

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

Function Documentation

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
xmmsv_t* xmmsv_deserialize ( xmmsv_t v)
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
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.

Parameters
urlThe url to encode.
Returns
The encoded url

Referenced by xmmsc_coll_idlist_from_playlist_file(), xmmsc_medialib_get_id(), xmmsc_medialib_import_path(), xmmsc_playlist_radd(), xmmsc_playlist_rinsert(), and xmmsc_xform_media_browse().

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.

Parameters
urlThe url to encode.
argsThe dict with arguments, or NULL.
Returns
The encoded url

Referenced by xmmsc_medialib_add_entry_full(), xmmsc_medialib_encode_url(), xmmsc_medialib_encode_url_full(), xmmsc_playlist_add_full(), xmmsc_playlist_insert_full(), and xmmsv_encode_url().

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.
xmmsv_t* xmmsv_serialize ( xmmsv_t v)
int xmmsv_utf8_validate ( const char *  str)

Check if a string is valid UTF-8.

Referenced by xmmsv_new_string().