source: box/trunk/lib/compress/CompressStream.h @ 217

Revision 217, 1.6 KB checked in by martin, 6 years ago (diff)

Set svn:eol-style as appropriate for all files

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    CompressStream.h
5//              Purpose: Compressing stream
6//              Created: 27/5/04
7//
8// --------------------------------------------------------------------------
9
10#ifndef COMPRESSSTREAM__H
11#define COMPRESSSTREAM__H
12
13#include "IOStream.h"
14
15// --------------------------------------------------------------------------
16//
17// Class
18//              Name:    CompressStream
19//              Purpose: Compressing stream
20//              Created: 27/5/04
21//
22// --------------------------------------------------------------------------
23class CompressStream : public IOStream
24{
25public:
26        CompressStream(IOStream *pStream, bool TakeOwnership,
27                bool DecompressRead, bool CompressWrite, bool PassThroughWhenNotCompressed = false);
28        ~CompressStream();
29private:
30        // No copying (have implementations which exception)
31        CompressStream(const CompressStream &);
32        CompressStream &operator=(const CompressStream &);
33public:
34
35        virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
36        virtual void Write(const void *pBuffer, int NBytes);
37        virtual void WriteAllBuffered();
38        virtual void Close();
39        virtual bool StreamDataLeft();
40        virtual bool StreamClosed();
41
42protected:
43        void CheckRead();
44        void CheckWrite();
45        void CheckBuffer();
46        void WriteCompressedData(bool SyncFlush = false);
47
48private:
49        IOStream *mpStream;
50        bool mHaveOwnership;
51        bool mDecompressRead;
52        bool mCompressWrite;
53        bool mPassThroughWhenNotCompressed;
54        // Avoid having to include Compress.h
55        void *mpReadCompressor;
56        void *mpWriteCompressor;
57        void *mpBuffer;
58        bool mIsClosed;
59};
60
61#endif // COMPRESSSTREAM__H
62
Note: See TracBrowser for help on using the repository browser.