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)
73 return fallbackProperties !=
nullptr ? fallbackProperties->
getValue (keyName, defaultValue)
85 return fallbackProperties !=
nullptr ? fallbackProperties->
getIntValue (keyName, defaultValue)
95 return properties.
getAllValues()[index].getDoubleValue();
97 return fallbackProperties !=
nullptr ? fallbackProperties->
getDoubleValue (keyName, defaultValue)
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);
167 for (
int i = 0; i < source.properties.
size(); ++i)
175 fallbackProperties = fallbackProperties_;
180 auto xml = std::make_unique<XmlElement> (nodeName);
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)
const StringArray & getAllValues() const noexcept
TextFormat singleLine() const
bool isNotEmpty() const noexcept
const StringArray & getAllKeys() const noexcept
void restoreFromXml(const XmlElement &xml)
virtual void propertyChanged()
bool isNotEmpty() const noexcept
PropertySet & operator=(const PropertySet &other)
String getValue(StringRef keyName, const String &defaultReturnValue=String()) const noexcept
bool getBoolValue(StringRef keyName, bool defaultReturnValue=false) const noexcept
std::unique_ptr< XmlElement > getXmlValue(StringRef keyName) const
int size() const noexcept
bool containsKey(StringRef keyName) const noexcept
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
std::unique_ptr< XmlElement > createXml(const String &nodeName) const
void removeValue(StringRef keyName)
int getIntValue(StringRef keyName, int defaultReturnValue=0) const noexcept
void addAllPropertiesFrom(const PropertySet &source)
void set(const String &key, const String &value)
bool contains(StringRef stringToLookFor, bool ignoreCase=false) const
int size() const noexcept
void remove(StringRef key)
double getDoubleValue(StringRef keyName, double defaultReturnValue=0.0) const noexcept
void setValue(const String &keyName, const var &value)
void setFallbackPropertySet(PropertySet *fallbackProperties) noexcept
PropertySet(bool ignoreCaseOfKeyNames=false)
const CriticalSection & getLock() const noexcept
TextFormat withoutHeader() const
String toString(const TextFormat &format={}) const