Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit492fc44e1667a2a5d7afd67bab4a14b75a12cb0a (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-01 09:15:51 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-01 09:15:51 +0300
Filesa5bbba0ede7621e0801f6192083ab7f7f9b089fd /src
FMI-OOP-P1_TicketSystem-492fc44e1667a2a5d7afd67bab4a14b75a12cb0a.tar
FMI-OOP-P1_TicketSystem-492fc44e1667a2a5d7afd67bab4a14b75a12cb0a.tar.gz
FMI-OOP-P1_TicketSystem-492fc44e1667a2a5d7afd67bab4a14b75a12cb0a.zip
Parent2d83acdd639e4a404360a65b7af08e286645066c (diff)
Autocommit at 01.05.2022 @ 09:15
2 files changed, 17 insertions, 0 deletions
-rw-r--r--src/DateTime/DateTime.cpp11
-rw-r--r--src/DateTime/DateTime.h6
diff --git a/src/DateTime/DateTime.cpp b/src/DateTime/DateTime.cpp
index 56ddba1..96e20b3 100644
--- a/src/DateTime/DateTime.cpp
+++ b/src/DateTime/DateTime.cpp
@@ -79,3 +79,14 @@ bool DateTime::set_year(unsigned short newYear) {
year = newYear;
return true;
}
+
+/* Outside of class */
+
+std::istream& operator>>(std::istream& istr, DateTime& dt) {
+ unsigned short h, m, d, M, y;
+ istr >> h >> m >> d >> M >> y;
+ dt = DateTime(h, m, d, M, y);
+ return istr;
+}
+
+std::ostream& operator<<(std::ostream& ostr, const DateTime& dt);
diff --git a/src/DateTime/DateTime.h b/src/DateTime/DateTime.h
index 7faa69c..cab5008 100644
--- a/src/DateTime/DateTime.h
+++ b/src/DateTime/DateTime.h
@@ -1,6 +1,9 @@
#ifndef HEADER_DATETIME
#define HEADER_DATETIME
+#include <istream>
+#include <ostream>
+
class DateTime {
unsigned short hour;
unsigned short minute;
@@ -31,4 +34,7 @@ public:
bool set_year(unsigned short newYear);
};
+std::istream& operator>>(std::istream& istr, DateTime& dt);
+std::ostream& operator<<(std::ostream& ostr, const DateTime& dt);
+
#endif