From 2b8255fabce194b35f7b2a350fd08f43d1e698a6 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 19 Mar 2007 18:44:25 +0000 Subject: Fixed some bugs and added some new goo. You can serialize FStrings and Heshes now. --- src/serializer.cpp | 94 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 42 deletions(-) (limited to 'src/serializer.cpp') 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) write( &p, sizeof(p) ); return *this; } +Serializer &Serializer::operator<<(long p) +{ + write( &p, sizeof(p) ); + return *this; +} Serializer &Serializer::operator<<(float p) { write( &p, sizeof(p) ); @@ -120,6 +125,11 @@ Serializer &Serializer::operator>>(uint64_t &p) read( &p, sizeof(p) ); return *this; } +Serializer &Serializer::operator>>(long &p) +{ + read( &p, sizeof(p) ); + return *this; +} Serializer &Serializer::operator>>(float &p) { read( &p, sizeof(p) ); @@ -136,149 +146,149 @@ Serializer &Serializer::operator>>(long double &p) return *this; } -/*Serializer::Serializer &operator&(bool &p) +Serializer &Serializer::operator&&(bool &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(int8_t &p) +Serializer &Serializer::operator&&(int8_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(int16_t &p) +Serializer &Serializer::operator&&(int16_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(int32_t &p) +Serializer &Serializer::operator&&(int32_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(int64_t &p) +Serializer &Serializer::operator&&(int64_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(uint8_t &p) +Serializer &Serializer::operator&&(uint8_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(uint16_t &p) +Serializer &Serializer::operator&&(uint16_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(uint32_t &p) +Serializer &Serializer::operator&&(uint32_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(uint64_t &p) +Serializer &Serializer::operator&&(uint64_t &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(float &p) +Serializer &Serializer::operator&&(float &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(double &p) +Serializer &Serializer::operator&&(double &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } } -Serializer::Serializer &operator&(long double &p) +Serializer &Serializer::operator&&(long double &p) { if (bLoading) { - return *this << p; + return *this >> p; } else { - return *this >> p; + return *this << p; } -}*/ +} Serializer &operator<<(Serializer &s, Serializable &p) @@ -293,17 +303,17 @@ Serializer &operator>>(Serializer &s, Serializable &p) return s; } -/*Serializer::Serializer &operator&(Serializable &p) +Serializer &operator&&(Serializer &s, Serializable &p) { - if (bLoading) + if (s.isLoading()) { - return *this << p; + return s >> p; } else { - return *this >> p; + return s << p; } -}*/ +} Serializer &operator<<( Serializer &ar, std::string &s ) { -- cgit v1.2.3