------------------------------------------------------------------------------
| 228 | |
| 229 | //------------------------------------------------------------------------------ |
| 230 | int vtkGeoJSONReader::GeoJSONReaderInternal::CanParseString(char* input, Json::Value& root) |
| 231 | { |
| 232 | if (!input) |
| 233 | { |
| 234 | vtkGenericWarningMacro(<< "Input string is empty"); |
| 235 | return VTK_ERROR; |
| 236 | } |
| 237 | |
| 238 | Json::CharReaderBuilder builder; |
| 239 | builder["collectComments"] = false; |
| 240 | |
| 241 | std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); |
| 242 | |
| 243 | std::string formattedErrors; |
| 244 | |
| 245 | // parse the entire geoJSON data into the Json::Value root |
| 246 | bool parsedSuccess = reader->parse(input, input + strlen(input), &root, &formattedErrors); |
| 247 | |
| 248 | if (!parsedSuccess) |
| 249 | { |
| 250 | // Report failures and their locations in the document |
| 251 | vtkGenericWarningMacro(<< "Failed to parse JSON" << endl << formattedErrors); |
| 252 | return VTK_ERROR; |
| 253 | } |
| 254 | |
| 255 | return VTK_OK; |
| 256 | } |
| 257 | |
| 258 | //------------------------------------------------------------------------------ |
| 259 | void vtkGeoJSONReader::GeoJSONReaderInternal::ParseFeatureProperties( |
no test coverage detected