]>
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 _COMPRESS_H_ | |
17 | #define _COMPRESS_H_ | |
18 | ||
19 | /* this is the parent class for all compress IO operations. | |
20 | * It | |
21 | */ | |
22 | ||
23 | class compress:public io_stream | |
24 | { | |
25 | public: | |
26 | /* Get a decompressed stream from a normal stream. If this function returns non-null | |
27 | * a valid compress header was found. The io_stream pointer passed to decompress | |
28 | * should be discarded. The old io_stream will be automatically closed when the | |
29 | * decompression stream is closed | |
30 | */ | |
31 | static io_stream *decompress (io_stream *); | |
32 | /* | |
33 | * To create a stream that will be compressed, you should open the url, and then get a new stream | |
34 | * from compress::compress. | |
35 | */ | |
36 | /* read data (duh!) */ | |
37 | virtual ssize_t read (void *buffer, size_t len); | |
38 | /* provide data to (double duh!) */ | |
39 | virtual ssize_t write (void *buffer, size_t len); | |
40 | /* read data without removing it from the class's internal buffer */ | |
41 | virtual ssize_t peek (void *buffer, size_t len); | |
42 | virtual long tell (); | |
43 | /* try guessing this one */ | |
44 | virtual int error (); | |
45 | /* Find out the next stream name - | |
46 | * ie for foo.tar.gz, at offset 0, next_file_name = foo.tar | |
47 | * for foobar that is an compress, next_file_name is the next | |
48 | * extractable filename. | |
49 | */ | |
50 | virtual const char *next_file_name () = NULL; | |
51 | /* if you are still needing these hints... give up now! */ | |
52 | virtual ~ compress (); | |
53 | }; | |
54 | ||
55 | #endif /* _COMPRESS_H_ */ |