Added assignment to MString from ZString operator=.
This commit is contained in:
parent
61d9f8015e
commit
7b333a3984
@ -80,6 +80,13 @@ namespace coreutils {
|
||||
length = value.getLength();
|
||||
return *this;
|
||||
}
|
||||
|
||||
MString &MString::operator=(coreutils::ZString value) {
|
||||
setSize(value.getLength());
|
||||
memcpy(data, value.getData(), value.getLength());
|
||||
length = value.getLength();
|
||||
return *this;
|
||||
}
|
||||
|
||||
MString &MString::operator=(const char *value) {
|
||||
int len = strlen(value);
|
||||
|
@ -94,11 +94,10 @@ namespace coreutils
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
||||
// MString& operator=(coreutils::ZString& data);
|
||||
|
||||
|
||||
MString &operator=(coreutils::MString data);
|
||||
|
||||
MString &operator=(coreutils::ZString data);
|
||||
|
||||
///
|
||||
/// Assignment operator will copy data to backing store.
|
||||
///
|
||||
|
Binary file not shown.
Binary file not shown.
@ -57,7 +57,15 @@ int main(int argc, char **argv) {
|
||||
std::cout << ">" << test10 << "<" << std::endl;
|
||||
test10 = "";
|
||||
std::cout << ">" << test10 << "<" << std::endl;
|
||||
|
||||
|
||||
// Assign from ZString tests.
|
||||
|
||||
coreutils::ZString test20("This is a zstring");
|
||||
coreutils::MString test21;
|
||||
test21 = test20;
|
||||
std::cout << "mstring = zstring: [" << test21 << "]" << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user