25 lines
391 B
C++
25 lines
391 B
C++
#ifndef JSONOUTPUT_HPP_
|
|
#define JSONOUTPUT_HPP_
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
|
|
class JsonOutput {
|
|
public:
|
|
explicit JsonOutput(char const* file_path);
|
|
~JsonOutput() = default;
|
|
|
|
template<typename T>
|
|
void add(char const* key, T const& obj)
|
|
{
|
|
jsonData_[key] = obj;
|
|
}
|
|
bool write();
|
|
|
|
private:
|
|
char const* filePath_;
|
|
::nlohmann::json jsonData_;
|
|
};
|
|
|
|
#endif // JSONOUTPUT_HPP_
|