Closed russel closed 6 years ago
For the most part, it's as simple as Node(someArray)
or Node(someScalar)
. You can use (associative/regular) arrays of nodes for more complicated things.
This one is as simple as
auto node = Node(["use_opengl": true]);
or
auto node = Node(string[string].init);
node.add("use_opengl", true);
That second example is looking a bit ugly... Perhaps it would be a good idea to skip the mapping check if the node is empty and allow the use of auto node = Node();
in that example instead.
Opened #144 to make the latter example easier.
I believe all the examples show starting by reading a YAML file to create a Node tree and then fiddling with the tree before dumping it out. Are there any simple examples of building a Node tree programmatically from scratch; the yaml_gen example is hard to follow – but this maybe that I am not trying hard enough.
A small example. A loaded YAML results in:
How might I create programmatically this Node tree?