1 |
/* |
2 |
* HT Editor |
3 |
* cstream.cc |
4 |
* |
5 |
* Copyright (C) 1999-2002 Sebastian Biallas (sb@web-productions.de) |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License version 2 as |
9 |
* published by the Free Software Foundation. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
#ifndef __CSTREAM_H__ |
21 |
#define __CSTREAM_H__ |
22 |
|
23 |
#include "stream.h" |
24 |
|
25 |
/* |
26 |
* NEVER use CompressedStream for both reading and writing! |
27 |
*/ |
28 |
|
29 |
#define COMPRESSED_STREAM_DEFAULT_GRANULARITY 10240 |
30 |
|
31 |
class CompressedStream: public StreamLayer { |
32 |
protected: |
33 |
byte *buffer; |
34 |
uint buffersize; |
35 |
uint bufferpos; |
36 |
|
37 |
bool flush_compressed(); |
38 |
bool flush_uncompressed(); |
39 |
public: |
40 |
CompressedStream(Stream *stream, bool own_stream, uint granularity = COMPRESSED_STREAM_DEFAULT_GRANULARITY); |
41 |
virtual ~CompressedStream(); |
42 |
/* extends StreamLayer */ |
43 |
virtual uint read(void *buf, uint size); |
44 |
virtual uint write(const void *buf, uint size); |
45 |
}; |
46 |
|
47 |
#endif |