From 7292af7c475c61920987ec498144a3fd1e90f1e8 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 20 Jan 2011 18:16:38 +0000 Subject: Updated with new Bu::String. --- src/dictionary.cpp | 58 ++++++++++++++++++++++++++--------------------------- src/dictionary.h | 56 +++++++++++++++++++++++++-------------------------- src/float.h | 4 ++-- src/list.cpp | 4 ++-- src/list.h | 6 +++--- src/string.cpp | 14 ++++++------- src/string.h | 6 +++--- src/unit/basic.unit | 8 ++++---- src/unit/io.unit | 6 +++--- 9 files changed, 81 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/dictionary.cpp b/src/dictionary.cpp index 4430e73..aaba7b8 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -11,7 +11,7 @@ template<> uint32_t Bu::__calcHashCode( const Gats::String &s ) { - return __calcHashCode( dynamic_cast(s) ); + return __calcHashCode( dynamic_cast(s) ); } Gats::Dictionary::Dictionary() @@ -56,119 +56,119 @@ void Gats::Dictionary::read( Bu::Stream &rIn, char cType ) } } -void Gats::Dictionary::insert( const Bu::FString &sKey, char i ) +void Gats::Dictionary::insert( const Bu::String &sKey, char i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned char i ) +void Gats::Dictionary::insert( const Bu::String &sKey, unsigned char i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, signed char i ) +void Gats::Dictionary::insert( const Bu::String &sKey, signed char i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned short i ) +void Gats::Dictionary::insert( const Bu::String &sKey, unsigned short i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, signed short i ) +void Gats::Dictionary::insert( const Bu::String &sKey, signed short i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned int i ) +void Gats::Dictionary::insert( const Bu::String &sKey, unsigned int i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, signed int i ) +void Gats::Dictionary::insert( const Bu::String &sKey, signed int i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned long i ) +void Gats::Dictionary::insert( const Bu::String &sKey, unsigned long i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, signed long i ) +void Gats::Dictionary::insert( const Bu::String &sKey, signed long i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned long long i ) +void Gats::Dictionary::insert( const Bu::String &sKey, unsigned long long i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, signed long long i ) +void Gats::Dictionary::insert( const Bu::String &sKey, signed long long i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } /* -void Gats::Dictionary::insert( const Bu::FString &sKey, bool b ) +void Gats::Dictionary::insert( const Bu::String &sKey, bool b ) { Bu::Hash::insert( sKey, new Gats::Boolean( b ) ); }*/ -void Gats::Dictionary::insert( const Bu::FString &sKey, float d ) +void Gats::Dictionary::insert( const Bu::String &sKey, float d ) { Bu::Hash::insert( sKey, new Gats::Float( d ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, double d ) +void Gats::Dictionary::insert( const Bu::String &sKey, double d ) { Bu::Hash::insert( sKey, new Gats::Float( d ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, const char *s ) +void Gats::Dictionary::insert( const Bu::String &sKey, const char *s ) { Bu::Hash::insert( sKey, new Gats::String( s ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, const Bu::FString &s ) +void Gats::Dictionary::insert( const Bu::String &sKey, const Bu::String &s ) { Bu::Hash::insert( sKey, new Gats::String( s ) ); } -bool Gats::Dictionary::getBool( const Bu::FString &sKey ) +bool Gats::Dictionary::getBool( const Bu::String &sKey ) { Gats::Boolean *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -178,7 +178,7 @@ bool Gats::Dictionary::getBool( const Bu::FString &sKey ) return pOb->getValue(); } -int64_t Gats::Dictionary::getInt( const Bu::FString &sKey ) +int64_t Gats::Dictionary::getInt( const Bu::String &sKey ) { Gats::Integer *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -188,7 +188,7 @@ int64_t Gats::Dictionary::getInt( const Bu::FString &sKey ) return pOb->getValue(); } -double Gats::Dictionary::getFloat( const Bu::FString &sKey ) +double Gats::Dictionary::getFloat( const Bu::String &sKey ) { Gats::Float *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -198,7 +198,7 @@ double Gats::Dictionary::getFloat( const Bu::FString &sKey ) return pOb->getValue(); } -Bu::FString Gats::Dictionary::getStr( const Bu::FString &sKey ) +Bu::String Gats::Dictionary::getStr( const Bu::String &sKey ) { Gats::String *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -208,7 +208,7 @@ Bu::FString Gats::Dictionary::getStr( const Bu::FString &sKey ) return *pOb; } -Gats::List *Gats::Dictionary::getList( const Bu::FString &sKey ) +Gats::List *Gats::Dictionary::getList( const Bu::String &sKey ) { Gats::List *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -218,7 +218,7 @@ Gats::List *Gats::Dictionary::getList( const Bu::FString &sKey ) return pOb; } -Gats::Dictionary *Gats::Dictionary::getDict( const Bu::FString &sKey ) +Gats::Dictionary *Gats::Dictionary::getDict( const Bu::String &sKey ) { Gats::Dictionary *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -228,7 +228,7 @@ Gats::Dictionary *Gats::Dictionary::getDict( const Bu::FString &sKey ) return pOb; } -bool Gats::Dictionary::getBool( const Bu::FString &sKey ) const +bool Gats::Dictionary::getBool( const Bu::String &sKey ) const { Gats::Boolean *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -238,7 +238,7 @@ bool Gats::Dictionary::getBool( const Bu::FString &sKey ) const return pOb->getValue(); } -int64_t Gats::Dictionary::getInt( const Bu::FString &sKey ) const +int64_t Gats::Dictionary::getInt( const Bu::String &sKey ) const { Gats::Integer *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -248,7 +248,7 @@ int64_t Gats::Dictionary::getInt( const Bu::FString &sKey ) const return pOb->getValue(); } -double Gats::Dictionary::getFloat( const Bu::FString &sKey ) const +double Gats::Dictionary::getFloat( const Bu::String &sKey ) const { Gats::Float *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -258,7 +258,7 @@ double Gats::Dictionary::getFloat( const Bu::FString &sKey ) const return pOb->getValue(); } -Bu::FString Gats::Dictionary::getStr( const Bu::FString &sKey ) const +Bu::String Gats::Dictionary::getStr( const Bu::String &sKey ) const { Gats::String *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -268,7 +268,7 @@ Bu::FString Gats::Dictionary::getStr( const Bu::FString &sKey ) const return *pOb; } -Gats::List *Gats::Dictionary::getList( const Bu::FString &sKey ) const +Gats::List *Gats::Dictionary::getList( const Bu::String &sKey ) const { Gats::List *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) @@ -278,7 +278,7 @@ Gats::List *Gats::Dictionary::getList( const Bu::FString &sKey ) const return pOb; } -Gats::Dictionary *Gats::Dictionary::getDict( const Bu::FString &sKey ) const +Gats::Dictionary *Gats::Dictionary::getDict( const Bu::String &sKey ) const { Gats::Dictionary *pOb = dynamic_cast( get( sKey ) ); if( !pOb ) diff --git a/src/dictionary.h b/src/dictionary.h index 1197a19..d421720 100644 --- a/src/dictionary.h +++ b/src/dictionary.h @@ -20,37 +20,37 @@ namespace Gats virtual void write( Bu::Stream &rOut ) const; virtual void read( Bu::Stream &rIn, char cType ); - void insert( const Bu::FString &sKey, const char *s ); - void insert( const Bu::FString &sKey, const Bu::FString &s ); - void insert( const Bu::FString &sKey, char i ); - void insert( const Bu::FString &sKey, unsigned char i ); - void insert( const Bu::FString &sKey, signed char i ); - void insert( const Bu::FString &sKey, unsigned short i ); - void insert( const Bu::FString &sKey, signed short i ); - void insert( const Bu::FString &sKey, unsigned int i ); - void insert( const Bu::FString &sKey, signed int i ); - void insert( const Bu::FString &sKey, unsigned long i ); - void insert( const Bu::FString &sKey, signed long i ); - void insert( const Bu::FString &sKey, unsigned long long i ); - void insert( const Bu::FString &sKey, signed long long i ); - //void insert( const Bu::FString &sKey, bool b ); - void insert( const Bu::FString &sKey, float d ); - void insert( const Bu::FString &sKey, double d ); + void insert( const Bu::String &sKey, const char *s ); + void insert( const Bu::String &sKey, const Bu::String &s ); + void insert( const Bu::String &sKey, char i ); + void insert( const Bu::String &sKey, unsigned char i ); + void insert( const Bu::String &sKey, signed char i ); + void insert( const Bu::String &sKey, unsigned short i ); + void insert( const Bu::String &sKey, signed short i ); + void insert( const Bu::String &sKey, unsigned int i ); + void insert( const Bu::String &sKey, signed int i ); + void insert( const Bu::String &sKey, unsigned long i ); + void insert( const Bu::String &sKey, signed long i ); + void insert( const Bu::String &sKey, unsigned long long i ); + void insert( const Bu::String &sKey, signed long long i ); + //void insert( const Bu::String &sKey, bool b ); + void insert( const Bu::String &sKey, float d ); + void insert( const Bu::String &sKey, double d ); using Bu::Hash::insert; - bool getBool( const Bu::FString &sKey ); - int64_t getInt( const Bu::FString &sKey ); - double getFloat( const Bu::FString &sKey ); - Bu::FString getStr( const Bu::FString &sKey ); - Gats::List *getList( const Bu::FString &sKey ); - Gats::Dictionary *getDict( const Bu::FString &sKey ); + bool getBool( const Bu::String &sKey ); + int64_t getInt( const Bu::String &sKey ); + double getFloat( const Bu::String &sKey ); + Bu::String getStr( const Bu::String &sKey ); + Gats::List *getList( const Bu::String &sKey ); + Gats::Dictionary *getDict( const Bu::String &sKey ); - bool getBool( const Bu::FString &sKey ) const; - int64_t getInt( const Bu::FString &sKey ) const; - double getFloat( const Bu::FString &sKey ) const; - Bu::FString getStr( const Bu::FString &sKey ) const; - Gats::List *getList( const Bu::FString &sKey ) const; - Gats::Dictionary *getDict( const Bu::FString &sKey ) const; + bool getBool( const Bu::String &sKey ) const; + int64_t getInt( const Bu::String &sKey ) const; + double getFloat( const Bu::String &sKey ) const; + Bu::String getStr( const Bu::String &sKey ) const; + Gats::List *getList( const Bu::String &sKey ) const; + Gats::Dictionary *getDict( const Bu::String &sKey ) const; }; }; diff --git a/src/float.h b/src/float.h index f7a3ed3..ad02d28 100644 --- a/src/float.h +++ b/src/float.h @@ -3,7 +3,7 @@ #include "gats/object.h" -#include +#include namespace Gats { @@ -22,7 +22,7 @@ namespace Gats private: double fVal; - mutable Bu::FString sWriteCache; + mutable Bu::String sWriteCache; }; } diff --git a/src/list.cpp b/src/list.cpp index 0e5f56f..02e2a8d 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -42,7 +42,7 @@ void Gats::List::append( const char *s ) Bu::List::append( new Gats::String( s ) ); } -void Gats::List::append( const Bu::FString &s ) +void Gats::List::append( const Bu::String &s ) { Bu::List::append( new Gats::String( s ) ); } @@ -73,7 +73,7 @@ void Gats::List::prepend( const char *s ) Bu::List::prepend( new Gats::String( s ) ); } -void Gats::List::prepend( const Bu::FString &s ) +void Gats::List::prepend( const Bu::String &s ) { Bu::List::prepend( new Gats::String( s ) ); } diff --git a/src/list.h b/src/list.h index 69cb846..5c50fae 100644 --- a/src/list.h +++ b/src/list.h @@ -3,7 +3,7 @@ #include "gats/object.h" #include -#include +#include namespace Gats { @@ -19,7 +19,7 @@ namespace Gats virtual void read( Bu::Stream &rIn, char cType ); void append( const char *s ); - void append( const Bu::FString &s ); + void append( const Bu::String &s ); void append( int32_t i ); void append( int64_t i ); void append( bool b ); @@ -27,7 +27,7 @@ namespace Gats using Bu::List::append; void prepend( const char *s ); - void prepend( const Bu::FString &s ); + void prepend( const Bu::String &s ); void prepend( int32_t i ); void prepend( int64_t i ); void prepend( bool b ); diff --git a/src/string.cpp b/src/string.cpp index 2134a01..c4c156b 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -9,27 +9,27 @@ Gats::String::String() } Gats::String::String( const char *s ) : - Bu::FString( s ) + Bu::String( s ) { } Gats::String::String( const char *s, long iLength ) : - Bu::FString( s, iLength ) + Bu::String( s, iLength ) { } Gats::String::String( long iLength ) : - Bu::FString( iLength ) + Bu::String( iLength ) { } Gats::String::String( const String &s ) : - Bu::FString( s ) + Bu::String( s ) { } -Gats::String::String( const Bu::FString &s ) : - Bu::FString( s ) +Gats::String::String( const Bu::String &s ) : + Bu::String( s ) { } @@ -55,6 +55,6 @@ void Gats::String::read( Bu::Stream &rIn, char cType ) Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::String &s ) { - return f << "(str) \"" << dynamic_cast(s) << "\""; + return f << "(str) \"" << dynamic_cast(s) << "\""; } diff --git a/src/string.h b/src/string.h index ea13517..f708e22 100644 --- a/src/string.h +++ b/src/string.h @@ -2,11 +2,11 @@ #define GATS_STRING_H #include "gats/object.h" -#include +#include namespace Gats { - class String : public Gats::Object, public Bu::FString + class String : public Gats::Object, public Bu::String { public: String(); @@ -14,7 +14,7 @@ namespace Gats String( const char *s, long iLength ); String( long iLength ); String( const String &s ); - String( const Bu::FString &s ); + String( const Bu::String &s ); virtual ~String(); virtual Type getType() const { return typeString; } diff --git a/src/unit/basic.unit b/src/unit/basic.unit index c27b70c..369e095 100644 --- a/src/unit/basic.unit +++ b/src/unit/basic.unit @@ -52,10 +52,10 @@ suite Basic test string { - Bu::List lStrs; + Bu::List lStrs; Bu::MemBuf mb; - lStrs.append( Bu::FString() ); + lStrs.append( Bu::String() ); Gats::String("").write( mb ); { @@ -66,7 +66,7 @@ suite Basic } for( int j = 1; j <= (1<<16); j=j<<1 ) { - Bu::FString s( j ); + Bu::String s( j ); for( int x = 0; x < j; x++ ) { s[x] = (unsigned char)(random()%256); @@ -78,7 +78,7 @@ suite Basic mb.setPos( 0 ); - for( Bu::List::iterator i = lStrs.begin(); i; i++ ) + for( Bu::List::iterator i = lStrs.begin(); i; i++ ) { Gats::Object *pObj = Gats::Object::read( mb ); if( pObj->getType() != Gats::typeString ) diff --git a/src/unit/io.unit b/src/unit/io.unit index 2cd8376..1a9747f 100644 --- a/src/unit/io.unit +++ b/src/unit/io.unit @@ -26,7 +26,7 @@ suite Basic { test basic { - Bu::FString sTmpFileName("temp-XXXXXXXXX"); + Bu::String sTmpFileName("temp-XXXXXXXXX"); Bu::File fIo = tempFile( sTmpFileName ); { @@ -60,7 +60,7 @@ suite Basic test spacers { - Bu::FString sTmpFileName("temp-XXXXXXXXX"); + Bu::String sTmpFileName("temp-XXXXXXXXX"); Bu::File fIo = tempFile( sTmpFileName ); { @@ -94,7 +94,7 @@ suite Basic test biggerSpacers { - Bu::FString sTmpFileName("temp-XXXXXXXXX"); + Bu::String sTmpFileName("temp-XXXXXXXXX"); Bu::File fIo = tempFile( sTmpFileName ); { -- cgit v1.2.3