This is a little experimental, but I thought I’d share it now anyway.
Source zip: ValueFinder_v01.zip
[EDIT: fixed a bug affecting the main algorithm]
EDIT: Mirror (if dropbox is down)
There are two sets of files here. The base stuff is in ValueFinder.h/cpp. What this provides is a set of base classes for creating a system that can search through a value tree according to some custom configuration. The flow of it is based on XPath (the XML Path language), although the base ValueFinder doesn’t actually implement any real behaviour - it holds the algorithms and types for building sets of nodes and applying filters to get to an end set of results from a given context node.
I’ve only just got that base framework together, so have quickly slapped together a ‘BasicValueFinder’ to demonstrate it. This takes a simple String path to point to a Value or set of ValueTrees from a given starting point.
Set the path with myFinder.setPath(), and then call myFinder.find(tree) with a node from the tree.
e.g. consider this data…
<Rooty>
<Node>
<Frog Cardigan="0"/>
</Node>
<OTHER>
<Sub index="0"/>
<Sub index="1"/>
</OTHER>
<NOTHER>
<T0 index="0"/>
<T1 index="1"/>
<T2 index="2"/>
</NOTHER>
</Rooty>
The path “/OTHER” would return the node that is a child of the root node.
The path “/NOTHER/[1]” would return the node
etc…
if it starts with a ‘/’ it searches from the root, else the current node.
if the path step has a number in square brackets, it means an index
if the last step starts with an ‘@’, it refers to a property [although, tbh, i haven’t tested that yet ;)]
Oh, and the names can use normal wildcards too.
This is uber basic though, and with absolutely minimal checking or effort! :-o
The rules for this particular path parsing system are handled in BasicValueFinder.cpp - if you look at how that works, it should be reasonably straightforward. If you want to understand more about it, have a look at the XPath spec… [fwiw, if you do, what xpath calls ‘predicates’ i’ve called ‘rules’, and the ‘node test’ is what the TreeSelectorStep’s virtual function is doing]
It’s probably got some bugs in, I’ve only just got it working, but it’s got potential to be megauseful so thought I’d share it now. Feel free to start hacking it up or putting together your own more complex path system - there is a hell of a lot you can do with it.
Other thoughts… it’ll be easy to add functionality to the base class so these searches can be performed asynchronously. I actually wrote that part automatically already but took it out for now as i couldn’t be arsed testing any of that yet! 
