From 4ad56ca10dc08f9091c68a34f56892e4452f41c2 Mon Sep 17 00:00:00 2001 From: James J Date: Tue, 23 Jan 2024 14:42:28 +0000 Subject: [PATCH] Add nullptr default to all undo-manager arguments in ValueTree --- .../values/juce_ValueTree.h | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index 8d147a5559cf..7f406c5fb351 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -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. @@ -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; @@ -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. @@ -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); //============================================================================== @@ -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 @@ -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 @@ -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. @@ -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. @@ -591,7 +591,7 @@ class JUCE_API ValueTree final faster algorithm is used, but equivalent elements may be rearranged. */ template - void sort (ElementComparator& comparator, UndoManager* undoManager, bool retainOrderOfEquivalentItems) + void sort (ElementComparator& comparator, UndoManager* undoManager = nullptr, bool retainOrderOfEquivalentItems = true) { if (object != nullptr) {