]>
Commit | Line | Data |
---|---|---|
b24c88b3 RC |
1 | /* |
2 | * Copyright (c) 2001, Robert Collins. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by Robert Collins <rbtcollins@hotmail.com> | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef _IO_STREAM_FILE_H_ | |
17 | #define _IO_STREAM_FILE_H_ | |
18 | ||
3c054baf RC |
19 | #include "io_stream.h" |
20 | #include "String++.h" | |
b24c88b3 RC |
21 | |
22 | /* io_stream on disk files | |
23 | */ | |
24 | ||
25 | class io_stream_file:public io_stream | |
26 | { | |
27 | public: | |
3c054baf RC |
28 | static int exists (String const &); |
29 | static int remove (String const &); | |
30 | static int mklink (String const &, String const &, io_stream_link_t); | |
31 | io_stream_file (String const &,String const &); | |
7c7034e8 | 32 | virtual ~ io_stream_file (); |
b24c88b3 RC |
33 | /* read data (duh!) */ |
34 | virtual ssize_t read (void *buffer, size_t len); | |
35 | /* provide data to (double duh!) */ | |
ca9506cc | 36 | virtual ssize_t write (const void *buffer, size_t len); |
b24c88b3 RC |
37 | /* read data without removing it from the class's internal buffer */ |
38 | virtual ssize_t peek (void *buffer, size_t len); | |
39 | virtual long tell (); | |
ca9506cc | 40 | virtual int seek (long where, io_stream_seek_t whence); |
b24c88b3 RC |
41 | /* can't guess, oh well */ |
42 | virtual int error (); | |
43 | virtual int set_mtime (int); | |
44 | /* not relevant yet */ | |
7c7034e8 RC |
45 | virtual int get_mtime () |
46 | { | |
47 | return 0; | |
48 | }; | |
341988b9 | 49 | virtual size_t get_size (); |
b24c88b3 | 50 | /* dummy for io_stream_file */ |
3c054baf | 51 | virtual String next_file_name () |
b24c88b3 RC |
52 | { |
53 | return NULL; | |
54 | }; | |
3c054baf | 55 | static int move (String const &,String const &); |
b24c88b3 RC |
56 | private: |
57 | /* always require parameters */ | |
7c7034e8 | 58 | io_stream_file () |
b24c88b3 RC |
59 | { |
60 | }; | |
61 | FILE *fp; | |
62 | int lasterr; | |
3c054baf RC |
63 | String fname; |
64 | String lmode; | |
b24c88b3 RC |
65 | }; |
66 | ||
67 | #endif /* _IO_STREAM_FILE_H_ */ |