Added ZString constructor for assignment on definition.
This commit is contained in:
parent
ce71aefaac
commit
37b9a5e316
@ -38,6 +38,12 @@ namespace coreutils {
|
||||
cursor = this->data;
|
||||
}
|
||||
|
||||
MString::MString(ZString zstring) {
|
||||
setSize(zstring.getLength());
|
||||
memcpy(data, zstring.getData(), zstring.getLength());
|
||||
cursor = data;
|
||||
}
|
||||
|
||||
MString::MString(const MString &mstring) {
|
||||
setSize(mstring.length);
|
||||
memcpy(data, mstring.data, mstring.length);
|
||||
|
@ -41,6 +41,8 @@ namespace coreutils
|
||||
|
||||
MString(const unsigned char *data, size_t length);
|
||||
|
||||
MString (ZString zstring);
|
||||
|
||||
///
|
||||
/// Consructor providing a copy of a ZString.
|
||||
///
|
||||
|
Binary file not shown.
Binary file not shown.
@ -27,6 +27,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
coreutils::ZString test7("zstring data");
|
||||
coreutils::MString test4;
|
||||
coreutils::MString test5 = test7;
|
||||
std::cout << "coreutils::MString test5 = test7: [" << test5 << "]" << std::endl;
|
||||
test4 << "this is a test." << test7;
|
||||
std::cout << "char* operator<<: [" << test4 << "]." << std::endl;
|
||||
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user