refactor: rename DTree to DValue
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
:sig
|
||||
DTree* unit_call(String file_name, String function_name, DTree* call_param = null)
|
||||
DValue* unit_call(String file_name, String function_name, DValue* call_param = null)
|
||||
|
||||
:params
|
||||
file_name : UCE file to load and execute
|
||||
function_name : name of the function to invoke
|
||||
call_param : optional, call parameter
|
||||
return value : DTree* returned from function
|
||||
return value : DValue* returned from function
|
||||
|
||||
:see
|
||||
>ob
|
||||
@@ -20,7 +20,7 @@ Calls an exported function inside another UCE file.
|
||||
|
||||
Use `unit_call()` when you need structured data exchange between units rather than rendered HTML output.
|
||||
|
||||
The callee must expose an `EXPORT` function whose name matches `function_name`. Arguments are passed through `call_param`, and the return value is a `DTree*` owned by the callee.
|
||||
The callee must expose an `EXPORT` function whose name matches `function_name`. Arguments are passed through `call_param`, and the return value is a `DValue*` owned by the callee.
|
||||
|
||||
`unit_call()` also understands the request-bound UCE entrypoint names:
|
||||
|
||||
@@ -31,7 +31,7 @@ The callee must expose an `EXPORT` function whose name matches `function_name`.
|
||||
- `ONCE`
|
||||
- `INIT`
|
||||
|
||||
When `function_name` matches one of those macro-style entrypoints, `unit_call()` does not look for a plain `EXPORT DTree* ...` function. Instead, it translates the name to the generated C++ symbol, uses the current `Request` context, and passes `call_param` into `context.props`, matching the normal component invocation model.
|
||||
When `function_name` matches one of those macro-style entrypoints, `unit_call()` does not look for a plain `EXPORT DValue* ...` function. Instead, it translates the name to the generated C++ symbol, uses the current `Request` context, and passes `call_param` into `context.props`, matching the normal component invocation model.
|
||||
|
||||
For `RENDER...` and `COMPONENT...`, the unit's `ONCE(Request& context)` hook is still honored automatically before the selected handler runs.
|
||||
|
||||
@@ -39,7 +39,7 @@ Example:
|
||||
|
||||
```cpp
|
||||
// export a function
|
||||
EXPORT DTree* test_func(DTree* call_param)
|
||||
EXPORT DValue* test_func(DValue* call_param)
|
||||
{
|
||||
print("HELLO FROM TEST FUNCTION");
|
||||
return(0);
|
||||
@@ -52,7 +52,7 @@ unit_call("call_file_funcs.uce", "test_func");
|
||||
Calling a named component handler through `unit_call()`:
|
||||
|
||||
```cpp
|
||||
DTree props;
|
||||
DValue props;
|
||||
props["title"] = "Diagnostics";
|
||||
props["body"] = "Ready";
|
||||
|
||||
@@ -62,7 +62,7 @@ unit_call("components/card.uce", "COMPONENT:BODY", &props);
|
||||
Calling a page render handler through `unit_call()`:
|
||||
|
||||
```cpp
|
||||
DTree props;
|
||||
DValue props;
|
||||
props["section"] = "summary";
|
||||
|
||||
unit_call("reports/summary.uce", "RENDER", &props);
|
||||
|
||||
Reference in New Issue
Block a user