aboutsummaryrefslogtreecommitdiff
path: root/src/dictionary.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-08-14 07:12:29 +0000
committerMike Buland <eichlan@xagasoft.com>2010-08-14 07:12:29 +0000
commit1b797548dff7e2475826ba29a71c3f496008988f (patch)
tree2a81ee2e8fa2f17fd95410aabbf44533d35a727a /src/dictionary.h
downloadlibgats-1b797548dff7e2475826ba29a71c3f496008988f.tar.gz
libgats-1b797548dff7e2475826ba29a71c3f496008988f.tar.bz2
libgats-1b797548dff7e2475826ba29a71c3f496008988f.tar.xz
libgats-1b797548dff7e2475826ba29a71c3f496008988f.zip
libgats gets it's own repo. The rest of the history is in my misc repo.
Diffstat (limited to 'src/dictionary.h')
-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