aboutsummaryrefslogtreecommitdiff
path: root/src/serializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/serializer.cpp185
1 files changed, 185 insertions, 0 deletions
diff --git a/src/serializer.cpp b/src/serializer.cpp
new file mode 100644
index 0000000..5982a26
--- /dev/null
+++ b/src/serializer.cpp
@@ -0,0 +1,185 @@
1#include "serializer.h"
2#include "serializable.h"
3
4Serializer::Serializer(bool bLoading):
5 bLoading(bLoading)
6{
7}
8Serializer::~Serializer()
9{
10}
11
12bool Serializer::isLoading()
13{
14 return bLoading;
15}
16
17/*Serializer::Serializer &operator&(bool &p)
18{
19 if (bLoading)
20 {
21 return *this << p;
22 }
23 else
24 {
25 return *this >> p;
26 }
27}
28
29Serializer::Serializer &operator&(int8_t &p)
30{
31 if (bLoading)
32 {
33 return *this << p;
34 }
35 else
36 {
37 return *this >> p;
38 }
39}
40
41Serializer::Serializer &operator&(int16_t &p)
42{
43 if (bLoading)
44 {
45 return *this << p;
46 }
47 else
48 {
49 return *this >> p;
50 }
51}
52
53Serializer::Serializer &operator&(int32_t &p)
54{
55 if (bLoading)
56 {
57 return *this << p;
58 }
59 else
60 {
61 return *this >> p;
62 }
63}
64
65Serializer::Serializer &operator&(int64_t &p)
66{
67 if (bLoading)
68 {
69 return *this << p;
70 }
71 else
72 {
73 return *this >> p;
74 }
75}
76
77Serializer::Serializer &operator&(uint8_t &p)
78{
79 if (bLoading)
80 {
81 return *this << p;
82 }
83 else
84 {
85 return *this >> p;
86 }
87}
88
89Serializer::Serializer &operator&(uint16_t &p)
90{
91 if (bLoading)
92 {
93 return *this << p;
94 }
95 else
96 {
97 return *this >> p;
98 }
99}
100
101Serializer::Serializer &operator&(uint32_t &p)
102{
103 if (bLoading)
104 {
105 return *this << p;
106 }
107 else
108 {
109 return *this >> p;
110 }
111}
112
113Serializer::Serializer &operator&(uint64_t &p)
114{
115 if (bLoading)
116 {
117 return *this << p;
118 }
119 else
120 {
121 return *this >> p;
122 }
123}
124
125Serializer::Serializer &operator&(float &p)
126{
127 if (bLoading)
128 {
129 return *this << p;
130 }
131 else
132 {
133 return *this >> p;
134 }
135}
136
137Serializer::Serializer &operator&(double &p)
138{
139 if (bLoading)
140 {
141 return *this << p;
142 }
143 else
144 {
145 return *this >> p;
146 }
147}
148
149Serializer::Serializer &operator&(long double &p)
150{
151 if (bLoading)
152 {
153 return *this << p;
154 }
155 else
156 {
157 return *this >> p;
158 }
159}*/
160
161
162Serializer &Serializer::operator<<(Serializable &p)
163{
164 p.serialize(*this);
165 return *this;
166}
167
168Serializer &Serializer::operator>>(Serializable &p)
169{
170 p.serialize(*this);
171 return *this;
172}
173
174/*Serializer::Serializer &operator&(Serializable &p)
175{
176 if (bLoading)
177 {
178 return *this << p;
179 }
180 else
181 {
182 return *this >> p;
183 }
184}*/
185