diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-06-11 04:05:22 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-06-11 04:05:22 +0000 |
| commit | 380b36be3352cd9a5c93dbd67db25346166a8547 (patch) | |
| tree | f69613e7b6238744c34af6dc14d6feb68a4f6706 /src/object.cpp | |
| parent | 3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc (diff) | |
| download | libgats-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 '')
| -rw-r--r-- | src/object.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/object.cpp b/src/object.cpp index 9662b6a..15d7cb5 100644 --- a/src/object.cpp +++ b/src/object.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "gats/string.h" | 6 | #include "gats/string.h" |
| 7 | #include "gats/list.h" | 7 | #include "gats/list.h" |
| 8 | #include "gats/dictionary.h" | 8 | #include "gats/dictionary.h" |
| 9 | #include "gats/null.h" | ||
| 9 | 10 | ||
| 10 | #include <stdlib.h> | 11 | #include <stdlib.h> |
| 11 | 12 | ||
| @@ -56,6 +57,10 @@ Gats::Object *Gats::Object::read( Bu::Stream &rIn ) | |||
| 56 | pObj = new Gats::Float(); | 57 | pObj = new Gats::Float(); |
| 57 | break; | 58 | break; |
| 58 | 59 | ||
| 60 | case 'n': | ||
| 61 | pObj = new Gats::Null(); | ||
| 62 | break; | ||
| 63 | |||
| 59 | case 'e': | 64 | case 'e': |
| 60 | return NULL; | 65 | return NULL; |
| 61 | 66 | ||
| @@ -250,6 +255,10 @@ Gats::Object *Gats::Object::strToGats( Bu::String::const_iterator &i ) | |||
| 250 | { | 255 | { |
| 251 | return new Gats::Boolean( false ); | 256 | return new Gats::Boolean( false ); |
| 252 | } | 257 | } |
| 258 | else if( st == "null" ) | ||
| 259 | { | ||
| 260 | return new Gats::Null(); | ||
| 261 | } | ||
| 253 | } | 262 | } |
| 254 | } | 263 | } |
| 255 | } | 264 | } |
| @@ -288,6 +297,9 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Object &obj ) | |||
| 288 | case Gats::typeBoolean: | 297 | case Gats::typeBoolean: |
| 289 | return f << dynamic_cast<const Gats::Boolean &>(obj); | 298 | return f << dynamic_cast<const Gats::Boolean &>(obj); |
| 290 | 299 | ||
| 300 | case Gats::typeNull: | ||
| 301 | return f << dynamic_cast<const Gats::Null &>(obj); | ||
| 302 | |||
| 291 | default: | 303 | default: |
| 292 | return f << "***ERROR: Bad Gats type***"; | 304 | return f << "***ERROR: Bad Gats type***"; |
| 293 | } | 305 | } |
| @@ -303,6 +315,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Type &t ) | |||
| 303 | case Gats::typeInteger: return f << "integer"; | 315 | case Gats::typeInteger: return f << "integer"; |
| 304 | case Gats::typeFloat: return f << "float"; | 316 | case Gats::typeFloat: return f << "float"; |
| 305 | case Gats::typeBoolean: return f << "boolean"; | 317 | case Gats::typeBoolean: return f << "boolean"; |
| 318 | case Gats::typeNull: return f << "null"; | ||
| 306 | } | 319 | } |
| 307 | 320 | ||
| 308 | return f << "***unknown***"; | 321 | return f << "***unknown***"; |
| @@ -318,6 +331,7 @@ const char *Gats::typeToStr( Gats::Type t ) | |||
| 318 | case Gats::typeInteger: return "integer"; | 331 | case Gats::typeInteger: return "integer"; |
| 319 | case Gats::typeFloat: return "float"; | 332 | case Gats::typeFloat: return "float"; |
| 320 | case Gats::typeBoolean: return "boolean"; | 333 | case Gats::typeBoolean: return "boolean"; |
| 334 | case Gats::typeNull: return "null"; | ||
| 321 | } | 335 | } |
| 322 | 336 | ||
| 323 | return "***unknown***"; | 337 | return "***unknown***"; |
