Maze Builder Docs 6.0.1
Loading...
Searching...
No Matches
json_helper.h
Go to the documentation of this file.
1#ifndef JSON_HELPER_H
2#define JSON_HELPER_H
3
4#include <string>
5#include <memory>
6#include <unordered_map>
7
8namespace mazes {
9
15public:
17 explicit json_helper();
18
21
22 // Copy constructor
23 json_helper(const json_helper& other);
24
25 // Copy assignment operator
26 json_helper& operator=(const json_helper& other);
27
28 // Move constructor
29 json_helper(json_helper&& other) noexcept = default;
30
31 // Move assignment operator
32 json_helper& operator=(json_helper&& other) noexcept = default;
33
38 std::string from(const std::unordered_map<std::string, std::string>& map, int pretty_print = 4) const noexcept;
39
44 bool from(const std::string& s, std::unordered_map<std::string, std::string>& m) const noexcept;
45
50 bool load(const std::string& filename, std::unordered_map<std::string, std::string>& m) const noexcept;
51
52private:
54 class json_helper_impl;
55 std::unique_ptr<json_helper_impl> impl;
56};
57
58} // namespace mazes
59
60#endif // JSON_HELPER_H
JSON helper class.
Definition json_helper.h:14
json_helper()
Default constructor.
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.
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.
~json_helper()
Destructor.
Namespace for the maze builder.
Definition algo_interface.h:9