| 140 | } |
| 141 | |
| 142 | void vtkBiomTableReader::ParseShape() |
| 143 | { |
| 144 | this->NumberOfRows = this->NumberOfColumns = -1; |
| 145 | |
| 146 | // find "shape": |
| 147 | size_t pos1 = this->FileContents.find("\"shape\":"); |
| 148 | if (pos1 == std::string::npos) |
| 149 | { |
| 150 | vtkErrorMacro(<< "shape not found in input file"); |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | // find [ |
| 155 | size_t pos2 = this->FileContents.find('[', pos1 + 1); |
| 156 | if (pos2 == std::string::npos) |
| 157 | { |
| 158 | vtkErrorMacro(<< "shape field not formatted properly"); |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | // find , |
| 163 | size_t pos3 = this->FileContents.find(',', pos2 + 1); |
| 164 | if (pos3 == std::string::npos) |
| 165 | { |
| 166 | vtkErrorMacro(<< "shape field not formatted properly"); |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | // find ] |
| 171 | size_t pos4 = this->FileContents.find(']', pos3 + 1); |
| 172 | if (pos4 == std::string::npos) |
| 173 | { |
| 174 | vtkErrorMacro(<< "shape field not formatted properly"); |
| 175 | return; |
| 176 | } |
| 177 | |
| 178 | // number of rows is between "[" and "," |
| 179 | this->NumberOfRows = |
| 180 | vtk::scan_int<int>(this->FileContents.substr(pos2 + 1, pos3 - pos2))->value(); |
| 181 | |
| 182 | // number of columns is between "," and "]" |
| 183 | this->NumberOfColumns = |
| 184 | vtk::scan_int<int>(this->FileContents.substr(pos3 + 1, pos4 - pos3 - 1))->value(); |
| 185 | } |
| 186 | |
| 187 | //------------------------------------------------------------------------------ |
| 188 | void vtkBiomTableReader::ParseDataType() |
no test coverage detected