From d45aaab69793fb0e5725b40ad1bba99d738ccdb5 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 8 May 2022 09:53:24 +0300 Subject: Autocommit at 08.05.2022 @ 09:53 --- src/Generic/Date/Date.h | 3 +++ src/Generic/String/String.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) (limited to 'src/Generic') diff --git a/src/Generic/Date/Date.h b/src/Generic/Date/Date.h index a7c0ecb..a960678 100644 --- a/src/Generic/Date/Date.h +++ b/src/Generic/Date/Date.h @@ -3,6 +3,7 @@ #include #include +#include "../String/String.h" class Date { unsigned short day; @@ -24,6 +25,8 @@ public: unsigned short get_year() const; bool set_year(unsigned short year); + String createCStr(); + void read(std::istream& istr); void write(std::ostream& ostr); int compare(const Date& other) const; diff --git a/src/Generic/String/String.cpp b/src/Generic/String/String.cpp index 4de5a29..bacd72c 100644 --- a/src/Generic/String/String.cpp +++ b/src/Generic/String/String.cpp @@ -36,6 +36,15 @@ unsigned String::get_length() const { } String& String::operator+=(const char* str) { + unsigned strLen = strlen(str); + char* newStr = new char[length + strLen + 1]; + strncpy(newStr, this->str, length + 1); + strncat(newStr, str, strLen + 1); + + delete[] this->str; + this->str = newStr; + length += strLen; + return *this; } -- cgit v1.3.1-26-gb76a