00001
00002
00003 #ifndef _LIBGNOMEVFSMM_URI_H
00004 #define _LIBGNOMEVFSMM_URI_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <libgnomevfsmm/file-info.h>
00030 #include <libgnomevfsmm/enums.h>
00031 #include <libgnomevfsmm/exception.h>
00032 #include <libgnomevfs/gnome-vfs-uri.h>
00033 #include <libgnomevfs/gnome-vfs-ops.h>
00034
00035
00036 namespace Gnome
00037 {
00038
00039 namespace Vfs
00040 {
00041
00055 enum MakeURIDirs
00056 {
00057 MAKE_URI_DIR_NONE = 0,
00058 MAKE_URI_DIR_HOMEDIR = 1 << 0,
00059 MAKE_URI_DIR_CURRENT = 1 << 1
00060 };
00061
00063 inline MakeURIDirs operator|(MakeURIDirs lhs, MakeURIDirs rhs)
00064 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00065
00067 inline MakeURIDirs operator&(MakeURIDirs lhs, MakeURIDirs rhs)
00068 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00069
00071 inline MakeURIDirs operator^(MakeURIDirs lhs, MakeURIDirs rhs)
00072 { return static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00073
00075 inline MakeURIDirs operator~(MakeURIDirs flags)
00076 { return static_cast<MakeURIDirs>(~static_cast<unsigned>(flags)); }
00077
00079 inline MakeURIDirs& operator|=(MakeURIDirs& lhs, MakeURIDirs rhs)
00080 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00081
00083 inline MakeURIDirs& operator&=(MakeURIDirs& lhs, MakeURIDirs rhs)
00084 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00085
00087 inline MakeURIDirs& operator^=(MakeURIDirs& lhs, MakeURIDirs rhs)
00088 { return (lhs = static_cast<MakeURIDirs>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00089
00090
00091 class Uri
00092 {
00093 public:
00094 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00095 typedef Uri CppObjectType;
00096 typedef GnomeVFSURI BaseObjectType;
00097 #endif
00098
00099
00100
00101 void reference() const;
00102 void unreference() const;
00103
00105 GnomeVFSURI* gobj();
00106
00108 const GnomeVFSURI* gobj() const;
00109
00111 GnomeVFSURI* gobj_copy() const;
00112
00113 protected:
00114
00115 Uri();
00116 void operator delete(void*, size_t);
00117
00118 private:
00119
00120 Uri(const Uri&);
00121 Uri& operator=(const Uri&);
00122
00123
00124 public:
00125
00130 static Glib::RefPtr<Uri> create(const Glib::ustring& uri);
00131
00132
00137 Glib::RefPtr<Uri> resolve_relative(const Glib::ustring& relative_reference);
00138
00139
00146 Glib::RefPtr<Uri> append_string(const Glib::ustring& uri_fragment);
00147
00154 Glib::RefPtr<Uri> append_path(const Glib::ustring& path);
00155
00162 Glib::RefPtr<Uri> append_file_name(const Glib::ustring& filename);
00163
00170 Glib::ustring to_string(URIHideOptions hide_options = URI_HIDE_NONE) const;
00171
00175 Glib::RefPtr<Uri> dup();
00176
00180 bool is_local() const;
00181
00185 bool has_parent() const;
00186
00190 Glib::RefPtr<Uri> get_parent();
00191
00195 Glib::RefPtr<const Uri> get_parent() const;
00196
00197
00198
00199
00200
00201
00205 Glib::ustring get_host_name() const;
00206
00210 Glib::ustring get_scheme() const;
00211
00215 guint get_host_port() const;
00216
00220 Glib::ustring get_user_name() const;
00221
00225 Glib::ustring get_password() const;
00226
00227
00231 void set_host_name(const Glib::ustring& host_name);
00232
00237 void set_host_port(guint host_port);
00238
00242 void set_user_name(const Glib::ustring& user_name);
00243
00247 void set_password(const Glib::ustring& password);
00248
00249
00258 bool equal(const Glib::RefPtr<const Uri>& uri) const;
00259
00260
00261
00269 bool is_parent(const Glib::RefPtr<const Uri>& possible_child, bool recursive = true) const;
00270
00271
00275 Glib::ustring get_path() const;
00276
00280 Glib::ustring get_fragment_identifier() const;
00281
00286 Glib::ustring extract_dirname() const;
00287
00298 Glib::ustring extract_short_name() const;
00299
00310 Glib::ustring extract_short_path_name() const;
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00327 static Glib::ustring make_full_from_relative(const Glib::ustring& base_uri, const Glib::ustring& relative_uri);
00328
00329
00344 static Glib::ustring format_for_display(const Glib::ustring& uri);
00345
00356 static Glib::ustring make_from_input(const Glib::ustring& uri);
00357
00358 static Glib::ustring make_from_input(const Glib::ustring& uri, MakeURIDirs dirs);
00359
00366 static Glib::ustring make_canonical_strip_fragment(const Glib::ustring& uri);
00367
00375 static bool uris_match(const Glib::ustring& uri_1, const Glib::ustring& uri_2);
00376
00383 static Glib::ustring get_scheme(const Glib::ustring& uri);
00384
00395 static Glib::ustring make_from_shell_arg(const Glib::ustring& uri);
00396
00397
00402 Glib::RefPtr<FileInfo> get_file_info(FileInfoOptions options = FILE_INFO_DEFAULT) const throw(exception);
00403
00407 void create_symbolic_link(const Glib::ustring& target_reference) throw(exception);
00408
00412 bool uri_exists() const;
00413
00419 FileSize get_volume_free_space() const throw(exception);
00420
00421
00422 };
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435 }
00436 }
00437
00438
00439 namespace Gnome
00440 {
00441
00442 namespace Vfs
00443 {
00444
00450 bool operator==(const Uri& lhs, const Uri& rhs);
00451
00457 bool operator!=(const Uri& lhs, const Uri& rhs);
00458
00459
00460 }
00461
00462 }
00463
00464
00465 namespace Glib
00466 {
00467
00473 Glib::RefPtr<Gnome::Vfs::Uri> wrap(GnomeVFSURI* object, bool take_copy = false);
00474
00475 }
00476
00477
00478 #endif
00479