@@ -36,6 +36,7 @@ The following table lists the serialization formats currently supported by refle
3636| flexbuffers | [ flatbuffers] ( https://github.com/google/flatbuffers ) | >= 23.5.26 | Apache 2.0 | Schema-less version of flatbuffers, binary format |
3737| msgpack | [ msgpack-c] ( https://github.com/msgpack/msgpack-c ) | >= 6.0.0 | BSL 1.0 | JSON-like binary format |
3838| TOML | [ toml++] ( https://github.com/marzer/tomlplusplus ) | >= 3.4.0 | MIT | Textual format with an emphasis on readability |
39+ | UBJSON | [ jsoncons] ( https://github.com/danielaparker/jsoncons ) | >= 0.176.0 | BSL 1.0 | JSON-like binary format |
3940| XML | [ pugixml] ( https://github.com/zeux/pugixml ) | >= 1.14 | MIT | Textual format used in many legacy projects |
4041| YAML | [ yaml-cpp] ( https://github.com/jbeder/yaml-cpp ) | >= 0.8.0 | MIT | Textual format with an emphasis on readability |
4142
@@ -114,13 +115,15 @@ rfl::cbor::write(homer);
114115rfl::flexbuf::write(homer);
115116rfl::msgpack::write(homer);
116117rfl::toml::write(homer);
118+ rfl::ubjson::write(homer);
117119rfl::xml::write(homer);
118120
119121rfl::bson::read<Person>(bson_bytes);
120122rfl::cbor::read<Person>(cbor_bytes);
121123rfl::flexbuf::read<Person>(flexbuf_bytes);
122124rfl::msgpack::read<Person>(msgpack_bytes);
123125rfl::toml::read<Person>(toml_string);
126+ rfl::ubjson::read<Person>(ubjson_bytes);
124127rfl::xml::read<Person>(xml_string);
125128```
126129
@@ -471,7 +474,7 @@ In addition, it supports the following custom containers:
471474
472475- `rfl::Binary`: Used to express numbers in binary format.
473476- `rfl::Box`: Similar to `std::unique_ptr`, but (almost) guaranteed to never be null.
474- - `rfl::Bytestring`: An alias for `std::basic_string<std::byte>`. Supported by BSON, CBOR, flexbuffers and msgpack .
477+ - `rfl::Bytestring`: An alias for `std::basic_string<std::byte>`. Supported by BSON, CBOR, flexbuffers, msgpack and UBJSON .
475478- `rfl::Generic`: A catch-all type that can represent (almost) anything.
476479- `rfl::Hex`: Used to express numbers in hex format.
477480- `rfl::Literal`: An explicitly enumerated string.
@@ -569,6 +572,7 @@ set(REFLECTCPP_CBOR ON) # Optional
569572set(REFLECTCPP_FLEXBUFFERS ON) # Optional
570573set(REFLECTCPP_MSGPACK ON) # Optional
571574set(REFLECTCPP_TOML ON) # Optional
575+ set(REFLECTCPP_UBJSON ON) # Optional
572576set(REFLECTCPP_XML ON) # Optional
573577set(REFLECTCPP_YAML ON) # Optional
574578
@@ -619,7 +623,7 @@ To run the tests, do the following:
619623To compile the tests with serialization formats other than JSON, do the following:
620624
621625``` bash
622- cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release
626+ cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_UBJSON=ON - DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release
623627cmake --build build -j 4 # gcc, clang
624628cmake --build build --config Release -j 4 # MSVC
625629```
@@ -633,6 +637,7 @@ To run the tests, do the following:
633637./build/tests/msgpack/reflect-cpp-msgpack-tests
634638./build/tests/json/reflect-cpp-json-tests
635639./build/tests/toml/reflect-cpp-toml-tests
640+ ./build/tests/ubjson/reflect-cpp-ubjson-tests
636641./build/tests/xml/reflect-cpp-xml-tests
637642./build/tests/yaml/reflect-cpp-yaml-tests
638643```
0 commit comments