JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::extractor_construction< T > Class Template Reference

An extractor for type T that has a constructor that accepts either a jsonv::value or a jsonv::value and extraction_context. More...

#include <jsonv/serialization/extractor_construction.hpp>

+ Inheritance diagram for jsonv::extractor_construction< T >:
+ Collaboration diagram for jsonv::extractor_construction< 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.
 

Protected Member Functions

template<typename U >
auto extract_impl (const extraction_context &context, const value &from, void *into) const -> decltype(U(from, context), void())
 
template<typename U , typename = void>
auto extract_impl (const extraction_context &, const value &from, void *into) const -> decltype(U(from), void())
 

Detailed Description

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

An extractor for type T that has a constructor that accepts either a jsonv::value or a jsonv::value and extraction_context.

Definition at line 24 of file extractor_construction.hpp.

Member Function Documentation

◆ extract()

template<typename T >
virtual void jsonv::extractor_construction< 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 33 of file extractor_construction.hpp.

◆ extract_impl() [1/2]

template<typename T >
template<typename U , typename = void>
auto jsonv::extractor_construction< T >::extract_impl ( const extraction_context ,
const value from,
void into 
) const -> decltype(U(from), void())
inlineprotected

Definition at line 53 of file extractor_construction.hpp.

◆ extract_impl() [2/2]

template<typename T >
template<typename U >
auto jsonv::extractor_construction< T >::extract_impl ( const extraction_context context,
const value from,
void into 
) const -> decltype(U(from, context), void())
inlineprotected

Definition at line 43 of file extractor_construction.hpp.

◆ get_type()

template<typename T >
virtual const std::type_info & jsonv::extractor_construction< 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 28 of file extractor_construction.hpp.


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