PIValueTree::readChildValue method

some child-oriented methods
allow to create JSON from single PIValueTree
This commit is contained in:
2023-04-28 14:40:55 +03:00
parent 3ab57eea88
commit f5392f8b63
5 changed files with 31 additions and 2 deletions

View File

@@ -252,6 +252,7 @@ PIJSON toJSONTree(const PIValueTree & root, PIValueTreeConversions::Options opti
PIJSON PIValueTreeConversions::toJSON(const PIValueTree & root, Options options) {
if (options[IncludeRoot]) return toJSONTree(root, options);
PIJSON ret = PIJSON::newArray();
for (const auto & c: root.children())
ret << toJSONTree(c, options);

View File

@@ -38,7 +38,8 @@ enum Option {
WithAttributes = 0x1,
WithComment = 0x2,
WithType = 0x4,
WithAll = 0xFFFFFF,
WithAll = 0xFFF,
IncludeRoot = 0x1000,
Default = WithAll
};
typedef PIFlags<Option> Options;