From 05f90010f5b49d2d56a388f5e904fabddca00955 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 19 Apr 2016 16:11:05 +0100 Subject: [PATCH] Fixed some MSVC warnings in CachedValue --- .../values/juce_CachedValue.h | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/juce_data_structures/values/juce_CachedValue.h b/modules/juce_data_structures/values/juce_CachedValue.h index 269a9cf589..3690b6955d 100644 --- a/modules/juce_data_structures/values/juce_CachedValue.h +++ b/modules/juce_data_structures/values/juce_CachedValue.h @@ -175,7 +175,7 @@ public: /** Returns a reference to the ValueTree containing the referenced property. */ ValueTree& getValueTree() noexcept { return targetTree; } - /** Returns the property ID of thereferenced property. */ + /** Returns the property ID of the referenced property. */ const Identifier& getPropertyID() const noexcept { return targetProperty; } private: @@ -202,10 +202,10 @@ private: //============================================================================== template -CachedValue::CachedValue() : undoManager (nullptr) {} +inline CachedValue::CachedValue() : undoManager (nullptr) {} template -CachedValue::CachedValue (ValueTree& v, const Identifier& i, UndoManager* um) +inline CachedValue::CachedValue (ValueTree& v, const Identifier& i, UndoManager* um) : targetTree (v), targetProperty (i), undoManager (um), defaultValue(), cachedValue (getTypedValue()) { @@ -213,7 +213,7 @@ CachedValue::CachedValue (ValueTree& v, const Identifier& i, UndoManager* } template -CachedValue::CachedValue (ValueTree& v, const Identifier& i, UndoManager* um, const Type& defaultToUse) +inline CachedValue::CachedValue (ValueTree& v, const Identifier& i, UndoManager* um, const Type& defaultToUse) : targetTree (v), targetProperty (i), undoManager (um), defaultValue (defaultToUse), cachedValue (getTypedValue()) { @@ -221,26 +221,26 @@ CachedValue::CachedValue (ValueTree& v, const Identifier& i, UndoManager* } template -Value CachedValue::getPropertyAsValue() +inline Value CachedValue::getPropertyAsValue() { return targetTree.getPropertyAsValue (targetProperty, undoManager); } template -bool CachedValue::isUsingDefault() const +inline bool CachedValue::isUsingDefault() const { return ! targetTree.hasProperty (targetProperty); } template -CachedValue& CachedValue::operator= (const Type& newValue) +inline CachedValue& CachedValue::operator= (const Type& newValue) { setValue (newValue, undoManager); return *this; } template -void CachedValue::setValue (const Type& newValue, UndoManager* undoManagerToUse) +inline void CachedValue::setValue (const Type& newValue, UndoManager* undoManagerToUse) { if (cachedValue != newValue) { @@ -250,38 +250,38 @@ void CachedValue::setValue (const Type& newValue, UndoManager* undoManager } template -void CachedValue::resetToDefault() +inline void CachedValue::resetToDefault() { resetToDefault (undoManager); } template -void CachedValue::resetToDefault (UndoManager* undoManagerToUse) +inline void CachedValue::resetToDefault (UndoManager* undoManagerToUse) { targetTree.removeProperty (targetProperty, undoManagerToUse); forceUpdateOfCachedValue(); } template -void CachedValue::referTo (ValueTree& v, const Identifier& i, UndoManager* um) +inline void CachedValue::referTo (ValueTree& v, const Identifier& i, UndoManager* um) { referToWithDefault (v, i, um, Type()); } template -void CachedValue::referTo (ValueTree& v, const Identifier& i, UndoManager* um, const Type& defaultVal) +inline void CachedValue::referTo (ValueTree& v, const Identifier& i, UndoManager* um, const Type& defaultVal) { referToWithDefault (v, i, um, defaultVal); } template -void CachedValue::forceUpdateOfCachedValue() +inline void CachedValue::forceUpdateOfCachedValue() { cachedValue = getTypedValue(); } template -void CachedValue::referToWithDefault (ValueTree& v, const Identifier& i, UndoManager* um, const Type& defaultVal) +inline void CachedValue::referToWithDefault (ValueTree& v, const Identifier& i, UndoManager* um, const Type& defaultVal) { targetTree.removeListener (this); targetTree = v; @@ -293,7 +293,7 @@ void CachedValue::referToWithDefault (ValueTree& v, const Identifier& i, U } template -Type CachedValue::getTypedValue() const +inline Type CachedValue::getTypedValue() const { if (const var* property = targetTree.getPropertyPointer (targetProperty)) return VariantConverter::fromVar (*property); @@ -302,7 +302,7 @@ Type CachedValue::getTypedValue() const } template -void CachedValue::valueTreePropertyChanged (ValueTree& changedTree, const Identifier& changedProperty) +inline void CachedValue::valueTreePropertyChanged (ValueTree& changedTree, const Identifier& changedProperty) { if (changedProperty == targetProperty && targetTree == changedTree) forceUpdateOfCachedValue();