MCPcopy Create free account
hub / github.com/InsightSoftwareConsortium/ITK / GetNextLine

Method GetNextLine

Modules/IO/VTK/src/itkVTKImageIO.cxx:40–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38VTKImageIO::~VTKImageIO() = default;
39
40int
41VTKImageIO::GetNextLine(std::ifstream & ifs, std::string & line, bool lowerCase, SizeValueType count)
42{
43 // The terminal condition for this recursive calls
44 if (count > 5)
45 {
46 itkExceptionMacro("Error of GetNextLine due to consecutive 5 empty lines in the given .*vtk file ");
47 }
48
49 // Get a next line from a given *.vtk file
50 std::getline(ifs, line);
51
52 // Check the End-of-File of the file
53 if (ifs.eof())
54 {
55 itkExceptionMacro("Premature EOF in reading a line");
56 }
57
58 // Convert characters of the line to lowercas
59 if (lowerCase)
60 {
61 std::transform(line.begin(), line.end(), line.begin(), ::tolower);
62 }
63
64 // Check an empty line with the size of a read line from *.vtk file
65 if (line.empty())
66 {
67 return GetNextLine(ifs, line, lowerCase, ++count);
68 }
69
70 return 1;
71}
72
73bool
74VTKImageIO::CanReadFile(const char * filename)

Callers 3

CanReadFileMethod · 0.95
ReadHeaderSizeMethod · 0.95

Calls 4

eofMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected