Add a class diagram. Still needs some details. Refactor to better respect SOLID principles. Housekeeping, move and rename classes/files.
30 lines
542 B
C++
30 lines
542 B
C++
#include <filesystem>
|
|
#include <fstream>
|
|
|
|
#include <ConfigManager.h>
|
|
#include <memory>
|
|
|
|
using namespace std;
|
|
namespace fs = std::filesystem;
|
|
|
|
ConfigManager::ConfigManager() {
|
|
if (fs::exists(CONFIG_FILE)) {
|
|
ifstream f(CONFIG_FILE);
|
|
mConfig = json::parse(f);
|
|
}
|
|
}
|
|
|
|
void ConfigManager::SaveFans(vector<shared_ptr<Fan>> fans) {
|
|
json obj;
|
|
|
|
for (auto fan : fans) {
|
|
}
|
|
}
|
|
|
|
ConfigManager::~ConfigManager() { WriteConfig(); }
|
|
|
|
void ConfigManager::WriteConfig() {
|
|
ofstream f(CONFIG_FILE, ios::trunc);
|
|
f << mConfig.dump(2) << endl;
|
|
}
|