MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ConfigFile

Method ConfigFile

source/ui/data/configFile.cpp:25–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "../../util/stringutil.h"
24
25ConfigFile::ConfigFile(BString fileName) {
26 std::vector<BString> lines;
27 readLinesFromFile(fileName, lines);
28 this->fileName = fileName;
29 for (auto& line : lines) {
30 std::vector<BString> parts;
31 line.split('=', parts);
32 if (parts.size() < 2) {
33 kwarn_fmt("%s has a malformed key/value pair", fileName.c_str());
34 } else {
35 parts[0] = parts[0].trim();
36 parts[1] = parts[1].trim();
37 this->values.set(parts[0], parts[1]);
38 }
39 }
40}
41
42BString ConfigFile::readString(BString name, BString defaultValue) {
43 BString value;

Callers

nothing calls this directly

Calls 7

readLinesFromFileFunction · 0.85
kwarn_fmtFunction · 0.85
trimMethod · 0.80
splitMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected