OpenShot Library | libopenshot-audio
0.1.9
|
This class acts as a wrapper around a property inside a ValueTree. More...
#include <juce_ValueWithDefault.h>
Public Member Functions | |
ValueWithDefault ()=default | |
Creates an unitialised ValueWithDefault. More... | |
ValueWithDefault (ValueTree &tree, const Identifier &propertyID, UndoManager *um) | |
Creates an ValueWithDefault object. More... | |
ValueWithDefault (ValueTree &tree, const Identifier &propertyID, UndoManager *um, const var &defaultToUse) | |
Creates an ValueWithDefault object. More... | |
ValueWithDefault (ValueTree &tree, const Identifier &propertyID, UndoManager *um, const var &defaultToUse, StringRef arrayDelimiter) | |
Creates an ValueWithDefault object. More... | |
ValueWithDefault (const ValueWithDefault &other) | |
Creates a ValueWithDefault object from another ValueWithDefault object. More... | |
var | get () const noexcept |
Returns the current value of the property. More... | |
Value | getPropertyAsValue () |
Returns the current property as a Value object. More... | |
var | getDefault () const |
Returns the current default value. More... | |
void | setDefault (const var &newDefault) |
Sets the default value to a new var. More... | |
bool | isUsingDefault () const |
Returns true if the property does not exist in the referenced ValueTree. More... | |
void | resetToDefault () noexcept |
Removes the property from the referenced ValueTree. More... | |
ValueWithDefault & | operator= (const var &newValue) |
Sets the property and returns the new ValueWithDefault. More... | |
void | setValue (const var &newValue, UndoManager *undoManagerToUse) |
Sets the property. More... | |
void | referTo (ValueTree &tree, const Identifier &property, UndoManager *um) |
Makes the ValueWithDefault refer to the specified property inside the given ValueTree. More... | |
void | referTo (ValueTree &tree, const Identifier &property, UndoManager *um, const var &defaultVal) |
Makes the ValueWithDefault refer to the specified property inside the given ValueTree, and specifies a default value to use. | |
void | referTo (ValueTree &tree, const Identifier &property, UndoManager *um, const var &defaultVal, StringRef arrayDelimiter) |
ValueTree & | getValueTree () noexcept |
Returns a reference to the ValueTree containing the referenced property. More... | |
Identifier & | getPropertyID () noexcept |
Returns the property ID of the referenced property. More... | |
UndoManager * | getUndoManager () noexcept |
Returns the UndoManager that is being used. More... | |
ValueWithDefault & | operator= (const ValueWithDefault &other) |
Public Attributes | |
std::function< void()> | onDefaultChange |
You can assign a lambda to this callback object to have it called when the default value is changed. More... | |
This class acts as a wrapper around a property inside a ValueTree.
If the property inside the ValueTree is missing or empty the ValueWithDefault will automatically return a default value, which can be specified when initialising the ValueWithDefault.
Definition at line 43 of file juce_ValueWithDefault.h.
|
default |
Creates an unitialised ValueWithDefault.
Initialise it using one of the referTo() methods.
|
inline |
Creates an ValueWithDefault object.
The default value will be an empty var.
Definition at line 51 of file juce_ValueWithDefault.h.
|
inline |
Creates an ValueWithDefault object.
The default value will be defaultToUse.
Definition at line 60 of file juce_ValueWithDefault.h.
|
inline |
Creates an ValueWithDefault object.
The default value will be defaultToUse.
Use this constructor if the underlying var object being controlled is an array and it will handle the conversion to/from a delimited String that can be written to XML format.
Definition at line 75 of file juce_ValueWithDefault.h.
|
inline |
Creates a ValueWithDefault object from another ValueWithDefault object.
Definition at line 86 of file juce_ValueWithDefault.h.
|
inlinenoexcept |
Returns the current value of the property.
If the property does not exist or is empty, returns the default value.
Definition at line 99 of file juce_ValueWithDefault.h.
References juce::String::isNotEmpty(), and isUsingDefault().
|
inline |
Returns the current property as a Value object.
Definition at line 111 of file juce_ValueWithDefault.h.
References juce::ValueTree::getPropertyAsValue().
|
inline |
Returns the current default value.
Definition at line 114 of file juce_ValueWithDefault.h.
|
inline |
Sets the default value to a new var.
Definition at line 117 of file juce_ValueWithDefault.h.
References onDefaultChange.
|
inline |
Returns true if the property does not exist in the referenced ValueTree.
Definition at line 129 of file juce_ValueWithDefault.h.
References juce::ValueTree::hasProperty().
Referenced by get().
|
inlinenoexcept |
Removes the property from the referenced ValueTree.
Definition at line 135 of file juce_ValueWithDefault.h.
References juce::ValueTree::removeProperty().
|
inline |
Sets the property and returns the new ValueWithDefault.
This will modify the property in the referenced ValueTree.
Definition at line 145 of file juce_ValueWithDefault.h.
References setValue().
Referenced by getUndoManager().
|
inline |
Sets the property.
This will actually modify the property in the referenced ValueTree.
Definition at line 152 of file juce_ValueWithDefault.h.
References juce::var::getArray(), and juce::ValueTree::setProperty().
Referenced by operator=().
|
inline |
Makes the ValueWithDefault refer to the specified property inside the given ValueTree.
Definition at line 162 of file juce_ValueWithDefault.h.
Referenced by referTo().
|
inlinenoexcept |
Returns a reference to the ValueTree containing the referenced property.
Definition at line 183 of file juce_ValueWithDefault.h.
|
inlinenoexcept |
Returns the property ID of the referenced property.
Definition at line 186 of file juce_ValueWithDefault.h.
|
inlinenoexcept |
Returns the UndoManager that is being used.
Definition at line 189 of file juce_ValueWithDefault.h.
References juce::StringArray::add(), juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::add(), juce::StringArray::fromTokens(), juce::String::isNotEmpty(), and operator=().
std::function<void()> juce::ValueWithDefault::onDefaultChange |
You can assign a lambda to this callback object to have it called when the default value is changed.
Definition at line 141 of file juce_ValueWithDefault.h.
Referenced by setDefault().