Structured shape-clipboard payload. See file comment for the wire format.
More...
#include "donner/editor/ShapeClipboardPayload.h"
|
|
std::string | toClipboardText () const |
| | Serialize this payload to the headered text form written to the clipboard.
|
|
|
std::string | svgFragment |
| | SVG fragment text: the serialized subtrees of the copied elements, in document paint order. Each top-level fragment node is one copied element.
|
|
std::optional< Box2d > | documentBounds |
| | Combined document-space bounding box of the copied elements at copy time. std::nullopt when no bounds were available (e.g. best-effort import).
|
|
std::vector< std::string > | sourceElementIds |
| | The id attribute of each copied top-level element, in the same order as they appear in svgFragment. Empty entries denote elements without an id.
|
|
bool | wasGroupSelection = false |
| | True when the copy originated from a selection of one or more whole groups (<g>/<svg> containers). Used by paste to decide group-aware insertion.
|
|
|
static constexpr std::string_view | kHeader = "# donner-shape-clipboard v1" |
| | Header line that identifies a Donner shape-clipboard payload.
|
Structured shape-clipboard payload. See file comment for the wire format.
◆ parse()
| std::optional< ShapeClipboardPayload > donner::editor::ShapeClipboardPayload::parse |
( |
std::string_view | clipboardText | ) |
|
|
staticnodiscard |
Parse clipboard text into a payload.
When the text begins with kHeader, the metadata block is parsed and the remaining bytes become svgFragment. Otherwise the entire text is treated as a best-effort SVG fragment with empty metadata. Returns std::nullopt only when no usable SVG fragment can be recovered (empty/whitespace text).
The documentation for this struct was generated from the following file: