|
tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications
« « « Anklang Documentation |
A CachedValue that can take a std::function to constrain its value. More...
#include "tracktion_ConstrainedCachedValue.h"
Public Member Functions | |
| ConstrainedCachedValue () | |
| Default constructor. | |
| ConstrainedCachedValue (juce::ValueTree &tree, const juce::Identifier &propertyID, juce::UndoManager *undoManager) | |
| Constructor. | |
| ConstrainedCachedValue (juce::ValueTree &tree, const juce::Identifier &propertyID, juce::UndoManager *undoManager, const Type &defaultToUse) | |
| Constructor. | |
| void | setConstrainer (std::function< Type(Type)> constrainerToUse) |
| Sets a std::function to use to constain the value. | |
| operator Type () const noexcept | |
| Returns the current value of the property. | |
| Type | get () const noexcept |
| Returns the current value of the property. | |
| Type & | operator* () noexcept |
| Dereference operator. | |
| Type * | operator-> () noexcept |
| Dereference operator. | |
| template<typename OtherType > | |
| bool | operator== (const OtherType &other) const |
| Returns true if the current value of the property (or the fallback value) is equal to other. | |
| template<typename OtherType > | |
| bool | operator!= (const OtherType &other) const |
| Returns true if the current value of the property (or the fallback value) is not equal to other. | |
| juce::Value | getPropertyAsValue () |
| Returns the current property as a Value object. | |
| bool | isUsingDefault () const |
| Returns true if the current property does not exist and the CachedValue is using the fallback default value instead. | |
| Type | getDefault () const |
| Returns the current fallback default value. | |
| ConstrainedCachedValue & | operator= (const Type &newValue) |
| Sets the property. | |
| void | setValue (const Type &newValue, juce::UndoManager *undoManagerToUse) |
| Sets the property. | |
| void | resetToDefault () |
| Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead. | |
| void | resetToDefault (juce::UndoManager *undoManagerToUse) |
| Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead. | |
| void | setDefault (const Type &value) |
| Resets the fallback default value. | |
| void | referTo (juce::ValueTree &tree, const juce::Identifier &property, juce::UndoManager *) |
| Makes the CachedValue refer to the specified property inside the given ValueTree. | |
| void | referTo (juce::ValueTree &tree, const juce::Identifier &property, juce::UndoManager *, const Type &defaultVal) |
| Makes the CachedValue refer to the specified property inside the given ValueTree, and specifies a fallback value to use if the property does not exist. | |
| void | forceUpdateOfCachedValue () |
| Force an update in case the referenced property has been changed from elsewhere. | |
| juce::ValueTree & | getValueTree () noexcept |
| Returns a reference to the ValueTree containing the referenced property. | |
| const juce::Identifier & | getPropertyID () const noexcept |
| Returns the property ID of the referenced property. | |
A CachedValue that can take a std::function to constrain its value.
Definition at line 19 of file tracktion_ConstrainedCachedValue.h.
| tracktion::engine::ConstrainedCachedValue< Type >::ConstrainedCachedValue | ( | ) |
Default constructor.
Creates a default CachedValue not referring to any property. To initialise the object, call one of the referTo() methods.
Definition at line 174 of file tracktion_ConstrainedCachedValue.h.
| tracktion::engine::ConstrainedCachedValue< Type >::ConstrainedCachedValue | ( | juce::ValueTree & | tree, |
| const juce::Identifier & | propertyID, | ||
| juce::UndoManager * | undoManager | ||
| ) |
Constructor.
Creates a CachedValue referring to a Value property inside a ValueTree. If you use this constructor, the fallback value will be a default-constructed instance of Type.
| tree | The ValueTree containing the property |
| propertyID | The identifier of the property |
| undoManager | The UndoManager to use when writing to the property |
Definition at line 177 of file tracktion_ConstrainedCachedValue.h.
| tracktion::engine::ConstrainedCachedValue< Type >::ConstrainedCachedValue | ( | juce::ValueTree & | tree, |
| const juce::Identifier & | propertyID, | ||
| juce::UndoManager * | undoManager, | ||
| const Type & | defaultToUse | ||
| ) |
Constructor.
Creates a default Cached Value referring to a Value property inside a ValueTree, and specifies a fallback value to use if the property does not exist.
| tree | The ValueTree containing the property |
| propertyID | The identifier of the property |
| undoManager | The UndoManager to use when writing to the property |
| defaultToUse | The fallback default value to use. |
Definition at line 185 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::forceUpdateOfCachedValue | ( | ) |
Force an update in case the referenced property has been changed from elsewhere.
Note: The CachedValue is a ValueTree::Listener and therefore will be informed of changes of the referenced property anyway (and update itself). But this may happen asynchronously. forceUpdateOfCachedValue() forces an update immediately.
Definition at line 263 of file tracktion_ConstrainedCachedValue.h.
|
noexcept |
Returns the current value of the property.
If the property does not exist, returns the fallback default value.
Definition at line 71 of file tracktion_ConstrainedCachedValue.h.
| Type tracktion::engine::ConstrainedCachedValue< Type >::getDefault | ( | ) | const |
Returns the current fallback default value.
Definition at line 103 of file tracktion_ConstrainedCachedValue.h.
| juce::Value tracktion::engine::ConstrainedCachedValue< Type >::getPropertyAsValue | ( | ) |
Returns the current property as a Value object.
Definition at line 206 of file tracktion_ConstrainedCachedValue.h.
|
noexcept |
Returns the property ID of the referenced property.
Definition at line 147 of file tracktion_ConstrainedCachedValue.h.
|
noexcept |
Returns a reference to the ValueTree containing the referenced property.
Definition at line 144 of file tracktion_ConstrainedCachedValue.h.
| bool tracktion::engine::ConstrainedCachedValue< Type >::isUsingDefault | ( | ) | const |
Returns true if the current property does not exist and the CachedValue is using the fallback default value instead.
Definition at line 212 of file tracktion_ConstrainedCachedValue.h.
|
noexcept |
Returns the current value of the property.
If the property does not exist, returns the fallback default value.
This is the same as calling get().
Definition at line 66 of file tracktion_ConstrainedCachedValue.h.
| bool tracktion::engine::ConstrainedCachedValue< Type >::operator!= | ( | const OtherType & | other | ) | const |
Returns true if the current value of the property (or the fallback value) is not equal to other.
Definition at line 91 of file tracktion_ConstrainedCachedValue.h.
|
noexcept |
Dereference operator.
Provides direct access to the property.
Definition at line 74 of file tracktion_ConstrainedCachedValue.h.
|
noexcept |
Dereference operator.
Provides direct access to members of the property if it is of object type.
Definition at line 79 of file tracktion_ConstrainedCachedValue.h.
| ConstrainedCachedValue< Type > & tracktion::engine::ConstrainedCachedValue< Type >::operator= | ( | const Type & | newValue | ) |
Sets the property.
This will actually modify the property in the referenced ValueTree.
Definition at line 218 of file tracktion_ConstrainedCachedValue.h.
| bool tracktion::engine::ConstrainedCachedValue< Type >::operator== | ( | const OtherType & | other | ) | const |
Returns true if the current value of the property (or the fallback value) is equal to other.
Definition at line 85 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::referTo | ( | juce::ValueTree & | tree, |
| const juce::Identifier & | property, | ||
| juce::UndoManager * | um | ||
| ) |
Makes the CachedValue refer to the specified property inside the given ValueTree.
Definition at line 251 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::referTo | ( | juce::ValueTree & | tree, |
| const juce::Identifier & | property, | ||
| juce::UndoManager * | um, | ||
| const Type & | defaultVal | ||
| ) |
Makes the CachedValue refer to the specified property inside the given ValueTree, and specifies a fallback value to use if the property does not exist.
Definition at line 257 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::resetToDefault | ( | ) |
Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead.
Definition at line 238 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::resetToDefault | ( | juce::UndoManager * | undoManagerToUse | ) |
Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead.
Definition at line 244 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::setConstrainer | ( | std::function< Type(Type)> | constrainerToUse | ) |
Sets a std::function to use to constain the value.
You must call this before setting any of the values.
Definition at line 193 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::setDefault | ( | const Type & | value | ) |
Resets the fallback default value.
Definition at line 123 of file tracktion_ConstrainedCachedValue.h.
| void tracktion::engine::ConstrainedCachedValue< Type >::setValue | ( | const Type & | newValue, |
| juce::UndoManager * | undoManagerToUse | ||
| ) |
Sets the property.
This will actually modify the property in the referenced ValueTree.
Definition at line 225 of file tracktion_ConstrainedCachedValue.h.