------------------------------------------------------------------------------
| 3558 | |
| 3559 | //------------------------------------------------------------------------------ |
| 3560 | void vtkDataReader::CheckFor(const char* name, char* line, int& num, char**& array, int& allocSize) |
| 3561 | { |
| 3562 | if (!strncmp(this->LowerCase(line, strlen(name)), name, strlen(name))) |
| 3563 | { |
| 3564 | int i; |
| 3565 | int newAllocSize; |
| 3566 | char** newArray; |
| 3567 | |
| 3568 | // update numbers |
| 3569 | num++; |
| 3570 | |
| 3571 | if (!array) |
| 3572 | { |
| 3573 | allocSize = 25; |
| 3574 | array = new char*[allocSize]; |
| 3575 | for (i = 0; i < allocSize; i++) |
| 3576 | { |
| 3577 | array[i] = nullptr; |
| 3578 | } |
| 3579 | } |
| 3580 | else if (num >= allocSize) |
| 3581 | { |
| 3582 | newAllocSize = 2 * num; |
| 3583 | newArray = new char*[newAllocSize]; |
| 3584 | for (i = 0; i < allocSize; i++) |
| 3585 | { |
| 3586 | newArray[i] = array[i]; |
| 3587 | } |
| 3588 | for (i = allocSize; i < newAllocSize; i++) |
| 3589 | { |
| 3590 | newArray[i] = nullptr; |
| 3591 | } |
| 3592 | allocSize = newAllocSize; |
| 3593 | delete[] array; |
| 3594 | array = newArray; |
| 3595 | } |
| 3596 | |
| 3597 | // enter the name |
| 3598 | auto result = |
| 3599 | vtk::scan<std::string_view, std::string_view>(std::string_view(line), "{:s} {:s}"); |
| 3600 | if (result) |
| 3601 | { |
| 3602 | auto& [_, nameOfAttribute] = result->values(); |
| 3603 | if (!nameOfAttribute.empty()) |
| 3604 | { |
| 3605 | array[num] = new char[nameOfAttribute.size() + 1]; |
| 3606 | std::copy_n(nameOfAttribute.data(), nameOfAttribute.size(), array[num - 1]); |
| 3607 | array[num - 1][nameOfAttribute.size()] = '\0'; |
| 3608 | } |
| 3609 | } |
| 3610 | } // found one |
| 3611 | } |
| 3612 | |
| 3613 | //------------------------------------------------------------------------------ |
| 3614 | const char* vtkDataReader::GetScalarsNameInFile(int i) |