From 7f74968cef73660cf87a1c762ef373b8288eb595 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 3 Jul 2012 20:47:06 +0100 Subject: [PATCH] Added a new callback ValueTree::Listener::valueTreeRedirected() --- modules/juce_data_structures/values/juce_ValueTree.cpp | 8 ++------ modules/juce_data_structures/values/juce_ValueTree.h | 7 ++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index b41596c378..19cbcaf1a9 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -663,6 +663,8 @@ ValueTree& ValueTree::operator= (const ValueTree& other) } object = other.object; + + listeners.call (&ValueTree::Listener::valueTreeRedirected, *this); return *this; } @@ -671,12 +673,6 @@ ValueTree::ValueTree (ValueTree&& other) noexcept : object (static_cast (other.object)) { } - -ValueTree& ValueTree::operator= (ValueTree&& other) noexcept -{ - object = static_cast (other.object); - return *this; -} #endif ValueTree::~ValueTree() diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index d818c71518..a9ba3a03e7 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -93,7 +93,6 @@ public: #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS ValueTree (ValueTree&& other) noexcept; - ValueTree& operator= (ValueTree&& other) noexcept; #endif /** Destructor. */ @@ -412,6 +411,12 @@ public: the listener is registered, and not to any of its children. */ virtual void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) = 0; + + /** This method is called when a tree is made to point to a different internal shared object. + When operator= is used to make a ValueTree refer to a different object, this callback + will be made. + */ + virtual void valueTreeRedirected (ValueTree& treeWhichHasBeenChanged) {} }; /** Adds a listener to receive callbacks when this node is changed.