diff options
Diffstat (limited to '')
-rw-r--r-- | c++-libbu++/src/dictionary.cpp | 25 | ||||
-rw-r--r-- | c++-libbu++/src/dictionary.h | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/c++-libbu++/src/dictionary.cpp b/c++-libbu++/src/dictionary.cpp index 5ed3834..00d06f7 100644 --- a/c++-libbu++/src/dictionary.cpp +++ b/c++-libbu++/src/dictionary.cpp | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "gats/float.h" | 12 | #include "gats/float.h" |
13 | #include "gats/string.h" | 13 | #include "gats/string.h" |
14 | #include "gats/list.h" | 14 | #include "gats/list.h" |
15 | #include "gats/null.h" | ||
15 | 16 | ||
16 | #include <bu/formatter.h> | 17 | #include <bu/formatter.h> |
17 | 18 | ||
@@ -249,6 +250,22 @@ Gats::Dictionary *Gats::Dictionary::insertDict( const Bu::String &sKey ) | |||
249 | return pDict; | 250 | return pDict; |
250 | } | 251 | } |
251 | 252 | ||
253 | void Gats::Dictionary::insertNull( const Bu::String &sKey ) | ||
254 | { | ||
255 | Bu::Hash<Gats::String, Gats::Object *>::insert( | ||
256 | sKey, | ||
257 | new Gats::Null() | ||
258 | ); | ||
259 | } | ||
260 | |||
261 | bool Gats::Dictionary::isNull( const Bu::String &sKey ) | ||
262 | { | ||
263 | Gats::Object *pObj = get( sKey ); | ||
264 | if( pObj->getType() == Gats::typeNull ) | ||
265 | return true; | ||
266 | return false; | ||
267 | } | ||
268 | |||
252 | bool Gats::Dictionary::getBool( const Bu::String &sKey ) | 269 | bool Gats::Dictionary::getBool( const Bu::String &sKey ) |
253 | { | 270 | { |
254 | Gats::Boolean *pOb = dynamic_cast<Gats::Boolean *>( get( sKey ) ); | 271 | Gats::Boolean *pOb = dynamic_cast<Gats::Boolean *>( get( sKey ) ); |
@@ -309,6 +326,14 @@ Gats::Dictionary *Gats::Dictionary::getDict( const Bu::String &sKey ) | |||
309 | return pOb; | 326 | return pOb; |
310 | } | 327 | } |
311 | 328 | ||
329 | bool Gats::Dictionary::isNull( const Bu::String &sKey ) const | ||
330 | { | ||
331 | Gats::Object *pObj = get( sKey ); | ||
332 | if( pObj->getType() == Gats::typeNull ) | ||
333 | return true; | ||
334 | return false; | ||
335 | } | ||
336 | |||
312 | bool Gats::Dictionary::getBool( const Bu::String &sKey ) const | 337 | bool Gats::Dictionary::getBool( const Bu::String &sKey ) const |
313 | { | 338 | { |
314 | Gats::Boolean *pOb = dynamic_cast<Gats::Boolean *>( get( sKey ) ); | 339 | Gats::Boolean *pOb = dynamic_cast<Gats::Boolean *>( get( sKey ) ); |
diff --git a/c++-libbu++/src/dictionary.h b/c++-libbu++/src/dictionary.h index d2cdec0..84cf69f 100644 --- a/c++-libbu++/src/dictionary.h +++ b/c++-libbu++/src/dictionary.h | |||
@@ -54,7 +54,9 @@ namespace Gats | |||
54 | void insertDict( const Bu::String &sKey, Gats::Dictionary *pD ); | 54 | void insertDict( const Bu::String &sKey, Gats::Dictionary *pD ); |
55 | Gats::List *insertList( const Bu::String &sKey ); | 55 | Gats::List *insertList( const Bu::String &sKey ); |
56 | Gats::Dictionary *insertDict( const Bu::String &sKey ); | 56 | Gats::Dictionary *insertDict( const Bu::String &sKey ); |
57 | void insertNull( const Bu::String &sKey ); | ||
57 | 58 | ||
59 | bool isNull( const Bu::String &sKey ); | ||
58 | bool getBool( const Bu::String &sKey ); | 60 | bool getBool( const Bu::String &sKey ); |
59 | int64_t getInt( const Bu::String &sKey ); | 61 | int64_t getInt( const Bu::String &sKey ); |
60 | double getFloat( const Bu::String &sKey ); | 62 | double getFloat( const Bu::String &sKey ); |
@@ -62,6 +64,7 @@ namespace Gats | |||
62 | Gats::List *getList( const Bu::String &sKey ); | 64 | Gats::List *getList( const Bu::String &sKey ); |
63 | Gats::Dictionary *getDict( const Bu::String &sKey ); | 65 | Gats::Dictionary *getDict( const Bu::String &sKey ); |
64 | 66 | ||
67 | bool isNull( const Bu::String &sKey ) const; | ||
65 | bool getBool( const Bu::String &sKey ) const; | 68 | bool getBool( const Bu::String &sKey ) const; |
66 | int64_t getInt( const Bu::String &sKey ) const; | 69 | int64_t getInt( const Bu::String &sKey ) const; |
67 | double getFloat( const Bu::String &sKey ) const; | 70 | double getFloat( const Bu::String &sKey ) const; |