|
|
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.
|
Structured shape-clipboard payload. See file comment for the wire format. More...
#include "donner/editor/ShapeClipboardPayload.h"
Public Member Functions | |
| std::string | toClipboardText () const |
| Serialize this payload to the headered text form written to the clipboard. | |
Static Public Member Functions | |
| static std::optional< ShapeClipboardPayload > | parse (std::string_view clipboardText) |
| Parse clipboard text into a payload. | |
Public Attributes | |
| 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 Public Attributes | |
| 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.
|
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).