JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::extraction_context Class Reference
+ Inheritance diagram for jsonv::extraction_context:
+ Collaboration diagram for jsonv::extraction_context:

Public Member Functions

 extraction_context ()
 Create a new instance using the default formats (formats::global).
 
 extraction_context (jsonv::formats fmt, const jsonv::version &ver=jsonv::version(), jsonv::path p=jsonv::path(), const void *userdata=nullptr)
 Create a new instance using the given fmt, ver and p.
 
const jsonv::pathpath () const
 Get the current path this extraction_context is extracting for.
 
template<typename T >
extract (const value &from) const
 Attempt to extract a T from from using the formats associated with this context.
 
void extract (const std::type_info &type, const value &from, void *into) const
 
template<typename T >
extract_sub (const value &from, jsonv::path subpath) const
 Attempt to extract a T from from.at_path(subpath) using the formats associated with this context.
 
void extract_sub (const std::type_info &type, const value &from, jsonv::path subpath, void *into) const
 
template<typename T >
extract_sub (const value &from, path_element elem) const
 Attempt to extract a T from from.at_path({elem}) using the formats associated with this context.
 
- Public Member Functions inherited from jsonv::context_base
 context_base ()
 Create a new instance using the default formats (formats::global).
 
 context_base (jsonv::formats fmt, const jsonv::version &ver=jsonv::version(1), const void *userdata=nullptr)
 Create a new instance using the given fmt, ver and p.
 
const jsonv::formatsformats () const
 Get the formats object backing extraction and encoding.
 
const jsonv::version version () const
 Get the version this extraction_context was created with.
 
const voiduser_data () const
 Get a pointer to arbitrary user data.
 

Detailed Description

Definition at line 601 of file serialization.hpp.

Member Function Documentation

◆ extract()

template<typename T >
T jsonv::extraction_context::extract ( const value from) const
inline

Attempt to extract a T from from using the formats associated with this context.

Template Parameters
Tis the type to extract from from. It must be movable.
Exceptions
extraction_errorif anything goes wrong when attempting to extract a value.

Definition at line 631 of file serialization.hpp.

+ Here is the call graph for this function:

◆ extract_sub() [1/2]

template<typename T >
T jsonv::extraction_context::extract_sub ( const value from,
jsonv::path  subpath 
) const
inline

Attempt to extract a T from from.at_path(subpath) using the formats associated with this context.

Template Parameters
Tis the type to extract from from. It must be movable.
Exceptions
extraction_errorif anything goes wrong when attempting to extract a value.

Definition at line 652 of file serialization.hpp.

◆ extract_sub() [2/2]

template<typename T >
T jsonv::extraction_context::extract_sub ( const value from,
path_element  elem 
) const
inline

Attempt to extract a T from from.at_path({elem}) using the formats associated with this context.

Template Parameters
Tis the type to extract from from. It must be movable.
Exceptions
extraction_errorif anything goes wrong when attempting to extract a value.

Definition at line 670 of file serialization.hpp.

◆ path()

const jsonv::path & jsonv::extraction_context::path ( ) const
inline

Get the current path this extraction_context is extracting for.

This is useful when debugging and generating error messages.

Definition at line 619 of file serialization.hpp.


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