summaryrefslogtreecommitdiff
path: root/src/serializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/serializer.cpp')
-rw-r--r--src/serializer.cpp94
1 files changed, 52 insertions, 42 deletions
diff --git a/src/serializer.cpp b/src/serializer.cpp
index 407aab2..636224e 100644
--- a/src/serializer.cpp
+++ b/src/serializer.cpp
@@ -59,6 +59,11 @@ Serializer &Serializer::operator<<(uint64_t p)
59 write( &p, sizeof(p) ); 59 write( &p, sizeof(p) );
60 return *this; 60 return *this;
61} 61}
62Serializer &Serializer::operator<<(long p)
63{
64 write( &p, sizeof(p) );
65 return *this;
66}
62Serializer &Serializer::operator<<(float p) 67Serializer &Serializer::operator<<(float p)
63{ 68{
64 write( &p, sizeof(p) ); 69 write( &p, sizeof(p) );
@@ -120,6 +125,11 @@ Serializer &Serializer::operator>>(uint64_t &p)
120 read( &p, sizeof(p) ); 125 read( &p, sizeof(p) );
121 return *this; 126 return *this;
122} 127}
128Serializer &Serializer::operator>>(long &p)
129{
130 read( &p, sizeof(p) );
131 return *this;
132}
123Serializer &Serializer::operator>>(float &p) 133Serializer &Serializer::operator>>(float &p)
124{ 134{
125 read( &p, sizeof(p) ); 135 read( &p, sizeof(p) );
@@ -136,149 +146,149 @@ Serializer &Serializer::operator>>(long double &p)
136 return *this; 146 return *this;
137} 147}
138 148
139/*Serializer::Serializer &operator&(bool &p) 149Serializer &Serializer::operator&&(bool &p)
140{ 150{
141 if (bLoading) 151 if (bLoading)
142 { 152 {
143 return *this << p; 153 return *this >> p;
144 } 154 }
145 else 155 else
146 { 156 {
147 return *this >> p; 157 return *this << p;
148 } 158 }
149} 159}
150 160
151Serializer::Serializer &operator&(int8_t &p) 161Serializer &Serializer::operator&&(int8_t &p)
152{ 162{
153 if (bLoading) 163 if (bLoading)
154 { 164 {
155 return *this << p; 165 return *this >> p;
156 } 166 }
157 else 167 else
158 { 168 {
159 return *this >> p; 169 return *this << p;
160 } 170 }
161} 171}
162 172
163Serializer::Serializer &operator&(int16_t &p) 173Serializer &Serializer::operator&&(int16_t &p)
164{ 174{
165 if (bLoading) 175 if (bLoading)
166 { 176 {
167 return *this << p; 177 return *this >> p;
168 } 178 }
169 else 179 else
170 { 180 {
171 return *this >> p; 181 return *this << p;
172 } 182 }
173} 183}
174 184
175Serializer::Serializer &operator&(int32_t &p) 185Serializer &Serializer::operator&&(int32_t &p)
176{ 186{
177 if (bLoading) 187 if (bLoading)
178 { 188 {
179 return *this << p; 189 return *this >> p;
180 } 190 }
181 else 191 else
182 { 192 {
183 return *this >> p; 193 return *this << p;
184 } 194 }
185} 195}
186 196
187Serializer::Serializer &operator&(int64_t &p) 197Serializer &Serializer::operator&&(int64_t &p)
188{ 198{
189 if (bLoading) 199 if (bLoading)
190 { 200 {
191 return *this << p; 201 return *this >> p;
192 } 202 }
193 else 203 else
194 { 204 {
195 return *this >> p; 205 return *this << p;
196 } 206 }
197} 207}
198 208
199Serializer::Serializer &operator&(uint8_t &p) 209Serializer &Serializer::operator&&(uint8_t &p)
200{ 210{
201 if (bLoading) 211 if (bLoading)
202 { 212 {
203 return *this << p; 213 return *this >> p;
204 } 214 }
205 else 215 else
206 { 216 {
207 return *this >> p; 217 return *this << p;
208 } 218 }
209} 219}
210 220
211Serializer::Serializer &operator&(uint16_t &p) 221Serializer &Serializer::operator&&(uint16_t &p)
212{ 222{
213 if (bLoading) 223 if (bLoading)
214 { 224 {
215 return *this << p; 225 return *this >> p;
216 } 226 }
217 else 227 else
218 { 228 {
219 return *this >> p; 229 return *this << p;
220 } 230 }
221} 231}
222 232
223Serializer::Serializer &operator&(uint32_t &p) 233Serializer &Serializer::operator&&(uint32_t &p)
224{ 234{
225 if (bLoading) 235 if (bLoading)
226 { 236 {
227 return *this << p; 237 return *this >> p;
228 } 238 }
229 else 239 else
230 { 240 {
231 return *this >> p; 241 return *this << p;
232 } 242 }
233} 243}
234 244
235Serializer::Serializer &operator&(uint64_t &p) 245Serializer &Serializer::operator&&(uint64_t &p)
236{ 246{
237 if (bLoading) 247 if (bLoading)
238 { 248 {
239 return *this << p; 249 return *this >> p;
240 } 250 }
241 else 251 else
242 { 252 {
243 return *this >> p; 253 return *this << p;
244 } 254 }
245} 255}
246 256
247Serializer::Serializer &operator&(float &p) 257Serializer &Serializer::operator&&(float &p)
248{ 258{
249 if (bLoading) 259 if (bLoading)
250 { 260 {
251 return *this << p; 261 return *this >> p;
252 } 262 }
253 else 263 else
254 { 264 {
255 return *this >> p; 265 return *this << p;
256 } 266 }
257} 267}
258 268
259Serializer::Serializer &operator&(double &p) 269Serializer &Serializer::operator&&(double &p)
260{ 270{
261 if (bLoading) 271 if (bLoading)
262 { 272 {
263 return *this << p; 273 return *this >> p;
264 } 274 }
265 else 275 else
266 { 276 {
267 return *this >> p; 277 return *this << p;
268 } 278 }
269} 279}
270 280
271Serializer::Serializer &operator&(long double &p) 281Serializer &Serializer::operator&&(long double &p)
272{ 282{
273 if (bLoading) 283 if (bLoading)
274 { 284 {
275 return *this << p; 285 return *this >> p;
276 } 286 }
277 else 287 else
278 { 288 {
279 return *this >> p; 289 return *this << p;
280 } 290 }
281}*/ 291}
282 292
283 293
284Serializer &operator<<(Serializer &s, Serializable &p) 294Serializer &operator<<(Serializer &s, Serializable &p)
@@ -293,17 +303,17 @@ Serializer &operator>>(Serializer &s, Serializable &p)
293 return s; 303 return s;
294} 304}
295 305
296/*Serializer::Serializer &operator&(Serializable &p) 306Serializer &operator&&(Serializer &s, Serializable &p)
297{ 307{
298 if (bLoading) 308 if (s.isLoading())
299 { 309 {
300 return *this << p; 310 return s >> p;
301 } 311 }
302 else 312 else
303 { 313 {
304 return *this >> p; 314 return s << p;
305 } 315 }
306}*/ 316}
307 317
308Serializer &operator<<( Serializer &ar, std::string &s ) 318Serializer &operator<<( Serializer &ar, std::string &s )
309{ 319{