Type (Path CDEnvC Header / autotree.h)

AutoTree

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.

Article - About this type


Using In

  void ccd_ui_attach(UIContainer view, AutoTree window);
    Add components tree to window. Specially, If current code running in desktop widget mode, calling this method will render the widget directly and Never Return

  AutoTree ccd_ui_id(AutoTree arg1, char *id);
    Search recursively, return the first node where id equals to given id

  AutoTree http_send(char *url, HttpMethod method, AutoTree args, AutoTree header);
    Send a http request

  AutoTree http_send_secure(char *url, AutoTree args);
    Send a http request to C Code Develop HTTP APIs, attach login info

  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

  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

  AutoTree text(char *text);
    UI Item: Display given text

  AutoTree label(char *text);
    UI Item: Display given text

  AutoTree labeli(long n);
    UI Item: Display given integer

  AutoTree labelf(double n);
    UI Item: Display given double

  AutoTree input(char *placeHolder);
    UI Item: Display Input Field

  AutoTree inputa(char *placeHolder, Action action);
    UI Item: Display Input Field, When text changed call action

  AutoTree button(char *text, Action action);
    UI Item: Display a button, action pointer will call on click time

  AutoTree spacer();
    UI Item: Fill the x or y axis space

  AutoTree spacerm(double minSpace);
    UI Item: Fill the x or y axis space, and given a minium fill size if more than one spacer in same direction

  AutoTree vstack(AutoTree mutating);
    UI Item: A container that arrange sub items in y-axis

  AutoTree hstack(AutoTree mutating);
    UI Item: A container that arrange sub items in x-axis

  AutoTree zstack(AutoTree mutating);
    UI Item: A container that arrange sub items in z-axis

  AutoTree list(AutoTree mutating);
    UI Item: A container list that arrange sub items in y-axis

  AutoTree component(AutoTree mutating);
    UI Component: The container that belongs to item and belongs to the component. In the Action function, the root parameter is the first root component element that triggers the Action.

  AutoTree view(AutoTree mutating);
    UI Item: Blank Item

  AutoTree request(char *tags);

  AutoTree buildMainView();

类型 (属于 CDEnvC拓展 / autotree.h)

AutoTree

typedef builtin AutoTree;

表示由AutoTree内存区管理的一棵树,或一个节点。可以是键值对、数组、字符串、整形、浮点型,其存储在AutoTree内存区并由引用计数管理。

关于此类型的介绍文章


被用于

  void ccd_ui_attach(UIContainer view, AutoTree window);
    将组件树附加到窗口区域,特别的,如果当前以桌面小组件形式运行代码,则不论view参数如何,使用给定的window参数渲染组件树,并且当前进程在此函数永不返回

  AutoTree ccd_ui_id(AutoTree arg1, char *id);
    以先序递归向下查找第一个id字段为给定值的节点

  AutoTree http_send(char *url, HttpMethod method, AutoTree args, AutoTree header);
    发送Http请求

  AutoTree http_send_secure(char *url, AutoTree args);
    向C Code Develop HTTP APIs发送Http请求,附带登陆参数

  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节点或数组节点创建迭代器以便遍历

  TreeType tree_typeof(AutoTree tree);
    获取节点的类型

  size_t tree_arraylen(AutoTree tree);
    如果节点是数组,获取它的长度

  AutoTree text(char *text);
    元素: 展示文本

  AutoTree label(char *text);
    元素: 展示文本

  AutoTree labeli(long n);
    元素: 展示整数数字

  AutoTree labelf(double n);
    元素: 展示浮点数

  AutoTree input(char *placeHolder);
    元素: 展示输入框

  AutoTree inputa(char *placeHolder, Action action);
    元素: 展示输入框,当输入内容改变时触发事件

  AutoTree button(char *text, Action action);
    元素: 展示一个可点击的按钮,在用户点击时action函数指针被调用

  AutoTree spacer();
    元素: 填充X或Y方向剩余的空间,如同方向有多个则平分剩余空间

  AutoTree spacerm(double minSpace);
    元素: 填充X或Y方向剩余的空间,并给定一个最少填充大小(当多个同方向space出现时计算比例)

  AutoTree vstack(AutoTree mutating);
    元素: 按竖直方向排列子元素的容器

  AutoTree hstack(AutoTree mutating);
    元素: 按水平方向排列子元素的容器

  AutoTree zstack(AutoTree mutating);
    元素: 按Z方向排列子元素的容器

  AutoTree list(AutoTree mutating);
    元素: 按竖直方向排列列表的容器

  AutoTree component(AutoTree mutating);
    组件: 属于元素且属于组件的容器,在Action函数中root参数为触发该Action的第一个根component元素

  AutoTree view(AutoTree mutating);
    元素: 空白元素

  AutoTree request(char *tags);

  AutoTree buildMainView();