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