aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/dictionary.cpp
diff options
context:
space:
mode:
authorMike Buland <mbuland@penny-arcade.com>2017-06-05 07:39:05 -0700
committerMike Buland <mbuland@penny-arcade.com>2017-06-05 07:39:05 -0700
commit19223f8527ef1c0d36cf8b40b9f8d093ea702ca5 (patch)
treed59222d22d96318948b52329e2ee4ec0e0745d1a /c++-libbu++/src/dictionary.cpp
parentae3649ec44e9c08dac7553031573ea52c1dfdd82 (diff)
downloadlibgats-19223f8527ef1c0d36cf8b40b9f8d093ea702ca5.tar.gz
libgats-19223f8527ef1c0d36cf8b40b9f8d093ea702ca5.tar.bz2
libgats-19223f8527ef1c0d36cf8b40b9f8d093ea702ca5.tar.xz
libgats-19223f8527ef1c0d36cf8b40b9f8d093ea702ca5.zip
Added better null helpers to libbu++/php
Diffstat (limited to 'c++-libbu++/src/dictionary.cpp')
-rw-r--r--c++-libbu++/src/dictionary.cpp25
1 files changed, 25 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
253void 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
261bool 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
252bool Gats::Dictionary::getBool( const Bu::String &sKey ) 269bool 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
329bool 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
312bool Gats::Dictionary::getBool( const Bu::String &sKey ) const 337bool 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 ) );