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