fix: normalize MITC4 reference identities
This commit is contained in:
@@ -120,13 +120,25 @@ double parseFiniteDouble(const std::string& field) {
|
||||
return value;
|
||||
}
|
||||
|
||||
std::string uppercaseAscii(std::string value) {
|
||||
std::transform(
|
||||
value.begin(), value.end(), value.begin(), [](const char character) {
|
||||
return character >= 'a' && character <= 'z'
|
||||
? static_cast<char>(character - 'a' + 'A')
|
||||
: character;
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
struct IdentityKey {
|
||||
std::string instanceName;
|
||||
std::int64_t sourceNodeLabel;
|
||||
|
||||
bool operator<(const IdentityKey& other) const noexcept {
|
||||
if (instanceName != other.instanceName) {
|
||||
return instanceName < other.instanceName;
|
||||
bool operator<(const IdentityKey& other) const {
|
||||
const std::string normalizedInstance = uppercaseAscii(instanceName);
|
||||
const std::string normalizedOther = uppercaseAscii(other.instanceName);
|
||||
if (normalizedInstance != normalizedOther) {
|
||||
return normalizedInstance < normalizedOther;
|
||||
}
|
||||
return sourceNodeLabel < other.sourceNodeLabel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user