JSON Voorhees
Killer JSON for C++
|
A serializer
holds the method for converting an arbitrary C++ type into a value
.
More...
#include <jsonv/serialization.hpp>
Public Member Functions | |
virtual const std::type_info & | get_type () const =0 |
Get the run-time type this serialize knows how to encode. More... | |
virtual value | to_json (const serialization_context &context, const void *from) const =0 |
Create a value from the value in the given region of memory. More... | |
A serializer
holds the method for converting an arbitrary C++ type into a value
.
Definition at line 235 of file serialization.hpp.
|
pure virtual |
Get the run-time type this serialize
knows how to encode.
Once this serializer
is registered with a formats
, it is not allowed to change.
Implemented in jsonv::adapter_for< T >, jsonv::adapter_for< TEnum >, jsonv::adapter_for< TPointer >, jsonv::adapter_for< TContainer >, jsonv::adapter_for< TOptional >, jsonv::adapter_for< optional< T > >, jsonv::adapter_for< TWrapper >, and jsonv::serializer_for< T >.
|
pure virtual |
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. |
Implemented in jsonv::adapter_for< T >, jsonv::adapter_for< TEnum >, jsonv::adapter_for< TPointer >, jsonv::adapter_for< TContainer >, jsonv::adapter_for< TOptional >, jsonv::adapter_for< optional< T > >, jsonv::adapter_for< TWrapper >, and jsonv::serializer_for< T >.