27 : properties (ignoreCaseOfKeyNames),
28 fallbackProperties (nullptr),
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;
56 const ScopedLock sl (lock);
58 if (properties.size() > 0)
67 const ScopedLock sl (lock);
68 auto index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
71 return properties.getAllValues() [index];
73 return fallbackProperties !=
nullptr ? fallbackProperties->getValue (keyName, defaultValue)
79 const ScopedLock sl (lock);
80 auto index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
83 return properties.getAllValues() [index].getIntValue();
85 return fallbackProperties !=
nullptr ? fallbackProperties->getIntValue (keyName, defaultValue)
91 const ScopedLock sl (lock);
92 auto index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
95 return properties.getAllValues()[index].getDoubleValue();
97 return fallbackProperties !=
nullptr ? fallbackProperties->getDoubleValue (keyName, defaultValue)
103 const ScopedLock sl (lock);
104 auto index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
107 return properties.getAllValues() [index].getIntValue() != 0;
109 return fallbackProperties !=
nullptr ? fallbackProperties->getBoolValue (keyName, defaultValue)
115 return parseXML (
getValue (keyName));
124 auto value = v.toString();
125 const ScopedLock sl (lock);
126 auto index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
128 if (index < 0 || properties.getAllValues() [index] != value)
130 properties.set (keyName, value);
140 const ScopedLock sl (lock);
141 auto index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
145 properties.remove (keyName);
159 const ScopedLock sl (lock);
160 return properties.getAllKeys().contains (keyName, ignoreCaseOfKeys);
165 const ScopedLock sl (source.
getLock());
167 for (
int i = 0; i < source.properties.
size(); ++i)
174 const ScopedLock sl (lock);
175 fallbackProperties = fallbackProperties_;
180 auto xml = std::make_unique<XmlElement> (nodeName);
182 const ScopedLock sl (lock);
184 for (
int i = 0; i < properties.getAllKeys().size(); ++i)
186 auto e = xml->createNewChildElement (
"VALUE");
187 e->setAttribute (
"name", properties.getAllKeys()[i]);
188 e->setAttribute (
"val", properties.getAllValues()[i]);
196 const ScopedLock sl (lock);
201 if (e->hasAttribute (
"name")
202 && e->hasAttribute (
"val"))
204 properties.set (e->getStringAttribute (
"name"),
205 e->getStringAttribute (
"val"));
209 if (properties.size() > 0)
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
void setValue(StringRef keyName, const var &value)
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
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)
const StringArray & getAllValues() const noexcept
int size() const noexcept
const StringArray & getAllKeys() const noexcept
bool isNotEmpty() const noexcept
String toString(const TextFormat &format={}) const
Iterator< GetNextElementWithTagName > getChildWithTagNameIterator(StringRef name) const
TextFormat withoutHeader() const
TextFormat singleLine() const