aboutsummaryrefslogtreecommitdiff
path: root/src/serializerbzip2.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-07-02 07:27:33 +0000
committerMike Buland <eichlan@xagasoft.com>2006-07-02 07:27:33 +0000
commit264f825549ecd23046ad049733870d0516d59e89 (patch)
treed16fab5f050a69aafac95bd6c134babda6e25c06 /src/serializerbzip2.h
parentd121afeeab6c7a52ae0964f5dc66cc6a3d8cf3ca (diff)
downloadlibbu++-264f825549ecd23046ad049733870d0516d59e89.tar.gz
libbu++-264f825549ecd23046ad049733870d0516d59e89.tar.bz2
libbu++-264f825549ecd23046ad049733870d0516d59e89.tar.xz
libbu++-264f825549ecd23046ad049733870d0516d59e89.zip
Fixed a bug in the serializer that would close the file it was using even when
it shouldn't, and added the serializerbzip2, which lets you read and write to compressed streams.
Diffstat (limited to '')
-rw-r--r--src/serializerbzip2.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/serializerbzip2.h b/src/serializerbzip2.h
new file mode 100644
index 0000000..2d646f2
--- /dev/null
+++ b/src/serializerbzip2.h
@@ -0,0 +1,53 @@
1#ifndef SERIALIZER_BINARY_H
2#define SERIALIZER_BINARY_H
3
4#include "serializer.h"
5#include <stdio.h>
6
7class SerializerBZip2 : public Serializer
8{
9public:
10 SerializerBZip2(FILE *fhFile, bool bLoading);
11 SerializerBZip2(char *sFileName, bool bLoading);
12 ~SerializerBZip2();
13
14 virtual void close();
15
16 virtual void write(const void *, int32_t);
17 virtual void read(void *, int32_t);
18
19 virtual Serializer &operator<<(bool);
20 virtual Serializer &operator<<(int8_t);
21 virtual Serializer &operator<<(int16_t);
22 virtual Serializer &operator<<(int32_t);
23 virtual Serializer &operator<<(int64_t);
24 virtual Serializer &operator<<(uint8_t);
25 virtual Serializer &operator<<(uint16_t);
26 virtual Serializer &operator<<(uint32_t);
27 virtual Serializer &operator<<(uint64_t);
28 virtual Serializer &operator<<(float);
29 virtual Serializer &operator<<(double);
30 virtual Serializer &operator<<(long double);
31
32 virtual Serializer &operator>>(bool &);
33 virtual Serializer &operator>>(int8_t &);
34 virtual Serializer &operator>>(int16_t &);
35 virtual Serializer &operator>>(int32_t &);
36 virtual Serializer &operator>>(int64_t &);
37 virtual Serializer &operator>>(uint8_t &);
38 virtual Serializer &operator>>(uint16_t &);
39 virtual Serializer &operator>>(uint32_t &);
40 virtual Serializer &operator>>(uint64_t &);
41 virtual Serializer &operator>>(float &);
42 virtual Serializer &operator>>(double &);
43 virtual Serializer &operator>>(long double &);
44
45private:
46 void checkBZError();
47 FILE *fhFile;
48 void *bzFile;
49 bool bCloseFile;
50 int bzerror;
51};
52
53#endif