2
0
mirror of https://github.com/boostorg/json.git synced 2026-01-19 04:12:14 +00:00

serializer refactor (API Change):

fix #275

* serialize() replaces to_string()
* serialize.hpp replaces to_string.hpp
* serializer works on all types
* serialize, operator<< work on all types
* reset() takes pointer arguments
* resetting constructor removed
This commit is contained in:
Vinnie Falco
2020-09-07 06:17:25 -07:00
parent 07dcc303b3
commit 591e2dc5a5
30 changed files with 665 additions and 355 deletions

View File

@@ -10,8 +10,8 @@
// Test that header file is self-contained.
#include <boost/json/value_stack.hpp>
#include <boost/json/serialize.hpp>
#include <boost/json/static_resource.hpp>
#include <boost/json/to_string.hpp>
#include "test_suite.hpp"
@@ -59,7 +59,7 @@ public:
// Pop the object from the stack and take ownership.
value jv = st.release();
assert( to_string(jv) == "{\"a\":1,\"b\":null,\"c\":\"hello\"}" );
assert( serialize(jv) == "{\"a\":1,\"b\":null,\"c\":\"hello\"}" );
// At this point we could re-use the stack by calling reset
}
@@ -83,7 +83,7 @@ public:
// Pop the object from the stack and take ownership.
value jv = st.release();
assert( to_string(jv) == "[1,2,3]" );
assert( serialize(jv) == "[1,2,3]" );
// At this point, reset must be called again to use the stack
}
@@ -106,7 +106,7 @@ public:
// Pop the object from the stack and take ownership.
value jv = st.release();
assert( to_string(jv) == "{\"x\":true}" );
assert( serialize(jv) == "{\"x\":true}" );
// At this point, reset must be called again to use the stack
}