This commit is contained in:
Matt Arant committed 2023-10-07 02:31:33 +00:00
commit badfc4c709
12 files changed
+166 -45

No files matched your search

+14 -20
View File
@@ -29,6 +29,13 @@ namespace coreutils
cursor = this->data;
}
MString::MString(unsigned char *data, size_t length)
{
setSize(length);
memcpy(this->data, data, length);
cursor = this->data;
}
MString::MString(const char *data, size_t length)
{
setSize(length);
@@ -65,34 +72,21 @@ namespace coreutils
cursor = this->data;
}
MString::MString(std::FILE *file)
{
setSize(1000000);
this->length = fread(this->data, 1000000, 1000000, file);
cursor = this->data;
}
MString::~MString()
{
if (data)
free(data);
}
// 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::ZString &value)
{
// if(*this == value)
// return *this;
setSize(value.getLength());
memcpy(data, value.getData(), value.getLength());
length = value.getLength();