Mercurial > audlegacy
annotate src/audacious/vfs.h @ 3121:3b6d316f8b09 trunk
GPL3 relicensing.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 20 Jul 2007 08:59:47 -0500 |
parents | 51dda959be4d |
children | f1c756f39e6c |
rev | line source |
---|---|
2313 | 1 /* |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
2 * Audacious |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
3 * Copyright (c) 2006-2007 Audacious team |
2313 | 4 * |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2896
diff
changeset
|
7 * the Free Software Foundation; under version 3 of the License. |
2313 | 8 * |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
12 * GNU General Public License for more details. |
2313 | 13 * |
2896
51dda959be4d
Backed out changeset 7d3beedf1db8677dab2327bc8d85af4746344f6e
William Pitcock <nenolod@atheme.org>
parents:
2861
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2896
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses>. |
2313 | 16 */ |
17 | |
18 #ifndef VFS_H | |
19 #define VFS_H | |
20 | |
21 #include <glib.h> | |
22 #include <stdio.h> | |
2688 | 23 #include <sys/types.h> |
2313 | 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); | |
2688 | 79 off_t (*vfs_fsize_impl)(VFSFile *file); |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
80 gchar *(*vfs_get_metadata_impl)(VFSFile *file, const gchar * field); |
2313 | 81 }; |
82 | |
83 G_BEGIN_DECLS | |
84 | |
85 extern VFSFile * vfs_fopen(const gchar * path, | |
86 const gchar * mode); | |
87 extern gint vfs_fclose(VFSFile * file); | |
88 | |
2562
07b990906823
[svn] - add reference-counting to VFS and add new function, vfs_dup() to
nenolod
parents:
2424
diff
changeset
|
89 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
|
90 |
2313 | 91 extern size_t vfs_fread(gpointer ptr, |
92 size_t size, | |
93 size_t nmemb, | |
94 VFSFile * file); | |
95 extern size_t vfs_fwrite(gconstpointer ptr, | |
96 size_t size, | |
97 size_t nmemb, | |
98 VFSFile *file); | |
99 | |
100 extern gint vfs_getc(VFSFile *stream); | |
101 extern gint vfs_ungetc(gint c, | |
102 VFSFile *stream); | |
103 extern gchar *vfs_fgets(gchar *s, | |
104 gint n, | |
105 VFSFile *stream); | |
106 | |
107 extern gint vfs_fseek(VFSFile * file, | |
108 glong offset, | |
109 gint whence); | |
110 extern void vfs_rewind(VFSFile * file); | |
111 extern glong vfs_ftell(VFSFile * file); | |
112 extern gboolean vfs_feof(VFSFile * file); | |
113 | |
114 extern gboolean vfs_file_test(const gchar * path, | |
115 GFileTest test); | |
116 | |
117 extern gboolean vfs_is_writeable(const gchar * path); | |
118 | |
119 extern gboolean vfs_truncate(VFSFile * file, glong length); | |
120 | |
2688 | 121 extern off_t vfs_fsize(VFSFile * file); |
122 | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2313
diff
changeset
|
123 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
|
124 |
2313 | 125 extern int vfs_fprintf(VFSFile *stream, gchar const *format, ...) |
126 __attribute__ ((__format__ (__printf__, 2, 3))); | |
127 | |
128 extern gboolean vfs_register_transport(VFSConstructor *vtable); | |
129 | |
2424 | 130 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size); |
131 | |
2313 | 132 G_END_DECLS |
133 | |
134 #endif /* VFS_H */ |