-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_parser.cpp
More file actions
39 lines (32 loc) · 875 Bytes
/
config_parser.cpp
File metadata and controls
39 lines (32 loc) · 875 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
33
34
35
36
37
38
39
#include "config_parser.hpp"
std::map<std::string, std::any> variables;
/*
"width=500;height=400;"
*/
void readConfigFile(const std::string& loc) {
std::ifstream file;
file.open(loc);
if (file.is_open()) {
//ignore spaces, read alphabet chars until =
//check if variable exist
//if variable exist get number after =
//set variable to number after =
//start again after hitting ';', until EOF
}
file.close();
//initVariableMap();
//setVariable("width", (int)555);
}
void initVariableMap() {
/*
variables["width"] = (int)App::getApp()->getWidth();
variables["height"] = (int)App::getApp()->getHeight();
*/
}
void setVariable(std::string& var, std::any& val) {
if (variables.find(var) == variables.end()) {
//std::cout << "Unknown variable: " << var << ". ";
return;
}
variables[var] = val;
}