From 5bb2e8ca6fe3ca25b8592d590cadf562cf29cd9d Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 2 Apr 2020 15:56:29 +0100 Subject: [PATCH] Made PropertySet::setValue() methods take a StringRef instead of a const String& so that Identifiers can be implicitly cast --- modules/juce_core/containers/juce_PropertySet.cpp | 4 ++-- modules/juce_core/containers/juce_PropertySet.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/juce_core/containers/juce_PropertySet.cpp b/modules/juce_core/containers/juce_PropertySet.cpp index fe3712721c..45f67eb5a4 100644 --- a/modules/juce_core/containers/juce_PropertySet.cpp +++ b/modules/juce_core/containers/juce_PropertySet.cpp @@ -115,7 +115,7 @@ std::unique_ptr PropertySet::getXmlValue (StringRef keyName) const return parseXML (getValue (keyName)); } -void PropertySet::setValue (const String& keyName, const var& v) +void PropertySet::setValue (StringRef keyName, const var& v) { jassert (keyName.isNotEmpty()); // shouldn't use an empty key name! @@ -148,7 +148,7 @@ void PropertySet::removeValue (StringRef keyName) } } -void PropertySet::setValue (const String& keyName, const XmlElement* xml) +void PropertySet::setValue (StringRef keyName, const XmlElement* xml) { setValue (keyName, xml == nullptr ? var() : var (xml->toString (XmlElement::TextFormat().singleLine().withoutHeader()))); diff --git a/modules/juce_core/containers/juce_PropertySet.h b/modules/juce_core/containers/juce_PropertySet.h index b14cabf5ca..be4a22b728 100644 --- a/modules/juce_core/containers/juce_PropertySet.h +++ b/modules/juce_core/containers/juce_PropertySet.h @@ -121,7 +121,7 @@ public: @param keyName the name of the property to set. (This mustn't be an empty string) @param value the new value to set it to */ - void setValue (const String& keyName, const var& value); + void setValue (StringRef keyName, const var& value); /** Sets a named property to an XML element. @@ -130,7 +130,7 @@ public: be set to an empty string @see getXmlValue */ - void setValue (const String& keyName, const XmlElement* xml); + void setValue (StringRef keyName, const XmlElement* xml); /** This copies all the values from a source PropertySet to this one. This won't remove any existing settings, it just adds any that it finds in the source set.