| 269 | } |
| 270 | |
| 271 | MapFormatPtr determineMapFormat(std::istream& stream, const std::string& type) |
| 272 | { |
| 273 | // Get all registered map formats matching the extension |
| 274 | auto availableFormats = type.empty() ? |
| 275 | GlobalMapFormatManager().getAllMapFormats() : |
| 276 | GlobalMapFormatManager().getMapFormatList(type); |
| 277 | |
| 278 | MapFormatPtr format; |
| 279 | |
| 280 | for (const auto& candidate : availableFormats) |
| 281 | { |
| 282 | // Rewind the stream before passing it to the format for testing |
| 283 | // Map format valid, rewind the stream |
| 284 | stream.seekg(0, std::ios_base::beg); |
| 285 | |
| 286 | if (candidate->canLoad(stream)) |
| 287 | { |
| 288 | format = candidate; |
| 289 | break; |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | // Rewind the stream when we're done |
| 294 | stream.seekg(0, std::ios_base::beg); |
| 295 | |
| 296 | return format; |
| 297 | } |
| 298 | |
| 299 | MapFormatPtr determineMapFormat(std::istream& stream) |
| 300 | { |
no test coverage detected