diff options
Diffstat (limited to 'src/old/serializer.h')
-rw-r--r-- | src/old/serializer.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/old/serializer.h b/src/old/serializer.h new file mode 100644 index 0000000..3af489c --- /dev/null +++ b/src/old/serializer.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef SERIALIZABLE_H | ||
2 | #define SERIALIZABLE_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | #include <string> | ||
6 | #include <list> | ||
7 | //#include "serializable.h" | ||
8 | |||
9 | class Serializer | ||
10 | { | ||
11 | private: | ||
12 | bool bLoading; | ||
13 | public: | ||
14 | bool isLoading(); | ||
15 | |||
16 | enum | ||
17 | { | ||
18 | load = true, | ||
19 | save = false | ||
20 | }; | ||
21 | |||
22 | Serializer(bool bLoading); | ||
23 | virtual ~Serializer(); | ||
24 | virtual void close()=0; | ||
25 | |||
26 | virtual void write(const void *, int32_t)=0; | ||
27 | virtual void read(void *, int32_t)=0; | ||
28 | |||
29 | virtual Serializer &operator<<(bool); | ||
30 | virtual Serializer &operator<<(int8_t); | ||
31 | virtual Serializer &operator<<(int16_t); | ||
32 | virtual Serializer &operator<<(int32_t); | ||
33 | virtual Serializer &operator<<(int64_t); | ||
34 | virtual Serializer &operator<<(uint8_t); | ||
35 | virtual Serializer &operator<<(uint16_t); | ||
36 | virtual Serializer &operator<<(uint32_t); | ||
37 | virtual Serializer &operator<<(uint64_t); | ||
38 | virtual Serializer &operator<<(long); | ||
39 | virtual Serializer &operator<<(float); | ||
40 | virtual Serializer &operator<<(double); | ||
41 | virtual Serializer &operator<<(long double); | ||
42 | |||
43 | virtual Serializer &operator>>(bool &); | ||
44 | virtual Serializer &operator>>(int8_t &); | ||
45 | virtual Serializer &operator>>(int16_t &); | ||
46 | virtual Serializer &operator>>(int32_t &); | ||
47 | virtual Serializer &operator>>(int64_t &); | ||
48 | virtual Serializer &operator>>(uint8_t &); | ||
49 | virtual Serializer &operator>>(uint16_t &); | ||
50 | virtual Serializer &operator>>(uint32_t &); | ||
51 | virtual Serializer &operator>>(uint64_t &); | ||
52 | virtual Serializer &operator>>(long &); | ||
53 | virtual Serializer &operator>>(float &); | ||
54 | virtual Serializer &operator>>(double &); | ||
55 | virtual Serializer &operator>>(long double &); | ||
56 | |||
57 | virtual Serializer &operator&&(bool &); | ||
58 | virtual Serializer &operator&&(int8_t &); | ||
59 | virtual Serializer &operator&&(int16_t &); | ||
60 | virtual Serializer &operator&&(int32_t &); | ||
61 | virtual Serializer &operator&&(int64_t &); | ||
62 | virtual Serializer &operator&&(uint8_t &); | ||
63 | virtual Serializer &operator&&(uint16_t &); | ||
64 | virtual Serializer &operator&&(uint32_t &); | ||
65 | virtual Serializer &operator&&(uint64_t &); | ||
66 | virtual Serializer &operator&&(float &); | ||
67 | virtual Serializer &operator&&(double &); | ||
68 | virtual Serializer &operator&&(long double &); | ||
69 | |||
70 | //virtual Serializer &operator&(Serializable &); | ||
71 | }; | ||
72 | |||
73 | Serializer &operator<<(Serializer &, class Serializable &); | ||
74 | Serializer &operator>>(Serializer &, class Serializable &); | ||
75 | Serializer &operator&&(Serializer &s, class Serializable &p); | ||
76 | |||
77 | Serializer &operator<<(Serializer &, std::string &); | ||
78 | Serializer &operator>>(Serializer &, std::string &); | ||
79 | |||
80 | #endif | ||