JSON primitive types mapper. More...
#include <primitiveMapper.hpp>
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) |
JSON primitive types mapper.
JSON primitive types does not have any fields.
T | the object type |
|
delete |
Forbids PrimitiveMapper copy constructor
other | the other mapper not to copy |
|
delete |
Forbids PrimitiveMapper move constructor
other | the other mapper not to move |
bool anch::json::PrimitiveMapper< T >::deserialize | ( | std::list< T > & | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
bool anch::json::PrimitiveMapper< T >::deserialize | ( | std::map< std::string, T > & | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
bool anch::json::PrimitiveMapper< T >::deserialize | ( | std::optional< T > & | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
null
, false
otherwise bool anch::json::PrimitiveMapper< T >::deserialize | ( | std::set< T > & | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
bool anch::json::PrimitiveMapper< T >::deserialize | ( | std::vector< T > & | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
bool anch::json::PrimitiveMapper< T >::deserialize | ( | T & | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
null
, false
otherwise bool anch::json::PrimitiveMapper< T >::deserialize | ( | T * | value, |
anch::json::ReaderContext & | context ) |
Deserialize JSON value
value | the value to set |
context | the mapping context |
null
, false
otherwise 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
value | the array attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
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
value | the map attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
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
value | the pointer attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
if attribute is set , false
otherwise 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
value | the array attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
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
value | the array attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
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
value | the reference attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
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
value | the pointer attribute to serialize |
out | the output stream to write the attribute |
options | the options to use |
field | the attribute's field name |
true
if attribute is not NULL
, false
otherwise