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

An extractor which calls a function to perform extraction. More...

#include <jsonv/serialization/function_extractor.hpp>

+ Inheritance diagram for jsonv::function_extractor< T, FExtract >:
+ Collaboration diagram for jsonv::function_extractor< T, FExtract >:

Public Member Functions

template<typename FUExtract >
 function_extractor (FUExtract &&func)
 
- Public Member Functions inherited from jsonv::extractor_for< T >
virtual const std::type_info & get_type () const noexcept override
 
virtual std::expected< void, ast_node_type > extract (extraction_context &context, reader &from, void *into) const override
 

Protected Member Functions

virtual std::expected< T, ast_node_type > create (extraction_context &context, reader &from) const override
 Create an instance of T by reading from.
 

Detailed Description

template<typename T, typename FExtract>
class jsonv::function_extractor< T, FExtract >

An extractor which calls a function to perform extraction.

The function may take any of the shapes detail::invoke_extract accepts and may return either a T or a std::expected<T, ast_node_type>.

Definition at line 31 of file function_extractor.hpp.

Constructor & Destructor Documentation

◆ function_extractor()

template<typename T , typename FExtract >
template<typename FUExtract >
jsonv::function_extractor< T, FExtract >::function_extractor ( FUExtract &&  func)
inlineexplicit

Definition at line 36 of file function_extractor.hpp.

Member Function Documentation

◆ create()

template<typename T , typename FExtract >
virtual std::expected< T, ast_node_type > jsonv::function_extractor< T, FExtract >::create ( extraction_context &  context,
reader &  from 
) const
inlineoverrideprotectedvirtual

Create an instance of T by reading from.

See also
adapter_for::create

Implements jsonv::extractor_for< T >.

Definition at line 42 of file function_extractor.hpp.


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