Line Code
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
#ifndef GENERS_ZLIBHANDLE_HH_
#define GENERS_ZLIBHANDLE_HH_

extern "C" {
struct z_stream_s;
}

namespace gs {
  class ZlibInflateHandle {
  public:
    ZlibInflateHandle();
    ~ZlibInflateHandle();

    inline z_stream_s &strm() { return *strm_; }

    ZlibInflateHandle(const ZlibInflateHandle &) = delete;
    ZlibInflateHandle &operator=(const ZlibInflateHandle &) = delete;

  private:
    z_stream_s *strm_;
  };

  class ZlibDeflateHandle {
  public:
    explicit ZlibDeflateHandle(int level);
    ~ZlibDeflateHandle();

    inline z_stream_s &strm() { return *strm_; }
    inline int level() { return level_; }

    ZlibDeflateHandle() = delete;
    ZlibDeflateHandle(const ZlibDeflateHandle &) = delete;
    ZlibDeflateHandle &operator=(const ZlibDeflateHandle &) = delete;

  private:
    z_stream_s *strm_;
    int level_;
  };
}  // namespace gs

#endif  // GENERS_ZLIBHANDLE_HH_