From d514c818290881b2fca793c22ee49fca09d57688 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Sun, 28 Apr 2024 15:41:43 +0530 Subject: [PATCH] SimpCfg: Add the const which I had forgotten wrt args --- common/simpcfg.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/simpcfg.hpp b/common/simpcfg.hpp index fc435a73a..643526248 100644 --- a/common/simpcfg.hpp +++ b/common/simpcfg.hpp @@ -34,27 +34,27 @@ private: std::map> mapStrings = {}; std::map> mapBools = {}; public: - void set_string(std::string &group, std::string &key, std::string &value) { + void set_string(const std::string &group, const std::string &key, const std::string &value) { auto gm = mapStrings[group]; gm[key] = value; } - void set_bool(std::string &group, std::string &key, bool value) { + void set_bool(const std::string &group, const std::string &key, bool value) { auto gm = mapBools[group]; gm[key] = value; } - std::string get_string(std::string &group, std::string &key) { + std::string get_string(const std::string &group, const std::string &key) { auto gm = mapStrings[group]; return gm[key]; } - bool get_bool(std::string &group, std::string &key) { + bool get_bool(const std::string &group, const std::string &key) { auto gm = mapBools[group]; return gm[key]; } - void load(std::string &fname) { + void load(const std::string &fname) { std::ifstream f {fname}; if (!f) { LOG_TEELN("ERRR:%s:%s:failed to load...", __func__, fname.c_str()); @@ -115,6 +115,7 @@ int main(int argc, char **argv) { std::string fname {argv[1]}; SimpCfg sc; sc.load(fname); + sc.get_bool("testme", "key101"); return 0; } #endif