From 3ac57795fe8e28915523de6dd95e336a3eaa8064 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 7 Jun 2008 06:15:07 +0000 Subject: This seems to have done the trick, on the 32 bit platform, anyway. Turns out it's a bad idea to rely on the intNN_t typedefs. I enumerated all non-pointer primitives in c++ (except void, you can't store things in a void), and it works great. I also discovered C and C++ actually have unsigned char, signed char, and char, which are all distinct types. It supports all three now. In addition, I got rid of all of the specific && operators, the general one covers it all. Also, the unit tests all pass for now. Now to try it on the 64bit system. --- src/archive.cpp | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 128 insertions(+), 5 deletions(-) (limited to 'src/archive.cpp') diff --git a/src/archive.cpp b/src/archive.cpp index d6ad18d..accdeb1 100644 --- a/src/archive.cpp +++ b/src/archive.cpp @@ -45,6 +45,129 @@ bool Bu::Archive::isLoading() { return bLoading; } + +Bu::Archive &Bu::Archive::operator<<(bool p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(char p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(signed char p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(unsigned char p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(signed short p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(unsigned short p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(signed int p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(unsigned int p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(signed long p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(unsigned long p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(signed long long p) +{ + write( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator<<(unsigned long long p) +{ + write( &p, sizeof(p) ); + return *this; +} + +Bu::Archive &Bu::Archive::operator>>(bool &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(char &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(signed char &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(unsigned char &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(signed short &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(unsigned short &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(signed int &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(unsigned int &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(signed long &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(unsigned long &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(signed long long &p) +{ + read( &p, sizeof(p) ); + return *this; +} +Bu::Archive &Bu::Archive::operator>>(unsigned long long &p) +{ + read( &p, sizeof(p) ); + return *this; +} +/* Bu::Archive &Bu::Archive::operator<<(bool p) { write( &p, sizeof(p) ); @@ -89,12 +212,12 @@ Bu::Archive &Bu::Archive::operator<<(uint64_t p) { write( &p, sizeof(p) ); return *this; -}/* +} Bu::Archive &Bu::Archive::operator<<(long p) { write( &p, sizeof(p) ); return *this; -}*/ +} Bu::Archive &Bu::Archive::operator<<(float p) { write( &p, sizeof(p) ); @@ -155,12 +278,12 @@ Bu::Archive &Bu::Archive::operator>>(uint64_t &p) { read( &p, sizeof(p) ); return *this; -}/* +} Bu::Archive &Bu::Archive::operator>>(long &p) { read( &p, sizeof(p) ); return *this; -}*/ +} Bu::Archive &Bu::Archive::operator>>(float &p) { read( &p, sizeof(p) ); @@ -320,7 +443,7 @@ Bu::Archive &Bu::Archive::operator&&(long double &p) return *this << p; } } - +*/ Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p) { -- cgit v1.2.3