forked from d-j-hirst/aus-polling-analyser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.cpp
More file actions
32 lines (29 loc) · 700 Bytes
/
Config.cpp
File metadata and controls
32 lines (29 loc) · 700 Bytes
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
31
32
#include "Config.h"
#include "General.h"
#include "Log.h"
#include <fstream>
Config::Config(std::string const& filename)
{
std::ifstream file(filename);
do {
std::string line;
std::getline(file, line);
if (!file) break;
auto values = splitString(line, "=");
if (values.size() != 2) continue;
try {
if (values[0] == "iModelThreads") {
modelThreads = std::stoi(values[1]);
}
if (values[0] == "iSimulationThreads") {
simulationThreads = std::stoi(values[1]);
}
if (values[0] == "bBeepOnCompletion") {
beepOnCompletion = std::stoi(values[1]) == 1;
}
}
catch (std::invalid_argument) {
logger << "Invalid config line: " + line;
}
} while (true);
}