MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / ConfigFile

Method ConfigFile

src/ConfigFile.cpp:19–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19ConfigFile::ConfigFile(std::string const& configFile) {
20 std::ifstream file(configFile.c_str());
21
22 std::string line;
23 std::string name;
24 std::string value;
25 std::string inSection;
26 int posEqual;
27 while (std::getline(file,line)) {
28
29 if (! line.length()) continue;
30
31 if (line[0] == '#') continue;
32 if (line[0] == ';') continue;
33
34 if (line[0] == '[') {
35 inSection=trim(line.substr(1,line.find(']')-1));
36 continue;
37 }
38
39 posEqual=line.find('=');
40 name = trim(line.substr(0,posEqual));
41 value = trim(line.substr(posEqual+1));
42
43 content_[inSection+'/'+name]=Chameleon(value);
44 }
45}
46
47Chameleon const& ConfigFile::Value(std::string const& section, std::string const& entry) const {
48

Callers

nothing calls this directly

Calls 2

trimFunction · 0.85
ChameleonClass · 0.85

Tested by

no test coverage detected