[*] AuCmdLine::GetValue(...) (both variants) refactored to use views to help with future stability issues around AuStrings (and their allocator?)
This commit is contained in:
parent
8063600b4f
commit
f059141505
@ -36,14 +36,14 @@ namespace Aurora::CmdLine
|
||||
* @param defaultValue
|
||||
* @return
|
||||
*/
|
||||
AUKN_SYM const AuString &GetValue(const AuROString &key, const AuString &defaultValue);
|
||||
AUKN_SYM AuROString GetValue(const AuROString &key, const AuROString &defaultValue);
|
||||
|
||||
/**
|
||||
* @brief Returns part after key=
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
AUKN_SYM AuOptional<const AuString &> GetValue(const AuROString &key);
|
||||
AUKN_SYM AuOptional<AuROString> GetValue(const AuROString &key);
|
||||
|
||||
/**
|
||||
* @brief Returns a constant array of values; key=values and /key values
|
||||
|
@ -35,27 +35,32 @@ namespace Aurora::CmdLine
|
||||
AuExists(gCmdValueMap, key);
|
||||
}
|
||||
|
||||
AUKN_SYM const AuString &GetValue(const AuROString &key, const AuString &defaultValue)
|
||||
AUKN_SYM AuROString GetValue(const AuROString &key, const AuROString &defaultValue)
|
||||
{
|
||||
auto itr = gCmdValueMap.find(key);
|
||||
if (itr == gCmdValueMap.end())
|
||||
AuString *pValue {};
|
||||
|
||||
if (AuTryFind(gCmdValueMap, key, pValue))
|
||||
{
|
||||
return defaultValue;
|
||||
return *pValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return itr->second;
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
AUKN_SYM AuOptional<const AuString &> GetValue(const AuROString &key)
|
||||
AUKN_SYM AuOptional<AuROString> GetValue(const AuROString &key)
|
||||
{
|
||||
auto itr = gCmdValueMap.find(key);
|
||||
if (itr == gCmdValueMap.end())
|
||||
AuString *pValue {};
|
||||
|
||||
if (AuTryFind(gCmdValueMap, key, pValue))
|
||||
{
|
||||
return AuOptional<const AuString &> {};
|
||||
return *pValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AuOptional<AuROString> {};
|
||||
}
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
AUKN_SYM const AuList<AuString> &GetValues(const AuROString &key)
|
||||
|
Loading…
Reference in New Issue
Block a user