src/cx/tree.h

branch
feature/tree_add
changeset 867
471c714d5b6f
parent 865
4b325b639117
child 871
e29c1f96646d
equal deleted inserted replaced
866:1f636de4a63f 867:471c714d5b6f
547 * 547 *
548 * When a location is found, the \p cfunc will be invoked with \p cdata and, 548 * When a location is found, the \p cfunc will be invoked with \p cdata and,
549 * in case \p sfunc returned a direct match, the already found node. 549 * in case \p sfunc returned a direct match, the already found node.
550 * 550 *
551 * If \p cfunc returns a new node pointer, it will be linked into the tree. 551 * If \p cfunc returns a new node pointer, it will be linked into the tree.
552 * Otherwise, this function just returns the found node. 552 * When \p sfunc returned a positive integer, the new node will be linked as a
553 * child. When \p sfunc returned zero and the found node has a parent, the new
554 * node will be added as sibling - otherwise, the new node will be the new root.
555 * When \p sfunc returned a negative value, the new node will always be the
556 * new root.
557 *
558 * If \p cfunc returns an existing node found by \p sfunc, this function just
559 * returns the found node without modifying the tree.
553 * 560 *
554 * This function may return \c NULL when \p cfunc tries to allocate a new node 561 * This function may return \c NULL when \p cfunc tries to allocate a new node
555 * but fails to do so. 562 * but fails to do so.
556 * 563 *
557 * The \p root argument shall point to a location where the pointer to the root 564 * The \p root argument shall point to a location where the pointer to the root
558 * node is stored. The pointer to the root node may be \c NULL in which case 565 * node is stored. The pointer to the root node may be \c NULL in which case
559 * this function will instantly create a new node and write the location to 566 * this function will instantly create a new node and write the location to
560 * \p root. On the other hand, if \p sfunc returns a negative integer for 567 * \p root.
561 * \c *root, the newly created node will be the new root node.
562 * 568 *
563 * Multiple elements can be added more efficiently with 569 * Multiple elements can be added more efficiently with
564 * #cx_tree_add_array() or #cx_tree_add_iter(). 570 * #cx_tree_add_array() or #cx_tree_add_iter().
565 * 571 *
566 * @param src a pointer to the data 572 * @param src a pointer to the data

mercurial