27 : properties (ignoreCaseOfKeyNames),
29 ignoreCaseOfKeys (ignoreCaseOfKeyNames)
34 : properties (
other.properties),
35 fallbackProperties (
other.fallbackProperties),
36 ignoreCaseOfKeys (
other.ignoreCaseOfKeys)
42 properties =
other.properties;
43 fallbackProperties =
other.fallbackProperties;
44 ignoreCaseOfKeys =
other.ignoreCaseOfKeys;
58 if (properties.
size() > 0)
68 auto index = properties.getAllKeys().indexOf (
keyName, ignoreCaseOfKeys);
71 return properties.getAllValues() [index];
73 return fallbackProperties !=
nullptr ? fallbackProperties->getValue (
keyName, defaultValue)
80 auto index = properties.getAllKeys().indexOf (
keyName, ignoreCaseOfKeys);
83 return properties.getAllValues() [index].getIntValue();
85 return fallbackProperties !=
nullptr ? fallbackProperties->getIntValue (
keyName, defaultValue)
92 auto index = properties.getAllKeys().indexOf (
keyName, ignoreCaseOfKeys);
95 return properties.getAllValues()[index].getDoubleValue();
97 return fallbackProperties !=
nullptr ? fallbackProperties->getDoubleValue (
keyName, defaultValue)
104 auto index = properties.getAllKeys().indexOf (
keyName, ignoreCaseOfKeys);
107 return properties.getAllValues() [index].getIntValue() != 0;
109 return fallbackProperties !=
nullptr ? fallbackProperties->getBoolValue (
keyName, defaultValue)
120 jassert (
keyName.isNotEmpty());
124 auto value = v.toString();
128 if (index < 0 || properties.
getAllValues() [index] != value)
160 return properties.getAllKeys().contains (
keyName, ignoreCaseOfKeys);
167 for (
int i = 0; i < source.properties.
size(); ++i)
180 auto xml = std::make_unique<XmlElement> (
nodeName);
184 for (
int i = 0; i < properties.
getAllKeys().size(); ++i)
186 auto e = xml->createNewChildElement (
"VALUE");
187 e->setAttribute (
"name", properties.
getAllKeys()[i]);
199 forEachXmlChildElementWithTagName (xml,
e,
"VALUE")
201 if (
e->hasAttribute (
"name")
202 &&
e->hasAttribute (
"val"))
204 properties.
set (
e->getStringAttribute (
"name"),
205 e->getStringAttribute (
"val"));
209 if (properties.
size() > 0)
int indexOf(ParameterType elementToLookFor) const
virtual void propertyChanged()
const CriticalSection & getLock() const noexcept
void setFallbackPropertySet(PropertySet *fallbackProperties) noexcept
void addAllPropertiesFrom(const PropertySet &source)
PropertySet(bool ignoreCaseOfKeyNames=false)
String getValue(StringRef keyName, const String &defaultReturnValue=String()) const noexcept
double getDoubleValue(StringRef keyName, double defaultReturnValue=0.0) const noexcept
bool containsKey(StringRef keyName) const noexcept
void removeValue(StringRef keyName)
int getIntValue(StringRef keyName, int defaultReturnValue=0) const noexcept
void setValue(const String &keyName, const var &value)
bool getBoolValue(StringRef keyName, bool defaultReturnValue=false) const noexcept
void restoreFromXml(const XmlElement &xml)
std::unique_ptr< XmlElement > createXml(const String &nodeName) const
std::unique_ptr< XmlElement > getXmlValue(StringRef keyName) const
PropertySet & operator=(const PropertySet &other)
void set(const String &key, const String &value)
void remove(StringRef key)
const StringArray & getAllValues() const noexcept
int size() const noexcept
const StringArray & getAllKeys() const noexcept
String toString(const TextFormat &format={}) const
TextFormat withoutHeader() const
TextFormat singleLine() const