From ae3649ec44e9c08dac7553031573ea52c1dfdd82 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Dec 2016 15:16:56 -0700 Subject: Static libs are just easier right now. --- c++-qt/libgats.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/c++-qt/libgats.pro b/c++-qt/libgats.pro index 8eaac84..45c3c8c 100644 --- a/c++-qt/libgats.pro +++ b/c++-qt/libgats.pro @@ -6,6 +6,7 @@ UI_DIR = tmp/ui MOC_DIR = tmp/moc OBJECTS_DIR = tmp/obj QMAKE_CXXFLAGS += -ggdb -W -Wall +CONFIG += staticlib win32:LIBS += -lwsock32 -- cgit v1.2.3 From 19223f8527ef1c0d36cf8b40b9f8d093ea702ca5 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Jun 2017 07:39:05 -0700 Subject: Added better null helpers to libbu++/php --- .gitignore | 4 ++++ c++-libbu++/src/dictionary.cpp | 25 +++++++++++++++++++++++++ c++-libbu++/src/dictionary.h | 3 +++ php/phpgats2.php | 11 +++++++++-- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6020bc1..bfa871f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ *.o *.a .*.swp +.*.un~ +/c++-libbu++/.build_cache /c++-libbu++/gats +/c++-libbu++/gatsc +/c++-libbu++/src/version.h /c++-qt/Makefile* *.dll /c++-qt/object_script.* 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 @@ #include "gats/float.h" #include "gats/string.h" #include "gats/list.h" +#include "gats/null.h" #include @@ -249,6 +250,22 @@ Gats::Dictionary *Gats::Dictionary::insertDict( const Bu::String &sKey ) return pDict; } +void Gats::Dictionary::insertNull( const Bu::String &sKey ) +{ + Bu::Hash::insert( + sKey, + new Gats::Null() + ); +} + +bool Gats::Dictionary::isNull( const Bu::String &sKey ) +{ + Gats::Object *pObj = get( sKey ); + if( pObj->getType() == Gats::typeNull ) + return true; + return false; +} + bool Gats::Dictionary::getBool( const Bu::String &sKey ) { Gats::Boolean *pOb = dynamic_cast( get( sKey ) ); @@ -309,6 +326,14 @@ Gats::Dictionary *Gats::Dictionary::getDict( const Bu::String &sKey ) return pOb; } +bool Gats::Dictionary::isNull( const Bu::String &sKey ) const +{ + Gats::Object *pObj = get( sKey ); + if( pObj->getType() == Gats::typeNull ) + return true; + return false; +} + bool Gats::Dictionary::getBool( const Bu::String &sKey ) const { Gats::Boolean *pOb = dynamic_cast( 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 void insertDict( const Bu::String &sKey, Gats::Dictionary *pD ); Gats::List *insertList( const Bu::String &sKey ); Gats::Dictionary *insertDict( const Bu::String &sKey ); + void insertNull( const Bu::String &sKey ); + bool isNull( const Bu::String &sKey ); bool getBool( const Bu::String &sKey ); int64_t getInt( const Bu::String &sKey ); double getFloat( const Bu::String &sKey ); @@ -62,6 +64,7 @@ namespace Gats Gats::List *getList( const Bu::String &sKey ); Gats::Dictionary *getDict( const Bu::String &sKey ); + bool isNull( const Bu::String &sKey ) const; bool getBool( const Bu::String &sKey ) const; int64_t getInt( const Bu::String &sKey ) const; double getFloat( const Bu::String &sKey ) const; diff --git a/php/phpgats2.php b/php/phpgats2.php index effaa78..f97bd89 100644 --- a/php/phpgats2.php +++ b/php/phpgats2.php @@ -237,7 +237,11 @@ function _phpgats2_writeDictionary( $d ) function _phpgats2__write( $unknown ) { - if( is_bool( $unknown ) ) + if( is_null( $unknown ) ) + { + return 'n'; + } + else if( is_bool( $unknown ) ) { return _phpgats2_writeBoolean( $unknown ); } @@ -462,7 +466,10 @@ function _phpgats2_parseMaster( $str_data, &$offset, $dbg=0 ) case '0': //echo "false\n"; return false; - break; + break; + case 'n': + return null; + break; default: //echo "str:"; $obj = _phpgats2_parseString( $str_data, $offset, $dbg ); -- cgit v1.2.3