Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::ElementAnchor Class Reference

Lifetime-aware reference to an SVG element entity. More...

#include "donner/svg/SVGElement.h"

Public Member Functions

 ElementAnchor ()=default
 Construct an empty anchor.
 ElementAnchor (EntityHandle handle)
 Construct an anchor from an entity handle.
 ElementAnchor (const ElementAnchor &other)
 Copy constructor, retaining another public reference.
 ElementAnchor (ElementAnchor &&other) noexcept
 Move constructor, transferring the public reference.
 ~ElementAnchor () noexcept
 Destructor, releasing the public reference.
ElementAnchoroperator= (const ElementAnchor &other)
 Copy assignment, retaining another public reference.
ElementAnchoroperator= (ElementAnchor &&other) noexcept
 Move assignment, transferring the public reference.
EntityHandle resolve () const
 Resolve this anchor to an EntityHandle.
EntityHandle unsafeResolve () const
 Resolve this anchor without checking for a scoped document access guard.
 operator EntityHandle () const
 Resolve this anchor for existing internal APIs that still accept EntityHandle.
bool valid () const
 Returns true if this anchor currently resolves to a live entity.
 operator bool () const
 Returns true if this anchor is non-empty.
Registryregistry () const
 Get the retained document registry.
RegistryunsafeRegistry () const
 Get the retained document registry without checking for a scoped access guard.
DocumentReadAccess readAccess () const
 Acquire read access to this anchor's document.
DocumentWriteAccess writeAccess () const
 Acquire write access to this anchor's document.
DocumentMutationBatch mutationBatch (bool commitOnScopeExit=true) const
 Acquire batched write access to this anchor's document.
void assertScopedEntityHandleAccessAllowed () const
 Assert that legacy raw ECS access is scoped when required by the document mode.
Entity entity () const
 Get the referenced entity id.
std::uint32_t generation () const
 Get the entity generation observed when this anchor was created.
template<typename... Type>
bool all_of () const
 Test whether the resolved entity has all requested components.
template<typename Type>
const Type & get () const
 Get a component from the resolved entity.
template<typename Type>
Type & get (DocumentWriteAccess &access) const
 Get a mutable component from the resolved entity.
template<typename Type>
const Type * try_get () const
 Get a component pointer from the resolved entity, or null if it is absent.
template<typename Type>
Type * try_get (DocumentWriteAccess &access) const
 Get a mutable component pointer from the resolved entity, or null if it is absent.
template<typename Type, typename... Args>
Type & emplace (DocumentWriteAccess &access, Args &&... args) const
 Emplace a component on the resolved entity.
template<typename Type, typename... Args>
Type & get_or_emplace (DocumentWriteAccess &access, Args &&... args) const
 Get or emplace a component on the resolved entity.
template<typename Type, typename... Args>
Type & emplace_or_replace (DocumentWriteAccess &access, Args &&... args) const
 Emplace or replace a component on the resolved entity.
template<typename... Type>
decltype(auto) remove (DocumentWriteAccess &access) const
 Remove components from the resolved entity.

Friends

bool operator== (const ElementAnchor &lhs, const ElementAnchor &rhs)
 Compare two anchors by document storage and entity id.
bool operator!= (const ElementAnchor &lhs, const ElementAnchor &rhs)
 Compare two anchors by document storage and entity id.

Detailed Description

Lifetime-aware reference to an SVG element entity.

ElementAnchor retains the owning document storage and records the entity generation observed when the public DOM wrapper was created. Callers resolve it to an EntityHandle only when they need to touch ECS storage.

Constructor & Destructor Documentation

◆ ElementAnchor()

donner::svg::ElementAnchor::ElementAnchor ( EntityHandle handle)
explicit

Construct an anchor from an entity handle.

Parameters
handleEntity handle to retain.

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