From dc759b40b9a18b20454b68244dd063ab56155c3e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 6 Jun 2017 22:45:21 -0700 Subject: Reading, writing, and accessing loaded data all work. --- src/unstable/json.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/unstable/json.h') diff --git a/src/unstable/json.h b/src/unstable/json.h index 47009cb..2d1770d 100644 --- a/src/unstable/json.h +++ b/src/unstable/json.h @@ -11,7 +11,14 @@ namespace Bu class Json { + private: + Json( char &c, Bu::Stream &sInput ); + typedef Bu::Hash JsonHash; + typedef Bu::List JsonList; + public: + typedef JsonList::iterator iterator; + typedef JsonList::const_iterator const_iterator; enum Type { Invalid, @@ -29,10 +36,28 @@ namespace Bu Json( Bu::Stream &sInput ); virtual ~Json(); + Type getType() const; + Bu::String getString() const; + double getNumber() const; + bool getBoolean() const; + bool isNull() const; + Json *operator[]( const Bu::String &sKey ) const; + int getSize() const; + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + void parse( Bu::Stream &sInput ); void reset(); + void write( Bu::Stream &sOutput ) const; + void writeStable( Bu::Stream &sOutput ) const; + Bu::String toString() const; + Bu::String toStringStable() const; + private: + void parse( char &c, Bu::Stream &sInput ); void parseString( char &c, Bu::Stream &sInput, Bu::String &sOut ); void parseString( char &c, Bu::Stream &sInput ); void parseObject( char &c, Bu::Stream &sInput ); @@ -42,11 +67,10 @@ namespace Bu bool readChar( char &c, Bu::Stream &sInput ); void readChar( char &c, Bu::Stream &sInput, const char *sSection ); bool isWs( char c ); + void skipWs( char &c, Bu::Stream &sInput ); + void writeStr( const Bu::String &sStr, Bu::Stream &sOutput ) const; private: - typedef Bu::Hash JsonHash; - typedef Bu::List JsonList; - Type eType; union DatUnion { -- cgit v1.2.3