From 889cf794108dc1a8c4d2c50fc864846799f512e1 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 12 Jun 2019 17:12:15 -0700 Subject: Json objects can be formatted directly. --- src/unstable/json.cpp | 6 ++++++ src/unstable/json.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/unstable') 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 sOutput.write("\"", 1 ); } +Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Json &j ) +{ + f.write( j.toString() ); + return f; +} + 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 @@ namespace Bu { class Stream; + class Formatter; typedef Bu::List UtfStringList; class Json @@ -123,6 +124,8 @@ namespace Bu bool bBoolean; } uDat; }; -}; + + Bu::Formatter &operator<<( Bu::Formatter &f, const Bu::Json &j ); +} #endif -- cgit v1.2.3