AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
anch::json::PrimitiveMapper< T > Class Template Reference

JSON primitive types mapper. More...

#include <primitiveMapper.hpp>

+ Collaboration diagram for anch::json::PrimitiveMapper< T >:

Public Member Functions

 PrimitiveMapper (const PrimitiveMapper &other)=delete
 
 PrimitiveMapper (PrimitiveMapper &&other)=delete
 
bool serialize (const T &value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool serialize (const T *const value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool serialize (const std::optional< T > &value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool serialize (const std::vector< T > &value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool serialize (const std::list< T > &value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool serialize (const std::set< T > &value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool serialize (const std::map< std::string, T > &value, std::ostream &out, const anch::json::MappingOptions &options, const std::optional< std::string > &field=EMPTY_FIELD)
 
bool deserialize (T &value, anch::json::ReaderContext &context)
 
bool deserialize (std::optional< T > &value, anch::json::ReaderContext &context)
 
bool deserialize (T *value, anch::json::ReaderContext &context)
 
bool deserialize (std::vector< T > &value, anch::json::ReaderContext &context)
 
bool deserialize (std::list< T > &value, anch::json::ReaderContext &context)
 
bool deserialize (std::set< T > &value, anch::json::ReaderContext &context)
 
bool deserialize (std::map< std::string, T > &value, anch::json::ReaderContext &context)
 

Detailed Description

template<typename T>
class anch::json::PrimitiveMapper< T >

JSON primitive types mapper.

JSON primitive types does not have any fields.

Template Parameters
Tthe object type
Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ PrimitiveMapper() [1/2]

template<typename T>
anch::json::PrimitiveMapper< T >::PrimitiveMapper ( const PrimitiveMapper< T > & other)
delete

Forbids PrimitiveMapper copy constructor

Parameters
otherthe other mapper not to copy

◆ PrimitiveMapper() [2/2]

template<typename T>
anch::json::PrimitiveMapper< T >::PrimitiveMapper ( PrimitiveMapper< T > && other)
delete

Forbids PrimitiveMapper move constructor

Parameters
otherthe other mapper not to move

Member Function Documentation

◆ deserialize() [1/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( std::list< T > & value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context

◆ deserialize() [2/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( std::map< std::string, T > & value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context

◆ deserialize() [3/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( std::optional< T > & value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context
Returns
\false when value is null , false otherwise

◆ deserialize() [4/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( std::set< T > & value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context

◆ deserialize() [5/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( std::vector< T > & value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context

◆ deserialize() [6/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( T & value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context
Returns
\false when value is null , false otherwise

◆ deserialize() [7/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::deserialize ( T * value,
anch::json::ReaderContext & context )

Deserialize JSON value

Parameters
valuethe value to set
contextthe mapping context
Returns
\false when value is null , false otherwise

◆ serialize() [1/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const std::list< T > & value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize array (as std::list ) attribute

Parameters
valuethe array attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true

◆ serialize() [2/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const std::map< std::string, T > & value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize map (as std::map ) attribute

Parameters
valuethe map attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true

◆ serialize() [3/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const std::optional< T > & value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize optional attribute

Parameters
valuethe pointer attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true if attribute is set , false otherwise

◆ serialize() [4/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const std::set< T > & value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize array (as std::set ) attribute

Parameters
valuethe array attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true

◆ serialize() [5/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const std::vector< T > & value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize array (as std::vector ) attribute

Parameters
valuethe array attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true

◆ serialize() [6/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const T & value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize reference attribute

Parameters
valuethe reference attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true

◆ serialize() [7/7]

template<typename T>
bool anch::json::PrimitiveMapper< T >::serialize ( const T *const value,
std::ostream & out,
const anch::json::MappingOptions & options,
const std::optional< std::string > & field = EMPTY_FIELD )

Serialize pointer attribute

Parameters
valuethe pointer attribute to serialize
outthe output stream to write the attribute
optionsthe options to use
fieldthe attribute's field name
Returns
true if attribute is not NULL , false otherwise

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