typedef builtin AutoTree;
Describing an AutoTree managed tree, or node. The value of it can be a key-value set, or an array, number and string, they storage in AutoTree memory zone and their life-cycle managed by reference count.
typedef builtin TreeType;
Describing Tree Type
typedef builtin Iterator;
Describing Tree Iterator
AutoTree json_tree(char *json);
Transfer a JSON string to an AutoTree object
size_t tree_json(AutoTree tree, char *writeTo, size_t writeToSize);
Transfer a Tree to JSON
void tree_release(AutoTree tree);
Release tree node once
void tree_retain(AutoTree tree);
Retain tree node once
int tree_refcnt(AutoTree tree);
Get the reference count of node
AutoTree tree_path(AutoTree tree, char *path);
Get the specified path element of the tree
AutoTree tree_null();
Get an unique empty tree, it has infinite reference count
AutoTree tree_clone(AutoTree fromTree);
Deep copy a tree
void tree_array_append(AutoTree operation, AutoTree toAdd);
[API From 3.1.2] Add an object to the end of tree if tree type is array
void tree_array_remove(AutoTree operation, int toRemove);
[API From 3.1.2] Remove an object at the specified index of the array tree
Iterator tree_iterator(AutoTree tree);
Create iterator for a kv node or array node to foreach
int iterator_next(Iterator &iterator, char *pathNameWriteTo, int writeToSize);
Move iterator to next
void iterator_destroy(Iterator &iterator);
Destroy an iterator
TreeType tree_typeof(AutoTree tree);
Get the type of the tree node
size_t tree_arraylen(AutoTree tree);
If the node is an array, get the length of it
TreeType tree_int;
32Bit or 64Bit integer node type
TreeType tree_str;
String node type
TreeType tree_empty;
Null node type
TreeType tree_kv;
Key-value map node type
TreeType tree_array;
Array node type
TreeType tree_double;
32Bit or 64Bit float node type
typedef builtin AutoTree;
表示由AutoTree内存区管理的一棵树,或一个节点。可以是键值对、数组、字符串、整形、浮点型,其存储在AutoTree内存区并由引用计数管理。
typedef builtin TreeType;
表示树节点的类型
typedef builtin Iterator;
表示一个用于遍历树的迭代器
AutoTree json_tree(char *json);
将一个JSON字符串转换成AutoTree树
size_t tree_json(AutoTree tree, char *writeTo, size_t writeToSize);
将一棵树转换为JSON,写入writeTo
void tree_release(AutoTree tree);
为节点降低1个引用计数
void tree_retain(AutoTree tree);
为节点增加1个引用计数
int tree_refcnt(AutoTree tree);
获取节点引用计数
AutoTree tree_path(AutoTree tree, char *path);
获取树的path处元素
AutoTree tree_null();
获取一棵空树,空树在程序中唯一,引用计数无穷大
AutoTree tree_clone(AutoTree fromTree);
深拷贝一棵树
void tree_array_append(AutoTree operation, AutoTree toAdd);
[API From 3.1.2] 为类型为数组的AutoTree添加一个元素到末尾
void tree_array_remove(AutoTree operation, int toRemove);
[API From 3.1.2] 为类型为数组的AutoTree删除指定位置的元素
Iterator tree_iterator(AutoTree tree);
为一个KV节点或数组节点创建迭代器以便遍历
int iterator_next(Iterator &iterator, char *pathNameWriteTo, int writeToSize);
迭代器到下一项
void iterator_destroy(Iterator &iterator);
销毁迭代器
TreeType tree_typeof(AutoTree tree);
获取节点的类型
size_t tree_arraylen(AutoTree tree);
如果节点是数组,获取它的长度
TreeType tree_int;
32或64位整数节点类型
TreeType tree_empty;
空节点类型
TreeType tree_array;
数组节点类型
TreeType tree_double;
32位或64位浮点数节点类型