A base class for all kind of json mapping. More...
#include <basic_json_mapper.hpp>
Inherits matador::generic_json_parser< basic_json_mapper< T, S > >.
Public Types | |
typedef generic_json_parser< basic_json_mapper< T, S > > | base |
Public Member Functions | |
basic_json_mapper () | |
T | object_from_string (const char *str) |
void | object_from_string (const char *str, T *obj) |
std::vector< T > | array_from_string (const char *str) |
Additional Inherited Members | |
Protected Member Functions inherited from matador::generic_json_parser< basic_json_mapper< T, S > > | |
generic_json_parser ()=default | |
void | on_parse_object (bool check_for_eos) |
void | on_parse_array (bool check_for_eos) |
void | on_begin_object () |
void | on_object_key (const std::string &) |
void | on_end_object () |
void | on_begin_array () |
void | on_end_array () |
void | on_string (const std::string &) |
void | on_integer (long long) |
void | on_real (double) |
void | on_bool (bool) |
void | on_null () |
void | sync_cursor (const char *cursor) |
A base class for all kind of json mapping.
The class acts as a boilerplate for all concrete json mapping classes (
It uses internally a generic json parser in combination with a given serialization class type S to map a json string to an object of type T.
T | Type of the object to which the json string is mapped |
S | The internally used serialization class type |
typedef generic_json_parser<basic_json_mapper<T, S> > matador::basic_json_mapper< T, S >::base |
Shortcut to this base class
|
inline |
Creates the basic json mapper
|
inline |
Maps a given json string to an array of objects of type type. if the json string doesn't contain an array a
str | The json array string to parse |
|
inline |
Maps a given json string to an new object of type T.
str | Json string to parse and map |
|
inline |
Maps a given json string to the given object of type T.
str | Json string to parse and map |
obj | The object to map |