|
using | Predicate = std::function<bool (juce::ValueTree)> |
|
using | Comparison = std::function<int (const juce::ValueTree&, const juce::ValueTree&)> |
|
|
| Query (const juce::Identifier &resultType=Result) |
| Construct a new Query object.
|
|
| Query (Predicate filter, const juce::Identifier &resultType=Result) |
| Construct a new Query object that has a single filter predicate ready to run.
|
|
| Query (const Query &)=default |
|
Query & | operator= (const Query &)=default |
|
| Query (Query &&)=default |
|
Query & | operator= (Query &&)=default |
|
Query & | addFilter (Predicate filter) |
| Append a filter predicate to the end of our list; these are executed in the sequence they're added, and we stop testing at the first filter that returns false.
|
|
juce::ValueTree | search (juce::ValueTree tree, bool deep, bool returnFirstFound=false) const |
| Execute the query we're programmed for – iterate through the children of tree , returning a new tree of type resultType that contains a copy (either shallow or deep) of each child that fulfills the query, sorted according to the sort criteria we've been given.
|
|
Query & | addComparison (Comparison sorter) |
| Add a comparison function to the list we use to sort a list of children.
|
|
juce::ValueTree | sort (juce::ValueTree tree, juce::UndoManager *undo=nullptr, bool stableSort=false) const |
| Use the list of comparison functions to sort the tree arg into its desired order.
|
|
|
static const juce::Identifier | Result { "result" } |
| The default identifier for the query results tree.
|
|
◆ Query() [1/2]
cello::Query::Query |
( |
const juce::Identifier & | resultType = Result | ) |
|
Construct a new Query object.
- Parameters
-
resultType | type id of the ValueTree that we should return. |
◆ Query() [2/2]
cello::Query::Query |
( |
Predicate | filter, |
|
|
const juce::Identifier & | resultType = Result ) |
Construct a new Query object that has a single filter predicate ready to run.
- Parameters
-
filter | Predicate function to run. You can add additional predicates (that will be logically ANDed) with the addFilter method. |
resultType | |
◆ addComparison()
Query & cello::Query::addComparison |
( |
Comparison | sorter | ) |
|
Add a comparison function to the list we use to sort a list of children.
- Parameters
-
- Returns
- Query& so we can chain these calls together.
◆ addFilter()
Query & cello::Query::addFilter |
( |
Predicate | filter | ) |
|
Append a filter predicate to the end of our list; these are executed in the sequence they're added, and we stop testing at the first filter that returns false.
- Parameters
-
- Returns
- Query& reference to this so we can use the builder pattern.
◆ search()
juce::ValueTree cello::Query::search |
( |
juce::ValueTree | tree, |
|
|
bool | deep, |
|
|
bool | returnFirstFound = false ) const |
Execute the query we're programmed for – iterate through the children of tree
, returning a new tree of type resultType
that contains a copy (either shallow or deep) of each child that fulfills the query, sorted according to the sort criteria we've been given.
- Parameters
-
tree | ValueTree to search. |
deep | If true, the result tree will contain a deep copy of each child found. |
returnFirstFound | If true, will return a copy of the first matching child found, or an invalid tree if none was found. |
- Returns
- juce::ValueTree with query results.
◆ sort()
juce::ValueTree cello::Query::sort |
( |
juce::ValueTree | tree, |
|
|
juce::UndoManager * | undo = nullptr, |
|
|
bool | stableSort = false ) const |
Use the list of comparison functions to sort the tree arg into its desired order.
- Parameters
-
tree | Tree to sort. |
undo | optional undo manager. |
stableSort | if true, retain the current order of elements that compare as equal. This is slower, so only use it if needed. |
- Returns
- juce::ValueTree
The documentation for this class was generated from the following files: