|
JSON Voorhees
Killer JSON for C++
|
An adapter for the type T.
More...
#include <jsonv/serialization/adapter_for.hpp>
Inheritance diagram for jsonv::adapter_for< T >:
Collaboration diagram for jsonv::adapter_for< T >:Public Member Functions | |
| virtual const std::type_info & | get_type () const noexcept override |
| virtual std::expected< void, ast_node_type > | deserialize (deserialization_context &context, reader &from, void *into) const override |
| virtual void | serialize (const serialization_context &context, const void *from, writer &to) const override |
Protected Member Functions | |
| virtual std::expected< T, ast_node_type > | create (deserialization_context &context, reader &from) const =0 |
Create an instance of T by reading from. | |
| virtual void | serialize (const serialization_context &context, const T &from, writer &to) const =0 |
| Write from into to. | |
An adapter for the type T.
This is a utility class which converts the void*s used in the deserializer and serializer interfaces into the more-friendly T.
Definition at line 34 of file adapter_for.hpp.
|
protectedpure virtual |
Create an instance of T by reading from.
| context | Extra information to help you decode sub-objects, such as looking up other deserializer implementations via formats. Record any problem you encounter with deserialization_context::problem. |
| from | The JSON reader to deserialize from. On a successful return it should sit one position past the value which was read, as reader::next_value would have left it. |
std::unexpected carrying the ast_node_type actually found when the failure was a type mismatch, or ast_node_type::error otherwise. Implemented in jsonv::value_adapter_for< T >, jsonv::container_adapter< TContainer >, jsonv::enum_adapter< TEnum, FEnumComp, FValueComp >, jsonv::function_adapter< T, FDeserialize, FSerialize >, jsonv::optional_adapter< TOptional >, jsonv::polymorphic_adapter< TPointer >, and jsonv::wrapper_adapter< TWrapper >.
|
inlineoverridevirtual |
Implements jsonv::deserializer.
Definition at line 49 of file adapter_for.hpp.
Here is the call graph for this function:
|
inlineoverridevirtualnoexcept |
Implements jsonv::deserializer.
Definition at line 41 of file adapter_for.hpp.
|
protectedpure virtual |
Write from into to.
Implemented in jsonv::enum_adapter< TEnum, FEnumComp, FValueComp >, jsonv::value_adapter_for< T >, jsonv::function_adapter< T, FDeserialize, FSerialize >, jsonv::container_adapter< TContainer >, jsonv::optional_adapter< TOptional >, jsonv::polymorphic_adapter< TPointer >, and jsonv::wrapper_adapter< TWrapper >.
|
inlineoverridevirtual |
Implements jsonv::serializer.
Definition at line 74 of file adapter_for.hpp.
Here is the call graph for this function: