aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/json.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2020-02-04 19:27:37 -0800
committerMike Buland <eichlan@xagasoft.com>2020-02-04 19:27:37 -0800
commit9459cb32504c9d269bc467190bba41897f86a97b (patch)
treee16a916fbbd071462ca0e9ce94fae88f062f289a /src/unstable/json.h
parentfd830279725081d95e3f08f768ed6879c92fe838 (diff)
parented5e7684b766a3914b30c5b449608542695fd3b8 (diff)
downloadlibbu++-9459cb32504c9d269bc467190bba41897f86a97b.tar.gz
libbu++-9459cb32504c9d269bc467190bba41897f86a97b.tar.bz2
libbu++-9459cb32504c9d269bc467190bba41897f86a97b.tar.xz
libbu++-9459cb32504c9d269bc467190bba41897f86a97b.zip
Merge branch 'master' into unicode
Diffstat (limited to '')
-rw-r--r--src/unstable/json.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/unstable/json.h b/src/unstable/json.h
index 5373bcf..a973f74 100644
--- a/src/unstable/json.h
+++ b/src/unstable/json.h
@@ -16,7 +16,22 @@ namespace Bu
16 class Json 16 class Json
17 { 17 {
18 private: 18 private:
19 Json( Bu::UtfChar &c, Bu::Stream &sInput ); 19 class ParseState
20 {
21 public:
22 ParseState( Bu::Stream &sInput ) :
23 c( 0 ), sInput( sInput ), iLine( 1 ), iChar( 0 )
24 {
25 }
26
27 void error( const Bu::String &sTxt );
28
29 Bu::UtfChar c;
30 Bu::Stream &sInput;
31 int iLine;
32 int iChar;
33 };
34 Json( ParseState &ps );
20 typedef Bu::Hash<Bu::UtfString, Json *> JsonHash; 35 typedef Bu::Hash<Bu::UtfString, Json *> JsonHash;
21 typedef Bu::Array<Json *> JsonList; 36 typedef Bu::Array<Json *> JsonList;
22 37
@@ -90,19 +105,17 @@ namespace Bu
90 bool operator==( const Bu::String &rRhs ); 105 bool operator==( const Bu::String &rRhs );
91 106
92 private: 107 private:
93 void parse( Bu::UtfChar &c, Bu::Stream &sInput ); 108 void parse( ParseState &ps );
94 void parseString( Bu::UtfChar &c, Bu::Stream &sInput, 109 void parseString( ParseState &ps, Bu::UtfString &sOut );
95 Bu::UtfString &sOut ); 110 void parseString( ParseState &ps );
96 void parseString( Bu::UtfChar &c, Bu::Stream &sInput ); 111 void parseObject( ParseState &ps );
97 void parseObject( Bu::UtfChar &c, Bu::Stream &sInput ); 112 void parseArray( ParseState &ps );
98 void parseArray( Bu::UtfChar &c, Bu::Stream &sInput ); 113 void parseNumber( ParseState &ps );
99 void parseNumber( Bu::UtfChar &c, Bu::Stream &sInput ); 114 void parseLiteral( ParseState &ps );
100 void parseLiteral( Bu::UtfChar &c, Bu::Stream &sInput ); 115 bool readChar( ParseState &ps );
101 bool readChar( Bu::UtfChar &c, Bu::Stream &sInput ); 116 void readChar( ParseState &ps, const char *sSection );
102 void readChar( Bu::UtfChar &c, Bu::Stream &sInput,
103 const char *sSection );
104 bool isWs( Bu::UtfChar c ); 117 bool isWs( Bu::UtfChar c );
105 void skipWs( Bu::UtfChar &c, Bu::Stream &sInput ); 118 void skipWs( ParseState &ps );
106 void writeStr( const Bu::UtfString &sStr, Bu::Stream &sOutput ) const; 119 void writeStr( const Bu::UtfString &sStr, Bu::Stream &sOutput ) const;
107 120
108 private: 121 private: