00001
00002
00003
00004
00005
00006
00007 #ifndef __WVGZIP_H
00008 #define __WVGZIP_H
00009
00010 #include "wvencoder.h"
00011 #include "wvencoderstream.h"
00012
00013 struct z_stream_s;
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class WvGzipEncoder : public WvEncoder
00036 {
00037 public:
00038 enum Mode {
00039 Deflate,
00040 Inflate
00041 };
00042
00043
00044
00045
00046
00047
00048 WvGzipEncoder(Mode mode);
00049 virtual ~WvGzipEncoder();
00050
00051 protected:
00052 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush);
00053 virtual bool _finish(WvBuf &outbuf);
00054 virtual bool _reset();
00055
00056 private:
00057 struct z_stream_s *zstr;
00058 WvInPlaceBuf tmpbuf;
00059 Mode mode;
00060
00061 void init();
00062 void close();
00063 void prepare(WvBuf *inbuf);
00064 bool process(WvBuf &outbuf, bool flush, bool finish);
00065 };
00066
00067
00068 #endif // __WVGZIP_H