diff options
Autocommit at 02.05.2022 @ 20:05
4 files changed, 26 insertions, 0 deletions
| -rw-r--r-- | src/EventSystem/Reservation.cpp | 8 | ||||
| -rw-r--r-- | src/EventSystem/Reservation.h | 1 | ||||
| -rw-r--r-- | src/EventSystem/Ticket.cpp | 16 | ||||
| -rw-r--r-- | src/EventSystem/Ticket.h | 1 |
diff --git a/src/EventSystem/Reservation.cpp b/src/EventSystem/Reservation.cpp index fd8910e..927b11a 100644 --- a/src/EventSystem/Reservation.cpp +++ b/src/EventSystem/Reservation.cpp @@ -1,8 +1,16 @@ #include "Reservation.h" #include <cstring> +Reservation::Reservation() : Reservation(Ticket(), "", "") {} + Reservation::Reservation(const Ticket& ticket, const char* password, const char* note) { this->ticket = ticket; strcpy(this->password, password); strcpy(this->note, note); } + +void Reservation::read(std::istream& istr) { + ticket.read(istr); + istr.read(password, sizeof(char) * 8); + istr.read(note, sizeof(char) * 32); +} diff --git a/src/EventSystem/Reservation.h b/src/EventSystem/Reservation.h index aead7a8..7e96412 100644 --- a/src/EventSystem/Reservation.h +++ b/src/EventSystem/Reservation.h @@ -11,6 +11,7 @@ class Reservation { char note[32]; public: + Reservation(); Reservation(const Ticket& ticket, const char* password, const char* note); void read(std::istream& istr); diff --git a/src/EventSystem/Ticket.cpp b/src/EventSystem/Ticket.cpp new file mode 100644 index 0000000..b616888 --- /dev/null +++ b/src/EventSystem/Ticket.cpp @@ -0,0 +1,16 @@ +#include "Ticket.h" + +Ticket::Ticket() : Ticket(0, 0) {} + +Ticket::Ticket(unsigned row, unsigned seat) { + this->row = row; + this->seat = seat; +} + +unsigned Ticket::get_row() const { + return row; +} + +unsigned Ticket::get_seat() const { + return seat; +} diff --git a/src/EventSystem/Ticket.h b/src/EventSystem/Ticket.h index 15cbc8d..159c6fa 100644 --- a/src/EventSystem/Ticket.h +++ b/src/EventSystem/Ticket.h @@ -6,6 +6,7 @@ class Ticket { unsigned seat; public: + Ticket(); Ticket(unsigned row, unsigned seat); unsigned get_row() const; |
