MString updates.

This commit is contained in:
Brad Arant committed 2022-07-28 08:06:33 -07:00
1 parent d2f13c192c
commit 036978130d
7 files changed
+80 -45

No files matched your search

+11 -6
View File
@@ -6,8 +6,8 @@
namespace coreutils {
std::ostream &operator<<(std::ostream &os, const ZString &zstring) {
for (char *ix = zstring.data; ix < (zstring.data + zstring.length); ++ix)
os << *ix;
for (char *ix = zstring.data; ix < (zstring.data + zstring.length); ++ix)
os << *ix;
return os;
}
@@ -21,6 +21,11 @@ namespace coreutils {
return os;
}
std::ostream &operator+(std::ostream &os, const char *value) {
os << value;
return os;
}
ZString::ZString() {
data = NULL;
length = 0;
@@ -49,16 +54,16 @@ namespace coreutils {
ZString::~ZString() {
if(cdata)
free(cdata);
}
}
bool ZString::operator<(const ZString &valuex) const {
return (strncmp(cursor, valuex.cursor, (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);
}