OpenShot Library | libopenshot-audio
0.2.0
|
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)
69 const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
72 return properties.getAllValues() [index];
74 return fallbackProperties !=
nullptr ? fallbackProperties->getValue (keyName, defaultValue)
81 const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
84 return properties.getAllValues() [index].getIntValue();
86 return fallbackProperties !=
nullptr ? fallbackProperties->getIntValue (keyName, defaultValue)
93 const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
96 return properties.getAllValues()[index].getDoubleValue();
98 return fallbackProperties !=
nullptr ? fallbackProperties->getDoubleValue (keyName, defaultValue)
105 const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys);
108 return properties.getAllValues() [index].getIntValue() != 0;
110 return fallbackProperties !=
nullptr ? fallbackProperties->getBoolValue (keyName, defaultValue)
125 const String value (v.toString());
130 if (index < 0 || properties.
getAllValues() [index] != value)
132 properties.
set (keyName, value);
147 properties.
remove (keyName);
162 return properties.getAllKeys().contains (keyName, ignoreCaseOfKeys);
169 for (
int i = 0; i < source.properties.
size(); ++i)
177 fallbackProperties = fallbackProperties_;
185 for (
int i = 0; i < properties.
getAllKeys().size(); ++i)
200 forEachXmlChildElementWithTagName (xml, e,
"VALUE")
202 if (e->hasAttribute (
"name")
203 && e->hasAttribute (
"val"))
205 properties.
set (e->getStringAttribute (
"name"),
206 e->getStringAttribute (
"val"));
210 if (properties.
size() > 0)
void setAttribute(const Identifier &attributeName, const String &newValue)
Adds a named attribute to the element.
int indexOf(StringRef stringToLookFor, bool ignoreCase=false, int startIndex=0) const
Searches for a string in the array.
A simple class for holding temporary references to a string literal or String.
PropertySet(bool ignoreCaseOfKeyNames=false)
Creates an empty PropertySet.
void setFallbackPropertySet(PropertySet *fallbackProperties) noexcept
Sets up a second PopertySet that will be used to look up any values that aren't set in this one.
XmlElement * getXmlValue(StringRef keyName) const
Returns one of the properties as an XML element.
int getIntValue(StringRef keyName, int defaultReturnValue=0) const noexcept
Returns one of the properties as an integer.
void removeValue(StringRef keyName)
Deletes a property.
virtual ~PropertySet()
Destructor.
A set of named property values, which can be strings, integers, floating point, etc.
const StringArray & getAllKeys() const noexcept
Returns a list of all keys in the array.
void clear()
Removes all values.
Used to build a tree of elements representing an XML document.
void addAllPropertiesFrom(const PropertySet &source)
This copies all the values from a source PropertySet to this one.
const CriticalSection & getLock() const noexcept
Returns the lock used when reading or writing to this set.
XmlElement * createNewChildElement(StringRef tagName)
Creates a new element with the given name and returns it, after adding it as a child element.
void clear()
Removes all elements from the array.
A variant class, that can be used to hold a range of primitive values.
bool containsKey(StringRef keyName) const noexcept
Returns true if the properies include the given key.
bool getBoolValue(StringRef keyName, bool defaultReturnValue=false) const noexcept
Returns one of the properties as an boolean.
void set(const String &key, const String &value)
Adds or amends a key/value pair.
void remove(StringRef key)
Removes a string from the array based on its key.
Automatically locks and unlocks a mutex object.
String createDocument(StringRef dtdToUse, bool allOnOneLine=false, bool includeXmlHeader=true, StringRef encodingType="UTF-8", int lineWrapLength=60) const
Returns an XML text document that represents this element.
bool isNotEmpty() const noexcept
Returns true if the string is not empty.
XmlElement * createXml(const String &nodeName) const
Returns an XML element which encapsulates all the items in this property set.
PropertySet & operator=(const PropertySet &other)
Copies another PropertySet over this one.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
double getDoubleValue(StringRef keyName, double defaultReturnValue=0.0) const noexcept
Returns one of the properties as an double.
static XmlElement * parse(const File &file)
A handy static method that parses a file.
void restoreFromXml(const XmlElement &xml)
Reloads a set of properties that were previously stored as XML.
int size() const noexcept
Returns the number of strings in the array.
const StringArray & getAllValues() const noexcept
Returns a list of all values in the array.
String getValue(StringRef keyName, const String &defaultReturnValue=String()) const noexcept
Returns one of the properties as a string.
void setValue(const String &keyName, const var &value)
Sets a named property.
virtual void propertyChanged()
Subclasses can override this to be told when one of the properies has been changed.