|
|
Donner
C++20 SVG rendering library
|
Selectors may need to traverse the tree in different ways to match, and this is abstracted away using C++20 coroutines. More...
#include "donner/base/element/ElementTraversalGenerators.h"
Classes | |
| class | Promise |
| Defines and controls the behavior of the coroutine itself, by implementing methods that are called by the C++ runtime during execution of the coroutine. More... | |
Public Types | |
| using | Handle = std::coroutine_handle<Promise> |
| The internal handle used to store the coroutine, used to construct ElementTraversalGenerator from a co_yield expression. | |
| using | promise_type = Promise |
| The internal object which stores the current value. | |
Public Member Functions | |
| ElementTraversalGenerator (Handle h) | |
| Construct a generator from a coroutine handle. | |
| ElementTraversalGenerator (const ElementTraversalGenerator &)=delete | |
| Copying generators is not allowed. | |
| ElementTraversalGenerator (ElementTraversalGenerator &&other) noexcept | |
| Move constructor. | |
| ElementTraversalGenerator & | operator= (const ElementTraversalGenerator &)=delete |
| Copying generators is not allowed. | |
| ElementTraversalGenerator & | operator= (ElementTraversalGenerator &&other) noexcept |
| Move assignment. | |
| ~ElementTraversalGenerator () | |
| Destructor. | |
| bool | next () |
| Advance the generator to the next element, and return whether there is another element. | |
| T | getValue () |
| Get the current value of the generator. | |
Selectors may need to traverse the tree in different ways to match, and this is abstracted away using C++20 coroutines.
Each traversal order is a coroutine that yields elements lazily, so that the tree is traversed only as far as necessary.
|
inline |
Get the current value of the generator.
|
inline |
Advance the generator to the next element, and return whether there is another element.