From b5eb1431c28254bfa90147f9ee4857598384be31 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 20 Oct 2010 18:35:28 +0000 Subject: Fixed a few minor things. --- src/dictionary.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++--- src/dictionary.h | 15 ++++++++--- src/gatsstream.cpp | 6 ++++- src/gatsstream.h | 1 + src/protocolgats.cpp | 5 +++- src/protocolgats.h | 2 +- 6 files changed, 90 insertions(+), 10 deletions(-) diff --git a/src/dictionary.cpp b/src/dictionary.cpp index 29bbd4e..9b84518 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -56,26 +56,89 @@ void Gats::Dictionary::read( Bu::Stream &rIn, char cType ) } } -void Gats::Dictionary::insert( const Bu::FString &sKey, int32_t i ) +void Gats::Dictionary::insert( const Bu::FString &sKey, char i ) { ((Bu::Hash *)this)->insert( sKey, new Gats::Integer( i ) ); } -void Gats::Dictionary::insert( const Bu::FString &sKey, int64_t i ) +void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned char 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::FString &sKey, signed char i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned short i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, signed short i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned int i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, signed int i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, unsigned long i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &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 ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, signed long long i ) +{ + ((Bu::Hash *)this)->insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insert( const Bu::FString &sKey, bool b ) { Bu::Hash::insert( sKey, new Gats::Boolean( b ) ); -}*/ +} void Gats::Dictionary::insert( const Bu::FString &sKey, double d ) { diff --git a/src/dictionary.h b/src/dictionary.h index c9bf1cb..620b7c3 100644 --- a/src/dictionary.h +++ b/src/dictionary.h @@ -22,9 +22,18 @@ namespace Gats 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, int32_t i ); - void insert( const Bu::FString &sKey, int64_t i ); - //void insert( const Bu::FString &sKey, bool b ); + 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, double d ); using Bu::Hash::insert; diff --git a/src/gatsstream.cpp b/src/gatsstream.cpp index 38adfbb..3e9b211 100644 --- a/src/gatsstream.cpp +++ b/src/gatsstream.cpp @@ -1,11 +1,15 @@ #include "gats/gatsstream.h" #include "gats/object.h" +#ifdef WIN32 +#include +#else #include +#endif // #include #include -using namespace Bu; +// using namespace Bu; Gats::GatsStream::GatsStream( Bu::Stream &rStream ) : rStream( rStream ) diff --git a/src/gatsstream.h b/src/gatsstream.h index b5efb87..39719cf 100644 --- a/src/gatsstream.h +++ b/src/gatsstream.h @@ -42,6 +42,7 @@ namespace Gats * non-null in the most recent call, this should always be false. */ bool hasReadBuffer() { return qbRead.getSize() > 0; } + int getReadBufferSize() { return qbRead.getSize(); } private: bool skipReadNulls(); diff --git a/src/protocolgats.cpp b/src/protocolgats.cpp index 2ef6079..827eb65 100644 --- a/src/protocolgats.cpp +++ b/src/protocolgats.cpp @@ -3,6 +3,9 @@ #include +#include +using namespace Bu; + Gats::ProtocolGats::ProtocolGats() : pStream( NULL ), pUsedClient( NULL ) @@ -42,7 +45,7 @@ void Gats::ProtocolGats::onNewData( Bu::Client *pClient ) Gats::Object *pObj = pStream->readObject(); if( pObj == NULL ) break; - onNewObject( pObj ); + onNewObject( pClient, pObj ); } } diff --git a/src/protocolgats.h b/src/protocolgats.h index e261ab5..7ed58d4 100644 --- a/src/protocolgats.h +++ b/src/protocolgats.h @@ -17,7 +17,7 @@ namespace Gats virtual void onNewConnection( Bu::Client *pClient ); virtual void onNewData( Bu::Client *pClient ); - virtual void onNewObject( Gats::Object *pObj )=0; + virtual void onNewObject( Bu::Client *pClient, Gats::Object *pObj )=0; void writeObject( Gats::Object *pObj ); -- cgit v1.2.3