aboutsummaryrefslogtreecommitdiff
path: root/src/archive.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-11-12 17:05:30 +0000
committerMike Buland <eichlan@xagasoft.com>2009-11-12 17:05:30 +0000
commit509d136e9adb60c56369565b9545e613cac3678e (patch)
treef118d676edeae2d5e17f48b32b180d4761b60520 /src/archive.cpp
parent3166bd631a093f42ea44a4b0f4d914cf51518bd4 (diff)
downloadlibbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.gz
libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.bz2
libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.xz
libbu++-509d136e9adb60c56369565b9545e613cac3678e.zip
I've started my campaign to clean up all of the header files in libbu++ as far
as includes go. This required a little bit of reworking as far as archive goes, but I've been planning on changing it aronud for a bit anyway. The final result here is that you may need to add some more includes in your own code, libbu++ doesn't include as many random things you didn't ask for anymore, most of these seem to be bu/hash.h, unistd.h, and time.h. Also, any Archive functions and operators should use ArchiveBase when they can instead of Archive, archivebase.h is a much lighterweight include that will be used everywhere in core that it can be, there are a few classes that actually want a specific archiver to be used, they will use it (such as the nids storage class). So far, except for adding header files, nothing has changed in functionality, and no other code changes should be required, although the above mentioned archive changeover is reccomended.
Diffstat (limited to 'src/archive.cpp')
-rw-r--r--src/archive.cpp476
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
49Bu::Archive &Bu::Archive::operator<<(bool p)
50{
51 write( &p, sizeof(p) );
52 return *this;
53}
54Bu::Archive &Bu::Archive::operator<<(char p)
55{
56 write( &p, sizeof(p) );
57 return *this;
58}
59Bu::Archive &Bu::Archive::operator<<(signed char p)
60{
61 write( &p, sizeof(p) );
62 return *this;
63}
64Bu::Archive &Bu::Archive::operator<<(unsigned char p)
65{
66 write( &p, sizeof(p) );
67 return *this;
68}
69Bu::Archive &Bu::Archive::operator<<(signed short p)
70{
71 write( &p, sizeof(p) );
72 return *this;
73}
74Bu::Archive &Bu::Archive::operator<<(unsigned short p)
75{
76 write( &p, sizeof(p) );
77 return *this;
78}
79Bu::Archive &Bu::Archive::operator<<(signed int p)
80{
81 write( &p, sizeof(p) );
82 return *this;
83}
84Bu::Archive &Bu::Archive::operator<<(unsigned int p)
85{
86 write( &p, sizeof(p) );
87 return *this;
88}
89Bu::Archive &Bu::Archive::operator<<(signed long p)
90{
91 write( &p, sizeof(p) );
92 return *this;
93}
94Bu::Archive &Bu::Archive::operator<<(unsigned long p)
95{
96 write( &p, sizeof(p) );
97 return *this;
98}
99Bu::Archive &Bu::Archive::operator<<(signed long long p)
100{
101 write( &p, sizeof(p) );
102 return *this;
103}
104Bu::Archive &Bu::Archive::operator<<(unsigned long long p)
105{
106 write( &p, sizeof(p) );
107 return *this;
108}
109Bu::Archive &Bu::Archive::operator<<(float p)
110{
111 write( &p, sizeof(p) );
112 return *this;
113}
114Bu::Archive &Bu::Archive::operator<<(double p)
115{
116 write( &p, sizeof(p) );
117 return *this;
118}
119Bu::Archive &Bu::Archive::operator<<(long double p)
120{
121 write( &p, sizeof(p) );
122 return *this;
123}
124
125Bu::Archive &Bu::Archive::operator>>(bool &p)
126{
127 read( &p, sizeof(p) );
128 return *this;
129}
130Bu::Archive &Bu::Archive::operator>>(char &p)
131{
132 read( &p, sizeof(p) );
133 return *this;
134}
135Bu::Archive &Bu::Archive::operator>>(signed char &p)
136{
137 read( &p, sizeof(p) );
138 return *this;
139}
140Bu::Archive &Bu::Archive::operator>>(unsigned char &p)
141{
142 read( &p, sizeof(p) );
143 return *this;
144}
145Bu::Archive &Bu::Archive::operator>>(signed short &p)
146{
147 read( &p, sizeof(p) );
148 return *this;
149}
150Bu::Archive &Bu::Archive::operator>>(unsigned short &p)
151{
152 read( &p, sizeof(p) );
153 return *this;
154}
155Bu::Archive &Bu::Archive::operator>>(signed int &p)
156{
157 read( &p, sizeof(p) );
158 return *this;
159}
160Bu::Archive &Bu::Archive::operator>>(unsigned int &p)
161{
162 read( &p, sizeof(p) );
163 return *this;
164}
165Bu::Archive &Bu::Archive::operator>>(signed long &p)
166{
167 read( &p, sizeof(p) );
168 return *this;
169}
170Bu::Archive &Bu::Archive::operator>>(unsigned long &p)
171{
172 read( &p, sizeof(p) );
173 return *this;
174}
175Bu::Archive &Bu::Archive::operator>>(signed long long &p)
176{
177 read( &p, sizeof(p) );
178 return *this;
179}
180Bu::Archive &Bu::Archive::operator>>(unsigned long long &p)
181{
182 read( &p, sizeof(p) );
183 return *this;
184}
185Bu::Archive &Bu::Archive::operator>>(float &p)
186{
187 read( &p, sizeof(p) );
188 return *this;
189}
190Bu::Archive &Bu::Archive::operator>>(double &p)
191{
192 read( &p, sizeof(p) );
193 return *this;
194}
195Bu::Archive &Bu::Archive::operator>>(long double &p)
196{
197 read( &p, sizeof(p) );
198 return *this;
199}
200
201/*
202Bu::Archive &Bu::Archive::operator<<(bool p)
203{
204 write( &p, sizeof(p) );
205 return *this;
206}
207Bu::Archive &Bu::Archive::operator<<(int8_t p)
208{
209 write( &p, sizeof(p) );
210 return *this;
211}
212Bu::Archive &Bu::Archive::operator<<(int16_t p)
213{
214 write( &p, sizeof(p) );
215 return *this;
216}
217Bu::Archive &Bu::Archive::operator<<(int32_t p)
218{
219 write( &p, sizeof(p) );
220 return *this;
221}
222Bu::Archive &Bu::Archive::operator<<(int64_t p)
223{
224 write( &p, sizeof(p) );
225 return *this;
226}
227Bu::Archive &Bu::Archive::operator<<(uint8_t p)
228{
229 write( &p, sizeof(p) );
230 return *this;
231}
232Bu::Archive &Bu::Archive::operator<<(uint16_t p)
233{
234 write( &p, sizeof(p) );
235 return *this;
236}
237Bu::Archive &Bu::Archive::operator<<(uint32_t p)
238{
239 write( &p, sizeof(p) );
240 return *this;
241}
242Bu::Archive &Bu::Archive::operator<<(uint64_t p)
243{
244 write( &p, sizeof(p) );
245 return *this;
246}
247Bu::Archive &Bu::Archive::operator<<(long p)
248{
249 write( &p, sizeof(p) );
250 return *this;
251}
252Bu::Archive &Bu::Archive::operator<<(float p)
253{
254 write( &p, sizeof(p) );
255 return *this;
256}
257Bu::Archive &Bu::Archive::operator<<(double p)
258{
259 write( &p, sizeof(p) );
260 return *this;
261}
262Bu::Archive &Bu::Archive::operator<<(long double p)
263{
264 write( &p, sizeof(p) );
265 return *this;
266}
267
268Bu::Archive &Bu::Archive::operator>>(bool &p)
269{
270 read( &p, sizeof(p) );
271 return *this;
272}
273Bu::Archive &Bu::Archive::operator>>(int8_t &p)
274{
275 read( &p, sizeof(p) );
276 return *this;
277}
278Bu::Archive &Bu::Archive::operator>>(int16_t &p)
279{
280 read( &p, sizeof(p) );
281 return *this;
282}
283Bu::Archive &Bu::Archive::operator>>(int32_t &p)
284{
285 read( &p, sizeof(p) );
286 return *this;
287}
288Bu::Archive &Bu::Archive::operator>>(int64_t &p)
289{
290 read( &p, sizeof(p) );
291 return *this;
292}
293Bu::Archive &Bu::Archive::operator>>(uint8_t &p)
294{
295 read( &p, sizeof(p) );
296 return *this;
297}
298Bu::Archive &Bu::Archive::operator>>(uint16_t &p)
299{
300 read( &p, sizeof(p) );
301 return *this;
302}
303Bu::Archive &Bu::Archive::operator>>(uint32_t &p)
304{
305 read( &p, sizeof(p) );
306 return *this;
307}
308Bu::Archive &Bu::Archive::operator>>(uint64_t &p)
309{
310 read( &p, sizeof(p) );
311 return *this;
312}
313Bu::Archive &Bu::Archive::operator>>(long &p)
314{
315 read( &p, sizeof(p) );
316 return *this;
317}
318Bu::Archive &Bu::Archive::operator>>(float &p)
319{
320 read( &p, sizeof(p) );
321 return *this;
322}
323Bu::Archive &Bu::Archive::operator>>(double &p)
324{
325 read( &p, sizeof(p) );
326 return *this;
327}
328Bu::Archive &Bu::Archive::operator>>(long double &p)
329{
330 read( &p, sizeof(p) );
331 return *this;
332}
333
334Bu::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
346Bu::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
358Bu::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
370Bu::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
382Bu::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
394Bu::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
406Bu::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
418Bu::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
430Bu::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
442Bu::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
454Bu::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
466Bu::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
479Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p)
480{
481 p.archive( s );
482 return s;
483}
484
485Bu::Archive &Bu::operator>>(Bu::Archive &s, Bu::Archival &p)
486{
487 p.archive( s );
488 return s;
489}
490
491Bu::Archive &Bu::operator<<(Bu::Archive &ar, class Bu::Archival *p )
492{
493 ar << *p;
494 return ar;
495}
496
497Bu::Archive &Bu::operator>>(Bu::Archive &ar, class Bu::Archival *p )
498{
499 ar >> *p;
500 return ar;
501}
502
503Bu::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
512Bu::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
525uint32_t Bu::Archive::getID( const void *ptr ) 49uint32_t Bu::Archive::getID( const void *ptr )
526{ 50{
527 if( hPtrID.has( (ptrdiff_t)ptr ) ) 51 if( hPtrID.has( (ptrdiff_t)ptr ) )