COMMON: ConfMan needs getValOrDefault

This commit is contained in:
Henrik "Henke37" Andersson 2020-10-20 02:29:18 +02:00 committed by Eugene Sandulenko
parent 2eb52fe900
commit 470505cc56
2 changed files with 3 additions and 2 deletions

View File

@ -458,7 +458,7 @@ const String &ConfigManager::get(const String &key) const {
else if (_appDomain.contains(key)) else if (_appDomain.contains(key))
return _appDomain[key]; return _appDomain[key];
return _defaultsDomain.getVal(key); return _defaultsDomain.getValOrDefault(key);
} }
const String &ConfigManager::get(const String &key, const String &domName) const { const String &ConfigManager::get(const String &key, const String &domName) const {
@ -477,7 +477,7 @@ const String &ConfigManager::get(const String &key, const String &domName) const
if (domain->contains(key)) if (domain->contains(key))
return (*domain)[key]; return (*domain)[key];
return _defaultsDomain.getVal(key); return _defaultsDomain.getValOrDefault(key);
} }
int ConfigManager::getInt(const String &key, const String &domName) const { int ConfigManager::getInt(const String &key, const String &domName) const {

View File

@ -89,6 +89,7 @@ public:
* @return True if the key exists, false otherwise. * @return True if the key exists, false otherwise.
* You can use this method if you frequently attempt to access keys that do not exist. * You can use this method if you frequently attempt to access keys that do not exist.
*/ */
const String &getValOrDefault(const String &key) const { return _entries.getValOrDefault(key); }
bool tryGetVal(const String &key, String &out) const { return _entries.tryGetVal(key, out); } bool tryGetVal(const String &key, String &out) const { return _entries.tryGetVal(key, out); }
void clear() { _entries.clear(); } /*!< Clear all configuration entries in the domain. */ void clear() { _entries.clear(); } /*!< Clear all configuration entries in the domain. */