From b82c6e251b995353ce205bbd53f3db2b985c5345 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 23 Aug 2017 06:36:55 -0700 Subject: Fixed string constructor. --- src/tests/json.cpp | 7 +++++++ src/unstable/json.cpp | 6 ++++++ src/unstable/json.h | 3 +++ 3 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/tests/json.cpp b/src/tests/json.cpp index 7c1c119..d588a02 100644 --- a/src/tests/json.cpp +++ b/src/tests/json.cpp @@ -4,6 +4,13 @@ #include int main( int argc, char *argv[] ) +{ + Bu::Json j("Hi there"); + Bu::println( j.toString() ); + return 0; +} + +void hi() { Bu::File fIn( "test1.json", Bu::File::Read ); Bu::Json ob( fIn ); diff --git a/src/unstable/json.cpp b/src/unstable/json.cpp index d13f6e2..b22ca0d 100644 --- a/src/unstable/json.cpp +++ b/src/unstable/json.cpp @@ -19,6 +19,12 @@ Bu::Json::Json( const Bu::String &sValue ) : { } +Bu::Json::Json( const char *sValue ) : + eType( String ), + uDat( sValue ) +{ +} + Bu::Json::Json( double dValue ) : eType( Number ), uDat( dValue ) diff --git a/src/unstable/json.h b/src/unstable/json.h index 5a59b7e..6042f7d 100644 --- a/src/unstable/json.h +++ b/src/unstable/json.h @@ -33,6 +33,7 @@ namespace Bu public: Json(); Json( const Bu::String &sValue ); + Json( const char *sValue ); Json( double dValue ); Json( bool bValue ); Json( Type eType ); @@ -83,6 +84,8 @@ namespace Bu DatUnion() : pObject( NULL ) { } DatUnion( const Bu::String &sValue ) : pString( new Bu::String( sValue ) ) { } + DatUnion( const char *sValue ) : + pString( new Bu::String( sValue ) ) { } DatUnion( double dValue ) : dNumber( dValue ) { } DatUnion( bool bValue ) : bBoolean( bValue ) { } JsonHash *pObject; -- cgit v1.2.3