libgnomevfsmm 2.26.0
|
00001 // -*- c++ -*- 00002 // Generated by gtkmmproc -- DO NOT MODIFY! 00003 #ifndef _LIBGNOMEVFSMM_ASYNC_HANDLE_H 00004 #define _LIBGNOMEVFSMM_ASYNC_HANDLE_H 00005 00006 00007 #include <glibmm.h> 00008 00009 /* Copyright 2003 gnome-vfsmm Development Team 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free 00023 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 #include <libgnomevfs/gnome-vfs-async-ops.h> 00027 #include <libgnomevfs/gnome-vfs-file-info.h> 00028 00029 #include <libgnomevfsmm/async-handle-2.h> 00030 #include <libgnomevfsmm/enums.h> 00031 #include <libgnomevfsmm/file-info.h> 00032 #include <libgnomevfsmm/uri.h> 00033 #include <libgnomevfsmm/transfer.h> 00034 00035 00036 namespace Gnome 00037 { 00038 00039 namespace Vfs 00040 { 00041 00043 namespace Async 00044 { 00045 00046 typedef Glib::ListHandle< Glib::RefPtr<const Uri> > ListHandleUris; 00047 00048 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00049 struct FileInfoResultTraits 00050 { 00051 typedef FileInfoResult CppType; 00052 typedef const GnomeVFSGetFileInfoResult* CType; 00053 typedef GnomeVFSGetFileInfoResult* CTypeNonConst; 00054 00055 static CType to_c_type (const CppType& obj) { return obj.gobj(); } 00056 static CType to_c_type (const CType& obj) { return obj; } 00057 static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CTypeNonConst>(obj), true); } 00058 static void release_c_type (const CType&) {} 00059 }; 00060 #endif //DOXYGEN_SHOULD_SKIP_THIS 00061 00062 typedef Glib::ListHandle< FileInfoResult, FileInfoResultTraits > ListHandleFileInfoResults; 00063 00064 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00065 struct FindDirectoryResultTraits 00066 { 00067 typedef FindDirectoryResult CppType; 00068 typedef const GnomeVFSFindDirectoryResult* CType; 00069 typedef GnomeVFSFindDirectoryResult* CTypeNonConst; 00070 00071 static CType to_c_type (const CppType& obj) { return obj.gobj(); } 00072 static CType to_c_type (const CType& obj) { return obj; } 00073 static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CTypeNonConst>(obj), true); } 00074 static void release_c_type (const CType&) {} 00075 }; 00076 #endif //DOXYGEN_SHOULD_SKIP_THIS 00077 00078 typedef Glib::ListHandle< FindDirectoryResult, FindDirectoryResultTraits > ListHandleFindDirectoryResult; 00079 00080 00081 //The default constructor creates a null handle. Use an open*() method before anything else. 00082 class Handle 00083 { 00084 public: 00085 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00086 typedef Handle CppObjectType; 00087 typedef GnomeVFSAsyncHandle BaseObjectType; 00088 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00089 00090 private: 00091 00092 00093 public: 00094 Handle(); 00095 ~Handle(); 00096 00097 typedef sigc::slot<void, const Async::Handle&, Result> SlotOpen; 00098 typedef SlotOpen SlotClose; 00099 00100 void open(const Glib::ustring& text_uri, OpenMode open_mode, int priority, const SlotOpen& slot); 00101 void open(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, int priority, const SlotOpen& slot); 00102 00103 typedef sigc::slot<void, const Async::Handle&, const Glib::RefPtr<Glib::IOChannel>&, Result> SlotOpenAsChannel; 00104 void open_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot); 00105 void open_as_channel(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot); 00106 00107 void create(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot); 00108 void create(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot); 00109 00110 void create_symbolic_link(const Glib::RefPtr<Uri>& uri, const Glib::ustring& uri_reference, int priority, const SlotOpen& slot); 00111 00112 typedef SlotOpenAsChannel SlotCreateAsChannel; 00113 void create_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot); 00114 //gnome_vfs_async_create_uri_as_channel() is declared, but not defined in gnome-vfs. 00115 //void create_as_channel(const Glib::RefPtr<Uri> uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot); 00116 00117 void close(const SlotClose& slot); 00118 00119 typedef sigc::slot<void, const Async::Handle&, Result, gpointer, FileSize, FileSize> SlotRead; 00120 void read(gpointer buffer, guint bytes, const SlotRead& slot); 00121 00122 typedef sigc::slot<void, const Async::Handle&, Result, gconstpointer, FileSize, FileSize> SlotWrite; 00123 void write(gconstpointer buffer, guint bytes, const SlotWrite& slot); 00124 00125 typedef sigc::slot<void, const Async::Handle&, ListHandleFileInfoResults > SlotGetFileInfo; 00126 void get_file_info(const ListHandleUris& uri_list, FileInfoOptions options, int priority, const SlotGetFileInfo& slot) const; 00127 00128 typedef sigc::slot<void, const Async::Handle&, Result, const Glib::RefPtr<FileInfo>& > SlotSetFileInfo; 00129 void set_file_info(const Glib::RefPtr<Uri>& uri, const Glib::RefPtr<FileInfo>& info, SetFileInfoMask mask, FileInfoOptions options, int priority, const SlotSetFileInfo& slot); 00130 00131 typedef sigc::slot<void, const Async::Handle&, Result, Glib::ListHandle<Glib::RefPtr<FileInfo> >, int> SlotLoadDirectory; 00132 void load_directory(const Glib::ustring& text_uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot); 00133 void load_directory(const Glib::RefPtr<Uri>& uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot); 00134 00135 typedef sigc::slot<int, const Async::Handle&, Transfer::ProgressInfo&> SlotTransferProgress; 00136 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00137 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 Transfer::SlotProgress& progress_sync_callback); 00138 #else 00139 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 Transfer::SlotProgress& progress_sync_callback, std::auto_ptr<Gnome::Vfs::exception>& error); 00140 #endif 00141 00142 typedef sigc::slot<void, const Async::Handle&, ListHandleFindDirectoryResult > SlotFindDirectory; 00143 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); 00144 00145 typedef sigc::slot<void, const Async::Handle&, Result, gpointer> SlotFileControl; 00146 void file_control(const Glib::ustring& operation, gpointer operation_data, const SlotFileControl& slot); 00147 00148 00154 void cancel(); 00155 00156 GnomeVFSAsyncHandle* gobj() { return gobject_; } 00157 const GnomeVFSAsyncHandle* gobj() const { return gobject_; } 00158 GnomeVFSAsyncHandle** gobj_addr() { return &gobject_; } 00159 00160 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00161 void assign_gobj(GnomeVFSAsyncHandle* src); 00162 #endif 00163 00164 protected: 00165 GnomeVFSAsyncHandle* gobject_; 00166 00167 private: 00168 Handle(const Handle&); 00169 Handle& operator=(const Handle&); 00170 00171 00172 }; 00173 00174 } // namespace Async 00175 } // namespace Vfs 00176 } // namespace Gnome 00177 00178 00179 #endif /* _LIBGNOMEVFSMM_ASYNC_HANDLE_H */ 00180