aboutsummaryrefslogtreecommitdiff
path: root/src/object.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-08-27 21:53:54 +0000
committerMike Buland <eichlan@xagasoft.com>2010-08-27 21:53:54 +0000
commitc10c9ef627c7e79fde6170fe334238bbcb5d66e5 (patch)
tree4a0971d81e666e91866ddeaf9b58b952ce2fdd0a /src/object.cpp
parent2a72923397d866f33221b9d32a3f9653d1a960e7 (diff)
downloadlibgats-c10c9ef627c7e79fde6170fe334238bbcb5d66e5.tar.gz
libgats-c10c9ef627c7e79fde6170fe334238bbcb5d66e5.tar.bz2
libgats-c10c9ef627c7e79fde6170fe334238bbcb5d66e5.tar.xz
libgats-c10c9ef627c7e79fde6170fe334238bbcb5d66e5.zip
Added formatter handlers for debugging, works really well. Also added a bunch
more helpers to make it as easy to use as possible.
Diffstat (limited to 'src/object.cpp')
-rw-r--r--src/object.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/object.cpp b/src/object.cpp
index 9176b49..f5148ad 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -7,6 +7,7 @@
7#include "gats/list.h" 7#include "gats/list.h"
8#include "gats/dictionary.h" 8#include "gats/dictionary.h"
9 9
10#include <bu/formatter.h>
10#include <bu/stream.h> 11#include <bu/stream.h>
11 12
12Gats::Object::Object() 13Gats::Object::Object()
@@ -61,3 +62,30 @@ Gats::Object *Gats::Object::read( Bu::Stream &rIn )
61 return pObj; 62 return pObj;
62} 63}
63 64
65Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj )
66{
67 switch( obj.getType() )
68 {
69 case Gats::typeDictionary:
70 return f << dynamic_cast<const Gats::Dictionary &>(obj);
71
72 case Gats::typeList:
73 return f << dynamic_cast<const Gats::List &>(obj);
74
75 case Gats::typeString:
76 return f << dynamic_cast<const Gats::String &>(obj);
77
78 case Gats::typeInteger:
79 return f << dynamic_cast<const Gats::Integer &>(obj);
80
81 case Gats::typeFloat:
82 return f << dynamic_cast<const Gats::Float &>(obj);
83
84 case Gats::typeBoolean:
85 return f << dynamic_cast<const Gats::Boolean &>(obj);
86
87 default:
88 return f << "***ERROR: Bad Gats type***";
89 }
90}
91