ImportAdoption.h header

#include <ew/app/import/ImportAdoption.h>

Namespace ew::app::import

Functions

std::vector< std::unique_ptr< ew::core::undo::Command > > ew::app::import::adoptImportedCommands(ew::core::project::Project &project, ImportedManuscript &imported)

The commands that add everything imported holds to project, ready to be pushed as one undoable step.

The order is the whole contract: categories, then entities, then documents. A category naming a parent that does not exist yet has nowhere to attach, and an entity naming a category that has not been created yet lands uncategorized – which reads like a parser bug and is an ordering bug. The importers hand back their categories already sorted parents-before-children; this preserves that order rather than imposing one of its own.

imported is taken by non-const reference because the documents and entities are moved out of it. It is left with empty vectors, so a caller cannot accidentally adopt the same objects twice.

No new command types were needed for any of this: Entity derives from ContentObject so it rides the same AddObjectCommand documents already use, and the taxonomy has AddCategoryCommand already. Returning the commands rather than pushing them keeps the whole thing testable without a window, which matters because apps/desktop has no test target.