Removed dbc and replaced with plain asserts everywhere.

This commit is contained in:
Zed A. Shaw 2025-05-10 10:53:53 -04:00
parent 767147c301
commit adc192c6dc
17 changed files with 69 additions and 185 deletions

View file

@ -1,5 +1,4 @@
#include "guecs/sfml/config.hpp"
#include "guecs/dbc.hpp"
#include <fmt/core.h>
using nlohmann::json;
@ -11,13 +10,14 @@ Config::Config(const std::string src_path) : $src_path(src_path) {
}
json &Config::operator[](const std::string &key) {
dbc::check($config.contains(key), fmt::format("ERROR in config, key {} doesn't exist.", key));
assert($config.contains(key) &&
"ERROR in config, key doesn't exist.");
return $config[key];
}
std::wstring Config::wstring(const std::string main_key, const std::string sub_key) {
dbc::check($config.contains(main_key), fmt::format("ERROR wstring main/key in config, main_key {} doesn't exist.", main_key));
dbc::check($config[main_key].contains(sub_key), fmt::format("ERROR wstring in config, main_key/key {}/{} doesn't exist.", main_key, sub_key));
assert($config.contains(main_key) && "ERROR wstring main/key in config, main_key doesn't exist.");
assert($config[main_key].contains(sub_key) && "ERROR wstring in config, main_key/key doesn't exist.");
const std::string& str_val = $config[main_key][sub_key];
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;