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
donner::editor::ShapeClipboardPayload Struct Reference

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< ShapeClipboardPayloadparse (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< Box2ddocumentBounds
 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.

Detailed Description

Structured shape-clipboard payload. See file comment for the wire format.

Member Function Documentation

◆ 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: