Browse Source

Made PropertySet::setValue() methods take a StringRef instead of a const String& so that Identifiers can be implicitly cast

tags/2021-05-28
ed 5 years ago
parent
commit
5bb2e8ca6f
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      modules/juce_core/containers/juce_PropertySet.cpp
  2. +2
    -2
      modules/juce_core/containers/juce_PropertySet.h

+ 2
- 2
modules/juce_core/containers/juce_PropertySet.cpp View File

@@ -115,7 +115,7 @@ std::unique_ptr<XmlElement> PropertySet::getXmlValue (StringRef keyName) const
return parseXML (getValue (keyName)); 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! 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() setValue (keyName, xml == nullptr ? var()
: var (xml->toString (XmlElement::TextFormat().singleLine().withoutHeader()))); : var (xml->toString (XmlElement::TextFormat().singleLine().withoutHeader())));


+ 2
- 2
modules/juce_core/containers/juce_PropertySet.h View File

@@ -121,7 +121,7 @@ public:
@param keyName the name of the property to set. (This mustn't be an empty string) @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 @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. /** Sets a named property to an XML element.
@@ -130,7 +130,7 @@ public:
be set to an empty string be set to an empty string
@see getXmlValue @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 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. This won't remove any existing settings, it just adds any that it finds in the source set.


Loading…
Cancel
Save