diff options
Autocommit at 05.05.2022 @ 14:38
6 files changed, 15 insertions, 2 deletions
| -rw-r--r-- | src/EventSystem/Event.cpp | 5 | ||||
| -rw-r--r-- | src/EventSystem/Event.h | 2 | ||||
| -rw-r--r-- | src/EventSystem/EventSystem.cpp | 3 | ||||
| -rw-r--r-- | src/Venue/Venue.cpp | 4 | ||||
| -rw-r--r-- | src/Venue/Venue.h | 1 | ||||
| -rw-r--r-- | src/main.cpp | 2 |
diff --git a/src/EventSystem/Event.cpp b/src/EventSystem/Event.cpp index 450eca9..7bd0428 100644 --- a/src/EventSystem/Event.cpp +++ b/src/EventSystem/Event.cpp @@ -45,3 +45,8 @@ StatusCode Event::buyTicketFromReservation(const Reservation& reservation, const tickets.insert(reservation.get_ticket()); return Success; } + +int Event::compare(const Event& other) { + // TODO: improve + return name.compare(other.name); +} diff --git a/src/EventSystem/Event.h b/src/EventSystem/Event.h index 5b26458..48cc137 100644 --- a/src/EventSystem/Event.h +++ b/src/EventSystem/Event.h @@ -27,6 +27,8 @@ public: StatusCode buyTicket(const Ticket& ticket); StatusCode buyTicketFromReservation(const Reservation& reservation, const char* password); + + int compare(const Event& other); }; #endif diff --git a/src/EventSystem/EventSystem.cpp b/src/EventSystem/EventSystem.cpp index ee416b0..1585966 100644 --- a/src/EventSystem/EventSystem.cpp +++ b/src/EventSystem/EventSystem.cpp @@ -20,5 +20,6 @@ EventSystem::EventSystem(const Event* events, unsigned eventCount) { } StatusCode EventSystem::createEvent(const Hall* hall, String name, DateTime time) { - + events.insert(Event(hall, name, time)); + return Success; } diff --git a/src/Venue/Venue.cpp b/src/Venue/Venue.cpp index dd29463..3185d7b 100644 --- a/src/Venue/Venue.cpp +++ b/src/Venue/Venue.cpp @@ -2,6 +2,10 @@ Venue::Venue() : halls(), es() {} +Venue::Venue(const Hall* halls, unsigned hallCount) : es() { + this->halls = List<Hall>(halls, hallCount); +} + Venue::Venue(const Hall* halls, unsigned hallCount, const EventSystem& es) { this->halls = List<Hall>(halls, hallCount); this->es = es; diff --git a/src/Venue/Venue.h b/src/Venue/Venue.h index b23ebb5..2f39bbc 100644 --- a/src/Venue/Venue.h +++ b/src/Venue/Venue.h @@ -11,6 +11,7 @@ class Venue { public: Venue(); + Venue(const Hall* halls, unsigned hallCount); Venue(const Hall* halls, unsigned hallCount, const EventSystem& es); bool hallExists(unsigned hallIndex) const; diff --git a/src/main.cpp b/src/main.cpp index 0a44cad..8575d3b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,6 @@ int main() { Hall myVenueHalls[] = { Hall(1, 20, 30), Hall(2, 15, 15), Hall(3, 10, 20) }; - Venue myVenue(myVenueHalls, 3, EventSystem()); + Venue myVenue(myVenueHalls, 3); runUI(myVenue); } |
