diff options
Diffstat (limited to 'src/archive.cpp')
-rw-r--r-- | src/archive.cpp | 476 |
1 files changed, 0 insertions, 476 deletions
diff --git a/src/archive.cpp b/src/archive.cpp index 6bad44c..1b48ec8 100644 --- a/src/archive.cpp +++ b/src/archive.cpp | |||
@@ -46,482 +46,6 @@ bool Bu::Archive::isLoading() | |||
46 | return bLoading; | 46 | return bLoading; |
47 | } | 47 | } |
48 | 48 | ||
49 | Bu::Archive &Bu::Archive::operator<<(bool p) | ||
50 | { | ||
51 | write( &p, sizeof(p) ); | ||
52 | return *this; | ||
53 | } | ||
54 | Bu::Archive &Bu::Archive::operator<<(char p) | ||
55 | { | ||
56 | write( &p, sizeof(p) ); | ||
57 | return *this; | ||
58 | } | ||
59 | Bu::Archive &Bu::Archive::operator<<(signed char p) | ||
60 | { | ||
61 | write( &p, sizeof(p) ); | ||
62 | return *this; | ||
63 | } | ||
64 | Bu::Archive &Bu::Archive::operator<<(unsigned char p) | ||
65 | { | ||
66 | write( &p, sizeof(p) ); | ||
67 | return *this; | ||
68 | } | ||
69 | Bu::Archive &Bu::Archive::operator<<(signed short p) | ||
70 | { | ||
71 | write( &p, sizeof(p) ); | ||
72 | return *this; | ||
73 | } | ||
74 | Bu::Archive &Bu::Archive::operator<<(unsigned short p) | ||
75 | { | ||
76 | write( &p, sizeof(p) ); | ||
77 | return *this; | ||
78 | } | ||
79 | Bu::Archive &Bu::Archive::operator<<(signed int p) | ||
80 | { | ||
81 | write( &p, sizeof(p) ); | ||
82 | return *this; | ||
83 | } | ||
84 | Bu::Archive &Bu::Archive::operator<<(unsigned int p) | ||
85 | { | ||
86 | write( &p, sizeof(p) ); | ||
87 | return *this; | ||
88 | } | ||
89 | Bu::Archive &Bu::Archive::operator<<(signed long p) | ||
90 | { | ||
91 | write( &p, sizeof(p) ); | ||
92 | return *this; | ||
93 | } | ||
94 | Bu::Archive &Bu::Archive::operator<<(unsigned long p) | ||
95 | { | ||
96 | write( &p, sizeof(p) ); | ||
97 | return *this; | ||
98 | } | ||
99 | Bu::Archive &Bu::Archive::operator<<(signed long long p) | ||
100 | { | ||
101 | write( &p, sizeof(p) ); | ||
102 | return *this; | ||
103 | } | ||
104 | Bu::Archive &Bu::Archive::operator<<(unsigned long long p) | ||
105 | { | ||
106 | write( &p, sizeof(p) ); | ||
107 | return *this; | ||
108 | } | ||
109 | Bu::Archive &Bu::Archive::operator<<(float p) | ||
110 | { | ||
111 | write( &p, sizeof(p) ); | ||
112 | return *this; | ||
113 | } | ||
114 | Bu::Archive &Bu::Archive::operator<<(double p) | ||
115 | { | ||
116 | write( &p, sizeof(p) ); | ||
117 | return *this; | ||
118 | } | ||
119 | Bu::Archive &Bu::Archive::operator<<(long double p) | ||
120 | { | ||
121 | write( &p, sizeof(p) ); | ||
122 | return *this; | ||
123 | } | ||
124 | |||
125 | Bu::Archive &Bu::Archive::operator>>(bool &p) | ||
126 | { | ||
127 | read( &p, sizeof(p) ); | ||
128 | return *this; | ||
129 | } | ||
130 | Bu::Archive &Bu::Archive::operator>>(char &p) | ||
131 | { | ||
132 | read( &p, sizeof(p) ); | ||
133 | return *this; | ||
134 | } | ||
135 | Bu::Archive &Bu::Archive::operator>>(signed char &p) | ||
136 | { | ||
137 | read( &p, sizeof(p) ); | ||
138 | return *this; | ||
139 | } | ||
140 | Bu::Archive &Bu::Archive::operator>>(unsigned char &p) | ||
141 | { | ||
142 | read( &p, sizeof(p) ); | ||
143 | return *this; | ||
144 | } | ||
145 | Bu::Archive &Bu::Archive::operator>>(signed short &p) | ||
146 | { | ||
147 | read( &p, sizeof(p) ); | ||
148 | return *this; | ||
149 | } | ||
150 | Bu::Archive &Bu::Archive::operator>>(unsigned short &p) | ||
151 | { | ||
152 | read( &p, sizeof(p) ); | ||
153 | return *this; | ||
154 | } | ||
155 | Bu::Archive &Bu::Archive::operator>>(signed int &p) | ||
156 | { | ||
157 | read( &p, sizeof(p) ); | ||
158 | return *this; | ||
159 | } | ||
160 | Bu::Archive &Bu::Archive::operator>>(unsigned int &p) | ||
161 | { | ||
162 | read( &p, sizeof(p) ); | ||
163 | return *this; | ||
164 | } | ||
165 | Bu::Archive &Bu::Archive::operator>>(signed long &p) | ||
166 | { | ||
167 | read( &p, sizeof(p) ); | ||
168 | return *this; | ||
169 | } | ||
170 | Bu::Archive &Bu::Archive::operator>>(unsigned long &p) | ||
171 | { | ||
172 | read( &p, sizeof(p) ); | ||
173 | return *this; | ||
174 | } | ||
175 | Bu::Archive &Bu::Archive::operator>>(signed long long &p) | ||
176 | { | ||
177 | read( &p, sizeof(p) ); | ||
178 | return *this; | ||
179 | } | ||
180 | Bu::Archive &Bu::Archive::operator>>(unsigned long long &p) | ||
181 | { | ||
182 | read( &p, sizeof(p) ); | ||
183 | return *this; | ||
184 | } | ||
185 | Bu::Archive &Bu::Archive::operator>>(float &p) | ||
186 | { | ||
187 | read( &p, sizeof(p) ); | ||
188 | return *this; | ||
189 | } | ||
190 | Bu::Archive &Bu::Archive::operator>>(double &p) | ||
191 | { | ||
192 | read( &p, sizeof(p) ); | ||
193 | return *this; | ||
194 | } | ||
195 | Bu::Archive &Bu::Archive::operator>>(long double &p) | ||
196 | { | ||
197 | read( &p, sizeof(p) ); | ||
198 | return *this; | ||
199 | } | ||
200 | |||
201 | /* | ||
202 | Bu::Archive &Bu::Archive::operator<<(bool p) | ||
203 | { | ||
204 | write( &p, sizeof(p) ); | ||
205 | return *this; | ||
206 | } | ||
207 | Bu::Archive &Bu::Archive::operator<<(int8_t p) | ||
208 | { | ||
209 | write( &p, sizeof(p) ); | ||
210 | return *this; | ||
211 | } | ||
212 | Bu::Archive &Bu::Archive::operator<<(int16_t p) | ||
213 | { | ||
214 | write( &p, sizeof(p) ); | ||
215 | return *this; | ||
216 | } | ||
217 | Bu::Archive &Bu::Archive::operator<<(int32_t p) | ||
218 | { | ||
219 | write( &p, sizeof(p) ); | ||
220 | return *this; | ||
221 | } | ||
222 | Bu::Archive &Bu::Archive::operator<<(int64_t p) | ||
223 | { | ||
224 | write( &p, sizeof(p) ); | ||
225 | return *this; | ||
226 | } | ||
227 | Bu::Archive &Bu::Archive::operator<<(uint8_t p) | ||
228 | { | ||
229 | write( &p, sizeof(p) ); | ||
230 | return *this; | ||
231 | } | ||
232 | Bu::Archive &Bu::Archive::operator<<(uint16_t p) | ||
233 | { | ||
234 | write( &p, sizeof(p) ); | ||
235 | return *this; | ||
236 | } | ||
237 | Bu::Archive &Bu::Archive::operator<<(uint32_t p) | ||
238 | { | ||
239 | write( &p, sizeof(p) ); | ||
240 | return *this; | ||
241 | } | ||
242 | Bu::Archive &Bu::Archive::operator<<(uint64_t p) | ||
243 | { | ||
244 | write( &p, sizeof(p) ); | ||
245 | return *this; | ||
246 | } | ||
247 | Bu::Archive &Bu::Archive::operator<<(long p) | ||
248 | { | ||
249 | write( &p, sizeof(p) ); | ||
250 | return *this; | ||
251 | } | ||
252 | Bu::Archive &Bu::Archive::operator<<(float p) | ||
253 | { | ||
254 | write( &p, sizeof(p) ); | ||
255 | return *this; | ||
256 | } | ||
257 | Bu::Archive &Bu::Archive::operator<<(double p) | ||
258 | { | ||
259 | write( &p, sizeof(p) ); | ||
260 | return *this; | ||
261 | } | ||
262 | Bu::Archive &Bu::Archive::operator<<(long double p) | ||
263 | { | ||
264 | write( &p, sizeof(p) ); | ||
265 | return *this; | ||
266 | } | ||
267 | |||
268 | Bu::Archive &Bu::Archive::operator>>(bool &p) | ||
269 | { | ||
270 | read( &p, sizeof(p) ); | ||
271 | return *this; | ||
272 | } | ||
273 | Bu::Archive &Bu::Archive::operator>>(int8_t &p) | ||
274 | { | ||
275 | read( &p, sizeof(p) ); | ||
276 | return *this; | ||
277 | } | ||
278 | Bu::Archive &Bu::Archive::operator>>(int16_t &p) | ||
279 | { | ||
280 | read( &p, sizeof(p) ); | ||
281 | return *this; | ||
282 | } | ||
283 | Bu::Archive &Bu::Archive::operator>>(int32_t &p) | ||
284 | { | ||
285 | read( &p, sizeof(p) ); | ||
286 | return *this; | ||
287 | } | ||
288 | Bu::Archive &Bu::Archive::operator>>(int64_t &p) | ||
289 | { | ||
290 | read( &p, sizeof(p) ); | ||
291 | return *this; | ||
292 | } | ||
293 | Bu::Archive &Bu::Archive::operator>>(uint8_t &p) | ||
294 | { | ||
295 | read( &p, sizeof(p) ); | ||
296 | return *this; | ||
297 | } | ||
298 | Bu::Archive &Bu::Archive::operator>>(uint16_t &p) | ||
299 | { | ||
300 | read( &p, sizeof(p) ); | ||
301 | return *this; | ||
302 | } | ||
303 | Bu::Archive &Bu::Archive::operator>>(uint32_t &p) | ||
304 | { | ||
305 | read( &p, sizeof(p) ); | ||
306 | return *this; | ||
307 | } | ||
308 | Bu::Archive &Bu::Archive::operator>>(uint64_t &p) | ||
309 | { | ||
310 | read( &p, sizeof(p) ); | ||
311 | return *this; | ||
312 | } | ||
313 | Bu::Archive &Bu::Archive::operator>>(long &p) | ||
314 | { | ||
315 | read( &p, sizeof(p) ); | ||
316 | return *this; | ||
317 | } | ||
318 | Bu::Archive &Bu::Archive::operator>>(float &p) | ||
319 | { | ||
320 | read( &p, sizeof(p) ); | ||
321 | return *this; | ||
322 | } | ||
323 | Bu::Archive &Bu::Archive::operator>>(double &p) | ||
324 | { | ||
325 | read( &p, sizeof(p) ); | ||
326 | return *this; | ||
327 | } | ||
328 | Bu::Archive &Bu::Archive::operator>>(long double &p) | ||
329 | { | ||
330 | read( &p, sizeof(p) ); | ||
331 | return *this; | ||
332 | } | ||
333 | |||
334 | Bu::Archive &Bu::Archive::operator&&(bool &p) | ||
335 | { | ||
336 | if (bLoading) | ||
337 | { | ||
338 | return *this >> p; | ||
339 | } | ||
340 | else | ||
341 | { | ||
342 | return *this << p; | ||
343 | } | ||
344 | } | ||
345 | |||
346 | Bu::Archive &Bu::Archive::operator&&(int8_t &p) | ||
347 | { | ||
348 | if (bLoading) | ||
349 | { | ||
350 | return *this >> p; | ||
351 | } | ||
352 | else | ||
353 | { | ||
354 | return *this << p; | ||
355 | } | ||
356 | } | ||
357 | |||
358 | Bu::Archive &Bu::Archive::operator&&(int16_t &p) | ||
359 | { | ||
360 | if (bLoading) | ||
361 | { | ||
362 | return *this >> p; | ||
363 | } | ||
364 | else | ||
365 | { | ||
366 | return *this << p; | ||
367 | } | ||
368 | } | ||
369 | |||
370 | Bu::Archive &Bu::Archive::operator&&(int32_t &p) | ||
371 | { | ||
372 | if (bLoading) | ||
373 | { | ||
374 | return *this >> p; | ||
375 | } | ||
376 | else | ||
377 | { | ||
378 | return *this << p; | ||
379 | } | ||
380 | } | ||
381 | |||
382 | Bu::Archive &Bu::Archive::operator&&(int64_t &p) | ||
383 | { | ||
384 | if (bLoading) | ||
385 | { | ||
386 | return *this >> p; | ||
387 | } | ||
388 | else | ||
389 | { | ||
390 | return *this << p; | ||
391 | } | ||
392 | } | ||
393 | |||
394 | Bu::Archive &Bu::Archive::operator&&(uint8_t &p) | ||
395 | { | ||
396 | if (bLoading) | ||
397 | { | ||
398 | return *this >> p; | ||
399 | } | ||
400 | else | ||
401 | { | ||
402 | return *this << p; | ||
403 | } | ||
404 | } | ||
405 | |||
406 | Bu::Archive &Bu::Archive::operator&&(uint16_t &p) | ||
407 | { | ||
408 | if (bLoading) | ||
409 | { | ||
410 | return *this >> p; | ||
411 | } | ||
412 | else | ||
413 | { | ||
414 | return *this << p; | ||
415 | } | ||
416 | } | ||
417 | |||
418 | Bu::Archive &Bu::Archive::operator&&(uint32_t &p) | ||
419 | { | ||
420 | if (bLoading) | ||
421 | { | ||
422 | return *this >> p; | ||
423 | } | ||
424 | else | ||
425 | { | ||
426 | return *this << p; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | Bu::Archive &Bu::Archive::operator&&(uint64_t &p) | ||
431 | { | ||
432 | if (bLoading) | ||
433 | { | ||
434 | return *this >> p; | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | return *this << p; | ||
439 | } | ||
440 | } | ||
441 | |||
442 | Bu::Archive &Bu::Archive::operator&&(float &p) | ||
443 | { | ||
444 | if (bLoading) | ||
445 | { | ||
446 | return *this >> p; | ||
447 | } | ||
448 | else | ||
449 | { | ||
450 | return *this << p; | ||
451 | } | ||
452 | } | ||
453 | |||
454 | Bu::Archive &Bu::Archive::operator&&(double &p) | ||
455 | { | ||
456 | if (bLoading) | ||
457 | { | ||
458 | return *this >> p; | ||
459 | } | ||
460 | else | ||
461 | { | ||
462 | return *this << p; | ||
463 | } | ||
464 | } | ||
465 | |||
466 | Bu::Archive &Bu::Archive::operator&&(long double &p) | ||
467 | { | ||
468 | if (bLoading) | ||
469 | { | ||
470 | return *this >> p; | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | return *this << p; | ||
475 | } | ||
476 | } | ||
477 | */ | ||
478 | |||
479 | Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p) | ||
480 | { | ||
481 | p.archive( s ); | ||
482 | return s; | ||
483 | } | ||
484 | |||
485 | Bu::Archive &Bu::operator>>(Bu::Archive &s, Bu::Archival &p) | ||
486 | { | ||
487 | p.archive( s ); | ||
488 | return s; | ||
489 | } | ||
490 | |||
491 | Bu::Archive &Bu::operator<<(Bu::Archive &ar, class Bu::Archival *p ) | ||
492 | { | ||
493 | ar << *p; | ||
494 | return ar; | ||
495 | } | ||
496 | |||
497 | Bu::Archive &Bu::operator>>(Bu::Archive &ar, class Bu::Archival *p ) | ||
498 | { | ||
499 | ar >> *p; | ||
500 | return ar; | ||
501 | } | ||
502 | |||
503 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, std::string &s ) | ||
504 | { | ||
505 | // This should be defined as long anyway, this is just insurance | ||
506 | ar << (long)s.length(); | ||
507 | ar.write( s.c_str(), s.length() ); | ||
508 | |||
509 | return ar; | ||
510 | } | ||
511 | |||
512 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, std::string &s ) | ||
513 | { | ||
514 | long l; | ||
515 | ar >> l; | ||
516 | char *tmp = new char[l+1]; | ||
517 | tmp[l] = '\0'; | ||
518 | ar.read( tmp, l ); | ||
519 | s = tmp; | ||
520 | delete[] tmp; | ||
521 | |||
522 | return ar; | ||
523 | } | ||
524 | |||
525 | uint32_t Bu::Archive::getID( const void *ptr ) | 49 | uint32_t Bu::Archive::getID( const void *ptr ) |
526 | { | 50 | { |
527 | if( hPtrID.has( (ptrdiff_t)ptr ) ) | 51 | if( hPtrID.has( (ptrdiff_t)ptr ) ) |