libgnomevfsmm 2.26.0
|
00001 // -*- c++ -*- 00002 // Generated by gtkmmproc -- DO NOT MODIFY! 00003 #ifndef _LIBGNOMEVFSMM_ASYNC_HANDLE_2_H 00004 #define _LIBGNOMEVFSMM_ASYNC_HANDLE_2_H 00005 00006 00007 #include <glibmm.h> 00008 00009 // -*- c++ -*- 00010 /* Copyright 2003, 2006 gnome-vfsmm Development Team 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2.1 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free 00024 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00025 */ 00026 00027 #include <libgnomevfs/gnome-vfs-async-ops.h> 00028 #include <libgnomevfs/gnome-vfs-file-info.h> 00029 00030 #include <libgnomevfsmm/enums.h> 00031 #include <libgnomevfsmm/file-info.h> 00032 #include <libgnomevfsmm/uri.h> 00033 #include <libgnomevfsmm/transfer-2.h> 00034 00035 00036 namespace Gnome 00037 { 00038 00039 namespace Vfs 00040 { 00041 00047 class FileInfoResult 00048 { 00049 public: 00050 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00051 typedef FileInfoResult CppObjectType; 00052 typedef GnomeVFSGetFileInfoResult BaseObjectType; 00053 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00054 00055 FileInfoResult(); 00056 00057 // Use make_a_copy=true when getting it directly from a struct. 00058 explicit FileInfoResult(GnomeVFSGetFileInfoResult* castitem, bool make_a_copy = false); 00059 00060 FileInfoResult(const FileInfoResult& src); 00061 FileInfoResult& operator=(const FileInfoResult& src); 00062 00063 ~FileInfoResult(); 00064 00065 GnomeVFSGetFileInfoResult* gobj() { return gobject_; } 00066 const GnomeVFSGetFileInfoResult* gobj() const { return gobject_; } 00067 00069 GnomeVFSGetFileInfoResult* gobj_copy() const; 00070 00071 protected: 00072 GnomeVFSGetFileInfoResult* gobject_; 00073 00074 private: 00075 00076 00077 public: 00078 00079 Glib::RefPtr<Uri> get_uri() const; 00080 Result get_result() const; 00081 Glib::RefPtr<FileInfo> get_file_info() const; 00082 00083 00084 }; 00085 00086 00091 class FindDirectoryResult 00092 { 00093 public: 00094 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00095 typedef FindDirectoryResult CppObjectType; 00096 typedef GnomeVFSFindDirectoryResult BaseObjectType; 00097 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00098 00099 FindDirectoryResult(); 00100 00101 // Use make_a_copy=true when getting it directly from a struct. 00102 explicit FindDirectoryResult(GnomeVFSFindDirectoryResult* castitem, bool make_a_copy = false); 00103 00104 FindDirectoryResult(const FindDirectoryResult& src); 00105 FindDirectoryResult& operator=(const FindDirectoryResult& src); 00106 00107 ~FindDirectoryResult(); 00108 00109 GnomeVFSFindDirectoryResult* gobj() { return gobject_; } 00110 const GnomeVFSFindDirectoryResult* gobj() const { return gobject_; } 00111 00113 GnomeVFSFindDirectoryResult* gobj_copy() const; 00114 00115 protected: 00116 GnomeVFSFindDirectoryResult* gobject_; 00117 00118 private: 00119 00120 00121 Glib::RefPtr<Uri> get_uri() const; 00122 Result get_result() const; 00123 00124 00125 }; 00126 00127 00133 enum FindDirectoryKind 00134 { 00135 DIRECTORY_KIND_DESKTOP = 1000, 00136 DIRECTORY_KIND_TRASH 00137 }; 00138 00139 00143 namespace Async2 00144 { 00145 00146 typedef Glib::ListHandle< Glib::RefPtr<const Uri> > ListHandleUris; 00147 00148 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00149 struct FileInfoResultTraits 00150 { 00151 typedef FileInfoResult CppType; 00152 typedef const GnomeVFSGetFileInfoResult* CType; 00153 typedef GnomeVFSGetFileInfoResult* CTypeNonConst; 00154 00155 static CType to_c_type (const CppType& obj) { return obj.gobj(); } 00156 static CType to_c_type (const CType& obj) { return obj; } 00157 static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CTypeNonConst>(obj), true); } 00158 static void release_c_type (const CType&) {} 00159 }; 00160 #endif //DOXYGEN_SHOULD_SKIP_THIS 00161 00162 typedef Glib::ListHandle< FileInfoResult, FileInfoResultTraits > ListHandleFileInfoResults; 00163 00164 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00165 struct FindDirectoryResultTraits 00166 { 00167 typedef FindDirectoryResult CppType; 00168 typedef const GnomeVFSFindDirectoryResult* CType; 00169 typedef GnomeVFSFindDirectoryResult* CTypeNonConst; 00170 00171 static CType to_c_type (const CppType& obj) { return obj.gobj(); } 00172 static CType to_c_type (const CType& obj) { return obj; } 00173 static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CTypeNonConst>(obj), true); } 00174 static void release_c_type (const CType&) {} 00175 }; 00176 #endif //DOXYGEN_SHOULD_SKIP_THIS 00177 00178 typedef Glib::ListHandle< FindDirectoryResult, FindDirectoryResultTraits > ListHandleFindDirectoryResult; 00179 00180 00181 //The default constructor creates a null handle. Use an open*() method before anything else. 00182 class Handle 00183 { 00184 public: 00185 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00186 typedef Handle CppObjectType; 00187 typedef GnomeVFSAsyncHandle BaseObjectType; 00188 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00189 00190 private: 00191 00192 00193 public: 00194 Handle(); 00195 ~Handle(); 00196 00197 typedef sigc::slot<void, const Async2::Handle&, Result> SlotOpen; 00198 typedef SlotOpen SlotClose; 00199 00200 //This is our C++ equivalent for GNOME_VFS_PRIORITY_MIN, GNOME_VFS_PRIORITY_MAX, and GNOME_VFS_PRIORITY_DEFAULT: 00204 enum Priority 00205 { 00206 PRIORITY_DEFAULT = 0, 00207 PRIORITY_MIN = -10, 00208 PRIORITY_MAX = 10 00209 }; 00210 00211 void open(const Glib::ustring& text_uri, OpenMode open_mode, int priority, const SlotOpen& slot); 00212 void open(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, int priority, const SlotOpen& slot); 00213 00214 typedef sigc::slot<void, const Async2::Handle&, const Glib::RefPtr<Glib::IOChannel>&, Result> SlotOpenAsChannel; 00215 void open_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot); 00216 void open_as_channel(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot); 00217 00218 void create(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot); 00219 void create(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot); 00220 00221 void create_symbolic_link(const Glib::RefPtr<Uri>& uri, const Glib::ustring& uri_reference, int priority, const SlotOpen& slot); 00222 00223 typedef SlotOpenAsChannel SlotCreateAsChannel; 00224 void create_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot); 00225 //gnome_vfs_async_create_uri_as_channel() is declared, but not defined in gnome-vfs. 00226 //void create_as_channel(const Glib::RefPtr<Uri> uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot); 00227 00228 void close(const SlotClose& slot); 00229 00230 typedef sigc::slot<void, const Async2::Handle&, Result, gpointer, FileSize, FileSize> SlotRead; 00231 void read(gpointer buffer, guint bytes, const SlotRead& slot); 00232 00233 typedef sigc::slot<void, const Async2::Handle&, Result, gconstpointer, FileSize, FileSize> SlotWrite; 00234 void write(gconstpointer buffer, guint bytes, const SlotWrite& slot); 00235 00236 typedef sigc::slot<void, const Async2::Handle&, ListHandleFileInfoResults > SlotGetFileInfo; 00237 void get_file_info(const ListHandleUris& uri_list, FileInfoOptions options, int priority, const SlotGetFileInfo& slot) const; 00238 00239 typedef sigc::slot<void, const Async2::Handle&, Result, const Glib::RefPtr<FileInfo>& > SlotSetFileInfo; 00240 void set_file_info(const Glib::RefPtr<Uri>& uri, const Glib::RefPtr<FileInfo>& info, SetFileInfoMask mask, FileInfoOptions options, int priority, const SlotSetFileInfo& slot); 00241 00242 typedef sigc::slot<void, const Async2::Handle&, Result, Glib::ListHandle<Glib::RefPtr<FileInfo> >, int> SlotLoadDirectory; 00243 void load_directory(const Glib::ustring& text_uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot); 00244 void load_directory(const Glib::RefPtr<Uri>& uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot); 00245 00246 typedef sigc::slot<int, const Async2::Handle&, Transfer2::ProgressInfo&> SlotTransferProgress; 00247 00248 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00249 void transfer(const ListHandleUris& source_uri_list, const ListHandleUris& target_uri_list, TransferOptions xfer_options, ErrorMode error_mode, OverwriteMode overwrite_mode, int priority, const SlotTransferProgress& progress_update_callback, const Transfer2::SlotProgress& progress_sync_callback); 00250 #else 00251 void transfer(const ListHandleUris& source_uri_list, const ListHandleUris& target_uri_list, TransferOptions xfer_options, ErrorMode error_mode, OverwriteMode overwrite_mode, int priority, const SlotTransferProgress& progress_update_callback, const Transfer2::SlotProgress& progress_sync_callback, std::auto_ptr<Gnome::Vfs::exception>& error); 00252 #endif 00253 00254 typedef sigc::slot<void, const Async2::Handle&, ListHandleFindDirectoryResult > SlotFindDirectory; 00255 void find_directory(const ListHandleUris& near_uri_list, FindDirectoryKind kind, bool create_if_needed, bool find_if_needed, guint permissions, int priority, const SlotFindDirectory& slot); 00256 00257 typedef sigc::slot<void, const Async2::Handle&, Result, gpointer> SlotFileControl; 00258 void file_control(const Glib::ustring& operation, gpointer operation_data, const SlotFileControl& slot); 00259 00260 00266 void cancel(); 00267 00268 GnomeVFSAsyncHandle* gobj() { return gobject_; } 00269 const GnomeVFSAsyncHandle* gobj() const { return gobject_; } 00270 GnomeVFSAsyncHandle** gobj_addr() { return &gobject_; } 00271 00272 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00273 void assign_gobj(GnomeVFSAsyncHandle* src); 00274 #endif 00275 00276 protected: 00277 GnomeVFSAsyncHandle* gobject_; 00278 00279 private: 00280 Handle(const Handle&); 00281 Handle& operator=(const Handle&); 00282 00283 00284 }; 00285 00286 } // namespace Async2 00287 } // namespace Vfs 00288 } // namespace Gnome 00289 00290 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00291 namespace Glib 00292 { 00293 00294 template <> 00295 class Value<Gnome::Vfs::FindDirectoryKind> : public Glib::Value_Flags<Gnome::Vfs::FindDirectoryKind> 00296 { 00297 public: 00298 static GType value_type() G_GNUC_CONST; 00299 }; 00300 00301 } // namespace Glib 00302 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00303 00304 00305 namespace Glib 00306 { 00307 00316 Gnome::Vfs::FileInfoResult wrap(GnomeVFSGetFileInfoResult* object, bool take_copy = false); 00317 00318 } // namespace Glib 00319 00320 00321 namespace Glib 00322 { 00323 00332 Gnome::Vfs::FindDirectoryResult wrap(GnomeVFSFindDirectoryResult* object, bool take_copy = false); 00333 00334 } // namespace Glib 00335 00336 00337 #endif /* _LIBGNOMEVFSMM_ASYNC_HANDLE_2_H */ 00338