Added ZString constructor for assignment on definition.

This commit is contained in:
Brad Arant committed 2024-02-16 14:38:04 -08:00
1 parent ce71aefaac
commit 37b9a5e316
6 files changed
+10

No files matched your search

+6
View File
@@ -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);
+2
View File
@@ -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.
+2
View File
@@ -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.