JSON Voorhees
Killer JSON for C++
jsonv::extraction_context Class Reference
+ Inheritance diagram for jsonv::extraction_context:

Public Member Functions

 extraction_context ()
 Create a new instance using the default formats (formats::global). More...
 
 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. More...
 
const jsonv::pathpath () const
 Get the current path this extraction_context is extracting for. More...
 
template<typename T >
extract (const value &from) const
 Attempt to extract a T from from using the formats associated with this context. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from jsonv::context_base
 context_base ()
 Create a new instance using the default formats (formats::global). More...
 
 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. More...
 
const jsonv::formatsformats () const
 Get the formats object backing extraction and encoding. More...
 
const jsonv::version version () const
 Get the version this extraction_context was created with. More...
 
const void * user_data () const
 Get a pointer to arbitrary user data. More...
 

Detailed Description

Definition at line 541 of file serialization.hpp.

Constructor & Destructor Documentation

jsonv::extraction_context::extraction_context ( )

Create a new instance using the default formats (formats::global).

jsonv::extraction_context::extraction_context ( jsonv::formats  fmt,
const jsonv::version ver = jsonv::version(),
jsonv::path  p = jsonv::path(),
const void *  userdata = nullptr 
)
explicit

Create a new instance using the given fmt, ver and p.

Member Function Documentation

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 572 of file serialization.hpp.

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 593 of file serialization.hpp.

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 611 of file serialization.hpp.

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 560 of file serialization.hpp.


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