Basic config system from a json file but it's got serious issues. Can't copy construct it because of the variable blocking copying, and it can't even be put into the dinkyecs in any way.
This commit is contained in:
parent
24b1e4a500
commit
0ba789697a
7 changed files with 93 additions and 5 deletions
19
config.hpp
Normal file
19
config.hpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <fstream>
|
||||
#include <codecvt>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
struct Config {
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
|
||||
json $config;
|
||||
std::string $src_path = "./config.json";
|
||||
|
||||
Config(const std::string src_path);
|
||||
Config(Config &other) = delete;
|
||||
|
||||
json &operator[](const std::string &key);
|
||||
|
||||
std::wstring wstring(const std::string main_key, const std::string sub_key);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue