ImportedManuscript.h header

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

Namespace ew::app::import

ImportedManuscript struct

struct ew::app::import::ImportedManuscript

What an importer produces: a manuscript, and – for a source that has one – the world behind it.

A header of its own because this is the shared vocabulary of every importer. It used to live in PlainTextImport.h, the one that happened to need it first, so an importer reading World Anvil articles had to include a plain-text header in order to speak about worlds.

It carried ONE field, documents, and that single line was the whole reason three importers from worldbuilding tools – World Anvil, Campfire, articy:draft – flattened structured characters, locations and factions into prose. Their traversals already had the field pairs in hand; there was nowhere to put them, so a writer arriving with 200 articles got 200 documents and an empty codex. Adding a destination is what lets those importers stop rendering data as text.

A manuscript importer (Scrivener, Word, plain text) simply leaves categories and entities empty and behaves exactly as before.

Members

std::vector<std::unique_ptr<ew::core::document::Document> > ew::app::import::ImportedManuscript::documents

The root document followed by its child scene documents. The root's parentId is null; each child's parentId is the root's id, and children are ordered by sortIndex. Held by pointer because content objects are non-copyable.

std::vector<ew::core::taxonomy::Category> ew::app::import::ImportedManuscript::categories

The categories the source's own grouping implies, parents before children.

The order is load-bearing, not tidiness: adoption pushes these in sequence, and a category naming a parent that does not exist yet has nowhere to attach.

By value, unlike the other two: a Category is copyable and ew::core::taxonomy::AddCategoryCommand takes one by value, so a pointer here would buy nothing and cost a dereference at every use.

std::vector<std::unique_ptr<ew::core::entity::Entity> > ew::app::import::ImportedManuscript::entities

The entities, each naming a category from categories.

Adoption pushes every category before any entity, for the same reason: an entity naming a category that has not been created yet lands uncategorized, which looks like a parser bug and is an ordering bug.