summaryrefslogtreecommitdiff
path: root/src/serializerbzip2.h
blob: 2d646f22df3ddca9d70d4e3014f104bb04bd62d2 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
#ifndef SERIALIZER_BINARY_H
#define SERIALIZER_BINARY_H

#include "serializer.h"
#include <stdio.h>

class SerializerBZip2 : public Serializer
{
public:
	SerializerBZip2(FILE *fhFile, bool bLoading);
	SerializerBZip2(char *sFileName, bool bLoading);
	~SerializerBZip2();

	virtual void close();

	virtual void write(const void *, int32_t);
	virtual void read(void *, int32_t);
	
	virtual Serializer &operator<<(bool);
	virtual Serializer &operator<<(int8_t);
	virtual Serializer &operator<<(int16_t);
	virtual Serializer &operator<<(int32_t);
	virtual Serializer &operator<<(int64_t);
	virtual Serializer &operator<<(uint8_t);
	virtual Serializer &operator<<(uint16_t);
	virtual Serializer &operator<<(uint32_t);
	virtual Serializer &operator<<(uint64_t);
	virtual Serializer &operator<<(float);
	virtual Serializer &operator<<(double);
	virtual Serializer &operator<<(long double);

	virtual Serializer &operator>>(bool &);
	virtual Serializer &operator>>(int8_t &);
	virtual Serializer &operator>>(int16_t &);
	virtual Serializer &operator>>(int32_t &);
	virtual Serializer &operator>>(int64_t &);
	virtual Serializer &operator>>(uint8_t &);
	virtual Serializer &operator>>(uint16_t &);
	virtual Serializer &operator>>(uint32_t &);
	virtual Serializer &operator>>(uint64_t &);
	virtual Serializer &operator>>(float &);
	virtual Serializer &operator>>(double &);
	virtual Serializer &operator>>(long double &);

private:
	void checkBZError();
	FILE *fhFile;
	void *bzFile;
	bool bCloseFile;
	int bzerror;
};

#endif