diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-11-03 00:18:10 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-11-03 00:20:41 +0200 |
commit | f3a4607d6a722a862af0eb9747a15dcdf624b6fb (patch) | |
tree | 9885709cdff55a865be6c03c591a9757680b0396 /src/conf.hpp.in | |
parent | Change spdlog from makedepends to depends (diff) | |
download | smolbote-f3a4607d6a722a862af0eb9747a15dcdf624b6fb.tar.xz |
Drop boost dependency
- wrote not-invented-here config file parser and conf class
- spent obscene amount of time plugging in said conf class
Diffstat (limited to 'src/conf.hpp.in')
-rw-r--r-- | src/conf.hpp.in | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/conf.hpp.in b/src/conf.hpp.in new file mode 100644 index 0000000..f509eb2 --- /dev/null +++ b/src/conf.hpp.in @@ -0,0 +1,32 @@ +/* + * This file is part of smolbote. It's copyrighted by the contributors recorded + * in the version control history of the file, available from its original + * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote + * + * SPDX-License-Identifier: GPL-3.0 + */ + +#include "configuration.h" +#include <fstream> + +#mesondefine CONFIG_POI_NAME +#mesondefine CONFIG_POI_ICON +#mesondefine CONFIG_POI_CFG_PATH + +#mesondefine CONFIG_QTBUG_65223 + +inline void init_conf(const std::string &path) +{ + std::fstream fs; + fs.open(path, std::fstream::in); + assert(fs.is_open()); + + auto value_map = std::make_unique<Configuration, std::initializer_list<std::pair<std::string, conf_value_t>>>({ + @conf_init_list@ + }); + value_map->read(fs); + + Configuration::move_global(std::move(value_map)); + fs.close(); +} + |