StringLikeVariantOrder: Compare in-place

This commit is contained in:
rune-scape 2024-10-21 20:32:03 -07:00
parent fc827bbe25
commit 0c7d78f455
5 changed files with 60 additions and 28 deletions

View file

@ -97,7 +97,7 @@ bool Char16String::operator<(const Char16String &p_right) const {
return p_right.length() != 0;
}
return is_str_less(get_data(), p_right.get_data());
return str_compare(get_data(), p_right.get_data()) < 0;
}
Char16String &Char16String::operator+=(char16_t p_char) {
@ -155,7 +155,7 @@ bool CharString::operator<(const CharString &p_right) const {
return p_right.length() != 0;
}
return is_str_less(get_data(), p_right.get_data());
return str_compare(get_data(), p_right.get_data()) < 0;
}
bool CharString::operator==(const CharString &p_right) const {
@ -640,7 +640,7 @@ bool String::operator<(const char *p_str) const {
if (is_empty()) {
return true;
}
return is_str_less(get_data(), p_str);
return str_compare(get_data(), p_str) < 0;
}
bool String::operator<(const wchar_t *p_str) const {
@ -653,10 +653,10 @@ bool String::operator<(const wchar_t *p_str) const {
#ifdef WINDOWS_ENABLED
// wchar_t is 16-bit
return is_str_less(get_data(), String::utf16((const char16_t *)p_str).get_data());
return str_compare(get_data(), String::utf16((const char16_t *)p_str).get_data()) < 0;
#else
// wchar_t is 32-bit
return is_str_less(get_data(), (const char32_t *)p_str);
return str_compare(get_data(), (const char32_t *)p_str) < 0;
#endif
}
@ -668,7 +668,7 @@ bool String::operator<(const char32_t *p_str) const {
return true;
}
return is_str_less(get_data(), p_str);
return str_compare(get_data(), p_str) < 0;
}
bool String::operator<(const String &p_str) const {