|
|
Donner
C++20 SVG rendering library
|
Helper to guard against recursion when evaluating references. More...
#include "donner/svg/graph/RecursionGuard.h"
Public Member Functions | |
| RecursionGuard ()=default | |
| efault constructor. | |
| bool | hasRecursion (Entity entity) const |
| Returns true if this entity has been seen before, indicating a cycle has been detected. | |
| void | add (Entity entity) |
| Add the given entity to the set of entities that have been seen. | |
| RecursionGuard | with (Entity entity) const |
| Create a new RecursionGuard with the given entity added to the set of entities that have been seen. | |
Helper to guard against recursion when evaluating references.
This is used to prevent infinite recursion when reference hierarchies contain cycles.
Usage:
There is also a shorthand when passing a RecursionGuard as a parameter:
|
inline |
Add the given entity to the set of entities that have been seen.
| entity | Entity to add. |
|
inline |
Returns true if this entity has been seen before, indicating a cycle has been detected.
| entity | Entity to check. |
|
inline |
Create a new RecursionGuard with the given entity added to the set of entities that have been seen.
| entity | Entity to add. |