JSON Voorhees
Killer JSON for C++
jsonv::adapter_for< T > Class Template Referenceabstract
+ Inheritance 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. More...
 
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. More...
 
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. More...
 

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
 

Detailed Description

template<typename T>
class jsonv::adapter_for< T >

Definition at line 218 of file serialization_util.hpp.

Member Function Documentation

template<typename T>
virtual void jsonv::adapter_for< T >::extract ( const extraction_context context,
const value from,
void *  into 
) const
inlineoverridevirtual

Extract a the type from a value into a region of memory.

Parameters
contextExtra 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.
fromThe JSON value to extract something from.
intoThe 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 227 of file serialization_util.hpp.

template<typename T>
virtual const std::type_info& jsonv::adapter_for< T >::get_type ( ) const
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 222 of file serialization_util.hpp.

template<typename T>
virtual value jsonv::adapter_for< T >::to_json ( const serialization_context context,
const void *  from 
) const
inlineoverridevirtual

Create a value from the value in the given region of memory.

Parameters
contextExtra 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.
fromThe 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 235 of file serialization_util.hpp.


The documentation for this class was generated from the following file: