From 8e49d2335332b3b97b516c9e00c5235d4f13f03e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 13 Aug 2009 05:56:57 +0000 Subject: Bu::FString now has some fun conversion operators, you can do: X << strVar; where X is any primitive, and strVar is an FString. We'll add other converters later, but it's fun so far. --- src/fstring.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/fstring.cpp b/src/fstring.cpp index c9861e0..ce5492b 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -60,55 +60,55 @@ uint8_t &Bu::operator<<( uint8_t &dst, const Bu::FString &sIn ) return dst; } -int8_t &operator<<( int8_t &dst, const Bu::FString &sIn ) +int8_t &Bu::operator<<( int8_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%hhd", &dst ); return dst; } -char &operator<<( char &dst, const Bu::FString &sIn ) +char &Bu::operator<<( char &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%hhd", &dst ); return dst; } -uint16_t &operator<<( uint16_t &dst, const Bu::FString &sIn ) +uint16_t &Bu::operator<<( uint16_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%hu", &dst ); return dst; } -int16_t &operator<<( int16_t &dst, const Bu::FString &sIn ) +int16_t &Bu::operator<<( int16_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%hd", &dst ); return dst; } -uint32_t &operator<<( uint32_t &dst, const Bu::FString &sIn ) +uint32_t &Bu::operator<<( uint32_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%u", &dst ); return dst; } -int32_t &operator<<( int32_t &dst, const Bu::FString &sIn ) +int32_t &Bu::operator<<( int32_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%d", &dst ); return dst; } -uint64_t &operator<<( uint64_t &dst, const Bu::FString &sIn ) +uint64_t &Bu::operator<<( uint64_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%llu", &dst ); return dst; } -int64_t &operator<<( int64_t &dst, const Bu::FString &sIn ) +int64_t &Bu::operator<<( int64_t &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%lld", &dst ); return dst; } -float &operator<<( float &dst, const Bu::FString &sIn ) +float &Bu::operator<<( float &dst, const Bu::FString &sIn ) { double tmp; sscanf( sIn.getStr(), "%f", &tmp ); @@ -116,19 +116,19 @@ float &operator<<( float &dst, const Bu::FString &sIn ) return dst; } -double &operator<<( double &dst, const Bu::FString &sIn ) +double &Bu::operator<<( double &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%f", &dst ); return dst; } -long double &operator<<( long double &dst, const Bu::FString &sIn ) +long double &Bu::operator<<( long double &dst, const Bu::FString &sIn ) { sscanf( sIn.getStr(), "%Lf", &dst ); return dst; } -Bu::FString &operator<<( Bu::FString &dst, const Bu::FString &sIn ) +Bu::FString &Bu::operator<<( Bu::FString &dst, const Bu::FString &sIn ) { dst = sIn; return dst; -- cgit v1.2.3