Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
TreeComponent.h File Reference
#include "donner/base/EcsRegistry.h"
#include "donner/base/RcString.h"
#include "donner/base/SmallVector.h"
#include "donner/base/Utils.h"
#include "donner/base/xml/XMLQualifiedName.h"
Include dependency graph for TreeComponent.h:
This graph shows which files directly or indirectly include this file:

Classes

class  donner::components::TreeComponent
 Stores the tree structure for an XML element, such as the parent, children, and siblings. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

template<typename Func>
void donner::components::ForAllChildrenRecursivePruned (EntityHandle handle, const Func &func)
 Iterate over the given entity and its descendants recursively, calling the given functor for each and skipping the descendants of any entity the functor rejects.
template<typename Func>
void donner::components::ForAllChildrenRecursive (EntityHandle handle, const Func &func)
 Iterate over the given entity and its descendants recursively, calling the given functor for each.
template<typename Func>
void donner::components::ForAllChildren (EntityHandle handle, const Func &func)
 Iterate over all direct children of the given entity and call the given functor for each child.

Function Documentation

◆ ForAllChildren()

template<typename Func>
void donner::components::ForAllChildren ( EntityHandle handle,
const Func & func )

Iterate over all direct children of the given entity and call the given functor for each child.

Iterates in pre-order traversal order.

Parameters
handleEntity handle to iterate over.
funcFunctor to call for each child.

◆ ForAllChildrenRecursive()

template<typename Func>
void donner::components::ForAllChildrenRecursive ( EntityHandle handle,
const Func & func )

Iterate over the given entity and its descendants recursively, calling the given functor for each.

Iterates in pre-order traversal order.

handle itself is visited first, which is why a caller that wants the descendants alone compares against it. Whatever func returns is discarded, so returning early from it skips the current entity only; use donner::components::ForAllChildrenRecursivePruned to skip a whole subtree.

Parameters
handleEntity handle to iterate over, which is visited first.
funcFunctor to call for each entity.

◆ ForAllChildrenRecursivePruned()

template<typename Func>
void donner::components::ForAllChildrenRecursivePruned ( EntityHandle handle,
const Func & func )

Iterate over the given entity and its descendants recursively, calling the given functor for each and skipping the descendants of any entity the functor rejects.

Iterates in pre-order traversal order.

Returning false from func prunes: neither that entity's children nor any deeper descendant is visited. Returning early from a donner::components::ForAllChildrenRecursive callback instead skips only the current entity, so a caller whose condition covers a whole subtree (for example display: none, which removes the subtree from the rendering tree) has to use this form.

Parameters
handleEntity handle to iterate over, which is visited first.
funcFunctor to call for each entity, returning whether to descend into its children.