I have Track
that holds Item
. Should the track class inherit ValueTreeObjectList
or should I create a separate class called ItemList
and then put a member of ItemList in Track?
Also, there’s a few compile errors.
BAD
void rebuildObjects()
{
jassert (objects.size() == 0); // must only call this method once at construction
for (const auto& v : parent)
if (isSuitableType (v))
if (ObjectType* newObject = createNewObject (v))
objects.add (newObject);
}
GOOD
void rebuildObjects()
{
jassert(objects.size() == 0); // must only call this method once at construction
for (int i = 0; i < parent.getNumChildren(); ++i)
{
auto& v = parent.getChild(i);
if (isSuitableType(v))
if (ObjectType * newObject = createNewObject(v))
objects.add(newObject);
}
}
And there’s a few places that const is used which cannot be compiled because CachedValue requires non-const for setting its value tree property.
Edit: At the same time actually I do need the ability to go through all items regardless of the track, make changes like moving item to another track, deleting items between a range of time, these things are track-independent. How should I structure my classes in that case?
I’m running into an issue where the constructor requires a value tree: