diff options
Autocommit at 02.05.2022 @ 09:35
2 files changed, 12 insertions, 1 deletions
| -rw-r--r-- | src/EventSystem/Reservation.h | 7 | ||||
| -rw-r--r-- | src/List/List.cpp | 6 |
diff --git a/src/EventSystem/Reservation.h b/src/EventSystem/Reservation.h index a5a77a6..aead7a8 100644 --- a/src/EventSystem/Reservation.h +++ b/src/EventSystem/Reservation.h @@ -2,14 +2,19 @@ #define HEADER_EVENTSYSTEM_RESERVATION #include "Ticket.h" +#include <istream> +#include <ostream> class Reservation { Ticket ticket; char password[8]; - char note[128]; + char note[32]; public: Reservation(const Ticket& ticket, const char* password, const char* note); + + void read(std::istream& istr); + void write(std::ostream& ostr) const; }; #endif diff --git a/src/List/List.cpp b/src/List/List.cpp index 5a0e1f2..1f3540f 100644 --- a/src/List/List.cpp +++ b/src/List/List.cpp @@ -77,6 +77,12 @@ std::istream& List<T>::read(std::istream& istr) { template <class T> std::ostream& List<T>::write(std::ostream& ostr) const { + ostr.write((const char*)&length, sizeof(length)); + ostr.write((const char*)&count, sizeof(count)); + + for (int i = 0; i < count; i++) + elements[i].write(ostr); // disgusting + return ostr; } |
