1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-25 13:41:56 +03:00

🔨 using input/output adapters for CBOR and MessagePack

- You can now pass a reference to a vector to the to_cbor and to_msgpack functions. The output will be written (appended) to the vector. #476

- You can now pass an output stream with uint8_t character type to the to_cbor and to_msgpack functions. #477

- You can now read from uint8_t */size in the to_cbor and to_msgpack functions. An input adapter will be created from this pair, so you need to use braces. #478
This commit is contained in:
Niels Lohmann
2017-07-23 23:02:24 +02:00
parent 9b1c058810
commit 4414f94cd5
4 changed files with 168 additions and 47 deletions

View File

@ -36,7 +36,7 @@ void check_escaped(const char* original, const char* escaped, const bool ensure_
void check_escaped(const char* original, const char* escaped, const bool ensure_ascii)
{
std::stringstream ss;
json::serializer s(nlohmann::detail::output_adapter_factory<char>::create(ss), ' ');
json::serializer s(nlohmann::detail::output_adapter<char>(ss), ' ');
s.dump_escaped(original, ensure_ascii);
CHECK(ss.str() == escaped);
}