JUCE
Classes | Functions

Classes

class  CachedValue< Type >
 This class acts as a typed wrapper around a property inside a ValueTree. More...
 
class  Value
 Represents a shared variant value. More...
 
class  Value::ValueSource
 Used internally by the Value class as the base class for its shared value objects. More...
 
class  Value::Listener
 Receives callbacks when a Value object changes. More...
 
class  ValueTree
 A powerful tree structure that can be used to hold free-form data, and which can handle its own undo and redo behaviour. More...
 
class  ValueTree::Listener
 Listener class for events that happen to a ValueTree. More...
 
struct  ValueTree::Iterator
 Iterator for a ValueTree. More...
 
class  ValueTreeSynchroniser
 This class can be used to watch for all changes to the state of a ValueTree, and to convert them to a transmittable binary encoding. More...
 
class  ValueWithDefault
 This class acts as a wrapper around a property inside a ValueTree. More...
 

Functions

OutputStream &JUCE_CALLTYPE operator<< (OutputStream &, const Value &)
 Writes a Value to an OutputStream as a UTF8 string. More...
 
 CachedValue< Type >::CachedValue ()
 Default constructor. More...
 
 CachedValue< Type >::CachedValue (ValueTree &tree, const Identifier &propertyID, UndoManager *undoManager)
 Constructor. More...
 
 CachedValue< Type >::CachedValue (ValueTree &tree, const Identifier &propertyID, UndoManager *undoManager, const Type &defaultToUse)
 Constructor. More...
 
Value CachedValue< Type >::getPropertyAsValue ()
 Returns the current property as a Value object. More...
 
bool CachedValue< Type >::isUsingDefault () const
 Returns true if the current property does not exist and the CachedValue is using the fallback default value instead. More...
 
CachedValueCachedValue< Type >::operator= (const Type &newValue)
 Sets the property. More...
 
void CachedValue< Type >::setValue (const Type &newValue, UndoManager *undoManagerToUse)
 Sets the property. More...
 
void CachedValue< Type >::resetToDefault ()
 Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead. More...
 
void CachedValue< Type >::resetToDefault (UndoManager *undoManagerToUse)
 Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead. More...
 
void CachedValue< Type >::referTo (ValueTree &tree, const Identifier &property, UndoManager *um)
 Makes the CachedValue refer to the specified property inside the given ValueTree. More...
 
void CachedValue< Type >::referTo (ValueTree &tree, const Identifier &property, 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. More...
 
void CachedValue< Type >::forceUpdateOfCachedValue ()
 Force an update in case the referenced property has been changed from elsewhere. More...
 

Detailed Description

Function Documentation

◆ operator<<()

OutputStream& JUCE_CALLTYPE operator<< ( OutputStream ,
const Value  
)

Writes a Value to an OutputStream as a UTF8 string.

◆ CachedValue() [1/3]

template<typename Type >
CachedValue< Type >::CachedValue ( )
default

Default constructor.

Creates a default CachedValue not referring to any property. To initialise the object, call one of the referTo() methods.

Referenced by CachedValue< Type >::getUndoManager().

◆ CachedValue() [2/3]

template<typename Type >
CachedValue< Type >::CachedValue ( ValueTree tree,
const Identifier propertyID,
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.

Parameters
treeThe ValueTree containing the property
propertyIDThe identifier of the property
undoManagerThe UndoManager to use when writing to the property

References ValueTree::addListener().

◆ CachedValue() [3/3]

template<typename Type >
CachedValue< Type >::CachedValue ( ValueTree tree,
const Identifier propertyID,
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.

Parameters
treeThe ValueTree containing the property
propertyIDThe identifier of the property
undoManagerThe UndoManager to use when writing to the property
defaultToUseThe fallback default value to use.

References ValueTree::addListener().

◆ getPropertyAsValue()

template<typename Type >
Value CachedValue< Type >::getPropertyAsValue ( )

Returns the current property as a Value object.

References ValueTree::getPropertyAsValue().

Referenced by CachedValue< Type >::operator!=().

◆ isUsingDefault()

template<typename Type >
bool CachedValue< Type >::isUsingDefault ( ) const

Returns true if the current property does not exist and the CachedValue is using the fallback default value instead.

References ValueTree::hasProperty().

Referenced by CachedValue< Type >::operator!=(), and CachedValue< Type >::setValue().

◆ operator=()

template<typename Type >
CachedValue< Type > & CachedValue< Type >::operator= ( const Type &  newValue)

Sets the property.

This will actually modify the property in the referenced ValueTree.

References CachedValue< Type >::setValue().

Referenced by CachedValue< Type >::getDefault().

◆ setValue()

template<typename Type >
void CachedValue< Type >::setValue ( const Type &  newValue,
UndoManager undoManagerToUse 
)

Sets the property.

This will actually modify the property in the referenced ValueTree.

References CachedValue< Type >::isUsingDefault(), and ValueTree::setProperty().

Referenced by CachedValue< Type >::getDefault(), and CachedValue< Type >::operator=().

◆ resetToDefault() [1/2]

template<typename Type >
void CachedValue< Type >::resetToDefault ( )

Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead.

Referenced by CachedValue< Type >::getDefault().

◆ resetToDefault() [2/2]

template<typename Type >
void CachedValue< Type >::resetToDefault ( UndoManager undoManagerToUse)

Removes the property from the referenced ValueTree and makes the CachedValue return the fallback default value instead.

References CachedValue< Type >::forceUpdateOfCachedValue(), and ValueTree::removeProperty().

◆ referTo() [1/2]

template<typename Type >
void CachedValue< Type >::referTo ( ValueTree tree,
const Identifier property,
UndoManager um 
)

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

Referenced by CachedValue< Type >::setDefault().

◆ referTo() [2/2]

template<typename Type >
void CachedValue< Type >::referTo ( ValueTree tree,
const Identifier property,
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.

◆ forceUpdateOfCachedValue()

template<typename Type >
void CachedValue< 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.

References ValueTree::addListener(), ValueTree::getPropertyPointer(), and ValueTree::removeListener().

Referenced by CachedValue< Type >::resetToDefault(), and CachedValue< Type >::setDefault().