------------------------------------------------------------------------------
| 495 | |
| 496 | //------------------------------------------------------------------------------ |
| 497 | std::pair<bool, std::string> EnSightFile::ReadNextLine(int size /* = MAX_LINE_LENGTH*/) |
| 498 | { |
| 499 | if (this->Format != FileType::ASCII) |
| 500 | { |
| 501 | return this->ReadLine(size); |
| 502 | } |
| 503 | |
| 504 | bool isComment = true; |
| 505 | bool lineRead = true; |
| 506 | |
| 507 | std::pair<bool, std::string> result; |
| 508 | while (isComment && lineRead) |
| 509 | { |
| 510 | result = this->ReadLine(size); |
| 511 | lineRead = result.first; |
| 512 | auto& line = result.second; |
| 513 | if (lineRead && line[0] != '#') |
| 514 | { |
| 515 | if (!std::all_of(line.begin(), line.end(), isspace)) |
| 516 | { |
| 517 | // The line was not empty, not beginning by '#' and not composed |
| 518 | // of only white space, this is not a comment |
| 519 | isComment = false; |
| 520 | } |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | if (lineRead) |
| 525 | { // remove any trailing comments from the line |
| 526 | char comment = '#'; |
| 527 | size_t found = result.second.find(comment); |
| 528 | if (found != std::string::npos) |
| 529 | { |
| 530 | result.second.erase(found); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | return result; |
| 535 | } |
| 536 | |
| 537 | //------------------------------------------------------------------------------ |
| 538 | void EnSightFile::SkipLine(vtkTypeInt64 size) |
no test coverage detected