uri.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _LIBGNOMEVFSMM_URI_H
00004 #define _LIBGNOMEVFSMM_URI_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 /* $Id: uri.hg,v 1.19 2005/04/07 11:04:01 murrayc Exp $ */
00010 // -*- C++ -*- // this is for the .hg, I realize gensig puts one in
00011 
00012 /* Copyright 2003 gnome-vfsmm Development Team
00013  *
00014  * This library is free software; you can redistribute it and/or
00015  * modify it under the terms of the GNU Library General Public
00016  * License as published by the Free Software Foundation; either
00017  * version 2 of the License, or (at your option) any later version.
00018  *
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Library General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Library General Public
00025  * License along with this library; if not, write to the Free
00026  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 /* DOXYGEN_SHOULD_SKIP_THIS */
00098 
00099 
00100   // For use with Glib::RefPtr<> only.
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   // Do not derive this.  Gnome::Vfs::Uri can neither be constructed nor deleted.
00115   Uri();
00116   void operator delete(void*, size_t);
00117 
00118 private:
00119   // noncopyable
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   //TODO: GnomeVFSToplevelURI inherits from GnomeVFSUri, but they are not GObjects. That needs a little work.  
00198   //_WRAP_METHOD(GnomeVFSToplevelURI* get_toplevel(), gnome_vfs_uri_get_toplevel)
00199   //_WRAP_METHOD(const GnomeVFSToplevelURI* get_toplevel() const, gnome_vfs_uri_get_toplevel)
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   //We wrap this as equal() as well, because operator== requires an operator*.
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   //These are used for creating hashes for hash tables, apparently.
00313   //I don't see the point of wrapping them.
00314   
00315 
00316 /*
00317 GList* gnome_vfs_uri_list_parse(const Glib::ustring& uri_list), )
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 //TODO: GnomeVFSToplevelURI inherits from GnomeVFSUri, but they are not GObjects. That needs a little work.
00426 /*
00427 class TopLevelUri : Uri
00428 {
00429   //TODO: Constructors/memory-management so we can wrap a GnomeVFSToplevelURI* in this.
00430   //TODO: member accessors?
00431 };
00432 */
00433   
00434 
00435 } // namespace Vfs
00436 } // namespace Gnome
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 } // namespace Vfs
00461 
00462 } // namespace Gnome
00463 
00464 
00465 namespace Glib
00466 {
00467 
00473   Glib::RefPtr<Gnome::Vfs::Uri> wrap(GnomeVFSURI* object, bool take_copy = false);
00474 
00475 } // namespace Glib
00476 
00477 
00478 #endif /* _LIBGNOMEVFSMM_URI_H */
00479 

Generated on Tue Aug 22 09:07:07 2006 for libgnomevfsmm by  doxygen 1.4.7