#include "config.hpp" using nlohmann::json; Config::Config(const std::string src_path) : $src_path(src_path) { std::ifstream infile($src_path); $config = json::parse(infile); } json &Config::operator[](const std::string &key) { return $config[key]; } std::wstring Config::wstring(const std::string key) { std::wstring_convert> $converter; const std::string& str_val = $config[key]; return $converter.from_bytes(str_val); } std::vector Config::keys() { // BUG: I mean, c'mon seriously this is how? std::vector keys; for(const auto& el : $config.items()) { keys.push_back(el.key()); } return keys; } std::wstring Config::wstring(const std::string main_key, const std::string sub_key) { std::wstring_convert> $converter; const std::string& str_val = $config[main_key][sub_key]; return $converter.from_bytes(str_val); }