source: trunk/third/gnome-vfs/libgnomevfs/gnome-vfs-method.h @ 15858

Revision 15858, 7.9 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15857, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2/* gnome-vfs-method.h - Virtual class for access methods in the GNOME
3   Virtual File System.
4
5   Copyright (C) 1999 Free Software Foundation
6
7   The Gnome Library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Library General Public License as
9   published by the Free Software Foundation; either version 2 of the
10   License, or (at your option) any later version.
11
12   The Gnome Library is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Library General Public License for more details.
16
17   You should have received a copy of the GNU Library General Public
18   License along with the Gnome Library; see the file COPYING.LIB.  If not,
19   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20   Boston, MA 02111-1307, USA.
21
22   Author: Ettore Perazzoli <ettore@comm2000.it> */
23
24#ifndef _GNOME_VFS_METHOD_H
25#define _GNOME_VFS_METHOD_H
26
27#define _GNOME_VFS_METHOD_PARAM_CHECK(expression)                       \
28        g_return_val_if_fail ((expression), GNOME_VFS_ERROR_BAD_PARAMETERS);
29
30
31typedef GnomeVFSMethod * (* GnomeVFSMethodInitFunc)(const char *method_name, const char *config_args);
32typedef void (*GnomeVFSMethodShutdownFunc)(GnomeVFSMethod *method);
33
34typedef GnomeVFSResult (* GnomeVFSMethodOpenFunc)
35                                        (GnomeVFSMethod *method,
36                                         GnomeVFSMethodHandle
37                                        **method_handle_return,
38                                         GnomeVFSURI *uri,
39                                         GnomeVFSOpenMode mode,
40                                         GnomeVFSContext *context);
41
42typedef GnomeVFSResult (* GnomeVFSMethodCreateFunc)
43                                        (GnomeVFSMethod *method,
44                                         GnomeVFSMethodHandle
45                                        **method_handle_return,
46                                         GnomeVFSURI *uri,
47                                         GnomeVFSOpenMode mode,
48                                         gboolean exclusive,
49                                         guint perm,
50                                         GnomeVFSContext *context);
51
52typedef GnomeVFSResult (* GnomeVFSMethodCloseFunc)
53                                        (GnomeVFSMethod *method,
54                                         GnomeVFSMethodHandle *method_handle,
55                                         GnomeVFSContext *context);
56
57typedef GnomeVFSResult (* GnomeVFSMethodReadFunc)
58                                        (GnomeVFSMethod *method,
59                                         GnomeVFSMethodHandle *method_handle,
60                                         gpointer buffer,
61                                         GnomeVFSFileSize num_bytes,
62                                         GnomeVFSFileSize *bytes_read_return,
63                                         GnomeVFSContext *context);
64
65typedef GnomeVFSResult (* GnomeVFSMethodWriteFunc)
66                                        (GnomeVFSMethod *method,
67                                         GnomeVFSMethodHandle *method_handle,
68                                         gconstpointer buffer,
69                                         GnomeVFSFileSize num_bytes,
70                                         GnomeVFSFileSize *bytes_written_return,
71                                         GnomeVFSContext *context);
72
73typedef GnomeVFSResult (* GnomeVFSMethodSeekFunc)
74                                        (GnomeVFSMethod *method,
75                                         GnomeVFSMethodHandle *method_handle,
76                                         GnomeVFSSeekPosition  whence,
77                                         GnomeVFSFileOffset    offset,
78                                         GnomeVFSContext *context);
79
80typedef GnomeVFSResult (* GnomeVFSMethodTellFunc)
81                                        (GnomeVFSMethod *method,
82                                         GnomeVFSMethodHandle *method_handle,
83                                         GnomeVFSFileOffset *offset_return);
84
85typedef GnomeVFSResult (* GnomeVFSMethodOpenDirectoryFunc)
86                                        (GnomeVFSMethod *method,
87                                         GnomeVFSMethodHandle **method_handle,
88                                         GnomeVFSURI *uri,
89                                         GnomeVFSFileInfoOptions options,
90                                         const GnomeVFSDirectoryFilter *filter,
91                                         GnomeVFSContext *context);
92
93typedef GnomeVFSResult (* GnomeVFSMethodCloseDirectoryFunc)
94                                        (GnomeVFSMethod *method,
95                                         GnomeVFSMethodHandle *method_handle,
96                                         GnomeVFSContext *context);
97
98typedef GnomeVFSResult (* GnomeVFSMethodReadDirectoryFunc)
99                                        (GnomeVFSMethod *method,
100                                         GnomeVFSMethodHandle *method_handle,
101                                         GnomeVFSFileInfo *file_info,
102                                         GnomeVFSContext *context);
103
104typedef GnomeVFSResult (* GnomeVFSMethodGetFileInfoFunc)
105                                        (GnomeVFSMethod *method,
106                                         GnomeVFSURI *uri,
107                                         GnomeVFSFileInfo *file_info,
108                                         GnomeVFSFileInfoOptions options,
109                                         GnomeVFSContext *context);
110
111typedef GnomeVFSResult (* GnomeVFSMethodGetFileInfoFromHandleFunc)
112                                        (GnomeVFSMethod *method,
113                                         GnomeVFSMethodHandle *method_handle,
114                                         GnomeVFSFileInfo *file_info,
115                                         GnomeVFSFileInfoOptions options,
116                                         GnomeVFSContext *context);
117
118typedef GnomeVFSResult (* GnomeVFSMethodTruncateFunc) (GnomeVFSMethod *method,
119                                                       GnomeVFSURI *uri,
120                                                       GnomeVFSFileSize length,
121                                                       GnomeVFSContext *context);
122typedef GnomeVFSResult (* GnomeVFSMethodTruncateHandleFunc) (GnomeVFSMethod *method,
123                                                             GnomeVFSMethodHandle *handle,
124                                                             GnomeVFSFileSize length,
125                                                             GnomeVFSContext *context);
126
127typedef gboolean       (* GnomeVFSMethodIsLocalFunc)
128                                        (GnomeVFSMethod *method,
129                                         const GnomeVFSURI *uri);
130
131typedef GnomeVFSResult (* GnomeVFSMethodMakeDirectoryFunc)
132                                        (GnomeVFSMethod *method,
133                                         GnomeVFSURI *uri,
134                                         guint perm,
135                                         GnomeVFSContext *context);
136
137typedef GnomeVFSResult (* GnomeVFSMethodFindDirectoryFunc)
138                                        (GnomeVFSMethod *method,
139                                         GnomeVFSURI *find_near_uri,
140                                         GnomeVFSFindDirectoryKind kind,
141                                         GnomeVFSURI **result_uri,
142                                         gboolean create_if_needed,
143                                         gboolean find_if_needed,
144                                         guint perm,
145                                         GnomeVFSContext *context);
146
147typedef GnomeVFSResult (* GnomeVFSMethodRemoveDirectoryFunc)
148                                        (GnomeVFSMethod *method,
149                                         GnomeVFSURI *uri,
150                                         GnomeVFSContext *context);
151
152typedef GnomeVFSResult (* GnomeVFSMethodMoveFunc)
153                                        (GnomeVFSMethod *method,
154                                         GnomeVFSURI *old_uri,
155                                         GnomeVFSURI *new_uri,
156                                         gboolean force_replace,
157                                         GnomeVFSContext *context);
158
159typedef GnomeVFSResult (* GnomeVFSMethodUnlinkFunc)
160                                        (GnomeVFSMethod *method,
161                                         GnomeVFSURI *uri,
162                                         GnomeVFSContext *context);
163
164typedef GnomeVFSResult (* GnomeVFSMethodCheckSameFSFunc)
165                                        (GnomeVFSMethod *method,
166                                         GnomeVFSURI *a,
167                                         GnomeVFSURI *b,
168                                         gboolean *same_fs_return,
169                                         GnomeVFSContext *context);
170
171typedef GnomeVFSResult (* GnomeVFSMethodSetFileInfo)
172                                        (GnomeVFSMethod *method,
173                                         GnomeVFSURI *a,
174                                         const GnomeVFSFileInfo *info,
175                                         GnomeVFSSetFileInfoMask mask,
176                                         GnomeVFSContext *context);
177
178typedef GnomeVFSResult (* GnomeVFSMethodCreateSymbolicLinkFunc)
179                                        (GnomeVFSMethod *method,
180                                         GnomeVFSURI *uri,
181                                         const gchar *target_reference,
182                                         GnomeVFSContext *context);
183
184
185
186/* Use this macro to test whether a given function is implemented in
187 * a given GnomeVFSMethod.  Note that it checks the expected size of the structure
188 * prior to testing NULL.
189 */
190 
191#define VFS_METHOD_HAS_FUNC(method,func) ((((char *)&((method)->func)) - ((char *)(method)) < (method)->method_table_size) && method->func != NULL)
192
193/* Structure defining an access method.  This is also defined as an
194   opaque type in `gnome-vfs-types.h'.  */
195struct GnomeVFSMethod {
196        size_t method_table_size;                       /* Used for versioning */
197        GnomeVFSMethodOpenFunc open;
198        GnomeVFSMethodCreateFunc create;
199        GnomeVFSMethodCloseFunc close;
200        GnomeVFSMethodReadFunc read;
201        GnomeVFSMethodWriteFunc write;
202        GnomeVFSMethodSeekFunc seek;
203        GnomeVFSMethodTellFunc tell;
204        GnomeVFSMethodTruncateHandleFunc truncate_handle;
205        GnomeVFSMethodOpenDirectoryFunc open_directory;
206        GnomeVFSMethodCloseDirectoryFunc close_directory;
207        GnomeVFSMethodReadDirectoryFunc read_directory;
208        GnomeVFSMethodGetFileInfoFunc get_file_info;
209        GnomeVFSMethodGetFileInfoFromHandleFunc get_file_info_from_handle;
210        GnomeVFSMethodIsLocalFunc is_local;
211        GnomeVFSMethodMakeDirectoryFunc make_directory;
212        GnomeVFSMethodRemoveDirectoryFunc remove_directory;
213        GnomeVFSMethodMoveFunc move;
214        GnomeVFSMethodUnlinkFunc unlink;
215        GnomeVFSMethodCheckSameFSFunc check_same_fs;
216        GnomeVFSMethodSetFileInfo set_file_info;
217        GnomeVFSMethodTruncateFunc truncate;
218        GnomeVFSMethodFindDirectoryFunc find_directory;
219        GnomeVFSMethodCreateSymbolicLinkFunc create_symbolic_link;
220};
221
222gboolean           gnome_vfs_method_init   (void);
223GnomeVFSMethod    *gnome_vfs_method_get    (const gchar *name);
224GnomeVFSTransform *gnome_vfs_transform_get (const gchar *name);
225
226#endif /* _GNOME_VFS_METHOD_H */
Note: See TracBrowser for help on using the repository browser.