diff options
author | David Robillard <d@drobilla.net> | 2023-05-10 16:59:02 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-11 00:44:30 -0400 |
commit | 71b215560249747a2f1c3d16f9d372e5b668c45e (patch) | |
tree | bfb0fc8eecee6c28c00f159f6ec871b5859bedb5 /include/zix/tree.h | |
parent | 67526c25f4a751be27d2f9eed38d07fe52342aa5 (diff) | |
download | zix-71b215560249747a2f1c3d16f9d372e5b668c45e.tar.gz zix-71b215560249747a2f1c3d16f9d372e5b668c45e.tar.bz2 zix-71b215560249747a2f1c3d16f9d372e5b668c45e.zip |
Improve reference documentation
Diffstat (limited to 'include/zix/tree.h')
-rw-r--r-- | include/zix/tree.h | 70 |
1 files changed, 47 insertions, 23 deletions
diff --git a/include/zix/tree.h b/include/zix/tree.h index 1b5c4ec..0ad37f2 100644 --- a/include/zix/tree.h +++ b/include/zix/tree.h @@ -19,12 +19,14 @@ ZIX_BEGIN_DECLS @{ */ +/** + @defgroup zix_tree_setup Setup + @{ +*/ + /// A balanced binary search tree typedef struct ZixTreeImpl ZixTree; -/// An iterator over a @ref ZixTree -typedef struct ZixTreeNodeImpl ZixTreeIter; - /// Function for comparing two Tree elements typedef int (*ZixTreeCompareFunc)(const void* ZIX_UNSPECIFIED a, const void* ZIX_UNSPECIFIED b, @@ -54,28 +56,14 @@ ZIX_PURE_API size_t zix_tree_size(const ZixTree* ZIX_NONNULL t); -/// Insert the element `e` into `t` and point `ti` at the new element -ZIX_API -ZixStatus -zix_tree_insert(ZixTree* ZIX_NONNULL t, - void* ZIX_UNSPECIFIED e, - ZixTreeIter* ZIX_NULLABLE* ZIX_NULLABLE ti); - -/// Remove the item pointed at by `ti` from `t` -ZIX_API -ZixStatus -zix_tree_remove(ZixTree* ZIX_NONNULL t, ZixTreeIter* ZIX_NONNULL ti); - /** - Set `ti` to an element equal to `e` in `t`. - - If no such item exists, `ti` is set to NULL. + @} + @defgroup zix_tree_iteration Iteration + @{ */ -ZIX_API -ZixStatus -zix_tree_find(const ZixTree* ZIX_NONNULL t, - const void* ZIX_UNSPECIFIED e, - ZixTreeIter* ZIX_NULLABLE* ZIX_NONNULL ti); + +/// An iterator over a @ref ZixTree +typedef struct ZixTreeNodeImpl ZixTreeIter; /// Return the data associated with the given tree item ZIX_PURE_API @@ -124,6 +112,42 @@ zix_tree_iter_prev(ZixTreeIter* ZIX_NULLABLE i); /** @} + @defgroup zix_tree_modification Modification + @{ +*/ + +/// Insert the element `e` into `t` and point `ti` at the new element +ZIX_API +ZixStatus +zix_tree_insert(ZixTree* ZIX_NONNULL t, + void* ZIX_UNSPECIFIED e, + ZixTreeIter* ZIX_NULLABLE* ZIX_NULLABLE ti); + +/// Remove the item pointed at by `ti` from `t` +ZIX_API +ZixStatus +zix_tree_remove(ZixTree* ZIX_NONNULL t, ZixTreeIter* ZIX_NONNULL ti); + +/** + @} + @defgroup zix_tree_searching Searching + @{ +*/ + +/** + Set `ti` to an element equal to `e` in `t`. + + If no such item exists, `ti` is set to NULL. +*/ +ZIX_API +ZixStatus +zix_tree_find(const ZixTree* ZIX_NONNULL t, + const void* ZIX_UNSPECIFIED e, + ZixTreeIter* ZIX_NULLABLE* ZIX_NONNULL ti); + +/** + @} + @} */ ZIX_END_DECLS |