diff options
Autocommit at 07.05.2022 @ 16:23
3 files changed, 13 insertions, 2 deletions
| -rw-r--r-- | src/Generic/List/List.hpp | 2 | ||||
| -rw-r--r-- | src/Models/Event.cpp | 5 | ||||
| -rw-r--r-- | src/Models/Event.h | 8 |
diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp index 5bbda8a..cb49da4 100644 --- a/src/Generic/List/List.hpp +++ b/src/Generic/List/List.hpp @@ -242,8 +242,6 @@ std::istream& operator>>(std::istream& istr, List<T>& obj) { template <typename T> std::ostream& operator<<(std::ostream& ostr, const List<T>& obj) { - ostr << obj.length << obj.count; - for (int i = 0; i < obj.count; i++) ostr << obj.elements[i]; diff --git a/src/Models/Event.cpp b/src/Models/Event.cpp index 4328e3b..51fb16c 100644 --- a/src/Models/Event.cpp +++ b/src/Models/Event.cpp @@ -34,3 +34,8 @@ int Event::compare(const Event& other) { return date.compare(other.date); return hall->compare(*other.hall); } + +std::istream& operator>>(std::istream& istr, Event& event) { + return istr >> event.hall >> event.name >> event.date >> event.tickets >> event.reservations; +} +std::ostream& operator<<(std::ostream& ostr, Event& event); diff --git a/src/Models/Event.h b/src/Models/Event.h index c69f1b8..92b5622 100644 --- a/src/Models/Event.h +++ b/src/Models/Event.h @@ -7,6 +7,8 @@ #include "Hall.h" #include "Ticket.h" #include "Reservation.h" +#include <istream> +#include <ostream> class Event { const Hall* hall; @@ -25,7 +27,13 @@ public: OrderedList<Ticket>& get_tickets(); OrderedList<Reservation>& get_reservations(); + void print(std::ostream& ostr); + void write(std::istream& istr); + int compare(const Event& other); + + friend std::istream& operator>>(std::istream& istr, Event& event); + friend std::ostream& operator<<(std::ostream& ostr, Event& event); }; #endif |
