Mercurial > audlegacy
annotate audacious/vfs.h @ 2210:165a62fdb49e trunk
[svn] - improve the presentation of the URL entry dialog
author | nenolod |
---|---|
date | Mon, 25 Dec 2006 08:44:29 -0800 |
parents | e0e50e151bab |
children | 329fb2453c87 |
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 | |
2105
f18a5b617c34
[svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents:
2060
diff
changeset
|
7 * the Free Software Foundation; under version 2 of the License. |
1974 | 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 */ | |
18 | |
0 | 19 #ifndef VFS_H |
20 #define VFS_H | |
21 | |
22 #include <glib.h> | |
23 #include <stdio.h> | |
24 | |
25 typedef struct _VFSFile VFSFile; | |
1975 | 26 typedef struct _VFSConstructor VFSConstructor; |
27 | |
2060 | 28 /** |
29 * VFSFile: | |
30 * @uri: The URI of the stream. | |
31 * @handle: Opaque data used by the transport plugins. | |
32 * @base: The base vtable used for VFS functions. | |
33 * | |
34 * #VFSFile objects describe a VFS stream. | |
35 **/ | |
1975 | 36 struct _VFSFile { |
37 gchar *uri; | |
38 gpointer handle; | |
39 VFSConstructor *base; | |
40 }; | |
0 | 41 |
2060 | 42 /** |
43 * VFSConstructor: | |
44 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams. | |
45 * @vfs_fopen_impl: A function pointer which points to a fopen implementation. | |
46 * @vfs_fclose_impl: A function pointer which points to a fclose implementation. | |
47 * @vfs_fread_impl: A function pointer which points to a fread implementation. | |
48 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation. | |
49 * @vfs_getc_impl: A function pointer which points to a getc implementation. | |
50 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation. | |
51 * @vfs_fseek_impl: A function pointer which points to a fseek implementation. | |
52 * @vfs_rewind_impl: A function pointer which points to a rewind implementation. | |
53 * @vfs_ftell_impl: A function pointer which points to a ftell implementation. | |
54 * @vfs_feof_impl: A function pointer which points to a feof implementation. | |
55 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation. | |
56 * | |
57 * #VFSConstructor objects contain the base vtables used for extrapolating | |
58 * a VFS stream. #VFSConstructor objects should be considered %virtual in | |
59 * nature. VFS base vtables are registered via vfs_register_transport(). | |
60 **/ | |
1974 | 61 struct _VFSConstructor { |
62 gchar *uri_id; | |
63 VFSFile *(*vfs_fopen_impl)(const gchar *path, | |
64 const gchar *mode); | |
65 gint (*vfs_fclose_impl)(VFSFile * file); | |
66 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, | |
67 size_t nmemb, VFSFile *file); | |
1975 | 68 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, |
69 size_t nmemb, VFSFile *file); | |
70 gint (*vfs_getc_impl)(VFSFile *stream); | |
1974 | 71 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream); |
72 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence); | |
73 void (*vfs_rewind_impl)(VFSFile *file); | |
74 glong (*vfs_ftell_impl)(VFSFile *file); | |
75 gboolean (*vfs_feof_impl)(VFSFile *file); | |
76 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); | |
77 }; | |
78 | |
0 | 79 G_BEGIN_DECLS |
80 | |
830 | 81 extern VFSFile * vfs_fopen(const gchar * path, |
0 | 82 const gchar * mode); |
830 | 83 extern gint vfs_fclose(VFSFile * file); |
0 | 84 |
830 | 85 extern size_t vfs_fread(gpointer ptr, |
0 | 86 size_t size, |
87 size_t nmemb, | |
88 VFSFile * file); | |
830 | 89 extern size_t vfs_fwrite(gconstpointer ptr, |
0 | 90 size_t size, |
91 size_t nmemb, | |
92 VFSFile *file); | |
93 | |
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
|
94 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
|
95 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
|
96 VFSFile *stream); |
1617 | 97 extern gchar *vfs_fgets(gchar *s, |
98 gint n, | |
99 VFSFile *stream); | |
100 | |
830 | 101 extern gint vfs_fseek(VFSFile * file, |
0 | 102 glong offset, |
103 gint whence); | |
830 | 104 extern void vfs_rewind(VFSFile * file); |
105 extern glong vfs_ftell(VFSFile * file); | |
106 extern gboolean vfs_feof(VFSFile * file); | |
0 | 107 |
830 | 108 extern gboolean vfs_file_test(const gchar * path, |
0 | 109 GFileTest test); |
811
86ca43d8a845
[svn] - implement vfs_feof() and vfs_ftell() and update the scrobbler plugin to reflect that,
nenolod
parents:
0
diff
changeset
|
110 |
830 | 111 extern gboolean vfs_is_writeable(const gchar * path); |
0 | 112 |
830 | 113 extern gboolean vfs_truncate(VFSFile * file, glong length); |
0 | 114 |
1669
07143b97314d
[svn] fprintf implementation in the VFS common layer by Luca Barbato. Use it in the Container plugins.
chainsaw
parents:
1617
diff
changeset
|
115 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
|
116 __attribute__ ((__format__ (__printf__, 2, 3))); |
0 | 117 |
1997 | 118 extern gboolean vfs_register_transport(VFSConstructor *vtable); |
119 | |
0 | 120 G_END_DECLS |
121 | |
122 #endif /* VFS_H */ |