MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / saveAndLoadMap

Function saveAndLoadMap

test/file_format_t.cpp:466–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464
465
466 std::unique_ptr<Map> saveAndLoadMap(const Map& input, const FileFormat* format)
467 {
468 auto out = std::make_unique<Map>();
469 auto exporter = format->makeExporter({}, &input, nullptr);
470 auto importer = format->makeImporter({}, out.get(), nullptr);
471 if (exporter && importer)
472 {
473 QBuffer buffer;
474 exporter->setDevice(&buffer);
475 importer->setDevice(&buffer);
476 if (buffer.open(QIODevice::ReadWrite)
477 && exporter->doExport()
478 && buffer.seek(0)
479 && importer->doImport())
480 {
481 return out; // success
482 }
483 }
484 out.reset(); // failure
485 return out;
486 }
487
488 auto const issue_513_files = {
489 "testdata:issue-513-coords-outside-printable.xmap",

Callers 2

saveAndLoadMethod · 0.85
pristineMapTestMethod · 0.85

Calls 9

setDeviceMethod · 0.80
openMethod · 0.80
seekMethod · 0.80
doImportMethod · 0.80
makeExporterMethod · 0.45
makeImporterMethod · 0.45
getMethod · 0.45
doExportMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected