zlibcomplete
Simple C++ wrapper for zlib using RAII and std::string with flush.
 All Classes Namespaces Files Functions Enumerations Enumerator Macros Pages
zlibbase.hpp
Go to the documentation of this file.
1 #ifndef __ZLIBBASE_HPP
2 #define __ZLIBBASE_HPP
3 
4 #define ZLIB_COMPLETE_CHUNK 16384
5 
6 #include <zlib.h>
7 
8 namespace zlibcomplete {
9 
10  enum flush_parameter { no_flush = 0, auto_flush = 1 };
11 
12  class ZLibBaseCompressor {
13  char in_[ZLIB_COMPLETE_CHUNK];
14  char out_[ZLIB_COMPLETE_CHUNK];
15  bool autoFlush_;
16  bool finished_;
17  z_stream strm_;
18 protected:
19  ZLibBaseCompressor(int level, flush_parameter autoFlush, int windowBits);
20  ~ZLibBaseCompressor(void);
21  std::string baseCompress(const std::string& input);
22  std::string baseFinish(void);
23  };
24 
25  class ZLibBaseDecompressor {
26  char in_[ZLIB_COMPLETE_CHUNK];
27  char out_[ZLIB_COMPLETE_CHUNK];
28  z_stream strm_;
29 protected:
30  ZLibBaseDecompressor(int windowBits);
31  ~ZLibBaseDecompressor(void);
32  std::string baseDecompress(const std::string& input);
33  };
34 
35 }
36 
37 #endif
flush_parameter
Definition: zlibbase.hpp:10
#define ZLIB_COMPLETE_CHUNK
Definition: zlibbase.hpp:4
Definition: zlibbase.hpp:10
Definition: zlibbase.hpp:10