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;
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)
115 return parseXML (
getValue (keyName));
124 auto value = v.toString();
128 if (index < 0 || properties.
getAllValues() [index] != value)
130 properties.
set (keyName, value);
145 properties.
remove (keyName);
160 return properties.getAllKeys().contains (keyName, ignoreCaseOfKeys);
167 for (
int i = 0; i < source.properties.
size(); ++i)
175 fallbackProperties = fallbackProperties_;
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]);
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)
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
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
bool isNotEmpty() const noexcept
String toString(const TextFormat &format={}) const
Iterator< GetNextElementWithTagName > getChildWithTagNameIterator(StringRef name) const
TextFormat withoutHeader() const
TextFormat singleLine() const