Improve logic for detecting and tracking extensions

This commit is contained in:
Bastiaan Olij
2022-11-19 00:17:37 +11:00
parent fa270c2456
commit a479f5af22
6 changed files with 375 additions and 312 deletions

View File

@ -161,6 +161,18 @@ bool CharString::operator<(const CharString &p_right) const {
return is_str_less(get_data(), p_right.get_data());
}
bool CharString::operator==(const CharString &p_right) const {
if (length() == 0) {
// True if both have length 0, false if only p_right has a length
return p_right.length() == 0;
} else if (p_right.length() == 0) {
// False due to unequal length
return false;
}
return strcmp(ptr(), p_right.ptr()) == 0;
}
CharString &CharString::operator+=(char p_char) {
const int lhs_len = length();
resize(lhs_len + 2);