JSON mapper with mapping options.
More...
#include <json.hpp>
|
| JSONMapper ()=delete |
| JSONMapper (const anch::json::MappingOptions &options) |
virtual | ~JSONMapper () |
template<typename T> |
void | serialize (const T &value, std::ostream &out) |
template<template< typename > typename C, typename T> |
void | serialize (const C< T > &value, std::ostream &out) |
template<typename T> |
void | serialize (anch::Flux< T > &value, std::ostream &out) |
template<typename T> |
void | serialize (const std::map< std::string, T > &value, std::ostream &out) |
template<typename T> |
std::string | serialize (const T &value) |
template<template< typename > typename C, typename T> |
std::string | serialize (const C< T > &value) |
template<typename T> |
std::string | serialize (const std::map< std::string, T > &value) |
template<typename T> |
void | deserialize (T &value, std::istream &input) |
template<typename T> |
T | deserialize (std::istream &input) |
template<template< typename > typename C, typename T> |
void | deserialize (C< T > &values, std::istream &input) |
template<typename T> |
void | deserialize (std::map< std::string, T > &values, std::istream &input) |
JSON mapper with mapping options.
JSON mapper declaration which will always use same mapping options
- Author
- Vincent Lachenal
- Since
- 0.1
◆ JSONMapper() [1/2]
anch::json::JSONMapper::JSONMapper |
( |
| ) |
|
|
delete |
◆ JSONMapper() [2/2]
JSONMapper constructor
- Parameters
-
options | the mapping options |
◆ ~JSONMapper()
virtual anch::json::JSONMapper::~JSONMapper |
( |
| ) |
|
|
virtual |
◆ deserialize() [1/4]
template<template< typename > typename C, typename T>
void anch::json::JSONMapper::deserialize |
( |
C< T > & | values, |
|
|
std::istream & | input ) |
Deserialize objects (it can also work with std::optional
, std::shared_ptr
, ...)
- Template Parameters
-
T | the object's type |
C | the container's type |
- Parameters
-
values | the values to fill |
input | the input stream to parse |
- Returns
true
◆ deserialize() [2/4]
template<typename T>
T anch::json::JSONMapper::deserialize |
( |
std::istream & | input | ) |
|
Deserialize object
- Template Parameters
-
- Parameters
-
input | the input stream to parse |
- Returns
- the deserialized object by copy
◆ deserialize() [3/4]
template<typename T>
void anch::json::JSONMapper::deserialize |
( |
std::map< std::string, T > & | values, |
|
|
std::istream & | input ) |
Deserialize objects
- Template Parameters
-
- Parameters
-
values | the values to fill |
input | the input stream to parse |
◆ deserialize() [4/4]
template<typename T>
void anch::json::JSONMapper::deserialize |
( |
T & | value, |
|
|
std::istream & | input ) |
Deserialize object
- Template Parameters
-
- Parameters
-
value | the value to fill |
input | the input stream to parse |
- Returns
true
when value has been found, false
otherwise
◆ serialize() [1/7]
template<typename T>
void anch::json::JSONMapper::serialize |
( |
anch::Flux< T > & | value, |
|
|
std::ostream & | out ) |
Serialize object's flux.
Error handler has to be set before this method call when needed. Consumer and finalize functions are set in this method.
This method will lock the processing until anch::Flux::finalize method has not be called (or error happened and throw itself).
- Template Parameters
-
- Parameters
-
value | the objects to serialize |
out | the output stream to write in |
◆ serialize() [2/7]
template<template< typename > typename C, typename T>
std::string anch::json::JSONMapper::serialize |
( |
const C< T > & | value | ) |
|
Serialize objects (it can also work with std::optional
, std::shared_ptr
, ...)
- Template Parameters
-
T | the object's type |
C | the container's type |
- Parameters
-
value | the object to serialize |
- Returns
- the serialized objects as
std::string
◆ serialize() [3/7]
template<template< typename > typename C, typename T>
void anch::json::JSONMapper::serialize |
( |
const C< T > & | value, |
|
|
std::ostream & | out ) |
Serialize objects (it can also work with std::optional
, std::shared_ptr
, ...)
- Template Parameters
-
T | the object's type |
C | the container's type |
- Parameters
-
value | the objects to serialize |
out | the output stream to write in |
◆ serialize() [4/7]
template<typename T>
std::string anch::json::JSONMapper::serialize |
( |
const std::map< std::string, T > & | value | ) |
|
Serialize objects
- Template Parameters
-
- Parameters
-
value | the object to serialize |
- Returns
- the serialized objects as
std::string
◆ serialize() [5/7]
template<typename T>
void anch::json::JSONMapper::serialize |
( |
const std::map< std::string, T > & | value, |
|
|
std::ostream & | out ) |
Serialize objects
- Template Parameters
-
- Parameters
-
value | the objects to serialize |
out | the output stream to write in |
◆ serialize() [6/7]
template<typename T>
std::string anch::json::JSONMapper::serialize |
( |
const T & | value | ) |
|
Serialize object
- Template Parameters
-
- Parameters
-
value | the object to serialize |
- Returns
- the serialized object as
std::string
◆ serialize() [7/7]
template<typename T>
void anch::json::JSONMapper::serialize |
( |
const T & | value, |
|
|
std::ostream & | out ) |
Serialize object
- Template Parameters
-
- Parameters
-
value | the object to serialize |
out | the output stream to write in |
The documentation for this class was generated from the following file: