diff options
Diffstat (limited to 'src/unstable')
-rw-r--r-- | src/unstable/json.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/unstable/json.cpp b/src/unstable/json.cpp index 0903499..e737f1e 100644 --- a/src/unstable/json.cpp +++ b/src/unstable/json.cpp | |||
@@ -248,6 +248,7 @@ Bu::Json &Bu::Json::insertArray( const Bu::String &sKey ) | |||
248 | Bu::Json &Bu::Json::insertNull( const Bu::String &sKey ) | 248 | Bu::Json &Bu::Json::insertNull( const Bu::String &sKey ) |
249 | { | 249 | { |
250 | uDat.pObject->insert( sKey, new Json( Null ) ); | 250 | uDat.pObject->insert( sKey, new Json( Null ) ); |
251 | return *this; | ||
251 | } | 252 | } |
252 | 253 | ||
253 | Bu::Json &Bu::Json::append( Bu::Json *pObj ) | 254 | Bu::Json &Bu::Json::append( Bu::Json *pObj ) |
@@ -299,6 +300,7 @@ Bu::Json &Bu::Json::appendArray() | |||
299 | Bu::Json &Bu::Json::appendNull() | 300 | Bu::Json &Bu::Json::appendNull() |
300 | { | 301 | { |
301 | uDat.pArray->append( new Json( Null ) ); | 302 | uDat.pArray->append( new Json( Null ) ); |
303 | return *this; | ||
302 | } | 304 | } |
303 | 305 | ||
304 | void Bu::Json::parse( Bu::Stream &sInput ) | 306 | void Bu::Json::parse( Bu::Stream &sInput ) |
@@ -595,7 +597,28 @@ void Bu::Json::parseString( Bu::Json::ParseState &ps, Bu::UtfString &sOut ) | |||
595 | break; | 597 | break; |
596 | 598 | ||
597 | case 'u': | 599 | case 'u': |
598 | // Not implimented yet, followed by four hex diigts | 600 | { |
601 | char hex[5]; | ||
602 | for( int j = 0; j < 4; j++ ) | ||
603 | { | ||
604 | readChar( ps ); | ||
605 | if( (ps.c >= '0' && ps.c <= '9') || | ||
606 | (ps.c >= 'a' && ps.c <= 'f') || | ||
607 | (ps.c >= 'A' && ps.c <= 'F') ) | ||
608 | { | ||
609 | hex[j] = ps.c; | ||
610 | } | ||
611 | else | ||
612 | { | ||
613 | ps.error( | ||
614 | "Invalid json: Invalid \\u<hex> " | ||
615 | "escape sequence." | ||
616 | ); | ||
617 | } | ||
618 | } | ||
619 | hex[4] = '\0'; | ||
620 | sOut += (Bu::UtfChar)strtol( hex, NULL, 16 ); | ||
621 | } | ||
599 | break; | 622 | break; |
600 | 623 | ||
601 | default: | 624 | default: |