[*] Update CmdLine prototype: AuOptional<const AuString &> GetValue(const AuString &key)

This commit is contained in:
Reece Wilson 2024-03-13 02:03:56 +00:00
parent 5c34a8435b
commit cac3746bf0
2 changed files with 17 additions and 6 deletions

View File

@ -39,11 +39,11 @@ namespace Aurora::CmdLine
AUKN_SYM const AuString &GetValue(const AuString &key, const AuString &defaultValue);
/**
* @brief Returns part after key= or an empty string
* @brief Returns part after key=
* @param key
* @return
*/
AUKN_SYM const AuString &GetValue(const AuString &key);
AUKN_SYM AuOptional<const AuString &> GetValue(const AuString &key);
/**
* @brief Returns a constant array of values; key=values and /key values

View File

@ -38,13 +38,24 @@ namespace Aurora::CmdLine
AUKN_SYM const AuString &GetValue(const AuString &key, const AuString &defaultValue)
{
auto itr = gCmdValueMap.find(key);
if (itr == gCmdValueMap.end()) return defaultValue;
return itr->second;
if (itr == gCmdValueMap.end())
{
return defaultValue;
}
else
{
return itr->second;
}
}
AUKN_SYM const AuString &GetValue(const AuString &key)
AUKN_SYM AuOptional<const AuString &> GetValue(const AuString &key)
{
return GetValue(key, kEmptyString);
auto itr = gCmdValueMap.find(key);
if (itr == gCmdValueMap.end())
{
return AuOptional<const AuString &> {};
}
return itr->second;
}
AUKN_SYM const AuList<AuString> &GetValues(const AuString &key)