bWidgets
Core widget toolkit designed for Blender
Iterators.h
Go to the documentation of this file.
1#pragma once
2
3#include <iterator>
4
5#include "Node.h"
6#include "ScreenGraph.h"
7
8namespace bWidgets {
9namespace bwScreenGraph {
10
26 public:
30
31 // Delete copy but keep move constructor for now. We store a parent path
32 // below which would require deep copying. So prefer move over copy.
35
36 auto operator!=(const PreOrderIterator&) const -> bool;
37 auto operator*() -> Node&;
39
40 private:
41 void triggerIterationEnd();
42 bool hasExceededLastSibling();
43
44 union {
46 Node::ChildList::iterator node_iter;
47 };
48
49 Node* root = nullptr;
50 bool is_root = true;
51 // Ancestors up to (but excluding!) node that started iteration.
52 std::list<Node::ChildList::iterator> ancestors;
53};
54
55/* PreOrderIterator is the default iterator (implicitly chosen when passing a
56 * node as range-expression for range-based foor loops) */
57auto begin(Node&) -> PreOrderIterator;
58auto end(Node&) -> PreOrderIterator;
59auto begin(ScreenGraph& screen_graph) -> PreOrderIterator;
60auto end(ScreenGraph& screen_graph) -> PreOrderIterator;
61
62} // namespace bwScreenGraph
63} // namespace bWidgets
The base data-structure for a screen-graph node.
Definition: Node.h:36
Iterator for pre-order (depth-first) traversal.
Definition: Iterators.h:25
auto operator!=(const PreOrderIterator &) const -> bool
Definition: Iterators.cc:36
Node * node
Definition: Iterators.h:45
auto operator++() -> PreOrderIterator &
Definition: Iterators.cc:66
PreOrderIterator(const PreOrderIterator &)=delete
PreOrderIterator()
Definition: Iterators.cc:7
Node::ChildList::iterator node_iter
Definition: Iterators.h:46
auto operator*() -> Node &
Definition: Iterators.cc:42
~PreOrderIterator()
Definition: Iterators.cc:11
auto end(Node &) -> PreOrderIterator
Definition: Iterators.cc:116
auto begin(Node &node) -> PreOrderIterator
Definition: Iterators.cc:112
Definition: bwContext.h:3