JSON Voorhees
Killer JSON for C++
jsonv::serializer Class Referenceabstract

A serializer holds the method for converting an arbitrary C++ type into a value. More...

#include <jsonv/serialization.hpp>

+ Inheritance diagram for jsonv::serializer:

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...
 

Detailed Description

A serializer holds the method for converting an arbitrary C++ type into a value.

Definition at line 235 of file serialization.hpp.

Member Function Documentation

virtual const std::type_info& jsonv::serializer::get_type ( ) const
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 >.

virtual value jsonv::serializer::to_json ( const serialization_context context,
const void *  from 
) const
pure virtual

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.

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 >.


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