libgnomevfsmm 2.26.0
|
00001 /* $Id: handle.h 2019 2009-01-27 08:29:42Z murrayc $ */ 00002 00003 /* Copyright 2003 gnome-vfsmm Development Team 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free 00017 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 00021 #ifndef _LIBGNOMEVFSMM_HANDLE_H 00022 #define _LIBGNOMEVFSMM_HANDLE_H 00023 00024 #include <glibmm.h> 00025 00026 #include <libgnomevfs/gnome-vfs-ops.h> 00027 00028 #include <libgnomevfsmm/uri.h> 00029 #include <libgnomevfsmm/exception.h> 00030 #include <libgnomevfsmm/file-info.h> 00031 #include <libgnomevfsmm/enums.h> 00032 #include <libgnomevfsmm/types.h> 00033 00034 00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00036 typedef struct GnomeVFSHandle GnomeVFSHandle; 00037 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00038 00039 namespace Gnome 00040 { 00041 00042 namespace Vfs 00043 { 00044 00045 class Handle 00046 { 00047 public: 00048 Handle(); 00049 virtual ~Handle(); 00050 00051 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00052 void open(const Glib::ustring& text_uri, OpenMode open_mode) throw(exception); 00053 void open(const Glib::RefPtr<const Uri>& uri, OpenMode open_mode) throw(exception); 00054 00055 void create(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint permissions) throw(exception); 00056 void create(const Glib::RefPtr<const Uri>& uri, OpenMode open_mode, bool exclusive, guint permissions) throw(exception); 00057 00058 void close() throw(exception); 00059 00060 FileSize read(gpointer buffer, FileSize bytes) throw(exception); 00061 00062 FileSize write(gconstpointer buffer, FileSize bytes) throw(exception); 00063 00064 void seek(SeekPosition whence, FileOffset offset) throw(exception); 00065 00066 FileSize tell() throw(exception); 00067 00068 static Glib::RefPtr<FileInfo> get_file_info(const Glib::ustring& text_uri, FileInfoOptions options = FILE_INFO_DEFAULT) throw(exception); 00069 00070 Glib::RefPtr<FileInfo> get_file_info(FileInfoOptions options = FILE_INFO_DEFAULT) const throw(exception); 00071 00072 00073 static void truncate(const Glib::ustring& text_uri, FileSize length) throw(exception); 00074 static void truncate(const Glib::RefPtr<const Uri>& uri, FileSize length) throw(exception); 00075 void truncate(FileSize length) throw(exception); 00076 00077 static void make_directory(const Glib::ustring& text_uri, guint permissions) throw(exception); 00078 static void make_directory(const Glib::RefPtr<const Uri>& uri, guint permissions) throw(exception); 00079 00080 static void remove_directory(const Glib::ustring& text_uri) throw(exception); 00081 static void remove_directory(const Glib::RefPtr<const Uri>& uri) throw(exception); 00082 00083 static void unlink(const Glib::ustring& text_uri) throw(exception); 00084 static void unlink(const Glib::RefPtr<const Uri>& uri) throw(exception); 00085 00086 static void move(const Glib::ustring& old_text_uri, const Glib::ustring& new_text_uri, bool force_replace) throw(exception); 00087 static void move(const Glib::RefPtr<const Uri>& old_uri, const Glib::RefPtr<const Uri>& new_uri, bool force_replace) throw(exception); 00088 00089 static bool check_same_fs(const Glib::ustring& source, const Glib::ustring& target) throw(exception); 00090 static bool check_same_fs(const Glib::RefPtr<const Uri>& source, const Glib::RefPtr<const Uri>& target) throw(exception); 00091 00092 bool uri_exists(const Glib::RefPtr<const Uri>& uri) throw(exception); 00093 00094 static void set_file_info(const Glib::ustring& text_uri, const Glib::RefPtr<const FileInfo>& info, SetFileInfoMask mask) throw(exception); 00095 static void set_file_info(const Glib::RefPtr<const Uri>& uri, const Glib::RefPtr<const FileInfo>& info, SetFileInfoMask mask) throw(exception); 00096 00097 void file_control(const Glib::ustring& operation, gpointer operation_data) throw(exception); 00098 #else 00099 void open(const Glib::ustring& text_uri, OpenMode open_mode, std::auto_ptr<Gnome::Vfs::exception>& error); 00100 void open(const Glib::RefPtr<const Uri>& uri, OpenMode open_mode, std::auto_ptr<Gnome::Vfs::exception>& error); 00101 00102 void create(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint permissions, std::auto_ptr<Gnome::Vfs::exception>& error); 00103 void create(const Glib::RefPtr<const Uri>& uri, OpenMode open_mode, bool exclusive, guint permissions, std::auto_ptr<Gnome::Vfs::exception>& error); 00104 00105 void close(std::auto_ptr<Gnome::Vfs::exception>& error); 00106 00107 FileSize read(gpointer buffer, FileSize bytes, std::auto_ptr<Gnome::Vfs::exception>& error); 00108 00109 FileSize write(gconstpointer buffer, FileSize bytes, std::auto_ptr<Gnome::Vfs::exception>& error); 00110 00111 void seek(SeekPosition whence, FileOffset offset, std::auto_ptr<Gnome::Vfs::exception>& error); 00112 00113 FileSize tell(std::auto_ptr<Gnome::Vfs::exception>& error); 00114 00115 static Glib::RefPtr<FileInfo> get_file_info(const Glib::ustring& text_uri, FileInfoOptions options, std::auto_ptr<Gnome::Vfs::exception>& error); 00116 00117 Glib::RefPtr<FileInfo> get_file_info(FileInfoOptions options, std::auto_ptr<Gnome::Vfs::exception>& error) const; 00118 00119 00120 static void truncate(const Glib::ustring& text_uri, FileSize length, std::auto_ptr<Gnome::Vfs::exception>& error); 00121 static void truncate(const Glib::RefPtr<const Uri>& uri, FileSize length, std::auto_ptr<Gnome::Vfs::exception>& error); 00122 void truncate(FileSize length, std::auto_ptr<Gnome::Vfs::exception>& error); 00123 00124 static void make_directory(const Glib::ustring& text_uri, guint permissions, std::auto_ptr<Gnome::Vfs::exception>& error); 00125 static void make_directory(const Glib::RefPtr<const Uri>& uri, guint permissions, std::auto_ptr<Gnome::Vfs::exception>& error); 00126 00127 static void remove_directory(const Glib::ustring& text_uri, std::auto_ptr<Gnome::Vfs::exception>& error); 00128 static void remove_directory(const Glib::RefPtr<const Uri>& uri, std::auto_ptr<Gnome::Vfs::exception>& error); 00129 00130 static void unlink(const Glib::ustring& text_uri, std::auto_ptr<Gnome::Vfs::exception>& error); 00131 static void unlink(const Glib::RefPtr<const Uri>& uri, std::auto_ptr<Gnome::Vfs::exception>& error); 00132 00133 static void move(const Glib::ustring& old_text_uri, const Glib::ustring& new_text_uri, bool force_replace, std::auto_ptr<Gnome::Vfs::exception>& error); 00134 static void move(const Glib::RefPtr<const Uri>& old_uri, const Glib::RefPtr<const Uri>& new_uri, bool force_replace, std::auto_ptr<Gnome::Vfs::exception>& error); 00135 00136 static bool check_same_fs(const Glib::ustring& source, const Glib::ustring& target, std::auto_ptr<Gnome::Vfs::exception>& error); 00137 static bool check_same_fs(const Glib::RefPtr<const Uri>& source, const Glib::RefPtr<const Uri>& target, std::auto_ptr<Gnome::Vfs::exception>& error); 00138 00139 bool uri_exists(const Glib::RefPtr<const Uri>& uri, std::auto_ptr<Gnome::Vfs::exception>& error); 00140 00141 static void set_file_info(const Glib::ustring& text_uri, const Glib::RefPtr<const FileInfo>& info, SetFileInfoMask mask, std::auto_ptr<Gnome::Vfs::exception>& error); 00142 static void set_file_info(const Glib::RefPtr<const Uri>& uri, const Glib::RefPtr<const FileInfo>& info, SetFileInfoMask mask, std::auto_ptr<Gnome::Vfs::exception>& error); 00143 00144 void file_control(const Glib::ustring& operation, gpointer operation_data, std::auto_ptr<Gnome::Vfs::exception>& error); 00145 #endif //GLIBMM_EXCEPTIONS_ENABLED 00146 00147 00148 GnomeVFSHandle* gobj(); 00149 const GnomeVFSHandle* gobj() const; 00150 00151 00152 protected: 00153 00154 GnomeVFSHandle* gobj_; 00155 }; 00156 00157 } // namespace Vfs 00158 } // namespace Gnome 00159 00160 00161 00162 00163 #endif /* _LIBGNOMEVFSMM_HANDLE_H */ 00164