From ec7b84c5f2f68ce8aae35c2dc12854117414f72b Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 30 Oct 2017 16:22:37 +0000 Subject: Config: Extract ConfigInfo into own header --- Source/Core/Common/Config/ConfigInfo.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Source/Core/Common/Config/ConfigInfo.cpp (limited to 'Source/Core/Common/Config/ConfigInfo.cpp') diff --git a/Source/Core/Common/Config/ConfigInfo.cpp b/Source/Core/Common/Config/ConfigInfo.cpp new file mode 100644 index 0000000000..cc34a2d9f0 --- /dev/null +++ b/Source/Core/Common/Config/ConfigInfo.cpp @@ -0,0 +1,25 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include + +#include "Common/Config/ConfigInfo.h" + +namespace Config +{ +bool ConfigLocation::operator==(const ConfigLocation& other) const +{ + return std::tie(system, section, key) == std::tie(other.system, other.section, other.key); +} + +bool ConfigLocation::operator!=(const ConfigLocation& other) const +{ + return !(*this == other); +} + +bool ConfigLocation::operator<(const ConfigLocation& other) const +{ + return std::tie(system, section, key) < std::tie(other.system, other.section, other.key); +} +} -- cgit v1.2.3 From e331a761762b23810df8c399c1f62d694fe48e4d Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 30 Oct 2017 17:09:05 +0000 Subject: ConfigInfo: Switch to doing case-insensitive comparison --- Source/Core/Common/Config/ConfigInfo.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Source/Core/Common/Config/ConfigInfo.cpp') diff --git a/Source/Core/Common/Config/ConfigInfo.cpp b/Source/Core/Common/Config/ConfigInfo.cpp index cc34a2d9f0..47d2e25c84 100644 --- a/Source/Core/Common/Config/ConfigInfo.cpp +++ b/Source/Core/Common/Config/ConfigInfo.cpp @@ -2,15 +2,17 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include +#include +#include "Common/CommonFuncs.h" #include "Common/Config/ConfigInfo.h" namespace Config { bool ConfigLocation::operator==(const ConfigLocation& other) const { - return std::tie(system, section, key) == std::tie(other.system, other.section, other.key); + return system == other.system && strcasecmp(section.c_str(), other.section.c_str()) == 0 && + strcasecmp(key.c_str(), other.key.c_str()) == 0; } bool ConfigLocation::operator!=(const ConfigLocation& other) const @@ -20,6 +22,14 @@ bool ConfigLocation::operator!=(const ConfigLocation& other) const bool ConfigLocation::operator<(const ConfigLocation& other) const { - return std::tie(system, section, key) < std::tie(other.system, other.section, other.key); + if (system != other.system) + return system < other.system; + + const int section_compare = strcasecmp(section.c_str(), other.section.c_str()); + if (section_compare != 0) + return section_compare < 0; + + const int key_compare = strcasecmp(key.c_str(), other.key.c_str()); + return key_compare < 0; } } -- cgit v1.2.3