From 744fe4ecbcf613ee637d00e8808f69668eac6bb2 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 8 Mar 2011 21:03:43 +0000 Subject: Added a whole load of new, cool helpers for working with dictionaries and lists. --- src/dictionary.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/dictionary.cpp') diff --git a/src/dictionary.cpp b/src/dictionary.cpp index aaba7b8..9728804 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -168,6 +168,63 @@ void Gats::Dictionary::insert( const Bu::String &sKey, const Bu::String &s ) ); } +void Gats::Dictionary::insertBool( const Bu::String &sKey, bool b ) +{ + Bu::Hash::insert( + sKey, new Gats::Boolean( b ) + ); +} + +void Gats::Dictionary::insertInt( const Bu::String &sKey, int64_t i ) +{ + Bu::Hash::insert( + sKey, new Gats::Integer( i ) + ); +} + +void Gats::Dictionary::insertFloat( const Bu::String &sKey, double d ) +{ + Bu::Hash::insert( + sKey, new Gats::Float( d ) + ); +} + +void Gats::Dictionary::insertStr( const Bu::String &sKey, const Bu::String &s ) +{ + Bu::Hash::insert( + sKey, new Gats::String( s ) + ); +} + +void Gats::Dictionary::insertList( const Bu::String &sKey, Gats::List *pL ) +{ + Bu::Hash::insert( + sKey, pL + ); +} + +void Gats::Dictionary::insertDict( const Bu::String &sKey, + Gats::Dictionary *pD ) +{ + Bu::Hash::insert( + sKey, pD + ); +} + +Gats::List *Gats::Dictionary::insertList( const Bu::String &sKey ) +{ + Gats::List *pLst = new Gats::List(); + insertList( sKey, pLst ); + return pLst; +} + +Gats::Dictionary *Gats::Dictionary::insertDict( const Bu::String &sKey ) +{ + Gats::Dictionary *pDict = new Gats::Dictionary(); + insertDict( sKey, pDict ); + return pDict; +} + bool Gats::Dictionary::getBool( const Bu::String &sKey ) { Gats::Boolean *pOb = dynamic_cast( get( sKey ) ); -- cgit v1.2.3