Website Summary Files Commits Branches @commit @diff @stats
path: root / src / EventSystem
diff options
context:
space:
mode:
Commit46a8208cb0acb836613d531766b61e94ec9517d7 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-02 20:05:04 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-02 20:05:04 +0300
Filesa4a68a145c4d172310e599bc932cd0b114e8f8d9 /src/EventSystem
FMI-OOP-P1_TicketSystem-46a8208cb0acb836613d531766b61e94ec9517d7.tar
FMI-OOP-P1_TicketSystem-46a8208cb0acb836613d531766b61e94ec9517d7.tar.gz
FMI-OOP-P1_TicketSystem-46a8208cb0acb836613d531766b61e94ec9517d7.zip
Parent0be711d04b44facbdbbf6a67bcf2a8decc80b4e2 (diff)
Autocommit at 02.05.2022 @ 20:05
4 files changed, 26 insertions, 0 deletions
-rw-r--r--src/EventSystem/Reservation.cpp8
-rw-r--r--src/EventSystem/Reservation.h1
-rw-r--r--src/EventSystem/Ticket.cpp16
-rw-r--r--src/EventSystem/Ticket.h1
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;