Mercurial > audlegacy
annotate libaudacious/vfs.h @ 2087:bc47a2129067 trunk
[svn] - update these files
author | nenolod |
---|---|
date | Mon, 11 Dec 2006 04:30:50 -0800 |
parents | 53a3d5db6b58 |
children | f18a5b617c34 |
rev | line source |
---|---|
1974 | 1 /* |
2 * Audacious | |
3 * Copyright (c) 2006 Audacious team | |
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; either version 2 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program; if not, write to the Free Software | |
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
18 */ | |
19 | |
0 | 20 #ifndef VFS_H |
21 #define VFS_H | |
22 | |
23 #include <glib.h> | |
24 #include <stdio.h> | |
25 | |
26 typedef struct _VFSFile VFSFile; | |
1975 | 27 typedef struct _VFSConstructor VFSConstructor; |
28 | |
2060 | 29 /** |
30 * VFSFile: | |
31 * @uri: The URI of the stream. | |
32 * @handle: Opaque data used by the transport plugins. | |
33 * @base: The base vtable used for VFS functions. | |
34 * | |
35 * #VFSFile objects describe a VFS stream. | |
36 **/ | |
1975 | 37 struct _VFSFile { |
38 gchar *uri; | |
39 gpointer handle; | |
40 VFSConstructor *base; | |
41 }; | |
0 | 42 |
2060 | 43 /** |
44 * VFSConstructor: | |
45 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams. | |
46 * @vfs_fopen_impl: A function pointer which points to a fopen implementation. | |
47 * @vfs_fclose_impl: A function pointer which points to a fclose implementation. | |
48 * @vfs_fread_impl: A function pointer which points to a fread implementation. | |
49 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation. | |
50 * @vfs_getc_impl: A function pointer which points to a getc implementation. | |
51 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation. | |
52 * @vfs_fseek_impl: A function pointer which points to a fseek implementation. | |
53 * @vfs_rewind_impl: A function pointer which points to a rewind implementation. | |
54 * @vfs_ftell_impl: A function pointer which points to a ftell implementation. | |
55 * @vfs_feof_impl: A function pointer which points to a feof implementation. | |
56 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation. | |
57 * | |
58 * #VFSConstructor objects contain the base vtables used for extrapolating | |
59 * a VFS stream. #VFSConstructor objects should be considered %virtual in | |
60 * nature. VFS base vtables are registered via vfs_register_transport(). | |
61 **/ | |
1974 | 62 struct _VFSConstructor { |
63 gchar *uri_id; | |
64 VFSFile *(*vfs_fopen_impl)(const gchar *path, | |
65 const gchar *mode); | |
66 gint (*vfs_fclose_impl)(VFSFile * file); | |
67 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, | |
68 size_t nmemb, VFSFile *file); | |
1975 | 69 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, |
70 size_t nmemb, VFSFile *file); | |
71 gint (*vfs_getc_impl)(VFSFile *stream); | |
1974 | 72 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream); |
73 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence); | |
74 void (*vfs_rewind_impl)(VFSFile *file); | |
75 glong (*vfs_ftell_impl)(VFSFile *file); | |
76 gboolean (*vfs_feof_impl)(VFSFile *file); | |
77 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); | |
78 }; | |
79 | |
0 | 80 G_BEGIN_DECLS |
81 | |
830 | 82 extern VFSFile * vfs_fopen(const gchar * path, |
0 | 83 const gchar * mode); |
830 | 84 extern gint vfs_fclose(VFSFile * file); |
0 | 85 |
830 | 86 extern size_t vfs_fread(gpointer ptr, |
0 | 87 size_t size, |
88 size_t nmemb, | |
89 VFSFile * file); | |
830 | 90 extern size_t vfs_fwrite(gconstpointer ptr, |
0 | 91 size_t size, |
92 size_t nmemb, | |
93 VFSFile *file); | |
94 | |
1683
e9c24e35bd76
[svn] - File stream API for audacious vfs; uses real getc/ungetc functions for vfs_stdio and emulated functions for vfs_gnome
giacomo
parents:
1669
diff
changeset
|
95 extern gint vfs_getc(VFSFile *stream); |
e9c24e35bd76
[svn] - File stream API for audacious vfs; uses real getc/ungetc functions for vfs_stdio and emulated functions for vfs_gnome
giacomo
parents:
1669
diff
changeset
|
96 extern gint vfs_ungetc(gint c, |
e9c24e35bd76
[svn] - File stream API for audacious vfs; uses real getc/ungetc functions for vfs_stdio and emulated functions for vfs_gnome
giacomo
parents:
1669
diff
changeset
|
97 VFSFile *stream); |
1617 | 98 extern gchar *vfs_fgets(gchar *s, |
99 gint n, | |
100 VFSFile *stream); | |
101 | |
830 | 102 extern gint vfs_fseek(VFSFile * file, |
0 | 103 glong offset, |
104 gint whence); | |
830 | 105 extern void vfs_rewind(VFSFile * file); |
106 extern glong vfs_ftell(VFSFile * file); | |
107 extern gboolean vfs_feof(VFSFile * file); | |
0 | 108 |
830 | 109 extern gboolean vfs_file_test(const gchar * path, |
0 | 110 GFileTest test); |
811
86ca43d8a845
[svn] - implement vfs_feof() and vfs_ftell() and update the scrobbler plugin to reflect that,
nenolod
parents:
0
diff
changeset
|
111 |
830 | 112 extern gboolean vfs_is_writeable(const gchar * path); |
0 | 113 |
830 | 114 extern gboolean vfs_truncate(VFSFile * file, glong length); |
0 | 115 |
1669
07143b97314d
[svn] fprintf implementation in the VFS common layer by Luca Barbato. Use it in the Container plugins.
chainsaw
parents:
1617
diff
changeset
|
116 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) |
07143b97314d
[svn] fprintf implementation in the VFS common layer by Luca Barbato. Use it in the Container plugins.
chainsaw
parents:
1617
diff
changeset
|
117 __attribute__ ((__format__ (__printf__, 2, 3))); |
0 | 118 |
1997 | 119 extern gboolean vfs_register_transport(VFSConstructor *vtable); |
120 | |
0 | 121 G_END_DECLS |
122 | |
123 #endif /* VFS_H */ |