diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2019-06-12 17:12:15 -0700 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2019-06-12 17:12:15 -0700 |
commit | 889cf794108dc1a8c4d2c50fc864846799f512e1 (patch) | |
tree | 0bcaaa64c9289cc48f55f9f1daa7f64ca5c8c45a /src/unstable | |
parent | ca3f5b64d656a86ea411572737be7facd067fd62 (diff) | |
download | libbu++-889cf794108dc1a8c4d2c50fc864846799f512e1.tar.gz libbu++-889cf794108dc1a8c4d2c50fc864846799f512e1.tar.bz2 libbu++-889cf794108dc1a8c4d2c50fc864846799f512e1.tar.xz libbu++-889cf794108dc1a8c4d2c50fc864846799f512e1.zip |
Json objects can be formatted directly.
Diffstat (limited to '')
-rw-r--r-- | src/unstable/json.cpp | 6 | ||||
-rw-r--r-- | src/unstable/json.h | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/unstable/json.cpp b/src/unstable/json.cpp index 8c766dd..7e6387b 100644 --- a/src/unstable/json.cpp +++ b/src/unstable/json.cpp | |||
@@ -832,3 +832,9 @@ void Bu::Json::writeStr( const Bu::UtfString &sStr, Bu::Stream &sOutput ) const | |||
832 | sOutput.write("\"", 1 ); | 832 | sOutput.write("\"", 1 ); |
833 | } | 833 | } |
834 | 834 | ||
835 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Json &j ) | ||
836 | { | ||
837 | f.write( j.toString() ); | ||
838 | return f; | ||
839 | } | ||
840 | |||
diff --git a/src/unstable/json.h b/src/unstable/json.h index 2ea62a2..100a3d1 100644 --- a/src/unstable/json.h +++ b/src/unstable/json.h | |||
@@ -10,6 +10,7 @@ | |||
10 | namespace Bu | 10 | namespace Bu |
11 | { | 11 | { |
12 | class Stream; | 12 | class Stream; |
13 | class Formatter; | ||
13 | typedef Bu::List<Bu::UtfString> UtfStringList; | 14 | typedef Bu::List<Bu::UtfString> UtfStringList; |
14 | 15 | ||
15 | class Json | 16 | class Json |
@@ -123,6 +124,8 @@ namespace Bu | |||
123 | bool bBoolean; | 124 | bool bBoolean; |
124 | } uDat; | 125 | } uDat; |
125 | }; | 126 | }; |
126 | }; | 127 | |
128 | Bu::Formatter &operator<<( Bu::Formatter &f, const Bu::Json &j ); | ||
129 | } | ||
127 | 130 | ||
128 | #endif | 131 | #endif |