WvStreams
wvgzip.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * Gzip encoder/decoder based on zlib.
6 */
7#ifndef __WVGZIP_H
8#define __WVGZIP_H
9
10#include "wvencoder.h"
11#include "wvencoderstream.h"
12
13struct z_stream_s;
14
36{
37public:
38 enum Mode {
40 Inflate
41 };
42
48 WvGzipEncoder(Mode mode, size_t _out_limit = 0);
49 virtual ~WvGzipEncoder();
50
55 size_t out_limit;
56
67
76
77protected:
78 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush);
79 virtual bool _finish(WvBuf &outbuf);
80 virtual bool _reset();
81
82private:
83 struct z_stream_s *zstr;
84 WvInPlaceBuf tmpbuf;
85 Mode mode;
86 size_t output;
87
88 void init();
89 void close();
90 void prepare(WvBuf *inbuf);
91 bool process(WvBuf &outbuf, bool flush, bool finish);
92};
93
94
95#endif // __WVGZIP_H
The base encoder class.
Definition wvencoder.h:68
bool finish(WvBuf &outbuf)
Tells the encoder that NO MORE DATA will ever be encoded.
Definition wvencoder.cc:49
bool flush(WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
Flushes the encoder and optionally finishes it.
Definition wvencoder.h:163
An encoder implementing Gzip encryption and decryption.
Definition wvgzip.h:36
size_t out_limit
Limit the amount of output produced in one call to encode().
Definition wvgzip.h:55
bool ignore_decompression_errors
Continue decompression if errors are found.
Definition wvgzip.h:66
virtual bool _reset()
Template method implementation of reset().
Definition wvgzip.cc:98
bool full_flush
Do full flushes.
Definition wvgzip.h:75
virtual bool _finish(WvBuf &outbuf)
Template method implementation of finish().
Definition wvgzip.cc:91
virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush)
Template method implementation of encode().
Definition wvgzip.cc:66
The in place raw memory buffer type.
Definition wvbuf.h:165