From 74dd68ad611d15abf16a65c36a7cfd3f4492930a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 16:25:22 +0000 Subject: Made the repo less libbu++-centric. --- c++-libbu++/src/dictionary.h | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 c++-libbu++/src/dictionary.h (limited to 'c++-libbu++/src/dictionary.h') diff --git a/c++-libbu++/src/dictionary.h b/c++-libbu++/src/dictionary.h new file mode 100644 index 0000000..3dd1000 --- /dev/null +++ b/c++-libbu++/src/dictionary.h @@ -0,0 +1,74 @@ +#ifndef GATS_DICTIONARY_H +#define GATS_DICTIONARY_H + +#include "gats/object.h" +#include "gats/string.h" +#include + +namespace Gats +{ + class List; + + class Dictionary : public Gats::Object, + public Bu::Hash + { + public: + Dictionary(); + virtual ~Dictionary(); + + virtual Type getType() const { return typeDictionary; } + virtual Object *clone() const; + virtual void write( Bu::Stream &rOut ) const; + virtual void read( Bu::Stream &rIn, char cType ); + + 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; + void insertBool( const Bu::String &sKey, bool b ); + void insertInt( const Bu::String &sKey, int64_t i ); + void insertFloat( const Bu::String &sKey, double d ); + void insertStr( const Bu::String &sKey, const Bu::String &s ); + void insertList( const Bu::String &sKey, Gats::List *pL ); + void insertDict( const Bu::String &sKey, Gats::Dictionary *pD ); + Gats::List *insertList( const Bu::String &sKey ); + Gats::Dictionary *insertDict( const Bu::String &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::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; + }; +}; + +namespace Bu +{ +template<> +uint32_t __calcHashCode( const Gats::String &s ); +}; + +Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Dictionary &d ); + +#endif -- cgit v1.2.3