EFL 1.7 svn doobies
[profile/ivi/efreet.git] / src / lib / efreet_uri.h
1 #ifndef EFREET_URI_H
2 #define EFREET_URI_H
3
4 /**
5  * @file efreet_uri.h
6  * @brief Contains the methods used to support the FDO URI specification.
7  * @addtogroup Efreet_Uri Efreet_Uri: The FDO URI Specification functions
8  * @{
9  */
10
11
12 /**
13  * Efreet_Uri
14  */
15 typedef struct Efreet_Uri Efreet_Uri;
16
17 /**
18  * Efreet_Uri
19  * @brief Contains a simple rappresentation of an uri. The string don't have 
20  * special chars escaped.
21  */
22 struct Efreet_Uri
23 {
24     const char *protocol;   /**< The protocol used (usually 'file')*/
25     const char *hostname;   /**< The name of the host if any, or NULL */
26     const char *path;       /**< The full file path whitout protocol nor host*/
27 };
28
29
30
31 /**
32  * @param uri Create an URI string from an Efreet_Uri struct
33  * @return The string rapresentation of uri (ex: 'file:///home/my%20name')
34  * @brief Get the string rapresentation of the given uri struct escaping
35  * illegal caracters. Remember to free the string with eina_stringshare_del()
36  * when you don't need it anymore.
37  * @note The resulting string will contain the protocol and the path but not
38  * the hostname, as many apps doesn't handle it.
39  */
40 EAPI const char *efreet_uri_encode(Efreet_Uri *uri);
41
42 /**
43  * @param val a valid uri string to parse
44  * @return Return The corresponding Efreet_Uri structure. Or NULL on errors.
45  * @brief Read a single uri and return an Efreet_Uri struct. If there's no
46  * hostname in the uri then the hostname parameter will be NULL. All the uri
47  * escaped chars will be converted to normal.
48  */
49 EAPI Efreet_Uri *efreet_uri_decode(const char *val);
50
51 /**
52  * @param uri The uri to free
53  * @brief Free the given uri structure.
54  */
55 EAPI void        efreet_uri_free(Efreet_Uri *uri);
56
57
58 /**
59  * @}
60  */
61
62 #endif