src/cx/tree.h

changeset 848
6456036bbb37
parent 845
2615317311b7
equal deleted inserted replaced
847:a39e410a05e6 848:6456036bbb37
60 typedef struct cx_tree_iterator_s { 60 typedef struct cx_tree_iterator_s {
61 /** 61 /**
62 * The base properties of this iterator. 62 * The base properties of this iterator.
63 */ 63 */
64 struct cx_iterator_base_s base; 64 struct cx_iterator_base_s base;
65 /**
66 * Indicates whether the subtree below the current node shall be skipped.
67 */
68 bool skip;
65 /** 69 /**
66 * Set to true, when the iterator shall visit a node again 70 * Set to true, when the iterator shall visit a node again
67 * when all it's children have been processed. 71 * when all it's children have been processed.
68 */ 72 */
69 bool visit_on_exit; 73 bool visit_on_exit;
156 /** 160 /**
157 * The base properties of this iterator. 161 * The base properties of this iterator.
158 */ 162 */
159 struct cx_iterator_base_s base; 163 struct cx_iterator_base_s base;
160 /** 164 /**
165 * Indicates whether the subtree below the current node shall be skipped.
166 */
167 bool skip;
168 /**
161 * Offset in the node struct for the children linked list. 169 * Offset in the node struct for the children linked list.
162 */ 170 */
163 ptrdiff_t loc_children; 171 ptrdiff_t loc_children;
164 /** 172 /**
165 * Offset in the node struct for the next pointer. 173 * Offset in the node struct for the next pointer.
212 q = next; 220 q = next;
213 } 221 }
214 } 222 }
215 223
216 /** 224 /**
225 * Advises the iterator to skip the subtree below the current node and
226 * also continues the current loop.
227 *
228 * @param iterator the iterator
229 */
230 #define cxTreeIteratorContinue(iterator) (iterator).skip = true; continue
231
232 /**
233 * Advises the visitor to skip the subtree below the current node and
234 * also continues the current loop.
235 *
236 * @param visitor the visitor
237 */
238 #define cxTreeVisitorContinue(visitor) cxTreeIteratorContinue(visitor)
239
240 /**
217 * Links a node to a (new) parent. 241 * Links a node to a (new) parent.
218 * 242 *
219 * If the node has already a parent, it is unlinked, first. 243 * If the node has already a parent, it is unlinked, first.
220 * If the parent has children already, the node is \em prepended to the list 244 * If the parent has children already, the node is \em prepended to the list
221 * of all currently existing children. 245 * of all currently existing children.

mercurial