Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::components::TreeMutationContext Struct Reference

Document-local hooks for tree mutations. More...

#include "donner/base/xml/components/TreeMutationContext.h"

Public Member Functions

 TreeMutationContext ()
 Default ctor installs the basic XML callbacks. Higher-level models (SVGDocument) overwrite the individual function fields after construction.

Static Public Member Functions

static void DefaultSetValue (EntityHandle node, const RcStringOrRef &value)
 Assign a value in the basic XML model.
static void DefaultInsertBefore (EntityHandle parent, EntityHandle newNode, EntityHandle referenceNode)
 Basic XML defaults - operate on TreeComponent directly.
static void DefaultAppendChild (EntityHandle parent, EntityHandle child)
 Append a child through the default ECS tree operation.
static void DefaultReplaceChild (EntityHandle parent, EntityHandle newChild, EntityHandle oldChild)
 Replace a child through the default ECS tree operation.
static void DefaultRemoveChild (EntityHandle parent, EntityHandle child)
 Detach a child through the default ECS tree operation.
static void DefaultRemove (EntityHandle entity)
 Detach an entity through the default ECS tree operation.

Public Attributes

std::function< void(EntityHandle parent, EntityHandle newNode, EntityHandle referenceNode)> insertBefore
 Callback for insertBefore(parent, newNode, referenceNode).
std::function< void(EntityHandle parent, EntityHandle child)> appendChild
 Callback for appendChild(parent, child).
std::function< void(EntityHandle parent, EntityHandle newChild, EntityHandle oldChild)> replaceChild
 Callback for replaceChild(parent, newChild, oldChild).
std::function< void(EntityHandle parent, EntityHandle child)> removeChild
 Callback for removeChild(parent, child).
std::function< void(EntityHandle entity)> remove
 Callback for remove(entity).
std::function< void(EntityHandle node, const RcStringOrRef &value)> setValue
 Callback for a node value assignment, allowing document-specific style invalidation.

Detailed Description

Document-local hooks for tree mutations.

Always installed in Registry::ctx() by the owning document model: donner::xml::XMLDocument installs the Default* callbacks below (which operate on TreeComponent directly), and higher-level models such as SVGDocument overwrite the individual callbacks after construction to layer invalidation and lifetime tracking on top. donner::xml::XMLNode mutation methods always go through the context, so the lookup never needs to fall back to a direct TreeComponent path - Registry::ctx().contains<TreeMutationContext>() is an invariant of any registry exposed through one of the document facades.

Member Function Documentation

◆ DefaultAppendChild()

void donner::components::TreeMutationContext::DefaultAppendChild ( EntityHandle parent,
EntityHandle child )
inlinestatic

Append a child through the default ECS tree operation.

Parameters
parentDestination parent in the same registry as the child.
childElement to append.

◆ DefaultRemove()

void donner::components::TreeMutationContext::DefaultRemove ( EntityHandle entity)
inlinestatic

Detach an entity through the default ECS tree operation.

Parameters
entityEntity to remove from its parent.

◆ DefaultRemoveChild()

void donner::components::TreeMutationContext::DefaultRemoveChild ( EntityHandle parent,
EntityHandle child )
inlinestatic

Detach a child through the default ECS tree operation.

Parameters
parentParent containing the child.
childChild to detach.

◆ DefaultReplaceChild()

void donner::components::TreeMutationContext::DefaultReplaceChild ( EntityHandle parent,
EntityHandle newChild,
EntityHandle oldChild )
inlinestatic

Replace a child through the default ECS tree operation.

Parameters
parentParent containing the old child.
newChildReplacement child in the same registry.
oldChildChild to replace.

◆ DefaultSetValue()

void donner::components::TreeMutationContext::DefaultSetValue ( EntityHandle node,
const RcStringOrRef & value )
inlinestatic

Assign a value in the basic XML model.

Parameters
nodeNode receiving the new value.
valueNew text or node value.

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