values
juce_data_structures

## 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...
CachedValue & | CachedValue< 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.

## 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

  tree | The ValueTree containing the property
  propertyID | The identifier of the property
  undoManager | The 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

  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.

References ValueTree::addListener().

## getPropertyAsValue()

template<typename Type >

Value CachedValue< Type >::getPropertyAsValue | ( |  | ) |

Returns the current property as a Value object.

## 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.

## 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.

## 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.

## 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.

## 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.

## 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.

## 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.