MCPcopy Create free account
hub / github.com/Kitware/VTK / IsMetaFile

Method IsMetaFile

IO/IOSS/vtkIOSSFilesScanner.cxx:34–58  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

32
33//----------------------------------------------------------------------------
34bool vtkIOSSFilesScanner::IsMetaFile(const std::string& filename)
35{
36 vtksys::ifstream metafile(filename.c_str());
37 if (!metafile.good())
38 {
39 return false;
40 }
41
42 std::string s;
43 std::getline(metafile, s);
44 rtrim(s); // strip trailing white-spaces
45 if (s.empty() ||
46 s.size() !=
47 static_cast<size_t>(std::count_if(
48 s.begin(), s.end(), [](unsigned char c) { return std::isprint(c) || std::isspace(c); })))
49 {
50 return false;
51 }
52
53 // let's just check that the first value is a valid filename.
54 auto metafile_path =
55 vtksys::SystemTools::GetFilenamePath(vtksys::SystemTools::CollapseFullPath(filename));
56 auto fpath = vtksys::SystemTools::CollapseFullPath(s, metafile_path);
57 return (vtksys::SystemTools::FileExists(fpath, /*isFile=*/true));
58}
59
60//----------------------------------------------------------------------------
61std::set<std::string> vtkIOSSFilesScanner::GetFilesFromMetaFile(const std::string& filename)

Callers

nothing calls this directly

Calls 8

count_ifFunction · 0.85
rtrimFunction · 0.70
c_strMethod · 0.45
goodMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected