Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / Date / Date.cpp
diff options
context:
space:
mode:
Commit9d90246b0e6e6cb7c98f47b87d2629509f106263 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 17:08:58 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 17:08:58 +0300
Files0aefd5f9f1e084d890684fe817c06e34d60867d8 /src/Generic/Date/Date.cpp
FMI-OOP-P1_TicketSystem-9d90246b0e6e6cb7c98f47b87d2629509f106263.tar
FMI-OOP-P1_TicketSystem-9d90246b0e6e6cb7c98f47b87d2629509f106263.tar.gz
FMI-OOP-P1_TicketSystem-9d90246b0e6e6cb7c98f47b87d2629509f106263.zip
Parent7dfef1b508256e3b629d40ea463b293792a0620e (diff)
Autocommit at 07.05.2022 @ 17:08
1 files changed, 19 insertions, 6 deletions
-rw-r--r--src/Generic/Date/Date.cpp25
diff --git a/src/Generic/Date/Date.cpp b/src/Generic/Date/Date.cpp
index 3df7947..b9f24d3 100644
--- a/src/Generic/Date/Date.cpp
+++ b/src/Generic/Date/Date.cpp
@@ -25,12 +25,6 @@ Date::Date(unsigned short day, unsigned short month, unsigned short year) {
this->year = year;
}
-int Date::compare(const Date& other) const {
- if (year < other.year || month < other.month || day < other.day)
- return -1;
- return year > other.year || month > other.month || day > other.day;
-}
-
unsigned short Date::get_day() const {
return day;
}
@@ -60,6 +54,25 @@ bool Date::set_year(unsigned short newYear) {
return true;
}
+void Date::read(std::istream& istr) {
+ istr.read((char*)&day, sizeof(day));
+ istr.read((char*)&month, sizeof(month));
+ istr.read((char*)&year, sizeof(year));
+}
+
+void Date::write(std::ostream& ostr) {
+ ostr.write((char*)&day, sizeof(day));
+ ostr.write((char*)&month, sizeof(month));
+ ostr.write((char*)&year, sizeof(year));
+}
+
+int Date::compare(const Date& other) const {
+ if (year < other.year || month < other.month || day < other.day)
+ return -1;
+ return year > other.year || month > other.month || day > other.day;
+}
+
+
/* Outside of class */
std::istream& operator>>(std::istream& istr, Date& dt) {