|
JSON Voorhees
Killer JSON for C++
|
A deserializer holds the method for converting JSON source into an arbitrary C++ type.
More...
#include <jsonv/serialization/deserialize.hpp>
Inheritance diagram for jsonv::deserializer:Public Member Functions | |
| virtual const std::type_info & | get_type () const noexcept=0 |
Get the run-time type this deserializer knows how to deserialize. | |
| virtual std::expected< void, ast_node_type > | deserialize (deserialization_context &context, reader &from, void *into) const =0 |
Deserialize the type from a reader into a region of memory. | |
A deserializer holds the method for converting JSON source into an arbitrary C++ type.
Definition at line 346 of file deserialize.hpp.
|
pure virtual |
Deserialize the type from a reader into a region of memory.
| context | Extra information to help you decode sub-objects, such as looking up other deserializer implementations via formats. It is also where a deserialization_context::problem is recorded and where the path a problem is reported at comes from. |
| from | The JSON reader to deserialize something from. On entry, reader::current is the first node of the value to deserialize – never ast_node_type::document_start, which the entry points step over before any deserializer runs. On a successful return it should be one position past that value, as reader::next_value would leave it. |
| into | The region of memory to create the deserialized object in. There will always be enough room to create your object and the alignment of the pointer should be correct (assuming a working alignof implementation). |
std::unexpected carrying the ast_node_type actually found when the failure was a type mismatch, or ast_node_type::error as a sentinel for everything else. In the failure case nothing has been constructed in into and deserialization_context::problems describes what went wrong.Implemented in jsonv::adapter_for< T >, jsonv::adapter_for< TContainer >, jsonv::adapter_for< TEnum >, jsonv::adapter_for< TOptional >, jsonv::adapter_for< TPointer >, jsonv::adapter_for< TWrapper >, jsonv::deserializer_construction< T >, and jsonv::deserializer_for< T >.
|
pure virtualnoexcept |
Get the run-time type this deserializer knows how to deserialize.
Once this deserializer is registered with a formats, it is not allowed to change.
Implemented in jsonv::adapter_for< T >, jsonv::adapter_for< TContainer >, jsonv::adapter_for< TEnum >, jsonv::adapter_for< TOptional >, jsonv::adapter_for< TPointer >, jsonv::adapter_for< TWrapper >, jsonv::deserializer_construction< T >, and jsonv::deserializer_for< T >.