Mercurial > audlegacy
annotate src/audacious/vfs.h @ 2686:3994b40acc99 trunk
[svn] Fix some wrong escape sequences
author | ertzing |
---|---|
date | Fri, 20 Apr 2007 04:45:22 -0700 |
parents | 07b990906823 |
children | ac22b2cb6013 |
rev | line source |
---|---|
2313 | 1 /* |
2 * Audacious | |
3 * Copyright (c) 2006-2007 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; under version 2 of the License. | |
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 | |
19 #ifndef VFS_H | |
20 #define VFS_H | |
21 | |
22 #include <glib.h> | |
23 #include <stdio.h> | |
24 | |
25 typedef struct _VFSFile VFSFile; | |
26 typedef struct _VFSConstructor VFSConstructor; | |
27 | |
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. | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
33 * @ref: The amount of references that the VFSFile object has. |
2313 | 34 * |
35 * #VFSFile objects describe a VFS stream. | |
36 **/ | |
37 struct _VFSFile { | |
38 gchar *uri; | |
39 gpointer handle; | |
40 VFSConstructor *base; | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
41 gint ref; |
2313 | 42 }; |
43 | |
44 /** | |
45 * VFSConstructor: | |
46 * @uri_id: The uri identifier, e.g. "file" would handle "file://" streams. | |
47 * @vfs_fopen_impl: A function pointer which points to a fopen implementation. | |
48 * @vfs_fclose_impl: A function pointer which points to a fclose implementation. | |
49 * @vfs_fread_impl: A function pointer which points to a fread implementation. | |
50 * @vfs_fwrite_impl: A function pointer which points to a fwrite implementation. | |
51 * @vfs_getc_impl: A function pointer which points to a getc implementation. | |
52 * @vfs_ungetc_impl: A function pointer which points to an ungetc implementation. | |
53 * @vfs_fseek_impl: A function pointer which points to a fseek implementation. | |
54 * @vfs_rewind_impl: A function pointer which points to a rewind implementation. | |
55 * @vfs_ftell_impl: A function pointer which points to a ftell implementation. | |
56 * @vfs_feof_impl: A function pointer which points to a feof implementation. | |
57 * @vfs_truncate_impl: A function pointer which points to a ftruncate implementation. | |
58 * | |
59 * #VFSConstructor objects contain the base vtables used for extrapolating | |
60 * a VFS stream. #VFSConstructor objects should be considered %virtual in | |
61 * nature. VFS base vtables are registered via vfs_register_transport(). | |
62 **/ | |
63 struct _VFSConstructor { | |
64 gchar *uri_id; | |
65 VFSFile *(*vfs_fopen_impl)(const gchar *path, | |
66 const gchar *mode); | |
67 gint (*vfs_fclose_impl)(VFSFile * file); | |
68 size_t (*vfs_fread_impl)(gpointer ptr, size_t size, | |
69 size_t nmemb, VFSFile *file); | |
70 size_t (*vfs_fwrite_impl)(gconstpointer ptr, size_t size, | |
71 size_t nmemb, VFSFile *file); | |
72 gint (*vfs_getc_impl)(VFSFile *stream); | |
73 gint (*vfs_ungetc_impl)(gint c, VFSFile *stream); | |
74 gint (*vfs_fseek_impl)(VFSFile *file, glong offset, gint whence); | |
75 void (*vfs_rewind_impl)(VFSFile *file); | |
76 glong (*vfs_ftell_impl)(VFSFile *file); | |
77 gboolean (*vfs_feof_impl)(VFSFile *file); | |
78 gboolean (*vfs_truncate_impl)(VFSFile *file, glong length); | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
79 gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field); |
2313 | 80 }; |
81 | |
82 G_BEGIN_DECLS | |
83 | |
84 extern VFSFile * vfs_fopen(const gchar * path, | |
85 const gchar * mode); | |
86 extern gint vfs_fclose(VFSFile * file); | |
87 | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
88 extern VFSFile * vfs_dup(VFSFile *in); |
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
89 |
2313 | 90 extern size_t vfs_fread(gpointer ptr, |
91 size_t size, | |
92 size_t nmemb, | |
93 VFSFile * file); | |
94 extern size_t vfs_fwrite(gconstpointer ptr, | |
95 size_t size, | |
96 size_t nmemb, | |
97 VFSFile *file); | |
98 | |
99 extern gint vfs_getc(VFSFile *stream); | |
100 extern gint vfs_ungetc(gint c, | |
101 VFSFile *stream); | |
102 extern gchar *vfs_fgets(gchar *s, | |
103 gint n, | |
104 VFSFile *stream); | |
105 | |
106 extern gint vfs_fseek(VFSFile * file, | |
107 glong offset, | |
108 gint whence); | |
109 extern void vfs_rewind(VFSFile * file); | |
110 extern glong vfs_ftell(VFSFile * file); | |
111 extern gboolean vfs_feof(VFSFile * file); | |
112 | |
113 extern gboolean vfs_file_test(const gchar * path, | |
114 GFileTest test); | |
115 | |
116 extern gboolean vfs_is_writeable(const gchar * path); | |
117 | |
118 extern gboolean vfs_truncate(VFSFile * file, glong length); | |
119 | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
120 extern gchar *vfs_get_metadata(VFSFile * file, const gchar * field); |
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
121 |
2313 | 122 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) |
123 __attribute__ ((__format__ (__printf__, 2, 3))); | |
124 | |
125 extern gboolean vfs_register_transport(VFSConstructor *vtable); | |
126 | |
2424 | 127 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size); |
128 | |
2313 | 129 G_END_DECLS |
130 | |
131 #endif /* VFS_H */ |