Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::CommandQueue Class Reference

Ordered queue of editor commands awaiting document access. More...

#include "donner/editor/CommandQueue.h"

Classes

struct  FlushResult
 Outcome of flushing pending editor commands. More...

Public Member Functions

void push (EditorCommand command)
 Push a command onto the queue. UI thread only.
std::optional< std::string > pendingStyleAttribute (const svg::SVGElement &element) const
 Return the latest queued style declaration list for an element, if one exists. A queued style removal returns an empty list. Commands before document replacement are ignored.
void discardStaleSourceRecoveries (std::optional< EditorCommand::SourceRecoveryState > current)
 Drop source-pane recoveries that no longer match the admitted document and draft. Runs before replacement coalescing so a refused recovery cannot discard earlier commands.
FlushResult flush ()
 Drain and coalesce the pending commands. Returns the effective set of commands to apply, in the order the application should issue them. After flush() returns, the queue is empty.
bool empty () const
 Whether the queue currently holds any pending commands. Useful for frame-skip optimizations (no need to re-render if nothing changed).
std::size_t size () const
 Number of un-coalesced commands currently pending. Coalescing happens at flush() time, so this is the raw count, not the effective count.
void clear ()
 Drop everything pending without applying. Useful for tests and for the "abort drag" cancel path.

Detailed Description

Ordered queue of editor commands awaiting document access.


Class Documentation

◆ donner::editor::CommandQueue::FlushResult

struct donner::editor::CommandQueue::FlushResult

Outcome of flushing pending editor commands.

Class Members
vector< EditorCommand > effectiveCommands
bool hadReplaceDocument = false True when any ReplaceDocument was drained from the raw pending batch.
bool preserveUndoOnReparse = false True only when the drained batch contained at least one ReplaceDocument and every drained ReplaceDocument carried the preserve-undo marker.

Member Function Documentation

◆ discardStaleSourceRecoveries()

void donner::editor::CommandQueue::discardStaleSourceRecoveries ( std::optional< EditorCommand::SourceRecoveryState > current)

Drop source-pane recoveries that no longer match the admitted document and draft. Runs before replacement coalescing so a refused recovery cannot discard earlier commands.

Parameters
currentCurrent admitted state, or nullopt when recovery policy is unavailable.

◆ flush()

FlushResult donner::editor::CommandQueue::flush ( )
nodiscard

Drain and coalesce the pending commands. Returns the effective set of commands to apply, in the order the application should issue them. After flush() returns, the queue is empty.

flush() is called once per frame at the start of the main loop.

◆ pendingStyleAttribute()

std::optional< std::string > donner::editor::CommandQueue::pendingStyleAttribute ( const svg::SVGElement & element) const
nodiscard

Return the latest queued style declaration list for an element, if one exists. A queued style removal returns an empty list. Commands before document replacement are ignored.

Parameters
elementElement whose pending style is needed for another property edit.

The documentation for this class was generated from the following file: