|
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 override |
Get the run-time type this extractor knows how to extract. | |
| virtual void | extract (const extraction_context &context, const value &from, void *into) const override |
Extract a the type from a value into a region of memory. | |
| virtual value | to_json (const serialization_context &context, const void *from) const override |
Create a value from the value in the given region of memory. | |
Protected Member Functions | |
| virtual T | create (const extraction_context &context, const value &from) const =0 |
| virtual value | to_json (const serialization_context &context, const T &from) const =0 |
An adapter for the type T.
This is a utility class which converts the void*s used in the extractor and serializer interfaces into the more-friendly T.
Definition at line 26 of file adapter_for.hpp.
|
inlineoverridevirtual |
Extract a the type from a value into a region of memory.
| context | Extra information to help you decode sub-objects, such as looking up other formats. It also tracks your path in the decoding heirarchy, so any exceptions thrown will have path information in the error message. |
| from | The JSON value to extract something from. |
| into | The region of memory to create the extracted 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). |
Implements jsonv::extractor.
Definition at line 35 of file adapter_for.hpp.
|
inlineoverridevirtual |
Get the run-time type this extractor knows how to extract.
Once this extractor is registered with a formats, it is not allowed to change.
Implements jsonv::extractor.
Definition at line 30 of file adapter_for.hpp.
|
inlineoverridevirtual |
Create a value from the value in the given region of memory.
| context | Extra information to help you encode sub-objects for your type, such as the ability to find other formats. It also tracks the progression of types in the encoding heirarchy, so any exceptions thrown will have type information in the error message. |
| from | The region of memory that represents the C++ value to convert to JSON. The pointer comes as the result of a static_cast<void*>, so performing a static_cast back to your type is okay. |
Implements jsonv::serializer.
Definition at line 43 of file adapter_for.hpp.
Here is the call graph for this function: