00001
00002
00003 #ifndef _LIBGNOMEVFSMM_URI_H
00004 #define _LIBGNOMEVFSMM_URI_H
00005
00006 #include <glibmm.h>
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <libgnomevfsmm/file-info.h>
00029 #include <libgnomevfsmm/enums.h>
00030 #include <libgnomevfsmm/exception.h>
00031 #include <libgnomevfs/gnome-vfs-uri.h>
00032 #include <libgnomevfs/gnome-vfs-ops.h>
00033
00034
00035 namespace Gnome
00036 {
00037
00038 namespace Vfs
00039 {
00040
00054 enum MakeURIDirs
00055 {
00056 MAKE_URI_DIR_NONE = 0,
00057 MAKE_URI_DIR_HOMEDIR = 1 << 0,
00058 MAKE_URI_DIR_CURRENT = 1 << 1
00059 };
00060
00062 inline MakeURIDirs operator|(MakeURIDirs lhs, MakeURIDirs rhs)
00063 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00064
00066 inline MakeURIDirs operator&(MakeURIDirs lhs, MakeURIDirs rhs)
00067 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00068
00070 inline MakeURIDirs operator^(MakeURIDirs lhs, MakeURIDirs rhs)
00071 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00072
00074 inline MakeURIDirs operator~(MakeURIDirs flags)
00075 { return static_cast<MakeURIDirs>(~static_cast<unsigned>(flags)); }
00076
00078 inline MakeURIDirs& operator|=(MakeURIDirs& lhs, MakeURIDirs rhs)
00079 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00080
00082 inline MakeURIDirs& operator&=(MakeURIDirs& lhs, MakeURIDirs rhs)
00083 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00084
00086 inline MakeURIDirs& operator^=(MakeURIDirs& lhs, MakeURIDirs rhs)
00087 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00088
00089
00090 class Uri
00091 {
00092 public:
00093 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00094 typedef Uri CppObjectType;
00095 typedef GnomeVFSURI BaseObjectType;
00096 #endif
00097
00098
00099
00100 void reference() const;
00101 void unreference() const;
00102
00104 GnomeVFSURI* gobj();
00105
00107 const GnomeVFSURI* gobj() const;
00108
00110 GnomeVFSURI* gobj_copy() const;
00111
00112 protected:
00113
00114 Uri();
00115 void operator delete(void*, size_t);
00116
00117 private:
00118
00119 Uri(const Uri&);
00120 Uri& operator=(const Uri&);
00121
00122
00123 public:
00124
00129 static Glib::RefPtr<Uri> create(const Glib::ustring& uri);
00130
00131
00136 Glib::RefPtr<Uri> resolve_relative(const Glib::ustring& relative_reference);
00137
00138
00145 Glib::RefPtr<Uri> append_string(const Glib::ustring& uri_fragment);
00146
00153 Glib::RefPtr<Uri> append_path(const Glib::ustring& path);
00154
00161 Glib::RefPtr<Uri> append_file_name(const Glib::ustring& filename);
00162
00169 Glib::ustring to_string(URIHideOptions hide_options = URI_HIDE_NONE) const;
00170
00174 Glib::RefPtr<Uri> dup();
00175
00179 bool is_local() const;
00180
00184 bool has_parent() const;
00185
00189 Glib::RefPtr<Uri> get_parent();
00190
00194 Glib::RefPtr<const Uri> get_parent() const;
00195
00196
00197
00198
00199
00200
00204 Glib::ustring get_host_name() const;
00205
00209 Glib::ustring get_scheme() const;
00210
00214 guint get_host_port() const;
00215
00219 Glib::ustring get_user_name() const;
00220
00224 Glib::ustring get_password() const;
00225
00226
00230 void set_host_name(const Glib::ustring& host_name);
00231
00236 void set_host_port(guint host_port);
00237
00241 void set_user_name(const Glib::ustring& user_name);
00242
00246 void set_password(const Glib::ustring& password);
00247
00248
00257 bool equal(const Glib::RefPtr<const Uri>& uri) const;
00258
00259
00260
00268 bool is_parent(const Glib::RefPtr<const Uri>& possible_child, bool recursive = true) const;
00269
00270
00274 Glib::ustring get_path() const;
00275
00279 Glib::ustring get_fragment_identifier() const;
00280
00285 Glib::ustring extract_dirname() const;
00286
00297 Glib::ustring extract_short_name() const;
00298
00309 Glib::ustring extract_short_path_name() const;
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00326 static Glib::ustring make_full_from_relative(const Glib::ustring& base_uri, const Glib::ustring& relative_uri);
00327
00328
00343 static Glib::ustring format_for_display(const Glib::ustring& uri);
00344
00355 static Glib::ustring make_from_input(const Glib::ustring& uri);
00356
00357 static Glib::ustring make_from_input(const Glib::ustring& uri, MakeURIDirs dirs);
00358
00365 static Glib::ustring make_canonical_strip_fragment(const Glib::ustring& uri);
00366
00374 static bool uris_match(const Glib::ustring& uri_1, const Glib::ustring& uri_2);
00375
00382 static Glib::ustring get_scheme(const Glib::ustring& uri);
00383
00394 static Glib::ustring make_from_shell_arg(const Glib::ustring& uri);
00395
00396
00401 Glib::RefPtr<FileInfo> get_file_info(FileInfoOptions options = FILE_INFO_DEFAULT) const throw(exception);
00402
00406 void create_symbolic_link(const Glib::ustring& target_reference) throw(exception);
00407
00411 bool uri_exists() const;
00412
00418 FileSize get_volume_free_space() const throw(exception);
00419
00420
00421 };
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434 }
00435 }
00436
00437
00438 namespace Gnome
00439 {
00440
00441 namespace Vfs
00442 {
00443
00449 bool operator==(const Uri& lhs, const Uri& rhs);
00450
00456 bool operator!=(const Uri& lhs, const Uri& rhs);
00457
00458
00459 }
00460
00461 }
00462
00463
00464 namespace Glib
00465 {
00466
00472 Glib::RefPtr<Gnome::Vfs::Uri> wrap(GnomeVFSURI* object, bool take_copy = false);
00473
00474 }
00475
00476 #endif
00477