1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-15 00:24:19 +00:00

Added an initialiser list based ValueTree constructor

This commit is contained in:
Tom Poole 2018-01-19 16:10:35 +00:00
parent e690350df3
commit 4c44d96fdf
2 changed files with 60 additions and 0 deletions

View file

@ -589,6 +589,20 @@ ValueTree::ValueTree (const Identifier& type) : object (new ValueTree::SharedOb
jassert (type.toString().isNotEmpty()); // All objects must be given a sensible type name!
}
#if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS
ValueTree::ValueTree (const Identifier& type,
std::initializer_list<std::pair<Identifier, var>> properties,
std::initializer_list<ValueTree> subTrees)
: ValueTree (type)
{
for (auto& prop : properties)
setProperty (prop.first, prop.second, nullptr);
for (auto& tree : subTrees)
addChild (tree, -1, nullptr);
}
#endif
ValueTree::ValueTree (SharedObject* so) noexcept : object (so)
{
}