Continues ZString and MString adjustments.

This commit is contained in:
Brad Arant committed 2022-07-30 18:04:27 -07:00
1 parent f8bc2df133
commit 963a0561e8
4 files changed
+43 -14

No files matched your search

+33 -10
View File
@@ -42,6 +42,12 @@ namespace coreutils {
cursor = data;
}
MString::MString(ZString zstring) {
setSize(zstring.getLength());
memcpy(data, zstring.getData(), zstring.getLength());
cursor = data;
}
MString::MString(std::string data) {
setSize(data.length());
memcpy(this->data, (char *)data.c_str(), data.length());
@@ -58,16 +64,25 @@ namespace coreutils {
return 0;
}
MString& MString::operator=(coreutils::ZString& value) {
if(*this == value)
return *this;
int len = length;
setSize(length + value.getLength());
memcpy(data + len, value.getData(), value.getLength());
return *this;
}
// MString& MString::operator=(coreutils::ZString& value) {
// if(*this == value)
// return *this;
// int len = length;
// setSize(length + value.getLength());
// memcpy(data + len, value.getData(), value.getLength());
// return *this;
// }
MString& MString::operator=(coreutils::MString& value) {
// MString& MString::operator=(coreutils::ZString& value) {
// if(*this == value)
// return *this;
// int len = length;
// setSize(length + value.getLength());
// memcpy(data + len, value.getData(), value.getLength());
// return *this;
// }
MString& MString::operator=(coreutils::ZString value) {
if(*this == value)
return *this;
int len = length;
@@ -105,7 +120,15 @@ namespace coreutils {
return *this;
}
MString& MString::operator<<(coreutils::ZString &zstring) {
// MString& MString::operator<<(coreutils::ZString &zstring) {
// int temp = length;
// int len = length + zstring.getLength();
// setSize(len);
// memcpy(data + temp, zstring.getData(), zstring.getLength());
// return *this;
// }
MString& MString::operator<<(coreutils::ZString zstring) {
int temp = length;
int len = length + zstring.getLength();
setSize(len);