Holds a set of named var objects. More...
Public Member Functions | |
| NamedValueSet () noexcept | |
| Creates an empty set. | |
| NamedValueSet (const NamedValueSet &other) | |
| Creates a copy of another set. | |
| NamedValueSet & | operator= (const NamedValueSet &other) |
| Replaces this set with a copy of another set. | |
| ~NamedValueSet () | |
| Destructor. | |
| bool | operator== (const NamedValueSet &other) const |
| bool | operator!= (const NamedValueSet &other) const |
| int | size () const noexcept |
| Returns the total number of values that the set contains. | |
| const var & | operator[] (const Identifier &name) const |
| Returns the value of a named item. | |
| var | getWithDefault (const Identifier &name, const var &defaultReturnValue) const |
| Tries to return the named value, but if no such value is found, this will instead return the supplied default value. | |
| bool | set (const Identifier &name, const var &newValue) |
| Changes or adds a named value. | |
| bool | contains (const Identifier &name) const |
| Returns true if the set contains an item with the specified name. | |
| bool | remove (const Identifier &name) |
| Removes a value from the set. | |
| const Identifier | getName (int index) const |
| Returns the name of the value at a given index. | |
| const var & | getValueAt (int index) const |
| Returns the value of the item at a given index. | |
| void | clear () |
| Removes all values. | |
| var * | getVarPointer (const Identifier &name) const noexcept |
| Returns a pointer to the var that holds a named value, or null if there is no value with this name. | |
| void | setFromXmlAttributes (const XmlElement &xml) |
| Sets properties to the values of all of an XML element's attributes. | |
| void | copyToXmlAttributes (XmlElement &xml) const |
| Sets attributes in an XML element corresponding to each of this object's properties. | |
Holds a set of named var objects.
This can be used as a basic structure to hold a set of var object, which can be retrieved by using their identifier.
| NamedValueSet::NamedValueSet | ( | ) |
Creates an empty set.
| NamedValueSet::NamedValueSet | ( | const NamedValueSet & | other ) |
Creates a copy of another set.
| NamedValueSet::~NamedValueSet | ( | ) |
Destructor.
| NamedValueSet& NamedValueSet::operator= | ( | const NamedValueSet & | other ) |
Replaces this set with a copy of another set.
| bool NamedValueSet::operator== | ( | const NamedValueSet & | other ) | const |
| bool NamedValueSet::operator!= | ( | const NamedValueSet & | other ) | const |
| int NamedValueSet::size | ( | ) | const |
Returns the total number of values that the set contains.
| const var& NamedValueSet::operator[] | ( | const Identifier & | name ) | const |
Returns the value of a named item.
If the name isn't found, this will return a void variant.
| var NamedValueSet::getWithDefault | ( | const Identifier & | name, |
| const var & | defaultReturnValue | ||
| ) | const |
Tries to return the named value, but if no such value is found, this will instead return the supplied default value.
| bool NamedValueSet::set | ( | const Identifier & | name, |
| const var & | newValue | ||
| ) |
Changes or adds a named value.
| bool NamedValueSet::contains | ( | const Identifier & | name ) | const |
Returns true if the set contains an item with the specified name.
| bool NamedValueSet::remove | ( | const Identifier & | name ) |
Removes a value from the set.
| const Identifier NamedValueSet::getName | ( | int | index ) | const |
Returns the name of the value at a given index.
The index must be between 0 and size() - 1.
| const var& NamedValueSet::getValueAt | ( | int | index ) | const |
Returns the value of the item at a given index.
The index must be between 0 and size() - 1.
| void NamedValueSet::clear | ( | ) |
Removes all values.
| var* NamedValueSet::getVarPointer | ( | const Identifier & | name ) | const |
Returns a pointer to the var that holds a named value, or null if there is no value with this name.
Do not use this method unless you really need access to the internal var object for some reason - for normal reading and writing always prefer operator[]() and set().
| void NamedValueSet::setFromXmlAttributes | ( | const XmlElement & | xml ) |
Sets properties to the values of all of an XML element's attributes.
| void NamedValueSet::copyToXmlAttributes | ( | XmlElement & | xml ) | const |
Sets attributes in an XML element corresponding to each of this object's properties.