async-handle.h

Go to the documentation of this file.
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 Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2 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  * Library General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Library 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/enums.h>
00030 #include <libgnomevfsmm/file-info.h>
00031 #include <libgnomevfsmm/uri.h>
00032 #include <libgnomevfsmm/transfer.h>
00033 
00034 
00035 namespace Gnome
00036 {
00037 
00038 namespace Vfs
00039 {
00040 
00041 class FileInfoResult
00042 {
00043   public:
00044 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00045   typedef FileInfoResult CppObjectType;
00046   typedef GnomeVFSGetFileInfoResult BaseObjectType;
00047 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00048 
00049   FileInfoResult();
00050 
00051   // Use make_a_copy=true when getting it directly from a struct.
00052   explicit FileInfoResult(GnomeVFSGetFileInfoResult* castitem, bool make_a_copy = false);
00053 
00054   FileInfoResult(const FileInfoResult& src);
00055   FileInfoResult& operator=(const FileInfoResult& src);
00056 
00057   ~FileInfoResult();
00058 
00059   GnomeVFSGetFileInfoResult*       gobj()       { return gobject_; }
00060   const GnomeVFSGetFileInfoResult* gobj() const { return gobject_; }
00061 
00063   GnomeVFSGetFileInfoResult* gobj_copy() const;
00064 
00065 protected:
00066   GnomeVFSGetFileInfoResult* gobject_;
00067 
00068 private:
00069 
00070   
00071 public:
00072 
00073    Glib::RefPtr<Uri> get_uri() const;
00074     Result get_result() const;
00075     Glib::RefPtr<FileInfo> get_file_info() const;
00076  
00077 
00078 };
00079 
00080 
00081 class FindDirectoryResult
00082 {
00083   public:
00084 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00085   typedef FindDirectoryResult CppObjectType;
00086   typedef GnomeVFSFindDirectoryResult BaseObjectType;
00087 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00088 
00089   FindDirectoryResult();
00090 
00091   // Use make_a_copy=true when getting it directly from a struct.
00092   explicit FindDirectoryResult(GnomeVFSFindDirectoryResult* castitem, bool make_a_copy = false);
00093 
00094   FindDirectoryResult(const FindDirectoryResult& src);
00095   FindDirectoryResult& operator=(const FindDirectoryResult& src);
00096 
00097   ~FindDirectoryResult();
00098 
00099   GnomeVFSFindDirectoryResult*       gobj()       { return gobject_; }
00100   const GnomeVFSFindDirectoryResult* gobj() const { return gobject_; }
00101 
00103   GnomeVFSFindDirectoryResult* gobj_copy() const;
00104 
00105 protected:
00106   GnomeVFSFindDirectoryResult* gobject_;
00107 
00108 private:
00109 
00110   
00111    Glib::RefPtr<Uri> get_uri() const;
00112     Result get_result() const;
00113  
00114 
00115 };
00116 
00117 
00123 enum FindDirectoryKind
00124 {
00125   DIRECTORY_KIND_DESKTOP = 1000,
00126   DIRECTORY_KIND_TRASH
00127 };
00128 
00129 
00130 namespace Async
00131 {
00132 
00133 typedef Glib::ListHandle< Glib::RefPtr<const Uri> > ListHandleUris;
00134 
00135 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00136 struct FileInfoResultTraits
00137 {
00138   typedef FileInfoResult  CppType;
00139   typedef const GnomeVFSGetFileInfoResult*    CType;
00140   typedef GnomeVFSGetFileInfoResult*    CTypeNonConst;
00141 
00142   static CType   to_c_type      (const CppType& obj) { return obj.gobj(); }
00143   static CType   to_c_type      (const CType&   obj) { return obj; }
00144   static CppType to_cpp_type    (const CType&   obj) { return CppType(const_cast<CTypeNonConst>(obj), true); }
00145   static void    release_c_type (const CType&)       {}
00146 };
00147 #endif //DOXYGEN_SHOULD_SKIP_THIS
00148 
00149 typedef Glib::ListHandle< FileInfoResult, FileInfoResultTraits > ListHandleFileInfoResults;
00150 
00151 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00152 struct FindDirectoryResultTraits
00153 {
00154   typedef FindDirectoryResult  CppType;
00155   typedef const GnomeVFSFindDirectoryResult*    CType;
00156   typedef GnomeVFSFindDirectoryResult*    CTypeNonConst;
00157 
00158   static CType   to_c_type      (const CppType& obj) { return obj.gobj(); }
00159   static CType   to_c_type      (const CType&   obj) { return obj; }
00160   static CppType to_cpp_type    (const CType&   obj) { return CppType(const_cast<CTypeNonConst>(obj), true); }
00161   static void    release_c_type (const CType&)       {}
00162 };
00163 #endif //DOXYGEN_SHOULD_SKIP_THIS
00164 
00165 typedef Glib::ListHandle< FindDirectoryResult, FindDirectoryResultTraits > ListHandleFindDirectoryResult;
00166 
00167 
00168 //The default constructor creates a null handle. Use an open*() method before anything else.
00169 class Handle
00170 {
00171   public:
00172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00173   typedef Handle CppObjectType;
00174   typedef GnomeVFSAsyncHandle BaseObjectType;
00175 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00176 
00177 private:
00178 
00179   
00180 public:
00181   Handle();
00182   ~Handle();
00183 
00184   typedef sigc::slot<void, const Async::Handle&, Result> SlotOpen;
00185   typedef SlotOpen SlotClose;
00186 
00187   void open(const Glib::ustring& text_uri, OpenMode open_mode, int priority, const SlotOpen& slot);
00188   void open(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, int priority, const SlotOpen& slot);
00189 
00190   typedef sigc::slot<void, const Async::Handle&, const Glib::RefPtr<Glib::IOChannel>&, Result> SlotOpenAsChannel;
00191   void open_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot);
00192   void open_as_channel(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot);
00193 
00194   void create(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot);
00195   void create(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot);
00196 
00197   void create_symbolic_link(const Glib::RefPtr<Uri>& uri, const Glib::ustring& uri_reference, int priority, const SlotOpen& slot);
00198 
00199   typedef SlotOpenAsChannel SlotCreateAsChannel;
00200   void create_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot);
00201   //gnome_vfs_async_create_uri_as_channel() is declared, but not defined in gnome-vfs.
00202   //void create_as_channel(const Glib::RefPtr<Uri> uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot);
00203 
00204   void close(const SlotClose& slot);
00205 
00206   typedef sigc::slot<void, const Async::Handle&, Result, gpointer, FileSize, FileSize> SlotRead;
00207   void read(gpointer buffer, guint bytes, const SlotRead& slot);
00208 
00209   typedef sigc::slot<void, const Async::Handle&, Result, gconstpointer, FileSize, FileSize> SlotWrite;
00210   void write(gconstpointer buffer, guint bytes, const SlotWrite& slot);
00211 
00212   typedef sigc::slot<void, const Async::Handle&, ListHandleFileInfoResults > SlotGetFileInfo;
00213   void get_file_info(const ListHandleUris& uri_list, FileInfoOptions options, int priority, const SlotGetFileInfo& slot) const;
00214 
00215   typedef sigc::slot<void, const Async::Handle&, Result, const Glib::RefPtr<FileInfo>& > SlotSetFileInfo;
00216   void set_file_info(const Glib::RefPtr<Uri>& uri, const Glib::RefPtr<FileInfo>& info, SetFileInfoMask mask, FileInfoOptions options, int priority, const SlotSetFileInfo& slot);
00217 
00218   typedef sigc::slot<void, const Async::Handle&, Result, Glib::ListHandle<Glib::RefPtr<FileInfo> >, int> SlotLoadDirectory;
00219   void load_directory(const Glib::ustring& text_uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot);
00220   void load_directory(const Glib::RefPtr<Uri>& uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot);
00221 
00222   typedef sigc::slot<int, const Async::Handle&, Transfer::ProgressInfo&> SlotTransferProgress;
00223   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);
00224 
00225   typedef sigc::slot<void, const Async::Handle&, ListHandleFindDirectoryResult > SlotFindDirectory;
00226   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);
00227 
00228   typedef sigc::slot<void, const Async::Handle&, Result, gpointer> SlotFileControl;
00229   void file_control(const Glib::ustring& operation, gpointer operation_data, const SlotFileControl& slot);
00230 
00231   
00237   void cancel();
00238 
00239   GnomeVFSAsyncHandle*       gobj()       { return gobject_; }
00240   const GnomeVFSAsyncHandle* gobj() const { return gobject_; }
00241   GnomeVFSAsyncHandle**      gobj_addr()  { return &gobject_; }
00242   
00243 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00244   void assign_gobj(GnomeVFSAsyncHandle* src);
00245 #endif
00246 
00247 protected:
00248   GnomeVFSAsyncHandle* gobject_;
00249   
00250 private:
00251   Handle(const Handle&);
00252   Handle& operator=(const Handle&);
00253 
00254 
00255 };
00256 
00257 } // namespace Async
00258 } // namespace Vfs
00259 } // namespace Gnome
00260 
00261 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00262 namespace Glib
00263 {
00264 
00265 template <>
00266 class Value<Gnome::Vfs::FindDirectoryKind> : public Glib::Value_Flags<Gnome::Vfs::FindDirectoryKind>
00267 {
00268 public:
00269   static GType value_type() G_GNUC_CONST;
00270 };
00271 
00272 } // namespace Glib
00273 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00274 
00275 
00276 namespace Glib
00277 {
00278 
00284 Gnome::Vfs::FileInfoResult wrap(GnomeVFSGetFileInfoResult* object, bool take_copy = false);
00285 
00286 } // namespace Glib
00287 
00288 
00289 namespace Glib
00290 {
00291 
00297 Gnome::Vfs::FindDirectoryResult wrap(GnomeVFSFindDirectoryResult* object, bool take_copy = false);
00298 
00299 } // namespace Glib
00300 
00301 
00302 #endif /* _LIBGNOMEVFSMM_ASYNC_HANDLE_H */
00303 

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