mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Make use of a default value
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
a672fd0647
commit
6f439097d6
3 changed files with 15 additions and 17 deletions
|
@ -141,13 +141,16 @@ bool Rules::has (const std::string& key) const
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Return the configuration value given the specified key.
|
||||
std::string Rules::get (const std::string& key) const
|
||||
std::string Rules::get (const std::string &key, const std::string &defaultValue) const
|
||||
{
|
||||
auto found = _settings.find (key);
|
||||
if (found != _settings.end ())
|
||||
return found->second;
|
||||
|
||||
return "";
|
||||
if (found != _settings.end ())
|
||||
{
|
||||
return found->second;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue