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

Public Member Functions

 serialization_context ()
 Create a new instance using the default formats (formats::global).
 
 serialization_context (jsonv::formats fmt, std::optional< jsonv::version > ver=std::nullopt, const void *userdata=nullptr)
 Create a new instance using the given fmt, ver and userdata.
 
template<typename T >
value to_json (const T &from) const
 Convenience function for converting a C++ object into a JSON value.
 
value to_json (const std::type_info &type, const void *from) const
 Dynamically convert a type into a JSON value.
 
- Public Member Functions inherited from jsonv::context
 context ()
 Create a new instance using the default formats (formats::global).
 
 context (jsonv::formats fmt, std::optional< jsonv::version > ver=std::nullopt, const void *userdata=nullptr)
 Create a new instance using the given fmt, ver and userdata.
 
const jsonv::formats & formats () const
 Get the formats object backing extraction and encoding.
 
const std::optional< jsonv::version > & version () const
 Get the version this context was created with.
 
const void * user_data () const
 Get a pointer to arbitrary user data.
 

Detailed Description

Definition at line 32 of file serialization.hpp.

Member Function Documentation

◆ to_json() [1/2]

value jsonv::serialization_context::to_json ( const std::type_info &  type,
const void *  from 
) const

Dynamically convert a type into a JSON value.

See also
formats::to_json

◆ to_json() [2/2]

template<typename T >
value jsonv::serialization_context::to_json ( const T &  from) const
inline

Convenience function for converting a C++ object into a JSON value.

See also
formats::to_json

Definition at line 52 of file serialization.hpp.

+ Here is the call graph for this function:

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