SimpleConfig: Add const char * key variants.

This commit is contained in:
2023-10-23 21:47:33 -07:00
parent 9a83cf6c08
commit 1bc8a9ad82
3 changed files with 88 additions and 2 deletions

View File

@@ -83,6 +83,13 @@ SimpleConfig::GetGlobal(std::string &key)
}
std::string
SimpleConfig::GetGlobal(const char *key)
{
return globalConfig.Get(key);
}
std::string
SimpleConfig::GetGlobal(std::string &key, const std::string &defaultValue)
{
@@ -90,6 +97,13 @@ SimpleConfig::GetGlobal(std::string &key, const std::string &defaultValue)
}
std::string
SimpleConfig::GetGlobal(const char *key, const std::string &defaultValue)
{
return globalConfig.Get(key, defaultValue);
}
void
SimpleConfig::PutGlobal(std::string &key, const std::string &value)
{
@@ -160,6 +174,14 @@ SimpleConfig::Get(std::string &key)
}
std::string
SimpleConfig::Get(const char *key)
{
auto keyStr = std::string(key);
return this->Get(keyStr, "");
}
std::string
SimpleConfig::Get(std::string &key, std::string defaultValue)
{
@@ -180,6 +202,14 @@ SimpleConfig::Get(std::string &key, std::string defaultValue)
}
std::string
SimpleConfig::Get(const char *key, std::string defaultValue)
{
auto keyStr = std::string(key);
return this->Get(keyStr, std::move(defaultValue));
}
void
SimpleConfig::Put(std::string &key, const std::string value)
{
@@ -187,6 +217,14 @@ SimpleConfig::Put(std::string &key, const std::string value)
}
void
SimpleConfig::Put(const char *key, const std::string value)
{
auto keyStr = std::string(key);
this->vars[std::move(keyStr)] = std::move(key);
}
std::vector<std::string>
SimpleConfig::KeyList()
{