Continues ZString and MString adjustments.
This commit is contained in:
parent
f8bc2df133
commit
963a0561e8
43
MString.cpp
43
MString.cpp
@ -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);
|
||||
|
12
MString.h
12
MString.h
@ -44,6 +44,8 @@ namespace coreutils {
|
||||
|
||||
MString(ZString &zstring);
|
||||
|
||||
MString(ZString zstring);
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
@ -62,13 +64,15 @@ namespace coreutils {
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
MString& operator=(coreutils::ZString& data);
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
MString& operator=(coreutils::MString& data);
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
MString& operator=(coreutils::ZString data);
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
@ -90,7 +94,9 @@ namespace coreutils {
|
||||
|
||||
MString& operator<<(const int value);
|
||||
|
||||
MString& operator<<(coreutils::ZString &zstring);
|
||||
// MString& operator<<(coreutils::ZString &zstring);
|
||||
|
||||
MString& operator<<(coreutils::ZString zstring);
|
||||
|
||||
MString& operator<<(std::string value);
|
||||
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user