Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models
diff options
context:
space:
mode:
Commit2145443cf8e8d5dd818d3e315ca1f0b39bfb8554 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:33:45 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:33:45 +0300
Files442233df1acf615fa587b489a6dfb3712f1225b7 /src/Models
FMI-OOP-P1_TicketSystem-2145443cf8e8d5dd818d3e315ca1f0b39bfb8554.tar
FMI-OOP-P1_TicketSystem-2145443cf8e8d5dd818d3e315ca1f0b39bfb8554.tar.gz
FMI-OOP-P1_TicketSystem-2145443cf8e8d5dd818d3e315ca1f0b39bfb8554.zip
Parent79c5f56ece8f43a72e89c44e24a2d8eae6f1e8f8 (diff)
Autocommit at 07.05.2022 @ 16:33
3 files changed, 20 insertions, 10 deletions
-rw-r--r--src/Models/Event.cpp16
-rw-r--r--src/Models/Event.h4
-rw-r--r--src/Models/Hall.h10
diff --git a/src/Models/Event.cpp b/src/Models/Event.cpp
index d86b907..71bf63a 100644
--- a/src/Models/Event.cpp
+++ b/src/Models/Event.cpp
@@ -29,11 +29,21 @@ const Date& Event::get_date() const {
return date;
}
-void Event::print(std::ostream& ostr) {
- ostr.write(hall, sizeof(hall));
+void Event::read(std::istream& istr) {
+ hall.read(istr);
+ name.read(istr);
+ date.read(istr);
+ tickets.read(istr);
+ reservations.read(istr);
}
-void Event::write(std::istream& istr);
+void Event::write(std::ostream& ostr) {
+ hall.write(ostr);
+ name.write(ostr);
+ date.write(ostr);
+ tickets.write(ostr);
+ reservations.write(ostr);
+}
int Event::compare(const Event& other) {
if (hall == other.hall)
diff --git a/src/Models/Event.h b/src/Models/Event.h
index b56d12d..05c511e 100644
--- a/src/Models/Event.h
+++ b/src/Models/Event.h
@@ -27,8 +27,8 @@ public:
OrderedList<Ticket>& get_tickets();
OrderedList<Reservation>& get_reservations();
- void print(std::ostream& ostr);
- void write(std::istream& istr);
+ void write(std::ostream& ostr);
+ void read(std::istream& istr);
int compare(const Event& other);
diff --git a/src/Models/Hall.h b/src/Models/Hall.h
index a164a0b..cd35a47 100644
--- a/src/Models/Hall.h
+++ b/src/Models/Hall.h
@@ -1,6 +1,9 @@
#ifndef HEADER_HALL
#define HEADER_HALL
+#include <istream>
+#include <ostream>
+
class Hall {
int number;
unsigned rows;
@@ -12,14 +15,11 @@ public:
Hall(int number, unsigned rows, unsigned seatsPerRow);
int get_number() const;
- void set_number(int number);
-
unsigned get_rows() const;
- void set_rows(unsigned rows);
-
unsigned get_seatsPerRow() const;
- void set_seatsPerRow(unsigned seatsPerRow);
+ void read(std::istream& istr);
+ void write(std::ostream& ostr);
int compare(const Hall& other) const;
};