AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
anch::json::JSONMapper Class Reference

JSON mapper with mapping options. More...

#include <json.hpp>

+ Collaboration diagram for anch::json::JSONMapper:

Public Member Functions

 JSONMapper ()=delete
 
 JSONMapper (const anch::json::MappingOptions &options)
 
virtual ~JSONMapper ()
 
template<typename T>
void serialize (const T &value, std::ostream &out)
 
template<typename T>
void serialize (const std::vector< T > &value, std::ostream &out)
 
template<typename T>
void serialize (const std::list< T > &value, std::ostream &out)
 
template<typename T>
void serialize (const std::set< 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<typename T>
std::string serialize (const std::vector< T > &value)
 
template<typename T>
std::string serialize (const std::list< T > &value)
 
template<typename T>
std::string serialize (const std::set< 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>
deserialize (std::istream &input)
 
template<typename T>
void deserialize (std::vector< T > &values, std::istream &input)
 
template<typename T>
void deserialize (std::list< T > &values, std::istream &input)
 
template<typename T>
void deserialize (std::set< T > &values, std::istream &input)
 
template<typename T>
void deserialize (std::map< std::string, T > &values, std::istream &input)
 

Detailed Description

JSON mapper with mapping options.

JSON mapper declaration which will always use same mapping options

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ JSONMapper() [1/2]

anch::json::JSONMapper::JSONMapper ( )
delete

Forbids JSONMapper default constructor

◆ JSONMapper() [2/2]

anch::json::JSONMapper::JSONMapper ( const anch::json::MappingOptions & options)

JSONMapper constructor

Parameters
optionsthe mapping options

◆ ~JSONMapper()

virtual anch::json::JSONMapper::~JSONMapper ( )
virtual

JSONMapper destructor

Member Function Documentation

◆ deserialize() [1/6]

template<typename T>
T anch::json::JSONMapper::deserialize ( std::istream & input)

Deserialize object

Template Parameters
Tthe object type
Parameters
inputthe input stream to parse
Returns
the deserialized object by copy

◆ deserialize() [2/6]

template<typename T>
void anch::json::JSONMapper::deserialize ( std::list< T > & values,
std::istream & input )

Deserialize objects

Template Parameters
Tthe object type
Parameters
valuesthe values to fill
inputthe input stream to parse
Returns
true

◆ deserialize() [3/6]

template<typename T>
void anch::json::JSONMapper::deserialize ( std::map< std::string, T > & values,
std::istream & input )

Deserialize objects

Template Parameters
Tthe object type
Parameters
valuesthe values to fill
inputthe input stream to parse

◆ deserialize() [4/6]

template<typename T>
void anch::json::JSONMapper::deserialize ( std::set< T > & values,
std::istream & input )

Deserialize objects

Template Parameters
Tthe object type
Parameters
valuesthe values to fill
inputthe input stream to parse
Returns
true

◆ deserialize() [5/6]

template<typename T>
void anch::json::JSONMapper::deserialize ( std::vector< T > & values,
std::istream & input )

Deserialize objects

Template Parameters
Tthe object type
Parameters
valuesthe values to fill
inputthe input stream to parse
Returns
true

◆ deserialize() [6/6]

template<typename T>
void anch::json::JSONMapper::deserialize ( T & value,
std::istream & input )

Deserialize object

Template Parameters
Tthe object type
Parameters
valuethe value to fill
inputthe input stream to parse
Returns
true when value has been found, false otherwise

◆ serialize() [1/10]

template<typename T>
std::string anch::json::JSONMapper::serialize ( const std::list< T > & value)

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe object to serialize
Returns
the serialized objects as std::string

◆ serialize() [2/10]

template<typename T>
void anch::json::JSONMapper::serialize ( const std::list< T > & value,
std::ostream & out )

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe objects to serialize
outthe output stream to write in

◆ serialize() [3/10]

template<typename T>
std::string anch::json::JSONMapper::serialize ( const std::map< std::string, T > & value)

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe object to serialize
Returns
the serialized objects as std::string

◆ serialize() [4/10]

template<typename T>
void anch::json::JSONMapper::serialize ( const std::map< std::string, T > & value,
std::ostream & out )

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe objects to serialize
outthe output stream to write in

◆ serialize() [5/10]

template<typename T>
std::string anch::json::JSONMapper::serialize ( const std::set< T > & value)

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe object to serialize
Returns
the serialized objects as std::string

◆ serialize() [6/10]

template<typename T>
void anch::json::JSONMapper::serialize ( const std::set< T > & value,
std::ostream & out )

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe objects to serialize
outthe output stream to write in

◆ serialize() [7/10]

template<typename T>
std::string anch::json::JSONMapper::serialize ( const std::vector< T > & value)

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe object to serialize
Returns
the serialized objects as std::string

◆ serialize() [8/10]

template<typename T>
void anch::json::JSONMapper::serialize ( const std::vector< T > & value,
std::ostream & out )

Serialize objects

Template Parameters
Tthe object type
Parameters
valuethe objects to serialize
outthe output stream to write in

◆ serialize() [9/10]

template<typename T>
std::string anch::json::JSONMapper::serialize ( const T & value)

Serialize object

Template Parameters
Tthe object type
Parameters
valuethe object to serialize
Returns
the serialized object as std::string

◆ serialize() [10/10]

template<typename T>
void anch::json::JSONMapper::serialize ( const T & value,
std::ostream & out )

Serialize object

Template Parameters
Tthe object type
Parameters
valuethe object to serialize
outthe output stream to write in

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