MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / readLines

Method readLines

src/Common/FileSystem.cpp:188–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188bool FileSystem::readLines(PathId fileId, std::vector<std::string> &lines) {
189 if (!fileId) return false;
190
191 bool result = false;
192 std::istream &strm = openForRead(fileId);
193 if (strm.good()) {
194 std::string line;
195 while (!strm.eof() && std::getline(strm, line)) {
196 while (!line.empty() &&
197 ((line.back() == '\r') || (line.back() == '\n'))) {
198 line.pop_back();
199 }
200 lines.emplace_back(line);
201 }
202 result = strm.eof();
203 }
204 close(strm);
205 return result;
206}
207
208bool FileSystem::writeLines(PathId fileId,
209 const std::vector<std::string> &lines,

Callers 5

TESTFunction · 0.80
reportHtmlMethod · 0.80
syntaxErrorMethod · 0.80
syntaxErrorMethod · 0.80
analyzeMethod · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64