Added >= and <= operators to ZString.
This commit is contained in:
1 parent
439c0c9b32
commit
9d62a09140
2 files changed
+12
-2
No files matched your search
+10
@@ -80,6 +80,16 @@ namespace coreutils {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: Fix the following comparison operators to handle the length problem appropriately.
|
||||
|
||||
bool ZString::operator<=(const ZString &valuex) const {
|
||||
return (strncmp(data, valuex.data, valuex.length <= length ? valuex.length : length) <= 0);
|
||||
}
|
||||
|
||||
bool ZString::operator>=(const ZString &valuex) const {
|
||||
return (strncmp(data, valuex.data, valuex.length <= length ? valuex.length : length) >= 0);
|
||||
}
|
||||
|
||||
bool ZString::operator>(const ZString &valuex) const {
|
||||
return (strncmp(data, valuex.data, valuex.length <= length ? valuex.length : length) > 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user