diff options
Diffstat (limited to 'c++-qt/src')
-rw-r--r-- | c++-qt/src/null.cpp | 31 | ||||
-rw-r--r-- | c++-qt/src/null.h | 28 | ||||
-rw-r--r-- | c++-qt/src/object.cpp | 5 | ||||
-rw-r--r-- | c++-qt/src/object.h | 3 | ||||
-rw-r--r-- | c++-qt/src/types.h | 1 |
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 | |||
5 | Gats::Null::Null() | ||
6 | { | ||
7 | } | ||
8 | |||
9 | Gats::Null::~Null() | ||
10 | { | ||
11 | } | ||
12 | |||
13 | Gats::Object *Gats::Null::clone() const | ||
14 | { | ||
15 | return new Gats::Null(); | ||
16 | } | ||
17 | |||
18 | void Gats::Null::write( QIODevice &rOut ) const | ||
19 | { | ||
20 | rOut.write("n", 1 ); | ||
21 | } | ||
22 | |||
23 | void Gats::Null::read( QIODevice &rIn, char cType ) | ||
24 | { | ||
25 | } | ||
26 | /* | ||
27 | Bu::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 | |||
6 | class QIODevice; | ||
7 | |||
8 | namespace 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" | ||