Added >= and <= operators to ZString.
This commit is contained in:
parent
439c0c9b32
commit
9d62a09140
10
ZString.cpp
10
ZString.cpp
@ -80,6 +80,16 @@ namespace coreutils {
|
|||||||
return 0;
|
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 {
|
bool ZString::operator>(const ZString &valuex) const {
|
||||||
return (strncmp(data, valuex.data, valuex.length <= length ? valuex.length : length) > 0);
|
return (strncmp(data, valuex.data, valuex.length <= length ? valuex.length : length) > 0);
|
||||||
}
|
}
|
||||||
|
@ -112,9 +112,9 @@ namespace coreutils {
|
|||||||
///
|
///
|
||||||
|
|
||||||
bool operator>(const ZString &valuex) const;
|
bool operator>(const ZString &valuex) const;
|
||||||
|
bool operator<=(const ZString &valuex) const;
|
||||||
|
bool operator>=(const ZString &valuex) const;
|
||||||
bool operator==(const ZString &valuex);
|
bool operator==(const ZString &valuex);
|
||||||
// bool operator==(std::string value);
|
|
||||||
// bool operator==(const char *valuex) const;
|
|
||||||
bool operator!=(const ZString &valuex) const;
|
bool operator!=(const ZString &valuex) const;
|
||||||
bool operator!=(const char *valuex) const;
|
bool operator!=(const char *valuex) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user