diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-08-14 07:12:29 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-08-14 07:12:29 +0000 |
commit | 1b797548dff7e2475826ba29a71c3f496008988f (patch) | |
tree | 2a81ee2e8fa2f17fd95410aabbf44533d35a727a /src/object.cpp | |
download | libgats-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 '')
-rw-r--r-- | src/object.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/object.cpp b/src/object.cpp new file mode 100644 index 0000000..3d7765e --- /dev/null +++ b/src/object.cpp | |||
@@ -0,0 +1,55 @@ | |||
1 | #include "gats/object.h" | ||
2 | |||
3 | #include "gats/integer.h" | ||
4 | #include "gats/float.h" | ||
5 | #include "gats/boolean.h" | ||
6 | #include "gats/string.h" | ||
7 | #include "gats/list.h" | ||
8 | #include "gats/dictionary.h" | ||
9 | |||
10 | #include <bu/stream.h> | ||
11 | |||
12 | Gats::Object::Object() | ||
13 | { | ||
14 | } | ||
15 | |||
16 | Gats::Object::~Object() | ||
17 | { | ||
18 | } | ||
19 | |||
20 | Gats::Object *Gats::Object::read( Bu::Stream &rIn ) | ||
21 | { | ||
22 | char buf; | ||
23 | rIn.read( &buf, 1 ); | ||
24 | Object *pObj = NULL; | ||
25 | switch( buf ) | ||
26 | { | ||
27 | case 'i': | ||
28 | pObj = new Gats::Integer(); | ||
29 | break; | ||
30 | |||
31 | case 's': | ||
32 | pObj = new Gats::String(); | ||
33 | break; | ||
34 | |||
35 | case '0': | ||
36 | case '1': | ||
37 | pObj = new Gats::Boolean(); | ||
38 | break; | ||
39 | |||
40 | case 'l': | ||
41 | pObj = new Gats::List(); | ||
42 | break; | ||
43 | |||
44 | case 'e': | ||
45 | return NULL; | ||
46 | |||
47 | default: | ||
48 | throw Bu::ExceptionBase("Invalid Gats type discovered: %c.", buf ); | ||
49 | } | ||
50 | |||
51 | pObj->read( rIn, buf ); | ||
52 | |||
53 | return pObj; | ||
54 | } | ||
55 | |||