From 5587c16d785716ce1ddfbccc5e5be4ed2941f170 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 11 Jun 2014 16:30:28 +0100 Subject: [PATCH] Added a method ValueTree::getReferenceCount() --- modules/juce_data_structures/values/juce_ValueTree.cpp | 5 +++++ modules/juce_data_structures/values/juce_ValueTree.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index f776224986..d46ebfe3ad 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -789,6 +789,11 @@ void ValueTree::copyPropertiesFrom (const ValueTree& source, UndoManager* const object->copyPropertiesFrom (*(source.object), undoManager); } +int ValueTree::getReferenceCount() const noexcept +{ + return object != nullptr ? object->getReferenceCount() : 0; +} + //============================================================================== class ValueTreePropertyValueSource : public Value::ValueSource, private ValueTree::Listener diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index 311d722f31..1e37e0cfd3 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -490,6 +490,11 @@ public: */ static const ValueTree invalid; + /** Returns the total number of references to the shared underlying data structure that this + ValueTree is using. + */ + int getReferenceCount() const noexcept; + private: //============================================================================== JUCE_PUBLIC_IN_DLL_BUILD (class SharedObject)