aboutsummaryrefslogtreecommitdiff
path: root/c++-qt
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-06-11 04:05:22 +0000
committerMike Buland <eichlan@xagasoft.com>2012-06-11 04:05:22 +0000
commit380b36be3352cd9a5c93dbd67db25346166a8547 (patch)
treef69613e7b6238744c34af6dc14d6feb68a4f6706 /c++-qt
parent3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc (diff)
downloadlibgats-380b36be3352cd9a5c93dbd67db25346166a8547.tar.gz
libgats-380b36be3352cd9a5c93dbd67db25346166a8547.tar.bz2
libgats-380b36be3352cd9a5c93dbd67db25346166a8547.tar.xz
libgats-380b36be3352cd9a5c93dbd67db25346166a8547.zip
All languages now support Null except for python and php, python is proving
slightly trickier.
Diffstat (limited to 'c++-qt')
-rw-r--r--c++-qt/src/null.cpp31
-rw-r--r--c++-qt/src/null.h28
-rw-r--r--c++-qt/src/object.cpp5
-rw-r--r--c++-qt/src/object.h3
-rw-r--r--c++-qt/src/types.h1
5 files changed, 67 insertions, 1 deletions
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 @@
1#include "gats-qt/null.h"
2
3#include <QIODevice>
4
5Gats::Null::Null()
6{
7}
8
9Gats::Null::~Null()
10{
11}
12
13Gats::Object *Gats::Null::clone() const
14{
15 return new Gats::Null();
16}
17
18void Gats::Null::write( QIODevice &rOut ) const
19{
20 rOut.write("n", 1 );
21}
22
23void Gats::Null::read( QIODevice &rIn, char cType )
24{
25}
26/*
27Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Null &b )
28{
29 return f << "(bool) " << b.getValue();
30}
31*/
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 @@
1#ifndef GATS_NULL_H
2#define GATS_NULL_H
3
4#include "gats-qt/object.h"
5
6class QIODevice;
7
8namespace Gats
9{
10 class Null : public Gats::Object
11 {
12 Q_OBJECT;
13 public:
14 Null();
15 virtual ~Null();
16
17 virtual Object *clone() const;
18
19 virtual Type getType() const { return typeNull; }
20
21 virtual void write( QIODevice &rOut ) const;
22 virtual void read( QIODevice &rIn, char cType );
23 };
24};
25
26//Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Null &b );
27
28#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 @@
6#include "gats-qt/string.h" 6#include "gats-qt/string.h"
7#include "gats-qt/list.h" 7#include "gats-qt/list.h"
8#include "gats-qt/dictionary.h" 8#include "gats-qt/dictionary.h"
9#include "gats-qt/null.h"
9 10
10#include <stdlib.h> 11#include <stdlib.h>
11 12
@@ -52,6 +53,10 @@ Gats::Object *Gats::Object::read( QIODevice &rIn )
52 pObj = new Gats::Float(); 53 pObj = new Gats::Float();
53 break; 54 break;
54 55
56 case 'n':
57 pObj = new Gats::Null();
58 break;
59
55 case 'e': 60 case 'e':
56 return NULL; 61 return NULL;
57 62
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
15 typeString, 15 typeString,
16 typeInteger, 16 typeInteger,
17 typeFloat, 17 typeFloat,
18 typeBoolean 18 typeBoolean,
19 typeNull
19 }; 20 };
20 21
21 /** 22 /**
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 @@
5#include "gats-qt/integer.h" 5#include "gats-qt/integer.h"
6#include "gats-qt/list.h" 6#include "gats-qt/list.h"
7#include "gats-qt/string.h" 7#include "gats-qt/string.h"
8#include "gats-qt/null.h"