Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit4e078ecef77dd202c19738f7587e4b7208f2996c (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 14:38:47 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 14:38:47 +0300
Files7674cb6263a5e339715ec3a229774dfbd311da94 /src
FMI-OOP-P1_TicketSystem-4e078ecef77dd202c19738f7587e4b7208f2996c.tar
FMI-OOP-P1_TicketSystem-4e078ecef77dd202c19738f7587e4b7208f2996c.tar.gz
FMI-OOP-P1_TicketSystem-4e078ecef77dd202c19738f7587e4b7208f2996c.zip
Parentdaf48c1659094a750cc37f7517ce827d483ecba2 (diff)
Autocommit at 05.05.2022 @ 14:38
6 files changed, 15 insertions, 2 deletions
-rw-r--r--src/EventSystem/Event.cpp5
-rw-r--r--src/EventSystem/Event.h2
-rw-r--r--src/EventSystem/EventSystem.cpp3
-rw-r--r--src/Venue/Venue.cpp4
-rw-r--r--src/Venue/Venue.h1
-rw-r--r--src/main.cpp2
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);
}