This commit is contained in:
Udo 2021-11-15 09:18:00 +00:00
parent 8edacfb64f
commit 80093190d4
3 changed files with 98 additions and 0 deletions

0
src/lib/compile_unit.h Normal file
View File

54
test/dtree.uce Normal file
View File

@ -0,0 +1,54 @@
RENDER()
{
DTree t;
<>
<link rel="stylesheet" href='style.css'></link>
<h1>
<a href="index.uce">UCE Test</a>:
DTree
</h1>
Value Types:
<pre><?
t.set("string test");
echo(string("string test: ") + t.to_string()+"\n");
t.set(true);
echo(string("bool test: ") + t.to_string()+"\n");
t.set(1234.5678);
echo(string("float test: ") + t.to_string()+"\n");
t.set(&t);
echo(string("pointer test: ") + t.to_string()+"\n");
?></pre>
Tree:
<pre><?
t.key("a")->set("valueA");
t.key("b")->set("valueB");
t.key("c")->key("c-d")->set("valueCD");
t.key("c")->key("c-e")->set("valueCE");
t.key("c")->key("c-f")->set(&t);
t.key("g")->key("g-h")->key("h-i")->set("valueHI");
t["g"]["x"]["y1"] = "XYZ1";
t["g"]["x"]["y2"] = &t;
t["g"]["x"]["y3"] = time();
t["g"]["x"]["y4"] = "Ünicödä";
echo(var_dump(t));
?></pre>
Params
<pre><?= var_dump(context->params) ?></pre>
</>
}

44
test/json.uce Normal file
View File

@ -0,0 +1,44 @@
RENDER()
{
DTree t;
<>
<link rel="stylesheet" href='style.css'></link>
<h1>
<a href="index.uce">UCE Test</a>:
DTree/JSON
</h1>
JSON:
<pre style="white-space: pre-wrap"><?
t.key("a")->set("valueA");
t.key("b")->set("valueB");
t.key("c")->key("c-d")->set("valueCD");
t.key("c")->key("c-e")->set("valueCE");
t.key("c")->key("c-f")->set(&t);
t.key("g")->key("g-h")->key("h-i")->set("valueHI");
t["g"]["x"]["y1"] = "XYZ1";
t["g"]["x"]["y2"] = &t;
t["g"]["x"]["y3"] = time();
t["g"]["x"]["y4"] = "Ünicödä";
string j;
echo(j = json_encode(t));
?></pre>
Parsed:
<pre><?
echo(var_dump(json_decode("1")));
?></pre>
Params
<pre><?= var_dump(context->params) ?></pre>
</>
}