![]() |
cello
JUCE ValueTrees for Humans
|
Class to navigate between subtrees that are all connected together. More...
#include <cello_path.h>
Public Types | |
enum class | SearchType { query , createTarget , createAll } |
enum | SearchResult { notFound , found , created } |
Public Member Functions | |
Path (const juce::String &pathString) | |
juce::ValueTree | findValueTree (juce::ValueTree &origin, SearchType searchType, juce::UndoManager *undo=nullptr) |
Navigate the path from origin to a tree that is expected at the end of the current path specification. | |
SearchResult | getSearchResult () const |
Find out whether performing a search succeeded, and if so, needed to create a new tree. | |
Static Public Attributes | |
static const juce::String | sep { "/" } |
Path separator. | |
static const juce::String | ancestor { "^" } |
static const juce::String | parent { ".." } |
static const juce::String | current { "." } |
Class to navigate between subtrees that are all connected together.
This is designed to operate similarly to directory paths, using a slash-separated string to declare a path between a ValueTree and some other ancestor, sibling, or descendant tree that can be reached from it.
Syntax works as follows:
"child"
without additional indications, a segment refers to a child.".."
the parent of the current tree"/"
separates segments. Begin a path string with this to indicate paths beginning at the root tree."^{treeType}"
navigate to the first parent tree of this type.""
(empty path string) refers to the current tree.These work together as expected, so that "../siblingName"
would specify a sibling of the current tree, "child/grandChild</tt>" specifies a descendant tree two levels below the current one.
|
strong |
juce::ValueTree cello::Path::findValueTree | ( | juce::ValueTree & | origin, |
Path::SearchType | searchType, | ||
juce::UndoManager * | undo = nullptr ) |
Navigate the path from origin
to a tree that is expected at the end of the current path specification.
origin | Initial/"current" value tree from which to begin search |
searchType |
query
may be an invalid tree
|
inline |
Find out whether performing a search succeeded, and if so, needed to create a new tree.