JSON helper class.
More...
#include <json_helper.h>
|
| json_helper () |
| Default constructor.
|
|
| ~json_helper () |
| Destructor.
|
|
| json_helper (const json_helper &other) |
|
json_helper & | operator= (const json_helper &other) |
|
| json_helper (json_helper &&other) noexcept=default |
|
json_helper & | operator= (json_helper &&other) noexcept=default |
|
std::string | from (const std::unordered_map< std::string, std::string > &map, int pretty_print=4) const noexcept |
| Get the contents of a map as a string in JSON format.
|
|
bool | from (const std::string &s, std::unordered_map< std::string, std::string > &m) const noexcept |
| Parse and set a JSON string into a C++ map.
|
|
bool | load (const std::string &filename, std::unordered_map< std::string, std::string > &m) const noexcept |
| Parse a JSON file into a C++ map from a file on disk.
|
|
JSON helper class.
This class provides methods to convert a map of strings into a JSON string
◆ from() [1/2]
bool mazes::json_helper::from |
( |
const std::string & | s, |
|
|
std::unordered_map< std::string, std::string > & | m ) const |
|
noexcept |
Parse and set a JSON string into a C++ map.
- Parameters
-
- Returns
- success or failure on parse
◆ from() [2/2]
std::string mazes::json_helper::from |
( |
const std::unordered_map< std::string, std::string > & | map, |
|
|
int | pretty_print = 4 ) const |
|
noexcept |
Get the contents of a map as a string in JSON format.
- Parameters
-
map | |
pretty_print | Number of spaces to use for indenting the JSON string |
- Returns
◆ load()
bool mazes::json_helper::load |
( |
const std::string & | filename, |
|
|
std::unordered_map< std::string, std::string > & | m ) const |
|
noexcept |
Parse a JSON file into a C++ map from a file on disk.
- Parameters
-
- Returns
The documentation for this class was generated from the following file: