Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
SourceStructuralMove.h File Reference
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string_view>
#include "donner/editor/FlashDecorations.h"
#include "donner/svg/SVGElement.h"
Include dependency graph for SourceStructuralMove.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::SourceStructuralMovePlan
 Revision-bound, DOM-shaped move prepared from a source drag target. More...
struct  donner::editor::SourceStructuralMoveEvaluation
 Result of validating and building a structural move plan. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Enumerations

enum class  donner::editor::SourceStructuralMoveStatus : std::uint8_t {
  Ready ,
  DocumentUnavailable ,
  StaleRevision ,
  RootElement ,
  Locked ,
  InvalidParent ,
  InvalidReference ,
  Cycle ,
  NoSourceRange ,
  NoChange ,
  Rejected
}
 Validation result for a source-initiated structural element move.

Functions

SourceStructuralMoveEvaluation donner::editor::BuildSourceStructuralMovePlan (EditorApp &app, std::string_view source, svg::SVGElement element, svg::SVGElement parent, std::optional< svg::SVGElement > referenceElement)
 Build a structural move plan without mutating the document.
SourceStructuralMoveStatus donner::editor::CommitSourceStructuralMove (EditorApp &app, const SourceStructuralMovePlan &plan, std::string_view source)
 Commit a previously validated plan if its source and document revisions are still current.
std::string_view donner::editor::SourceStructuralMoveStatusMessage (SourceStructuralMoveStatus status)
 Human-readable reason suitable for a disabled drop-target tooltip.

Function Documentation

◆ BuildSourceStructuralMovePlan()

SourceStructuralMoveEvaluation donner::editor::BuildSourceStructuralMovePlan ( EditorApp & app,
std::string_view source,
svg::SVGElement element,
svg::SVGElement parent,
std::optional< svg::SVGElement > referenceElement )
nodiscard

Build a structural move plan without mutating the document.

Parameters
appCurrent editor document owner.
sourceEditable source corresponding exactly to the current DOM.
elementComplete source-backed element being dragged.
parentDestination container.
referenceElementDestination sibling, or std::nullopt to append.

◆ CommitSourceStructuralMove()

SourceStructuralMoveStatus donner::editor::CommitSourceStructuralMove ( EditorApp & app,
const SourceStructuralMovePlan & plan,
std::string_view source )
nodiscard

Commit a previously validated plan if its source and document revisions are still current.

Parameters
appCurrent editor document owner.
planPlan returned by BuildSourceStructuralMovePlan.
sourceCurrent editable source.
Returns
SourceStructuralMoveStatus::Ready when the DOM move was queued.