MCPcopy Create free account
hub / github.com/cselab/aphros / ParseFile

Method ParseFile

src/parse/parser.cpp:325–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325void Parser::ParseFile(std::string path, std::string dir) {
326 fassert(path != "", "Empty path");
327 std::ifstream f(path);
328 if (dir != "") {
329 fassert(
330 util::IsDir(dir),
331 util::Format(
332 "Not a directory '{}' specified to look for file '{}'", dir, path));
333 auto path2 = util::Join(dir, path);
334 if (!f.good() && path[0] != '/') {
335 f.open(path2);
336 fassert(
337 f.good(), util::Format("Can't open file '{}' or '{}'", path, path2));
338 }
339 path = path2;
340 }
341 fassert(f.good(), util::Format("Can't open file '{}'", path));
342
343 int line = 0;
344 while (f) {
345 const std::pair<std::string, int> p = ReadMultiline(f);
346 line += p.second;
347 imp->Cmd(p.first, path, line);
348 }
349}
350
351template <class T>
352void Parser::PrintMap(const Vars::Map<T>& m, std::ostream& out) {

Callers 5

aphros_ParserFileIniFunction · 0.80
mainFunction · 0.80
CmdIncludeMethod · 0.80
TestFileFunction · 0.80
RunMpi0Function · 0.80

Calls 5

IsDirFunction · 0.85
FormatFunction · 0.85
ReadMultilineFunction · 0.85
CmdMethod · 0.80
JoinFunction · 0.70

Tested by 1

TestFileFunction · 0.64