aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/dictionary.h
diff options
context:
space:
mode:
Diffstat (limited to 'c++-libbu++/src/dictionary.h')
-rw-r--r--c++-libbu++/src/dictionary.h74
1 files changed, 74 insertions, 0 deletions
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 @@
1#ifndef GATS_DICTIONARY_H
2#define GATS_DICTIONARY_H
3
4#include "gats/object.h"
5#include "gats/string.h"
6#include <bu/hash.h>
7
8namespace Gats
9{
10 class List;
11
12 class Dictionary : public Gats::Object,
13 public Bu::Hash<Gats::String, Gats::Object *>
14 {
15 public:
16 Dictionary();
17 virtual ~Dictionary();
18
19 virtual Type getType() const { return typeDictionary; }
20 virtual Object *clone() const;
21 virtual void write( Bu::Stream &rOut ) const;
22 virtual void read( Bu::Stream &rIn, char cType );
23
24 void insert( const Bu::String &sKey, const char *s );
25 void insert( const Bu::String &sKey, const Bu::String &s );
26 void insert( const Bu::String &sKey, char i );
27 void insert( const Bu::String &sKey, unsigned char i );
28 void insert( const Bu::String &sKey, signed char i );
29 void insert( const Bu::String &sKey, unsigned short i );
30 void insert( const Bu::String &sKey, signed short i );
31 void insert( const Bu::String &sKey, unsigned int i );
32 void insert( const Bu::String &sKey, signed int i );
33 void insert( const Bu::String &sKey, unsigned long i );
34 void insert( const Bu::String &sKey, signed long i );
35 void insert( const Bu::String &sKey, unsigned long long i );
36 void insert( const Bu::String &sKey, signed long long i );
37 //void insert( const Bu::String &sKey, bool b );
38 void insert( const Bu::String &sKey, float d );
39 void insert( const Bu::String &sKey, double d );
40 using Bu::Hash<Gats::String, Gats::Object *>::insert;
41 void insertBool( const Bu::String &sKey, bool b );
42 void insertInt( const Bu::String &sKey, int64_t i );
43 void insertFloat( const Bu::String &sKey, double d );
44 void insertStr( const Bu::String &sKey, const Bu::String &s );
45 void insertList( const Bu::String &sKey, Gats::List *pL );
46 void insertDict( const Bu::String &sKey, Gats::Dictionary *pD );
47 Gats::List *insertList( const Bu::String &sKey );
48 Gats::Dictionary *insertDict( const Bu::String &sKey );
49
50 bool getBool( const Bu::String &sKey );
51 int64_t getInt( const Bu::String &sKey );
52 double getFloat( const Bu::String &sKey );
53 Bu::String getStr( const Bu::String &sKey );
54 Gats::List *getList( const Bu::String &sKey );
55 Gats::Dictionary *getDict( const Bu::String &sKey );
56
57 bool getBool( const Bu::String &sKey ) const;
58 int64_t getInt( const Bu::String &sKey ) const;
59 double getFloat( const Bu::String &sKey ) const;
60 Bu::String getStr( const Bu::String &sKey ) const;
61 Gats::List *getList( const Bu::String &sKey ) const;
62 Gats::Dictionary *getDict( const Bu::String &sKey ) const;
63 };
64};
65
66namespace Bu
67{
68template<>
69uint32_t __calcHashCode<Gats::String>( const Gats::String &s );
70};
71
72Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Dictionary &d );
73
74#endif