Refactoring, housekeeping, documentation
Add a class diagram. Still needs some details. Refactor to better respect SOLID principles. Housekeeping, move and rename classes/files.
This commit is contained in:
29
app/src/ConfigManager.cxx
Normal file
29
app/src/ConfigManager.cxx
Normal file
@@ -0,0 +1,29 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user