Website Summary Files Commits Branches @commit @diff @stats
path: root / src / EventSystem
diff options
context:
space:
mode:
Commitb0f046461b44a0c4002ea667a726403ff4a1a701 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-04 10:58:48 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-04 10:58:48 +0300
Filesd5a340a133f2f18394445446b218e56765ecb4a5 /src/EventSystem
FMI-OOP-P1_TicketSystem-b0f046461b44a0c4002ea667a726403ff4a1a701.tar
FMI-OOP-P1_TicketSystem-b0f046461b44a0c4002ea667a726403ff4a1a701.tar.gz
FMI-OOP-P1_TicketSystem-b0f046461b44a0c4002ea667a726403ff4a1a701.zip
Parentbff99a11272743fb1caa4b7d345ebb3b0f8a5609 (diff)
Moved templated stuff into hpp files and added a blank main.cpp file
5 files changed, 12 insertions, 4 deletions
-rw-r--r--src/EventSystem/Event.cpp2
-rw-r--r--src/EventSystem/Event.h2
-rw-r--r--src/EventSystem/EventSystem.h2
-rw-r--r--src/EventSystem/Reservation.cpp8
-rw-r--r--src/EventSystem/Reservation.h2
diff --git a/src/EventSystem/Event.cpp b/src/EventSystem/Event.cpp
index 1452057..450eca9 100644
--- a/src/EventSystem/Event.cpp
+++ b/src/EventSystem/Event.cpp
@@ -39,7 +39,7 @@ StatusCode Event::buyTicketFromReservation(const Reservation& reservation, const
unsigned resInd = reservations.findIndex(reservation);
if (resInd == reservations.get_count()) return E_ReservationDoesNotExist;
- if (!reservation.checkPassword(password)) return E_WrongReservationPassword;
+ if (!reservation.validPassword(password)) return E_WrongReservationPassword;
reservations.removeAt(resInd);
tickets.insert(reservation.get_ticket());
diff --git a/src/EventSystem/Event.h b/src/EventSystem/Event.h
index ad3ae89..5b26458 100644
--- a/src/EventSystem/Event.h
+++ b/src/EventSystem/Event.h
@@ -1,7 +1,7 @@
#ifndef HEADER_EVENTSYSTEM_EVENT
#define HEADER_EVENTSYSTEM_EVENT
-#include "../List/OrderedList.h"
+#include "../List/OrderedList.hpp"
#include "../DateTime/DateTime.h"
#include "../String/String.h"
#include "../Venue/Hall.h"
diff --git a/src/EventSystem/EventSystem.h b/src/EventSystem/EventSystem.h
index 5c83fd8..79fac10 100644
--- a/src/EventSystem/EventSystem.h
+++ b/src/EventSystem/EventSystem.h
@@ -1,7 +1,7 @@
#ifndef HEADER_EVENTSYSTEM
#define HEADER_EVENTSYSTEM
-#include "../List/OrderedList.h"
+#include "../List/OrderedList.hpp"
#include "../DateTime/DateTime.h"
#include "Event.h"
diff --git a/src/EventSystem/Reservation.cpp b/src/EventSystem/Reservation.cpp
index 4cc716e..26278b2 100644
--- a/src/EventSystem/Reservation.cpp
+++ b/src/EventSystem/Reservation.cpp
@@ -12,6 +12,14 @@ Reservation::Reservation(const Ticket& ticket, const char* password, const char*
strcpy(this->note, note);
}
+bool Reservation::validPassword(const char* password) const {
+ return !strcmp(this->password, password);
+}
+
+const Ticket& Reservation::get_ticket() const {
+ return ticket;
+}
+
void Reservation::read(std::istream& istr) {
ticket.read(istr);
istr.read(password, sizeof(password));
diff --git a/src/EventSystem/Reservation.h b/src/EventSystem/Reservation.h
index a73e719..ff56db6 100644
--- a/src/EventSystem/Reservation.h
+++ b/src/EventSystem/Reservation.h
@@ -15,7 +15,7 @@ public:
Reservation(const Ticket& ticket);
Reservation(const Ticket& ticket, const char* password, const char* note);
- bool checkPassword(const char* password) const;
+ bool validPassword(const char* password) const;
const Ticket& get_ticket() const;
void read(std::istream& istr);