From 380b36be3352cd9a5c93dbd67db25346166a8547 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 11 Jun 2012 04:05:22 +0000 Subject: All languages now support Null except for python and php, python is proving slightly trickier. --- c++-qt/src/null.cpp | 31 +++++++++++++++++++++++++++++++ c++-qt/src/null.h | 28 ++++++++++++++++++++++++++++ c++-qt/src/object.cpp | 5 +++++ c++-qt/src/object.h | 3 ++- c++-qt/src/types.h | 1 + 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 c++-qt/src/null.cpp create mode 100644 c++-qt/src/null.h (limited to 'c++-qt/src') diff --git a/c++-qt/src/null.cpp b/c++-qt/src/null.cpp new file mode 100644 index 0000000..f259887 --- /dev/null +++ b/c++-qt/src/null.cpp @@ -0,0 +1,31 @@ +#include "gats-qt/null.h" + +#include + +Gats::Null::Null() +{ +} + +Gats::Null::~Null() +{ +} + +Gats::Object *Gats::Null::clone() const +{ + return new Gats::Null(); +} + +void Gats::Null::write( QIODevice &rOut ) const +{ + rOut.write("n", 1 ); +} + +void Gats::Null::read( QIODevice &rIn, char cType ) +{ +} +/* +Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Null &b ) +{ + return f << "(bool) " << b.getValue(); +} +*/ diff --git a/c++-qt/src/null.h b/c++-qt/src/null.h new file mode 100644 index 0000000..354de12 --- /dev/null +++ b/c++-qt/src/null.h @@ -0,0 +1,28 @@ +#ifndef GATS_NULL_H +#define GATS_NULL_H + +#include "gats-qt/object.h" + +class QIODevice; + +namespace Gats +{ + class Null : public Gats::Object + { + Q_OBJECT; + public: + Null(); + virtual ~Null(); + + virtual Object *clone() const; + + virtual Type getType() const { return typeNull; } + + virtual void write( QIODevice &rOut ) const; + virtual void read( QIODevice &rIn, char cType ); + }; +}; + +//Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Null &b ); + +#endif diff --git a/c++-qt/src/object.cpp b/c++-qt/src/object.cpp index 3955ced..4290e17 100644 --- a/c++-qt/src/object.cpp +++ b/c++-qt/src/object.cpp @@ -6,6 +6,7 @@ #include "gats-qt/string.h" #include "gats-qt/list.h" #include "gats-qt/dictionary.h" +#include "gats-qt/null.h" #include @@ -52,6 +53,10 @@ Gats::Object *Gats::Object::read( QIODevice &rIn ) pObj = new Gats::Float(); break; + case 'n': + pObj = new Gats::Null(); + break; + case 'e': return NULL; diff --git a/c++-qt/src/object.h b/c++-qt/src/object.h index 10501e4..008ebef 100644 --- a/c++-qt/src/object.h +++ b/c++-qt/src/object.h @@ -15,7 +15,8 @@ namespace Gats typeString, typeInteger, typeFloat, - typeBoolean + typeBoolean, + typeNull }; /** diff --git a/c++-qt/src/types.h b/c++-qt/src/types.h index 1264a9d..bd1c8ae 100644 --- a/c++-qt/src/types.h +++ b/c++-qt/src/types.h @@ -5,3 +5,4 @@ #include "gats-qt/integer.h" #include "gats-qt/list.h" #include "gats-qt/string.h" +#include "gats-qt/null.h" -- cgit v1.2.3