From e9284e319a1b73ba9afe49f5c5b8cae9605d674c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 8 May 2022 09:33:17 +0300 Subject: Autocommit at 08.05.2022 @ 09:33 --- src/Generic/Date/Date.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Generic/Date/Date.cpp') diff --git a/src/Generic/Date/Date.cpp b/src/Generic/Date/Date.cpp index b9f24d3..4961698 100644 --- a/src/Generic/Date/Date.cpp +++ b/src/Generic/Date/Date.cpp @@ -19,6 +19,17 @@ unsigned short Date::daysInMonth() { Date::Date() : Date(01, 05, 2022) {} +Date::Date(const char* str) : Date(0, 0, 0) { + for (unsigned i = 0; i < MAX_LINE_WIDTH && y == 0; i++) { + if (dateStr[i] != ' ') { + if (d == 0) d = atoi(dateStr + i); + else if (m == 0) m = atoi(dateStr + i); + else y = atoi(dateStr + i); + i++; + } + } +} + Date::Date(unsigned short day, unsigned short month, unsigned short year) { this->day = day; this->month = month; -- cgit v1.3.1-26-gb76a