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
42
|
#ifndef GENERS_BZ2HANDLE_HH_
#define GENERS_BZ2HANDLE_HH_
// There is no way to have a forward declaration of bz_stream
// because it is a typedef of an anonymous struct. Because of
// this, the bzlib header must be included here...
#include "bzlib.h"
// Note that, unlike similar Zlib handles, BZ2 handles manage
// external objects (typically living on the stack). This is
// because bz_stream has to be created every time a compression
// is performed, and having it on the stack saves a bit of time.
namespace gs {
class BZ2InflateHandle {
public:
explicit BZ2InflateHandle(bz_stream &strm);
~BZ2InflateHandle();
BZ2InflateHandle() = delete;
BZ2InflateHandle(const BZ2InflateHandle &) = delete;
BZ2InflateHandle &operator=(const BZ2InflateHandle &) = delete;
private:
bz_stream *strm_;
};
class BZ2DeflateHandle {
public:
explicit BZ2DeflateHandle(bz_stream &strm);
~BZ2DeflateHandle();
BZ2DeflateHandle() = delete;
BZ2DeflateHandle(const BZ2DeflateHandle &) = delete;
BZ2DeflateHandle &operator=(const BZ2DeflateHandle &) = delete;
private:
bz_stream *strm_;
};
} // namespace gs
#endif // GENERS_BZ2HANDLE_HH_
|