| 1 | // Copyright 2016 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "Common/Config/ConfigInfo.h" |
| 5 | |
| 6 | #include <cstring> |
| 7 | |
| 8 | #include "Common/CommonFuncs.h" |
| 9 | |
| 10 | namespace Config |
| 11 | { |
| 12 | bool Location::operator==(const Location& other) const |
| 13 | { |
| 14 | return system == other.system && strcasecmp(section.c_str(), other.section.c_str()) == 0 && |
| 15 | strcasecmp(key.c_str(), other.key.c_str()) == 0; |
| 16 | } |
| 17 | |
| 18 | bool Location::operator<(const Location& other) const |
| 19 | { |
| 20 | if (system != other.system) |
| 21 | return system < other.system; |
| 22 | |
| 23 | const int section_compare = strcasecmp(section.c_str(), other.section.c_str()); |
| 24 | if (section_compare != 0) |
| 25 | return section_compare < 0; |
| 26 | |
| 27 | const int key_compare = strcasecmp(key.c_str(), other.key.c_str()); |
| 28 | return key_compare < 0; |
| 29 | } |
| 30 | } // namespace Config |