aboutsummaryrefslogtreecommitdiff
path: root/src/dictionary.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dictionary.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/dictionary.h b/src/dictionary.h
new file mode 100644
index 0000000..3bcaec6
--- /dev/null
+++ b/src/dictionary.h
@@ -0,0 +1,44 @@
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 void write( Bu::Stream &rOut ) const;
21 virtual void read( Bu::Stream &rIn, char cType );
22
23 void insert( const Bu::FString &sKey, int64_t i );
24 void insert( const Bu::FString &sKey, bool b );
25 void insert( const Bu::FString &sKey, double d );
26 void insert( const Bu::FString &sKey, const Bu::FString &s );
27 using Bu::Hash<Gats::String, Gats::Object *>::insert;
28
29 bool getBool( const Bu::FString &sKey );
30 int64_t getInt( const Bu::FString &sKey );
31 double getFloat( const Bu::FString &sKey );
32 Bu::FString getStr( const Bu::FString &sKey );
33 Gats::List *getList( const Bu::FString &sKey );
34 Gats::Dictionary *getDict( const Bu::FString &sKey );
35 };
36};
37
38namespace Bu
39{
40template<>
41uint32_t __calcHashCode<Gats::String>( const Gats::String &s );
42};
43
44#endif