Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nullptr default to all undo-manager arguments in ValueTree #1333

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 15 additions & 15 deletions modules/juce_data_structures/values/juce_ValueTree.h
Expand Up @@ -183,13 +183,13 @@ class JUCE_API ValueTree final
any that are not present in the source tree will be removed.
@see copyPropertiesAndChildrenFrom
*/
void copyPropertiesFrom (const ValueTree& source, UndoManager* undoManager);
void copyPropertiesFrom (const ValueTree& source, UndoManager* undoManager = nullptr);

/** Replaces all children and properties of this object with copies of those from
the source object.
@see copyPropertiesFrom
*/
void copyPropertiesAndChildrenFrom (const ValueTree& source, UndoManager* undoManager);
void copyPropertiesAndChildrenFrom (const ValueTree& source, UndoManager* undoManager = nullptr);

//==============================================================================
/** Returns the type of this tree.
Expand Down Expand Up @@ -239,7 +239,7 @@ class JUCE_API ValueTree final
@see var, getProperty, removeProperty
@returns a reference to the value tree, so that you can daisy-chain calls to this method.
*/
ValueTree& setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager);
ValueTree& setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager = nullptr);

/** Returns true if the tree contains a named property. */
bool hasProperty (const Identifier& name) const noexcept;
Expand All @@ -248,13 +248,13 @@ class JUCE_API ValueTree final
If the undoManager parameter is not nullptr, its UndoManager::perform() method will be used,
so that this change can be undone. Be very careful not to mix undoable and non-undoable changes!
*/
void removeProperty (const Identifier& name, UndoManager* undoManager);
void removeProperty (const Identifier& name, UndoManager* undoManager = nullptr);

/** Removes all properties from the tree.
If the undoManager parameter is not nullptr, its UndoManager::perform() method will be used,
so that this change can be undone. Be very careful not to mix undoable and non-undoable changes!
*/
void removeAllProperties (UndoManager* undoManager);
void removeAllProperties (UndoManager* undoManager = nullptr);

/** Returns the total number of properties that the tree contains.
@see getProperty.
Expand All @@ -277,7 +277,7 @@ class JUCE_API ValueTree final
If shouldUpdateSynchronously is true the Value::Listener will be updated synchronously.
@see ValueSource::sendChangeMessage (bool)
*/
Value getPropertyAsValue (const Identifier& name, UndoManager* undoManager,
Value getPropertyAsValue (const Identifier& name, UndoManager* undoManager = nullptr,
bool shouldUpdateSynchronously = false);

//==============================================================================
Expand Down Expand Up @@ -305,7 +305,7 @@ class JUCE_API ValueTree final
the method on is itself invalid.
@see getChildWithName
*/
ValueTree getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager);
ValueTree getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager = nullptr);

/** Looks for the first sub-tree that has the specified property value.
This will scan the child trees in order, until it finds one that has property that matches
Expand All @@ -324,32 +324,32 @@ class JUCE_API ValueTree final
so that this change can be undone. Be very careful not to mix undoable and non-undoable changes!
@see appendChild, removeChild
*/
void addChild (const ValueTree& child, int index, UndoManager* undoManager);
void addChild (const ValueTree& child, int index, UndoManager* undoManager = nullptr);

/** Appends a new child sub-tree to this tree.
This is equivalent to calling addChild() with an index of -1. See addChild() for more details.
@see addChild, removeChild
*/
void appendChild (const ValueTree& child, UndoManager* undoManager);
void appendChild (const ValueTree& child, UndoManager* undoManager = nullptr);

/** Removes the specified child from this tree's child-list.
If the undoManager parameter is not nullptr, its UndoManager::perform() method will be used,
so that this change can be undone. Be very careful not to mix undoable and non-undoable changes!
*/
void removeChild (const ValueTree& child, UndoManager* undoManager);
void removeChild (const ValueTree& child, UndoManager* undoManager = nullptr);

/** Removes a sub-tree from this tree.
If the index is out-of-range, nothing will be changed.
If the undoManager parameter is not nullptr, its UndoManager::perform() method will be used,
so that this change can be undone. Be very careful not to mix undoable and non-undoable changes!
*/
void removeChild (int childIndex, UndoManager* undoManager);
void removeChild (int childIndex, UndoManager* undoManager = nullptr);

/** Removes all child-trees.
If the undoManager parameter is not nullptr, its UndoManager::perform() method will be used,
so that this change can be undone. Be very careful not to mix undoable and non-undoable changes!
*/
void removeAllChildren (UndoManager* undoManager);
void removeAllChildren (UndoManager* undoManager = nullptr);

/** Moves one of the sub-trees to a different index.
This will move the child to a specified index, shuffling along any intervening
Expand All @@ -363,7 +363,7 @@ class JUCE_API ValueTree final
of the list
@param undoManager the optional UndoManager to use to store this transaction
*/
void moveChild (int currentIndex, int newIndex, UndoManager* undoManager);
void moveChild (int currentIndex, int newIndex, UndoManager* undoManager = nullptr);

/** Returns true if this tree is a sub-tree (at any depth) of the given parent.
This searches recursively, so returns true if it's a sub-tree at any level below the parent.
Expand Down Expand Up @@ -561,7 +561,7 @@ class JUCE_API ValueTree final
*/
ValueTree& setPropertyExcludingListener (Listener* listenerToExclude,
const Identifier& name, const var& newValue,
UndoManager* undoManager);
UndoManager* undoManager = nullptr);

/** Causes a property-change callback to be triggered for the specified property,
calling any listeners that are registered.
Expand Down Expand Up @@ -591,7 +591,7 @@ class JUCE_API ValueTree final
faster algorithm is used, but equivalent elements may be rearranged.
*/
template <typename ElementComparator>
void sort (ElementComparator& comparator, UndoManager* undoManager, bool retainOrderOfEquivalentItems)
void sort (ElementComparator& comparator, UndoManager* undoManager = nullptr, bool retainOrderOfEquivalentItems = true)
{
if (object != nullptr)
{
Expand Down