libgnomevfsmm  2.26.0
async-handle.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _LIBGNOMEVFSMM_ASYNC_HANDLE_H
4 #define _LIBGNOMEVFSMM_ASYNC_HANDLE_H
5 
6 
7 #include <glibmm.h>
8 
9 /* Copyright 2003 gnome-vfsmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 #include <libgnomevfs/gnome-vfs-async-ops.h>
27 #include <libgnomevfs/gnome-vfs-file-info.h>
28 
30 #include <libgnomevfsmm/enums.h>
32 #include <libgnomevfsmm/uri.h>
33 #include <libgnomevfsmm/transfer.h>
34 
35 
36 namespace Gnome
37 {
38 
39 namespace Vfs
40 {
41 
43 namespace Async
44 {
45 
46 typedef Glib::ListHandle< Glib::RefPtr<const Uri> > ListHandleUris;
47 
48 #ifndef DOXYGEN_SHOULD_SKIP_THIS
49 struct FileInfoResultTraits
50 {
51  typedef FileInfoResult CppType;
52  typedef const GnomeVFSGetFileInfoResult* CType;
53  typedef GnomeVFSGetFileInfoResult* CTypeNonConst;
54 
55  static CType to_c_type (const CppType& obj) { return obj.gobj(); }
56  static CType to_c_type (const CType& obj) { return obj; }
57  static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CTypeNonConst>(obj), true); }
58  static void release_c_type (const CType&) {}
59 };
60 #endif //DOXYGEN_SHOULD_SKIP_THIS
61 
62 typedef Glib::ListHandle< FileInfoResult, FileInfoResultTraits > ListHandleFileInfoResults;
63 
64 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65 struct FindDirectoryResultTraits
66 {
67  typedef FindDirectoryResult CppType;
68  typedef const GnomeVFSFindDirectoryResult* CType;
69  typedef GnomeVFSFindDirectoryResult* CTypeNonConst;
70 
71  static CType to_c_type (const CppType& obj) { return obj.gobj(); }
72  static CType to_c_type (const CType& obj) { return obj; }
73  static CppType to_cpp_type (const CType& obj) { return CppType(const_cast<CTypeNonConst>(obj), true); }
74  static void release_c_type (const CType&) {}
75 };
76 #endif //DOXYGEN_SHOULD_SKIP_THIS
77 
78 typedef Glib::ListHandle< FindDirectoryResult, FindDirectoryResultTraits > ListHandleFindDirectoryResult;
79 
80 
81 //The default constructor creates a null handle. Use an open*() method before anything else.
82 class Handle
83 {
84  public:
85 #ifndef DOXYGEN_SHOULD_SKIP_THIS
86  typedef Handle CppObjectType;
87  typedef GnomeVFSAsyncHandle BaseObjectType;
88 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
89 
90 private:
91 
92 
93 public:
94  Handle();
95  ~Handle();
96 
97  typedef sigc::slot<void, const Async::Handle&, Result> SlotOpen;
99 
100  void open(const Glib::ustring& text_uri, OpenMode open_mode, int priority, const SlotOpen& slot);
101  void open(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, int priority, const SlotOpen& slot);
102 
103  typedef sigc::slot<void, const Async::Handle&, const Glib::RefPtr<Glib::IOChannel>&, Result> SlotOpenAsChannel;
104  void open_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot);
105  void open_as_channel(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, guint advised_block_size, int priority, const SlotOpenAsChannel& slot);
106 
107  void create(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot);
108  void create(const Glib::RefPtr<Uri>& uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotOpen& slot);
109 
110  void create_symbolic_link(const Glib::RefPtr<Uri>& uri, const Glib::ustring& uri_reference, int priority, const SlotOpen& slot);
111 
113  void create_as_channel(const Glib::ustring& text_uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot);
114  //gnome_vfs_async_create_uri_as_channel() is declared, but not defined in gnome-vfs.
115  //void create_as_channel(const Glib::RefPtr<Uri> uri, OpenMode open_mode, bool exclusive, guint perm, int priority, const SlotCreateAsChannel& slot);
116 
117  void close(const SlotClose& slot);
118 
119  typedef sigc::slot<void, const Async::Handle&, Result, gpointer, FileSize, FileSize> SlotRead;
120  void read(gpointer buffer, guint bytes, const SlotRead& slot);
121 
122  typedef sigc::slot<void, const Async::Handle&, Result, gconstpointer, FileSize, FileSize> SlotWrite;
123  void write(gconstpointer buffer, guint bytes, const SlotWrite& slot);
124 
125  typedef sigc::slot<void, const Async::Handle&, ListHandleFileInfoResults > SlotGetFileInfo;
126  void get_file_info(const ListHandleUris& uri_list, FileInfoOptions options, int priority, const SlotGetFileInfo& slot) const;
127 
128  typedef sigc::slot<void, const Async::Handle&, Result, const Glib::RefPtr<FileInfo>& > SlotSetFileInfo;
129  void set_file_info(const Glib::RefPtr<Uri>& uri, const Glib::RefPtr<FileInfo>& info, SetFileInfoMask mask, FileInfoOptions options, int priority, const SlotSetFileInfo& slot);
130 
131  typedef sigc::slot<void, const Async::Handle&, Result, Glib::ListHandle<Glib::RefPtr<FileInfo> >, int> SlotLoadDirectory;
132  void load_directory(const Glib::ustring& text_uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot);
133  void load_directory(const Glib::RefPtr<Uri>& uri, FileInfoOptions options, guint items_per_notification, int priority, const SlotLoadDirectory& slot);
134 
135  typedef sigc::slot<int, const Async::Handle&, Transfer::ProgressInfo&> SlotTransferProgress;
136 #ifdef GLIBMM_EXCEPTIONS_ENABLED
137  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);
138 #else
139  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);
140 #endif
141 
142  typedef sigc::slot<void, const Async::Handle&, ListHandleFindDirectoryResult > SlotFindDirectory;
143  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);
144 
145  typedef sigc::slot<void, const Async::Handle&, Result, gpointer> SlotFileControl;
146  void file_control(const Glib::ustring& operation, gpointer operation_data, const SlotFileControl& slot);
147 
148 
154  void cancel();
155 
156  GnomeVFSAsyncHandle* gobj() { return gobject_; }
157  const GnomeVFSAsyncHandle* gobj() const { return gobject_; }
158  GnomeVFSAsyncHandle** gobj_addr() { return &gobject_; }
159 
160 #ifndef DOXYGEN_SHOULD_SKIP_THIS
161  void assign_gobj(GnomeVFSAsyncHandle* src);
162 #endif
163 
164 protected:
165  GnomeVFSAsyncHandle* gobject_;
166 
167 private:
168  Handle(const Handle&);
169  Handle& operator=(const Handle&);
170 
171 
172 };
173 
174 } // namespace Async
175 } // namespace Vfs
176 } // namespace Gnome
177 
178 
179 #endif /* _LIBGNOMEVFSMM_ASYNC_HANDLE_H */
180