Mercurial > minori
comparison src/core/ini.cc @ 276:ec0a2b5493f8
ini: simplify INI code, use templates less
less magic voodoo code
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 22 Apr 2024 19:10:28 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
275:22f9aacf6ac1 | 276:ec0a2b5493f8 |
---|---|
1 #include "core/ini.h" | |
2 | |
3 namespace INI { | |
4 | |
5 std::string GetIniString(const mINI::INIStructure& ini, const std::string& section, const std::string& key, const std::string& def) { | |
6 if (!ini.has(section) || !ini.get(section).has(key)) | |
7 return def; | |
8 | |
9 return ini.get(section).get(key); | |
10 } | |
11 | |
12 bool GetIniBool(const mINI::INIStructure& ini, const std::string& section, const std::string& key, bool def) { | |
13 return Strings::ToBool(GetIniString(ini, section, key, ""), def); | |
14 } | |
15 | |
16 } |