421ace2acc59863dfb0df824b77867c040c61027
[captive.git] / src / libcaptive / include / captive / client-file.h
1 /* $Id$
2  * Include file with client-application 'file' access to libcaptive
3  * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #ifndef _CAPTIVE_CLIENT_FILE_H
21 #define _CAPTIVE_CLIENT_FILE_H 1
22
23
24 #include <glib/gmacros.h>
25 #include <glib-object.h>
26 #include <libgnomevfs/gnome-vfs-handle.h>       /* for GnomeVFSOpenMode */
27 #include "captive/client-vfs.h"
28
29
30 G_BEGIN_DECLS
31
32 #define CAPTIVE_FILE_TYPE_OBJECT            (captive_file_object_get_type())
33 #define CAPTIVE_FILE_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_CAST((object),CAPTIVE_FILE_TYPE_OBJECT,CaptiveFileObject))
34 #define CAPTIVE_FILE_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),CAPTIVE_FILE_TYPE_OBJECT,CaptiveFileObjectClass))
35 #define CAPTIVE_FILE_IS_OBJECT(object)      (G_TYPE_CHECK_INSTANCE_TYPE((object),CAPTIVE_FILE_TYPE_OBJECT))
36 #define CAPTIVE_FILE_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),CAPTIVE_FILE_TYPE_OBJECT))
37 #define CAPTIVE_FILE_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),CAPTIVE_FILE_TYPE_OBJECT,CaptiveFileObjectClass))
38 typedef struct _CaptiveFileObject      CaptiveFileObject;
39 typedef struct _CaptiveFileObjectClass CaptiveFileObjectClass;
40
41
42 GType captive_file_object_get_type(void);
43
44 GnomeVFSResult captive_file_new_open(CaptiveFileObject **captive_file_object_return,
45                 CaptiveVfsObject *captive_vfs_object,const gchar *pathname,GnomeVFSOpenMode mode);
46 GnomeVFSResult captive_file_new_create(CaptiveFileObject **captive_file_object_return,
47                 CaptiveVfsObject *captive_vfs_object,const gchar *pathname,GnomeVFSOpenMode mode,gboolean exclusive,guint perm);
48 CaptiveVfsObject *captive_file_ref_vfs(CaptiveFileObject *captive_file_object);
49 GnomeVFSResult captive_file_read(CaptiveFileObject *captive_file_object,
50                 gpointer buffer,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_read_return);
51 GnomeVFSResult captive_file_write(CaptiveFileObject *captive_file_object,
52                 gconstpointer buffer,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_written_return);
53 GnomeVFSResult captive_file_seek
54                 (CaptiveFileObject *captive_file_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset);
55 GnomeVFSResult captive_file_tell(CaptiveFileObject *captive_file_object,GnomeVFSFileOffset *offset_return);
56 GnomeVFSResult captive_file_remove(CaptiveFileObject *captive_file_object);
57 GnomeVFSResult captive_file_file_info_get(CaptiveFileObject *captive_file_object,
58                 GnomeVFSFileInfo *file_info);
59 GnomeVFSResult captive_file_file_info_set(CaptiveFileObject *captive_file_object,
60                 const GnomeVFSFileInfo *info,GnomeVFSSetFileInfoMask mask);
61 GnomeVFSResult captive_file_truncate(CaptiveFileObject *captive_file_object,GnomeVFSFileSize file_size);
62 GnomeVFSResult captive_file_move(CaptiveFileObject *captive_file_object_old,const gchar *pathname_new,gboolean force_replace);
63
64 G_END_DECLS
65
66
67 #endif /* _CAPTIVE_CLIENT_FILE_H */