ManuscriptTree.h header

#include <ew/core/ManuscriptTree.h>

Namespace ew::core

Functions

ew::core::foundation::ContentId ew::core::document::corkboardContainer(const ew::core::project::Project &project, ew::core::foundation::ContentId selected)

The container whose children a corkboard should show for the current selection: the selected document if it has children, otherwise the selected document's parent (so a leaf shows its siblings). A null selection – or a leaf with no parent – yields a null id, meaning the top level.

int ew::core::document::descendantDocumentCount(const ew::core::project::Project &project, ew::core::foundation::ContentId rootId)

How many documents sit under rootId, at any depth.

The manuscript walk starts at the top level and descends, so a document whose parent no longer exists is never reached. Deleting a container therefore drops its whole subtree out of the manuscript tree and out of every export while the documents still sit on disk – which is worth telling the user before they agree to it, and worth telling an MCP caller afterwards (F-0077).

Bounded by the document count, so a parent cycle in a hand-edited project cannot spin it.

int ew::core::document::dropInsertionIndex(const ew::core::project::Project &project, ew::core::foundation::ContentId documentId, ew::core::foundation::ContentId newParentId, int row)

The insertion index to pass to MoveDocumentCommand for a drag that drops documentId under newParentId at visual position row (or -1 to append). When the document stays under the same parent it is removed from the list before reinsertion, so a drop below its current position is shifted up by one; cross-parent drops are used as given.

ew::core::foundation::ContentId ew::core::document::findChildDocumentByTitle(const ew::core::project::Project &project, ew::core::foundation::ContentId parentId, const QString &title)

The id of the child document of parentId (top-level if it is null) whose title is exactly title, or a null id if none matches. Used to find-or-create well-known documents such as the daily-notes folder and a given day's note.

std::vector< ew::core::foundation::ContentId > ew::core::document::orderedChildDocumentIds(const ew::core::project::Project &project, ew::core::foundation::ContentId parentId)

The ids of the documents whose parent is parentId (top-level documents if it is null), in manuscript-tree order: ascending sort index, then title, then id. This is the single source of truth for sibling order, shared by the document tree model and the commands that reorder documents, so a manuscript reads the same everywhere.