JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::formats_builder Class Reference

Public Member Functions

template<typename T >
adapter_builder< T > type ()
 
template<typename T , typename F >
adapter_builder< T > type (F &&f)
 
template<typename TEnum >
formats_builder & enum_type (std::string enum_name, std::initializer_list< std::pair< TEnum, value > > mapping)
 
template<typename TEnum >
formats_builder & enum_type_icase (std::string enum_name, std::initializer_list< std::pair< TEnum, value > > mapping)
 
template<typename TPointer >
polymorphic_adapter_builder< TPointer > polymorphic_type (std::string discrimination_key="")
 
template<typename TPointer , typename F >
polymorphic_adapter_builder< TPointer > polymorphic_type (std::string discrimination_key, F &&f)
 
template<typename F >
formats_builder & extend (F &&func)
 
formats_builder & register_adapter (const adapter *p)
 
formats_builder & register_adapter (std::shared_ptr< const adapter > p)
 
template<typename TOptional >
formats_builder & register_optional ()
 
template<typename TContainer >
formats_builder & register_container ()
 
template<typename TWrapper >
formats_builder & register_wrapper ()
 
template<typename T >
formats_builder & register_containers ()
 
template<typename T , template< class... > class TTContainer, template< class... > class... TTRest>
formats_builder & register_containers ()
 
 operator formats () const
 
formats_builder & reference_type (std::type_index type)
 
formats_builder & reference_type (std::type_index type, std::type_index from)
 
formats_builder & on_duplicate_type (duplicate_type_action action) noexcept
 Assigns the action to perform when a serializer or deserializer is being registered by this formats_builder and there is already a serializer or deserializer for that type.
 
formats_builder & check_references (const formats &other, const std::string &name="")
 Check that every type referenced by this formats_builder has both a deserializer and a serializer in the formats it is generating, combined with the formats other or others where they are given.
 
formats_builder & check_references (const formats::list &others, const std::string &name="")
 Check that every type referenced by this formats_builder has both a deserializer and a serializer in the formats it is generating, combined with the formats other or others where they are given.
 
formats_builder & check_references (const std::string &name="")
 Check that every type referenced by this formats_builder has both a deserializer and a serializer in the formats it is generating, combined with the formats other or others where they are given.
 
formats compose_checked (formats other, const std::string &name="")
 Check the references of this builder (see check_references) and compose a formats instance if successful (see formats::compose).
 
formats compose_checked (formats::list others, const std::string &name="")
 Check the references of this builder (see check_references) and compose a formats instance if successful (see formats::compose).
 

Detailed Description

Definition at line 1997 of file serialization_builder.hpp.

Member Function Documentation

◆ check_references() [1/3]

formats_builder & jsonv::formats_builder::check_references ( const formats &  other,
const std::string &  name = "" 
)

Check that every type referenced by this formats_builder has both a deserializer and a serializer in the formats it is generating, combined with the formats other or others where they are given.

If name is non-empty and this function throws, name will be provided in the exception's what string. This can be useful if you are running multiple check_references calls and you want to name the different checks.

Exceptions
std::logic_errorif some referenced type is missing a deserializer or a serializer.

◆ check_references() [2/3]

formats_builder & jsonv::formats_builder::check_references ( const formats::list &  others,
const std::string &  name = "" 
)

Check that every type referenced by this formats_builder has both a deserializer and a serializer in the formats it is generating, combined with the formats other or others where they are given.

If name is non-empty and this function throws, name will be provided in the exception's what string. This can be useful if you are running multiple check_references calls and you want to name the different checks.

Exceptions
std::logic_errorif some referenced type is missing a deserializer or a serializer.

◆ check_references() [3/3]

formats_builder & jsonv::formats_builder::check_references ( const std::string &  name = "")

Check that every type referenced by this formats_builder has both a deserializer and a serializer in the formats it is generating, combined with the formats other or others where they are given.

If name is non-empty and this function throws, name will be provided in the exception's what string. This can be useful if you are running multiple check_references calls and you want to name the different checks.

Exceptions
std::logic_errorif some referenced type is missing a deserializer or a serializer.

◆ enum_type()

template<typename TEnum >
formats_builder & jsonv::formats_builder::enum_type ( std::string  enum_name,
std::initializer_list< std::pair< TEnum, value > >  mapping 
)
inline

Definition at line 2015 of file serialization_builder.hpp.

◆ enum_type_icase()

template<typename TEnum >
formats_builder & jsonv::formats_builder::enum_type_icase ( std::string  enum_name,
std::initializer_list< std::pair< TEnum, value > >  mapping 
)
inline

Definition at line 2023 of file serialization_builder.hpp.

◆ extend()

template<typename F >
formats_builder & jsonv::formats_builder::extend ( F &&  func)
inline

Definition at line 2045 of file serialization_builder.hpp.

◆ operator formats()

jsonv::formats_builder::operator formats ( ) const
inline

Definition at line 2104 of file serialization_builder.hpp.

◆ polymorphic_type() [1/2]

template<typename TPointer , typename F >
polymorphic_adapter_builder< TPointer > jsonv::formats_builder::polymorphic_type ( std::string  discrimination_key,
F &&  f 
)
inline

Definition at line 2039 of file serialization_builder.hpp.

◆ polymorphic_type() [2/2]

template<typename TPointer >
polymorphic_adapter_builder< TPointer > jsonv::formats_builder::polymorphic_type ( std::string  discrimination_key = "")
inline

Definition at line 2032 of file serialization_builder.hpp.

◆ register_adapter() [1/2]

formats_builder & jsonv::formats_builder::register_adapter ( const adapter *  p)
inline

Definition at line 2051 of file serialization_builder.hpp.

◆ register_adapter() [2/2]

formats_builder & jsonv::formats_builder::register_adapter ( std::shared_ptr< const adapter >  p)
inline

Definition at line 2057 of file serialization_builder.hpp.

◆ register_container()

template<typename TContainer >
formats_builder & jsonv::formats_builder::register_container ( )
inline

Definition at line 2073 of file serialization_builder.hpp.

◆ register_containers() [1/2]

template<typename T >
formats_builder & jsonv::formats_builder::register_containers ( )
inline

Definition at line 2091 of file serialization_builder.hpp.

◆ register_containers() [2/2]

template<typename T , template< class... > class TTContainer, template< class... > class... TTRest>
formats_builder & jsonv::formats_builder::register_containers ( )
inline

Definition at line 2097 of file serialization_builder.hpp.

◆ register_optional()

template<typename TOptional >
formats_builder & jsonv::formats_builder::register_optional ( )
inline

Definition at line 2064 of file serialization_builder.hpp.

◆ register_wrapper()

template<typename TWrapper >
formats_builder & jsonv::formats_builder::register_wrapper ( )
inline

Definition at line 2082 of file serialization_builder.hpp.

◆ type() [1/2]

template<typename T >
adapter_builder< T > jsonv::formats_builder::type ( )
inline

Definition at line 2003 of file serialization_builder.hpp.

◆ type() [2/2]

template<typename T , typename F >
adapter_builder< T > jsonv::formats_builder::type ( F &&  f)
inline

Definition at line 2009 of file serialization_builder.hpp.


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