summaryrefslogtreecommitdiffstats
path: root/include/zix/tree.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/zix/tree.h')
-rw-r--r--include/zix/tree.h70
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