libdtree ======== The last C datastructure library you will use. Provides a versatile tree-like structure that can act as lists, sets and more! Many features are still experimental and the API might change at any point so be aware. How to build ============ libdyntree is built with cmake. It has no external dependencies and compilation has been tested with gcc 6+ on Linx systems. It was tested with C99 but shouldbe able to compile with ANSI C as well. ```console $> mkdir build; cd build $> cmake .. $> make -j 2 ``` This will create a `.so` file. If you require a static object, you can change the linking behaviour in the `CMakeLists.txt` file. ## How to use Everything resolves around `dtree` objects and providing fields to API functions. Generally, memory is managed for you by libdtree: ```C dt_err err; dtree *data; err = dtree_malloc(&data); ``` Alternatively you can use the shortcut alloc functions provided: ```C dtree *str_node = dtree_alloc_literal("My string in this node!"); dtree *num_node = dtree_alloc_numeral(1337); dtree *key, *val; dtree *pair_node = dtree *dtree_allocpair_new(&key, &val); ``` Nodes can change their type, provided they get reset before assigning a different type of data to them first. The available types are listed below: - Unset - Literal - Numerical - Recursive - Pair - Pointer Some more advanced functions include a getter, a search, a keyed search as well as tree merge and split functions. Please consult the wiki for details on how to use some of these functions. ## License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. I hope you enjoy ♥