44 extern "C" { |
44 extern "C" { |
45 #endif |
45 #endif |
46 |
46 |
47 /** |
47 /** |
48 * When entering a node. |
48 * When entering a node. |
|
49 * |
|
50 * When this is the first sibling, source is the parent, otherwise it is the previous child. |
49 */ |
51 */ |
50 #define CX_TREE_ITERATOR_ENTER 0x1 |
52 #define CX_TREE_ITERATOR_ENTER 0x1 |
51 /** |
53 /** |
52 * When advancing to the next child. |
54 * When advancing to the next child. |
|
55 * |
|
56 * The visited node is the next child and the source is the previous child. |
|
57 * This pass is triggered after exiting the previous child and before entering the next child. |
53 */ |
58 */ |
54 #define CX_TREE_ITERATOR_NEXT_CHILD 0x2 |
59 #define CX_TREE_ITERATOR_NEXT_CHILD 0x2 |
55 /** |
60 /** |
56 * When exiting the node. |
61 * When exiting the node. |
|
62 * |
|
63 * The visited node is the node being exited and source is the previously entered node |
|
64 * (usually the last child of the exited node, unless it has no children, in which case it is the node itself). |
|
65 * When advancing to the next child in a list of siblings, the previous child is exited, first. |
57 */ |
66 */ |
58 #define CX_TREE_ITERATOR_EXIT 0x4 |
67 #define CX_TREE_ITERATOR_EXIT 0x4 |
59 |
68 |
60 /** |
69 /** |
61 * Tree iterator. |
70 * Tree iterator. |
276 * @param loc_next offset in the node struct for the next pointer |
285 * @param loc_next offset in the node struct for the next pointer |
277 * @return the new tree iterator |
286 * @return the new tree iterator |
278 * @see cxTreeIteratorDispose() |
287 * @see cxTreeIteratorDispose() |
279 */ |
288 */ |
280 __attribute__((__nonnull__)) |
289 __attribute__((__nonnull__)) |
281 CxTreeIterator cx_tree_iterate( |
290 CxTreeIterator cx_tree_iterator( |
282 void const *root, |
291 void *root, |
283 int passes, |
292 int passes, |
284 ptrdiff_t loc_children, |
293 ptrdiff_t loc_children, |
285 ptrdiff_t loc_next |
294 ptrdiff_t loc_next |
286 ); |
295 ); |
287 |
296 |