A little more cleanup and then removing any completed bug notes.

This commit is contained in:
Zed A. Shaw 2025-01-05 15:20:20 -05:00
parent f35b74f335
commit 8e4add25a9
2 changed files with 12 additions and 30 deletions

View file

@ -16,13 +16,17 @@ json &Config::operator[](const std::string &key) {
}
std::wstring Config::wstring(const std::string key) {
dbc::check($config.contains(key), format("ERROR wstring in config, key {} doesn't exist.", key));
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
const std::string& str_val = $config[key];
return $converter.from_bytes(str_val);
}
std::wstring Config::wstring(const std::string main_key, const std::string sub_key) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
dbc::check($config.contains(main_key), format("ERROR wstring main/key in config, main_key {} doesn't exist.", main_key));
dbc::check($config[main_key].contains(sub_key), format("ERROR wstring in config, main_key/key {}/{} doesn't exist.", main_key, sub_key));
const std::string& str_val = $config[main_key][sub_key];
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
return $converter.from_bytes(str_val);
}