ScrivenerImport.h header

#include <ew/app/ScrivenerImport.h>

Namespace ew::app

ScrivenerNode struct

struct ew::app::ScrivenerNode

A node in a Scrivener project's binder tree: its identity, title, item type, and ordered children. The type is Scrivener's own (for example "Text", "Folder", "DraftFolder").

Members

QString ew::app::ScrivenerNode::uuid

The binder item's unique identifier.

QString ew::app::ScrivenerNode::title

The item's title.

QString ew::app::ScrivenerNode::type

Scrivener's own item type (e.g. "Text", "Folder", "DraftFolder").

std::vector<ScrivenerNode> ew::app::ScrivenerNode::children

The item's children, in binder order.

Functions

ImportedManuscript ew::app::buildScrivenerManuscript(const QString &projectTitle, const std::vector< ScrivenerNode > &nodes, const std::function< QString(const QString &uuid)> &rtfFor)

Builds an importable manuscript from a parsed binder. projectTitle becomes the root Document (falling back to "Imported Project"); every binder node becomes a Document beneath it, preserving order and nesting – container items (folders) become container Documents and text items become prose Documents whose body is rtfFor(uuid) run through rtfToPlainText(). The Trash folder is omitted. rtfFor supplies the raw RTF for a text node's UUID (injected so this stays pure and testable). Documents are returned by pointer, root first.

ImportedManuscript ew::app::importScrivener(const QString &scrivDir)

Reads a Scrivener project directory scrivDir (a .scriv package), parses its .scrivx binder, and imports it – reading each text item's prose from Files/Data/<uuid>/content.rtf (falling back to the Scrivener 2 layout Files/Docs/<uuid>.rtf). The project title comes from the .scrivx file name. Returns just a root Document if the directory has no readable binder.

std::vector< ScrivenerNode > ew::app::parseScrivenerBinder(const QString &scrivxXml)

Parses the <Binder> tree from a Scrivener .scrivx document's scrivxXml into binder nodes, preserving item order and nesting. Malformed or empty XML yields an empty list.