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

Method ParseColumns

IO/Infovis/vtkBiomTableReader.cxx:495–533  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

493
494//------------------------------------------------------------------------------
495void vtkBiomTableReader::ParseColumns()
496{
497 // find "columns":
498 size_t pos_start = this->FileContents.find("\"columns\":");
499 if (pos_start == std::string::npos)
500 {
501 vtkErrorMacro(<< "columns not found in input file");
502 return;
503 }
504
505 for (int currentCol = 1; currentCol < this->NumberOfColumns + 1; ++currentCol)
506 {
507 // find id for this column
508 size_t pos_column_1 = this->FileContents.find("\"id\":", pos_start);
509 if (pos_column_1 == std::string::npos)
510 {
511 vtkErrorMacro(<< "columns field not formatted properly");
512 return;
513 }
514 size_t pos_column_2 = this->FileContents.find("\", \"metadata\":", pos_column_1);
515 if (pos_column_2 == std::string::npos)
516 {
517 vtkErrorMacro(<< "columns field not formatted properly");
518 return;
519 }
520 std::string name = this->FileContents.substr(pos_column_1 + 5, pos_column_2 - pos_column_1 - 5);
521 // remove quotes
522 name.erase(remove(name.begin(), name.end(), '\"'), name.end());
523 // trim whitespace
524 const size_t beginStr = name.find_first_not_of(" \t");
525 const size_t endStr = name.find_last_not_of(" \t");
526 const size_t range = endStr - beginStr + 1;
527 name = name.substr(beginStr, range);
528 this->GetOutput()->GetColumn(currentCol)->SetName(name.c_str());
529 pos_start = pos_column_2;
530
531 // this is where we would capture the metadata for this column
532 }
533}
534
535//------------------------------------------------------------------------------
536void vtkBiomTableReader::ParseRows()

Callers 1

ReadMeshSimpleMethod · 0.95

Calls 9

GetOutputMethod · 0.95
removeFunction · 0.50
findMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SetNameMethod · 0.45
GetColumnMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected