Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / HallService.cpp
diff options
context:
space:
mode:
1 files changed, 21 insertions, 0 deletions
-rw-r--r--src/Services/HallService.cpp21
diff --git a/src/Services/HallService.cpp b/src/Services/HallService.cpp
index ffbf989..02bf040 100644
--- a/src/Services/HallService.cpp
+++ b/src/Services/HallService.cpp
@@ -1,4 +1,5 @@
#include "HallService.h"
+#include <fstream>
HallService::HallService(const Hall* halls, unsigned hallCount) {
this->halls = OrderedList<Hall>(halls, hallCount);
@@ -7,3 +8,23 @@ HallService::HallService(const Hall* halls, unsigned hallCount) {
const OrderedList<Hall>& HallService::get_halls() const {
return halls;
}
+
+StatusCode HallService::load() {
+ std::ifstream inFile("hallsDatabase.fmits");
+ if (!inFile.is_open())
+ return E_FileCouldNotBeOpened;
+
+ events.read(inFile);
+ inFile.close();
+ return Success;
+}
+
+StatusCode HallService::save() {
+ std::ofstream outFile("hallsDatabase.fmits");
+ if (!outFile.is_open())
+ return E_FileCouldNotBeOpened;
+
+ events.write(outFile);
+ outFile.close();
+ return Success;
+}