Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Event.cpp
diff options
context:
space:
mode:
Commit79c5f56ece8f43a72e89c44e24a2d8eae6f1e8f8 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:28:43 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:28:43 +0300
Filese9288460b3fbc06bb8cc7327f7c2ba4165c8897f /src/Models/Event.cpp
FMI-OOP-P1_TicketSystem-79c5f56ece8f43a72e89c44e24a2d8eae6f1e8f8.tar
FMI-OOP-P1_TicketSystem-79c5f56ece8f43a72e89c44e24a2d8eae6f1e8f8.tar.gz
FMI-OOP-P1_TicketSystem-79c5f56ece8f43a72e89c44e24a2d8eae6f1e8f8.zip
Parentbb4433952047a63906e1e61cdf3f2336e7b517d3 (diff)
Autocommit at 07.05.2022 @ 16:28
1 files changed, 17 insertions, 1 deletions
-rw-r--r--src/Models/Event.cpp18
diff --git a/src/Models/Event.cpp b/src/Models/Event.cpp
index 51fb16c..d86b907 100644
--- a/src/Models/Event.cpp
+++ b/src/Models/Event.cpp
@@ -29,6 +29,12 @@ const Date& Event::get_date() const {
return date;
}
+void Event::print(std::ostream& ostr) {
+ ostr.write(hall, sizeof(hall));
+}
+
+void Event::write(std::istream& istr);
+
int Event::compare(const Event& other) {
if (hall == other.hall)
return date.compare(other.date);
@@ -38,4 +44,14 @@ int Event::compare(const Event& other) {
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);
+std::ostream& operator<<(std::ostream& ostr, const Event& event) {
+ ostr << "Hall: " << event.hall << " Name: " << event.name << " Date: " << event.date << std::endl;
+
+ ostr << "Bought tickets: ";
+ for (unsigned i = 0; i < event.tickets.get_count(); i++)
+ ostr << event.tickets[i] << " ";
+ ostr << std::endl << "Reserved tickets: ";
+ for (unsigned i = 0; i < event.reservations.get_count(); i++)
+ ostr << event.reservations[i] << " ";
+ return ostr << std::endl;
+}