MCPcopy Create free account
hub / github.com/USBGuard/usbguard / parseStream

Method parseStream

src/Library/KeyValueParserPrivate.cpp:93–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 }
92
93 void KeyValueParserPrivate::parseStream(std::istream& stream)
94 {
95 std::map<std::string, std::string> m;
96 std::map<std::string, std::string>::iterator it;
97 std::string line;
98
99 while ( getline (stream, line) ) {
100 if ((line.size() < 1) || (line[0] == '#')) {
101 continue;
102 }
103
104 auto p = this->parseLine(line);
105 it = m.find(p.first);
106
107 if (it != m.end()) {
108 m.emplace(p.first, p.second);
109 }
110 else {
111 m[p.first] = p.second;
112 }
113 }
114
115 this->_output_map = std::move(m);
116 }
117
118 bool KeyValueParserPrivate::checkKeyValidity(const std::string& key)
119 {

Callers 2

parseConfMethod · 0.45
parseNSSwitchMethod · 0.45

Calls 1

parseLineMethod · 0.95

Tested by

no test coverage detected