Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / HallService.cpp
blob: b85746e2c3ce5e8ad83db3de40d437e83dcce6b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "HallService.h"
#include <fstream>

HallService::HallService(const Hall* halls, unsigned hallCount) {
	this->halls = OrderedList<Hall>(halls, 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;

	halls.read(inFile);
	inFile.close();
	return Success;
}

StatusCode HallService::save() {
	std::ofstream outFile("hallsDatabase.fmits");
	if (!outFile.is_open())
		return E_FileCouldNotBeOpened;

	halls.write(outFile);
	outFile.close();
	return Success;
}