From 1b797548dff7e2475826ba29a71c3f496008988f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 14 Aug 2010 07:12:29 +0000 Subject: libgats gets it's own repo. The rest of the history is in my misc repo. --- src/object.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/object.cpp (limited to 'src/object.cpp') 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 @@ +#include "gats/object.h" + +#include "gats/integer.h" +#include "gats/float.h" +#include "gats/boolean.h" +#include "gats/string.h" +#include "gats/list.h" +#include "gats/dictionary.h" + +#include + +Gats::Object::Object() +{ +} + +Gats::Object::~Object() +{ +} + +Gats::Object *Gats::Object::read( Bu::Stream &rIn ) +{ + char buf; + rIn.read( &buf, 1 ); + Object *pObj = NULL; + switch( buf ) + { + case 'i': + pObj = new Gats::Integer(); + break; + + case 's': + pObj = new Gats::String(); + break; + + case '0': + case '1': + pObj = new Gats::Boolean(); + break; + + case 'l': + pObj = new Gats::List(); + break; + + case 'e': + return NULL; + + default: + throw Bu::ExceptionBase("Invalid Gats type discovered: %c.", buf ); + } + + pObj->read( rIn, buf ); + + return pObj; +} + -- cgit v1.2.3