From c10c9ef627c7e79fde6170fe334238bbcb5d66e5 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 27 Aug 2010 21:53:54 +0000 Subject: Added formatter handlers for debugging, works really well. Also added a bunch more helpers to make it as easy to use as possible. --- src/object.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/object.cpp') 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 @@ #include "gats/list.h" #include "gats/dictionary.h" +#include #include Gats::Object::Object() @@ -61,3 +62,30 @@ Gats::Object *Gats::Object::read( Bu::Stream &rIn ) return pObj; } +Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj ) +{ + switch( obj.getType() ) + { + case Gats::typeDictionary: + return f << dynamic_cast(obj); + + case Gats::typeList: + return f << dynamic_cast(obj); + + case Gats::typeString: + return f << dynamic_cast(obj); + + case Gats::typeInteger: + return f << dynamic_cast(obj); + + case Gats::typeFloat: + return f << dynamic_cast(obj); + + case Gats::typeBoolean: + return f << dynamic_cast(obj); + + default: + return f << "***ERROR: Bad Gats type***"; + } +} + -- cgit v1.2.3