From b0f046461b44a0c4002ea667a726403ff4a1a701 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 4 May 2022 10:58:48 +0300 Subject: Moved templated stuff into hpp files and added a blank main.cpp file --- src/EventSystem/Event.cpp | 2 +- src/EventSystem/Event.h | 2 +- src/EventSystem/EventSystem.h | 2 +- src/EventSystem/Reservation.cpp | 8 ++++++++ src/EventSystem/Reservation.h | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/EventSystem') 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); -- cgit v1.3.1-26-gb76a