OpenShot Audio Library | OpenShotAudio 0.4.0
Loading...
Searching...
No Matches
juce::ValueTreePropertyWithDefault Class Reference

#include <juce_ValueTreePropertyWithDefault.h>

Inheritance diagram for juce::ValueTreePropertyWithDefault:
[legend]
Collaboration diagram for juce::ValueTreePropertyWithDefault:
[legend]

Public Member Functions

 ValueTreePropertyWithDefault ()=default
 
 ValueTreePropertyWithDefault (ValueTree &tree, const Identifier &propertyID, UndoManager *um)
 
 ValueTreePropertyWithDefault (ValueTree &tree, const Identifier &propertyID, UndoManager *um, var defaultToUse)
 
 ValueTreePropertyWithDefault (ValueTree &tree, const Identifier &propertyID, UndoManager *um, var defaultToUse, StringRef arrayDelimiter)
 
 ValueTreePropertyWithDefault (const ValueTreePropertyWithDefault &other)
 
 ~ValueTreePropertyWithDefault () override
 
var get () const noexcept
 
Value getPropertyAsValue ()
 
var getDefault () const
 
void setDefault (const var &newDefault)
 
bool isUsingDefault () const
 
void resetToDefault () noexcept
 
ValueTreePropertyWithDefaultoperator= (const var &newValue)
 
void setValue (const var &newValue, UndoManager *undoManagerToUse)
 
void referTo (ValueTree tree, const Identifier &property, UndoManager *um)
 
void referTo (ValueTree tree, const Identifier &property, UndoManager *um, var defaultVal)
 
void referTo (ValueTree tree, const Identifier &property, UndoManager *um, var defaultVal, StringRef arrayDelimiter)
 
ValueTreegetValueTree () noexcept
 
IdentifiergetPropertyID () noexcept
 
UndoManagergetUndoManager () noexcept
 
ValueTreePropertyWithDefaultoperator= (const ValueTreePropertyWithDefault &other)
 

Public Attributes

std::function< void()> onDefaultChange
 

Detailed Description

This class acts as a wrapper around a property inside a ValueTree.

If the property inside the ValueTree is missing it will return a default value, which can be specified in the constructor or by calling setDefault().

Definition at line 38 of file juce_ValueTreePropertyWithDefault.h.

Constructor & Destructor Documentation

◆ ValueTreePropertyWithDefault() [1/5]

juce::ValueTreePropertyWithDefault::ValueTreePropertyWithDefault ( )
default

Creates an uninitialised ValueTreePropertyWithDefault object.

Initialise it using one of the referTo() methods.

◆ ValueTreePropertyWithDefault() [2/5]

juce::ValueTreePropertyWithDefault::ValueTreePropertyWithDefault ( ValueTree & tree,
const Identifier & propertyID,
UndoManager * um )
inline

Creates a ValueTreePropertyWithDefault object for the specified property.

The default value will be an empty var.

Definition at line 52 of file juce_ValueTreePropertyWithDefault.h.

◆ ValueTreePropertyWithDefault() [3/5]

juce::ValueTreePropertyWithDefault::ValueTreePropertyWithDefault ( ValueTree & tree,
const Identifier & propertyID,
UndoManager * um,
var defaultToUse )
inline

Creates an ValueTreePropertyWithDefault object for the specified property.

The default value will be defaultToUse.

Definition at line 63 of file juce_ValueTreePropertyWithDefault.h.

◆ ValueTreePropertyWithDefault() [4/5]

juce::ValueTreePropertyWithDefault::ValueTreePropertyWithDefault ( ValueTree & tree,
const Identifier & propertyID,
UndoManager * um,
var defaultToUse,
StringRef arrayDelimiter )
inline

Creates a ValueTreePropertyWithDefault object for the specified property.

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 79 of file juce_ValueTreePropertyWithDefault.h.

◆ ValueTreePropertyWithDefault() [5/5]

juce::ValueTreePropertyWithDefault::ValueTreePropertyWithDefault ( const ValueTreePropertyWithDefault & other)
inline

Creates a ValueTreePropertyWithDefault object from another ValueTreePropertyWithDefault object.

Definition at line 89 of file juce_ValueTreePropertyWithDefault.h.

◆ ~ValueTreePropertyWithDefault()

juce::ValueTreePropertyWithDefault::~ValueTreePropertyWithDefault ( )
inlineoverride

Destructor.

Definition at line 99 of file juce_ValueTreePropertyWithDefault.h.

Member Function Documentation

◆ get()

var juce::ValueTreePropertyWithDefault::get ( ) const
inlinenoexcept

Returns the current value of the property.

If the property does not exist this returns the default value.

Definition at line 109 of file juce_ValueTreePropertyWithDefault.h.

◆ getDefault()

var juce::ValueTreePropertyWithDefault::getDefault ( ) const
inline

Returns the current default value.

Definition at line 124 of file juce_ValueTreePropertyWithDefault.h.

◆ getPropertyAsValue()

Value juce::ValueTreePropertyWithDefault::getPropertyAsValue ( )
inline

Returns the current property as a Value object.

Definition at line 121 of file juce_ValueTreePropertyWithDefault.h.

◆ getPropertyID()

Identifier & juce::ValueTreePropertyWithDefault::getPropertyID ( )
inlinenoexcept

Returns the property ID of the referenced property.

Definition at line 222 of file juce_ValueTreePropertyWithDefault.h.

◆ getUndoManager()

UndoManager * juce::ValueTreePropertyWithDefault::getUndoManager ( )
inlinenoexcept

Returns the UndoManager that is being used.

Definition at line 225 of file juce_ValueTreePropertyWithDefault.h.

◆ getValueTree()

ValueTree & juce::ValueTreePropertyWithDefault::getValueTree ( )
inlinenoexcept

Returns a reference to the ValueTree containing the referenced property.

Definition at line 219 of file juce_ValueTreePropertyWithDefault.h.

◆ isUsingDefault()

bool juce::ValueTreePropertyWithDefault::isUsingDefault ( ) const
inline

Returns true if the property does not exist in the referenced ValueTree.

Definition at line 130 of file juce_ValueTreePropertyWithDefault.h.

◆ operator=() [1/2]

ValueTreePropertyWithDefault & juce::ValueTreePropertyWithDefault::operator= ( const ValueTreePropertyWithDefault & other)
inline

Definition at line 228 of file juce_ValueTreePropertyWithDefault.h.

◆ operator=() [2/2]

ValueTreePropertyWithDefault & juce::ValueTreePropertyWithDefault::operator= ( const var & newValue)
inline

Sets the property and returns the new ValueTreePropertyWithDefault.

This will modify the property in the referenced ValueTree.

Definition at line 147 of file juce_ValueTreePropertyWithDefault.h.

◆ referTo() [1/3]

void juce::ValueTreePropertyWithDefault::referTo ( ValueTree tree,
const Identifier & property,
UndoManager * um )
inline

Makes the ValueTreePropertyWithDefault refer to the specified property inside the given ValueTree.

The default value will be an empty var.

Definition at line 171 of file juce_ValueTreePropertyWithDefault.h.

◆ referTo() [2/3]

void juce::ValueTreePropertyWithDefault::referTo ( ValueTree tree,
const Identifier & property,
UndoManager * um,
var defaultVal )
inline

Makes the ValueTreePropertyWithDefault refer to the specified property inside the given ValueTree.

The default value will be defaultVal.

Definition at line 187 of file juce_ValueTreePropertyWithDefault.h.

◆ referTo() [3/3]

void juce::ValueTreePropertyWithDefault::referTo ( ValueTree tree,
const Identifier & property,
UndoManager * um,
var defaultVal,
StringRef arrayDelimiter )
inline

Makes the ValueTreePropertyWithDefault refer to the specified property inside the given ValueTree.

The default value will be defaultVal.

Definition at line 204 of file juce_ValueTreePropertyWithDefault.h.

◆ resetToDefault()

void juce::ValueTreePropertyWithDefault::resetToDefault ( )
inlinenoexcept

Removes the property from the referenced ValueTree.

Definition at line 133 of file juce_ValueTreePropertyWithDefault.h.

◆ setDefault()

void juce::ValueTreePropertyWithDefault::setDefault ( const var & newDefault)
inline

Sets the default value to a new var.

Definition at line 127 of file juce_ValueTreePropertyWithDefault.h.

◆ setValue()

void juce::ValueTreePropertyWithDefault::setValue ( const var & newValue,
UndoManager * undoManagerToUse )
inline

Sets the property.

This will modify the property in the referenced ValueTree.

Definition at line 157 of file juce_ValueTreePropertyWithDefault.h.

Member Data Documentation

◆ onDefaultChange

std::function<void()> juce::ValueTreePropertyWithDefault::onDefaultChange

You can assign a lambda to this callback and it will called when the default value is changed.

See also
setDefault

Definition at line 140 of file juce_ValueTreePropertyWithDefault.h.


The documentation for this class was generated from the following file: