1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* gnome-vfs-uri.h - URI handling for the GNOME Virtual File System.
4 Copyright (C) 1999 Free Software Foundation
6 The Gnome Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The Gnome Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the Gnome Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
21 Author: Ettore Perazzoli <ettore@comm2000.it>
24 #ifndef GNOME_VFS_URI_H
25 #define GNOME_VFS_URI_H
27 #include <glib/glist.h>
31 /* This describes a URI element. */
32 typedef struct GnomeVFSURI {
33 /* Reference count. */
36 /* Text for the element: eg. some/path/name. */
39 /* Text for uri fragment: eg, #anchor */
42 /* Method string: eg. `gzip', `tar', `http'. This is necessary as
43 one GnomeVFSMethod can be used for different method strings
44 (e.g. extfs handles zip, rar, zoo and several other ones). */
47 /* VFS method to access the element. */
48 struct GnomeVFSMethod *method;
50 /* Pointer to the parent element, or NULL for toplevel elements. */
51 struct GnomeVFSURI *parent;
53 /* Reserved to avoid future breaks in ABI compatibility */
58 /* This is the toplevel URI element. A toplevel method implementations should
59 cast the `GnomeVFSURI' argument to this type to get the additional host/auth
60 information. If any of the elements is 0, it is unspecified. */
65 /* Server location information. */
69 /* Authorization information. */
73 /* The parent URN, if it exists */
76 /* Reserved to avoid future breaks in ABI compatibility */
80 } GnomeVFSToplevelURI;
84 * GnomeVFSURIHideOptions:
85 * @GNOME_VFS_URI_HIDE_NONE: don't hide anything
86 * @GNOME_VFS_URI_HIDE_USER_NAME: hide the user name
87 * @GNOME_VFS_URI_HIDE_PASSWORD: hide the password
88 * @GNOME_VFS_URI_HIDE_HOST_NAME: hide the host name
89 * @GNOME_VFS_URI_HIDE_HOST_PORT: hide the port
90 * @GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD: hide the method (e.g. http, file)
91 * @GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER: hide the fragment identifier
93 * Packed boolean bitfield controlling hiding of various elements
94 * of a GnomeVFSURI when it is converted to a string.
97 GNOME_VFS_URI_HIDE_NONE = 0,
98 GNOME_VFS_URI_HIDE_USER_NAME = 1 << 0,
99 GNOME_VFS_URI_HIDE_PASSWORD = 1 << 1,
100 GNOME_VFS_URI_HIDE_HOST_NAME = 1 << 2,
101 GNOME_VFS_URI_HIDE_HOST_PORT = 1 << 3,
102 GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD = 1 << 4,
103 GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER = 1 << 8
104 } GnomeVFSURIHideOptions;
108 * GNOME_VFS_URI_MAGIC_CHR:
110 * The character used to divide location from
111 * extra "arguments" passed to the method.
114 * GNOME_VFS_URI_MAGIC_STR:
116 * The character used to divide location from
117 * extra "arguments" passed to the method.
119 #define GNOME_VFS_URI_MAGIC_CHR '#'
120 #define GNOME_VFS_URI_MAGIC_STR "#"
123 * GNOME_VFS_URI_PATH_CHR:
125 * Defines the path seperator character.
128 * GNOME_VFS_URI_PATH_STR:
130 * Defines the path seperator string.
132 #define GNOME_VFS_URI_PATH_CHR '/'
133 #define GNOME_VFS_URI_PATH_STR "/"
136 GnomeVFSURI *gnome_vfs_uri_new (const gchar *text_uri);
137 GnomeVFSURI *gnome_vfs_uri_resolve_relative (const GnomeVFSURI *base,
138 const gchar *relative_reference);
139 GnomeVFSURI *gnome_vfs_uri_ref (GnomeVFSURI *uri);
140 void gnome_vfs_uri_unref (GnomeVFSURI *uri);
142 GnomeVFSURI *gnome_vfs_uri_append_string (const GnomeVFSURI *uri,
143 const char *uri_fragment);
144 GnomeVFSURI *gnome_vfs_uri_append_path (const GnomeVFSURI *uri,
146 GnomeVFSURI *gnome_vfs_uri_append_file_name (const GnomeVFSURI *uri,
147 const gchar *filename);
148 gchar *gnome_vfs_uri_to_string (const GnomeVFSURI *uri,
149 GnomeVFSURIHideOptions hide_options);
150 GnomeVFSURI *gnome_vfs_uri_dup (const GnomeVFSURI *uri);
151 gboolean gnome_vfs_uri_is_local (const GnomeVFSURI *uri);
152 gboolean gnome_vfs_uri_has_parent (const GnomeVFSURI *uri);
153 GnomeVFSURI *gnome_vfs_uri_get_parent (const GnomeVFSURI *uri);
155 GnomeVFSToplevelURI *gnome_vfs_uri_get_toplevel (const GnomeVFSURI *uri);
157 const gchar *gnome_vfs_uri_get_host_name (const GnomeVFSURI *uri);
158 const gchar *gnome_vfs_uri_get_scheme (const GnomeVFSURI *uri);
159 guint gnome_vfs_uri_get_host_port (const GnomeVFSURI *uri);
160 const gchar *gnome_vfs_uri_get_user_name (const GnomeVFSURI *uri);
161 const gchar *gnome_vfs_uri_get_password (const GnomeVFSURI *uri);
163 void gnome_vfs_uri_set_host_name (GnomeVFSURI *uri,
164 const gchar *host_name);
165 void gnome_vfs_uri_set_host_port (GnomeVFSURI *uri,
167 void gnome_vfs_uri_set_user_name (GnomeVFSURI *uri,
168 const gchar *user_name);
169 void gnome_vfs_uri_set_password (GnomeVFSURI *uri,
170 const gchar *password);
172 gboolean gnome_vfs_uri_equal (const GnomeVFSURI *a,
173 const GnomeVFSURI *b);
175 gboolean gnome_vfs_uri_is_parent (const GnomeVFSURI *possible_parent,
176 const GnomeVFSURI *possible_child,
179 const gchar *gnome_vfs_uri_get_path (const GnomeVFSURI *uri);
180 const gchar *gnome_vfs_uri_get_fragment_identifier (const GnomeVFSURI *uri);
181 gchar *gnome_vfs_uri_extract_dirname (const GnomeVFSURI *uri);
182 gchar *gnome_vfs_uri_extract_short_name (const GnomeVFSURI *uri);
183 gchar *gnome_vfs_uri_extract_short_path_name (const GnomeVFSURI *uri);
185 gint gnome_vfs_uri_hequal (gconstpointer a,
187 guint gnome_vfs_uri_hash (gconstpointer p);
189 GList *gnome_vfs_uri_list_parse (const gchar* uri_list);
190 GList *gnome_vfs_uri_list_ref (GList *list);
191 GList *gnome_vfs_uri_list_unref (GList *list);
192 GList *gnome_vfs_uri_list_copy (GList *list);
193 void gnome_vfs_uri_list_free (GList *list);
195 char *gnome_vfs_uri_make_full_from_relative (const char *base_uri,
196 const char *relative_uri);
200 #endif /* GNOME_VFS_URI_H */