diff options
Diffstat (limited to '')
-rw-r--r-- | src/tests/json.cpp | 6 | ||||
-rw-r--r-- | src/unstable/json.cpp | 6 | ||||
-rw-r--r-- | src/unstable/json.h | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/tests/json.cpp b/src/tests/json.cpp index 6490d8d..6ec92f0 100644 --- a/src/tests/json.cpp +++ b/src/tests/json.cpp | |||
@@ -7,6 +7,12 @@ int main( int argc, char *argv[] ) | |||
7 | { | 7 | { |
8 | Bu::Json j( "\x01" "ACTION" "\x01" ); | 8 | Bu::Json j( "\x01" "ACTION" "\x01" ); |
9 | Bu::println( j.toString() ); | 9 | Bu::println( j.toString() ); |
10 | |||
11 | Bu::Json ob( Bu::Json::Object ); | ||
12 | ob.insert("hello", 47.0 ); | ||
13 | const Bu::Json &obRef = ob; | ||
14 | Bu::println("%1").arg( obRef["hello"] ); | ||
15 | |||
10 | return 0; | 16 | return 0; |
11 | } | 17 | } |
12 | 18 | ||
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 |