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

Method ReadHeaderData

IO/Image/vtkHDRReader.cxx:375–516  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

373
374//------------------------------------------------------------------------------
375bool vtkHDRReader::ReadHeaderData()
376{
377 vtkResourceStream* stream = this->GetStream();
378 vtkNew<vtkFileResourceStream> fileStream;
379 if (!stream)
380 {
381 if (!fileStream->Open(this->InternalFileName))
382 {
383 vtkErrorMacro("Could not open file " << this->InternalFileName);
384 return false;
385 }
386 stream = fileStream;
387 }
388 stream->Seek(0, vtkResourceStream::SeekDirection::Begin);
389
390 int headersize = 0;
391
392 vtkNew<vtkResourceParser> parser;
393 parser->SetStream(stream);
394
395 std::string str;
396 vtkTypeInt64 cur = parser->Tell();
397 vtkParseResult res = parser->ReadLine(str);
398 if (res == vtkParseResult::Error)
399 {
400 vtkErrorMacro("Error reading program type");
401 return false;
402 }
403 headersize += parser->Tell() - cur;
404
405 this->ProgramType = str.substr(2);
406
407 // Read header
408 while (true)
409 {
410 cur = parser->Tell();
411 res = parser->ReadLine(str);
412 if (res == vtkParseResult::Error)
413 {
414 vtkErrorMacro("Error reading program type");
415 return false;
416 }
417 headersize += parser->Tell() - cur;
418
419 // EOL
420 if (str.empty())
421 {
422 break;
423 }
424
425 // skip comments
426 if (str.front() == '#')
427 {
428 continue;
429 }
430
431 // Split by '='
432 std::string::size_type equalChar = str.find_first_of('=');

Callers 1

ExecuteInformationMethod · 0.95

Calls 10

swapFunction · 0.50
GetStreamMethod · 0.45
OpenMethod · 0.45
SeekMethod · 0.45
SetStreamMethod · 0.45
TellMethod · 0.45
ReadLineMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected