Common: Drop fallback path for HeterogeneousContainers

This commit is contained in:
Stenzek
2023-09-05 21:03:49 +10:00
parent 58b4946fb9
commit 391307efaa
6 changed files with 74 additions and 162 deletions

View File

@ -21,7 +21,7 @@ void MemorySettingsInterface::Clear()
bool MemorySettingsInterface::GetIntValue(const char* section, const char* key, s32* value) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
@ -39,11 +39,11 @@ bool MemorySettingsInterface::GetIntValue(const char* section, const char* key,
bool MemorySettingsInterface::GetUIntValue(const char* section, const char* key, u32* value) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
const auto iter = UnorderedStringMultiMapFind(sit->second, key);
const auto iter = sit->second.find(key);
if (iter == sit->second.end())
return false;
@ -57,11 +57,11 @@ bool MemorySettingsInterface::GetUIntValue(const char* section, const char* key,
bool MemorySettingsInterface::GetFloatValue(const char* section, const char* key, float* value) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
const auto iter = UnorderedStringMultiMapFind(sit->second, key);
const auto iter = sit->second.find(key);
if (iter == sit->second.end())
return false;
@ -75,11 +75,11 @@ bool MemorySettingsInterface::GetFloatValue(const char* section, const char* key
bool MemorySettingsInterface::GetDoubleValue(const char* section, const char* key, double* value) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
const auto iter = UnorderedStringMultiMapFind(sit->second, key);
const auto iter = sit->second.find(key);
if (iter == sit->second.end())
return false;
@ -93,11 +93,11 @@ bool MemorySettingsInterface::GetDoubleValue(const char* section, const char* ke
bool MemorySettingsInterface::GetBoolValue(const char* section, const char* key, bool* value) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
const auto iter = UnorderedStringMultiMapFind(sit->second, key);
const auto iter = sit->second.find(key);
if (iter == sit->second.end())
return false;
@ -111,11 +111,11 @@ bool MemorySettingsInterface::GetBoolValue(const char* section, const char* key,
bool MemorySettingsInterface::GetStringValue(const char* section, const char* key, std::string* value) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
const auto iter = UnorderedStringMultiMapFind(sit->second, key);
const auto iter = sit->second.find(key);
if (iter == sit->second.end())
return false;
@ -156,7 +156,7 @@ void MemorySettingsInterface::SetStringValue(const char* section, const char* ke
std::vector<std::pair<std::string, std::string>> MemorySettingsInterface::GetKeyValueList(const char* section) const
{
std::vector<std::pair<std::string, std::string>> output;
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit != m_sections.end())
{
for (const auto& it : sit->second)
@ -168,7 +168,7 @@ std::vector<std::pair<std::string, std::string>> MemorySettingsInterface::GetKey
void MemorySettingsInterface::SetKeyValueList(const char* section,
const std::vector<std::pair<std::string, std::string>>& items)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
sit->second.clear();
for (const auto& [key, value] : items)
sit->second.emplace(key, value);
@ -176,11 +176,11 @@ void MemorySettingsInterface::SetKeyValueList(const char* section,
void MemorySettingsInterface::SetValue(const char* section, const char* key, std::string value)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit == m_sections.end())
sit = m_sections.emplace(std::make_pair(std::string(section), KeyMap())).first;
const auto range = UnorderedStringMultiMapEqualRange(sit->second, key);
const auto range = sit->second.equal_range(key);
if (range.first == sit->second.end())
{
sit->second.emplace(std::string(key), std::move(value));
@ -203,10 +203,10 @@ std::vector<std::string> MemorySettingsInterface::GetStringList(const char* sect
{
std::vector<std::string> ret;
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit != m_sections.end())
{
const auto range = UnorderedStringMultiMapEqualRange(sit->second, key);
const auto range = sit->second.equal_range(key);
for (auto iter = range.first; iter != range.second; ++iter)
ret.emplace_back(iter->second);
}
@ -216,11 +216,11 @@ std::vector<std::string> MemorySettingsInterface::GetStringList(const char* sect
void MemorySettingsInterface::SetStringList(const char* section, const char* key, const std::vector<std::string>& items)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit == m_sections.end())
sit = m_sections.emplace(std::make_pair(std::string(section), KeyMap())).first;
const auto range = UnorderedStringMultiMapEqualRange(sit->second, key);
const auto range = sit->second.equal_range(key);
for (auto iter = range.first; iter != range.second;)
sit->second.erase(iter++);
@ -231,11 +231,11 @@ void MemorySettingsInterface::SetStringList(const char* section, const char* key
bool MemorySettingsInterface::RemoveFromStringList(const char* section, const char* key, const char* item)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit == m_sections.end())
sit = m_sections.emplace(std::make_pair(std::string(section), KeyMap())).first;
const auto range = UnorderedStringMultiMapEqualRange(sit->second, key);
const auto range = sit->second.equal_range(key);
bool result = false;
for (auto iter = range.first; iter != range.second;)
{
@ -255,11 +255,11 @@ bool MemorySettingsInterface::RemoveFromStringList(const char* section, const ch
bool MemorySettingsInterface::AddToStringList(const char* section, const char* key, const char* item)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit == m_sections.end())
sit = m_sections.emplace(std::make_pair(std::string(section), KeyMap())).first;
const auto range = UnorderedStringMultiMapEqualRange(sit->second, key);
const auto range = sit->second.equal_range(key);
for (auto iter = range.first; iter != range.second; ++iter)
{
if (iter->second == item)
@ -272,7 +272,7 @@ bool MemorySettingsInterface::AddToStringList(const char* section, const char* k
bool MemorySettingsInterface::ContainsValue(const char* section, const char* key) const
{
const auto sit = UnorderedStringMapFind(m_sections, section);
const auto sit = m_sections.find(section);
if (sit == m_sections.end())
return false;
@ -281,18 +281,18 @@ bool MemorySettingsInterface::ContainsValue(const char* section, const char* key
void MemorySettingsInterface::DeleteValue(const char* section, const char* key)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit == m_sections.end())
return;
const auto range = UnorderedStringMultiMapEqualRange(sit->second, key);
const auto range = sit->second.equal_range(key);
for (auto iter = range.first; iter != range.second;)
sit->second.erase(iter++);
}
void MemorySettingsInterface::ClearSection(const char* section)
{
auto sit = UnorderedStringMapFind(m_sections, section);
auto sit = m_sections.find(section);
if (sit == m_sections.end())
return;