aboutsummaryrefslogtreecommitdiffstats
path: root/src/tree.h
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2006-08-04 11:57:52 +0000
committerWarren Dukes <warren.dukes@gmail.com>2006-08-04 11:57:52 +0000
commit58bcdbb875354d39246370b0be71d637ecf5f5de (patch)
treee86184fb699d7018f302f25b818b008c5ccd2159 /src/tree.h
parentf33325d8e23494f7580b1040d9fd85c92d9b94bb (diff)
downloadmpd-58bcdbb875354d39246370b0be71d637ecf5f5de.tar.gz
mpd-58bcdbb875354d39246370b0be71d637ecf5f5de.tar.xz
mpd-58bcdbb875354d39246370b0be71d637ecf5f5de.zip
use the tree for the tagTracker.
git-svn-id: https://svn.musicpd.org/mpd/branches/mpd-tree@4545 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/tree.h')
-rw-r--r--src/tree.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/tree.h b/src/tree.h
index 6f53a9145..54416a065 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -22,6 +22,7 @@
typedef struct _Tree Tree;
typedef struct _TreeNode TreeNode;
typedef struct _TreeIterator TreeIterator;
+typedef struct _TreeKeyData TreeKeyData;
struct _TreeIterator
{
@@ -30,20 +31,32 @@ struct _TreeIterator
int which;
};
-typedef int (*TreeCompareDataFunction)(const void * data1, const void * data2);
-typedef void (*TreeFreeDataFunction)(void * data);
+struct _TreeKeyData
+{
+ void * key;
+ void * data;
+};
+
+typedef int (*TreeCompareKeyFunction)(const void * key1, const void * key2);
+typedef void (*TreeFreeFunction)(void * data);
+
+Tree * MakeTree(TreeCompareKeyFunction compareFunc,
+ TreeFreeFunction freeKey,
+ TreeFreeFunction freeData);
+void FreeTree(Tree * tree);
-Tree * MakeTree(TreeCompareDataFunction compareFunc,
- TreeFreeDataFunction freeData);
+int GetTreeSize(Tree * tree);
-void SetTreeIteratorToBegin(TreeIterator * iter, Tree * tree);
+void SetTreeIteratorToBegin(Tree * tree, TreeIterator * iter);
int IsTreeIteratorAtEnd(const TreeIterator * iter);
void IncrementTreeIterator(TreeIterator * iter);
-void * GetDataFromTreeIterator(TreeIterator * iter);
+TreeKeyData GetTreeKeyData(TreeIterator * iter);
-int InsertIntoTree(Tree * tree, void * data);
+int InsertInTree(Tree * tree, void * key, void * data);
+int RemoveFromTreeByKey(Tree * tree, void * key);
+void RemoveFromTreeByIterator(Tree * tree, TreeIterator * iter);
-int DeleteFromTree(Tree * tree, void * data);
+int FindInTree(Tree * tree, void * key, TreeIterator * iter /* can be NULL */);
#endif