2011-04-14 16:21:30 +04:00
|
|
|
#ifndef MC__VFS_PATH_H
|
|
|
|
#define MC__VFS_PATH_H
|
|
|
|
|
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
|
|
|
|
2011-06-14 16:09:59 +04:00
|
|
|
#define VFS_PATH_URL_DELIMITER "://"
|
|
|
|
|
2011-04-14 16:21:30 +04:00
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
2011-06-29 14:12:19 +04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
VPF_NONE = 0,
|
2011-08-15 15:37:59 +04:00
|
|
|
VPF_NO_CANON = 1 << 0,
|
|
|
|
VPF_USE_DEPRECATED_PARSER = 1 << 1
|
2011-06-29 14:12:19 +04:00
|
|
|
} vfs_path_flag_t;
|
|
|
|
|
2011-04-14 16:21:30 +04:00
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
|
|
|
struct vfs_class;
|
2011-04-28 15:39:59 +04:00
|
|
|
struct vfs_url_struct;
|
2011-04-14 16:21:30 +04:00
|
|
|
|
2011-04-20 16:59:06 +04:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-04-28 15:39:59 +04:00
|
|
|
GList *path;
|
2011-04-14 16:21:30 +04:00
|
|
|
} vfs_path_t;
|
|
|
|
|
2011-04-20 16:59:06 +04:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-07 14:18:08 +04:00
|
|
|
char *user;
|
|
|
|
char *password;
|
|
|
|
char *host;
|
2011-07-05 17:05:15 +04:00
|
|
|
gboolean ipv6;
|
2011-06-07 14:18:08 +04:00
|
|
|
int port;
|
2011-04-14 16:21:30 +04:00
|
|
|
char *path;
|
|
|
|
struct vfs_class *class;
|
|
|
|
char *encoding;
|
2011-06-13 14:19:47 +04:00
|
|
|
char *vfs_prefix;
|
2011-04-28 15:39:59 +04:00
|
|
|
|
2011-05-30 11:16:40 +04:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
GIConv converter;
|
|
|
|
DIR *info;
|
2011-05-27 19:28:46 +04:00
|
|
|
} dir;
|
2011-04-14 16:21:30 +04:00
|
|
|
} vfs_path_element_t;
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
2011-04-20 16:59:06 +04:00
|
|
|
vfs_path_t *vfs_path_new (void);
|
2011-06-08 17:40:36 +04:00
|
|
|
vfs_path_t *vfs_path_clone (const vfs_path_t * vpath);
|
|
|
|
void vfs_path_remove_element_by_index (vfs_path_t * vpath, int element_index);
|
2011-04-14 16:21:30 +04:00
|
|
|
void vfs_path_free (vfs_path_t * path);
|
2011-04-28 15:39:59 +04:00
|
|
|
int vfs_path_elements_count (const vfs_path_t * path);
|
2011-04-14 16:21:30 +04:00
|
|
|
|
|
|
|
char *vfs_path_to_str (const vfs_path_t * path);
|
2011-04-28 15:39:59 +04:00
|
|
|
char *vfs_path_to_str_elements_count (const vfs_path_t * path, int elements_count);
|
2011-04-20 16:59:06 +04:00
|
|
|
vfs_path_t *vfs_path_from_str (const char *path_str);
|
2011-06-29 14:12:19 +04:00
|
|
|
vfs_path_t *vfs_path_from_str_flags (const char *path_str, vfs_path_flag_t flags);
|
2011-04-14 16:21:30 +04:00
|
|
|
|
2011-04-28 15:39:59 +04:00
|
|
|
vfs_path_element_t *vfs_path_get_by_index (const vfs_path_t * path, int element_index);
|
2011-06-08 17:40:36 +04:00
|
|
|
vfs_path_element_t *vfs_path_element_clone (const vfs_path_element_t * element);
|
2011-04-20 16:59:06 +04:00
|
|
|
void vfs_path_element_free (vfs_path_element_t * element);
|
2011-04-14 16:21:30 +04:00
|
|
|
|
2011-04-28 15:39:59 +04:00
|
|
|
struct vfs_class *vfs_prefix_to_class (const char *prefix);
|
2011-04-14 16:21:30 +04:00
|
|
|
|
2011-06-01 14:56:52 +04:00
|
|
|
gboolean vfs_path_element_need_cleanup_converter (const vfs_path_element_t * element);
|
|
|
|
|
2011-06-07 13:22:31 +04:00
|
|
|
char *vfs_path_serialize (const vfs_path_t * vpath, GError ** error);
|
|
|
|
vfs_path_t *vfs_path_deserialize (const char *data, GError ** error);
|
|
|
|
|
2011-04-14 16:21:30 +04:00
|
|
|
/*** inline functions ****************************************************************************/
|
|
|
|
|
2011-06-17 14:28:37 +04:00
|
|
|
static inline gboolean
|
|
|
|
vfs_path_element_valid (const vfs_path_element_t * element)
|
|
|
|
{
|
|
|
|
return (element != NULL && element->class != NULL);
|
|
|
|
}
|
|
|
|
|
2011-04-14 16:21:30 +04:00
|
|
|
#endif
|