1.1 --- a/src/cx/tree.h Wed Mar 20 23:35:32 2024 +0100 1.2 +++ b/src/cx/tree.h Wed Apr 03 21:22:23 2024 +0200 1.3 @@ -63,6 +63,10 @@ 1.4 */ 1.5 struct cx_iterator_base_s base; 1.6 /** 1.7 + * Indicates whether the subtree below the current node shall be skipped. 1.8 + */ 1.9 + bool skip; 1.10 + /** 1.11 * Set to true, when the iterator shall visit a node again 1.12 * when all it's children have been processed. 1.13 */ 1.14 @@ -158,6 +162,10 @@ 1.15 */ 1.16 struct cx_iterator_base_s base; 1.17 /** 1.18 + * Indicates whether the subtree below the current node shall be skipped. 1.19 + */ 1.20 + bool skip; 1.21 + /** 1.22 * Offset in the node struct for the children linked list. 1.23 */ 1.24 ptrdiff_t loc_children; 1.25 @@ -214,6 +222,22 @@ 1.26 } 1.27 1.28 /** 1.29 + * Advises the iterator to skip the subtree below the current node and 1.30 + * also continues the current loop. 1.31 + * 1.32 + * @param iterator the iterator 1.33 + */ 1.34 +#define cxTreeIteratorContinue(iterator) (iterator).skip = true; continue 1.35 + 1.36 +/** 1.37 + * Advises the visitor to skip the subtree below the current node and 1.38 + * also continues the current loop. 1.39 + * 1.40 + * @param visitor the visitor 1.41 + */ 1.42 +#define cxTreeVisitorContinue(visitor) cxTreeIteratorContinue(visitor) 1.43 + 1.44 +/** 1.45 * Links a node to a (new) parent. 1.46 * 1.47 * If the node has already a parent, it is unlinked, first.