mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
Added a few missing override and noexcept keywords to ValueTree
This commit is contained in:
parent
549b5dc429
commit
64f36624ec
2 changed files with 41 additions and 41 deletions
|
|
@ -396,7 +396,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool isEquivalentTo (const SharedObject& other) const
|
||||
bool isEquivalentTo (const SharedObject& other) const noexcept
|
||||
{
|
||||
if (type != other.type
|
||||
|| properties.size() != other.properties.size()
|
||||
|
|
@ -465,7 +465,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
bool perform()
|
||||
bool perform() override
|
||||
{
|
||||
jassert (! (isAddingNewProperty && target->hasProperty (name)));
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool undo()
|
||||
bool undo() override
|
||||
{
|
||||
if (isAddingNewProperty)
|
||||
target->removeProperty (name, nullptr);
|
||||
|
|
@ -487,12 +487,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
int getSizeInUnits()
|
||||
int getSizeInUnits() override
|
||||
{
|
||||
return (int) sizeof (*this); //xxx should be more accurate
|
||||
}
|
||||
|
||||
UndoableAction* createCoalescedAction (UndoableAction* nextAction)
|
||||
UndoableAction* createCoalescedAction (UndoableAction* nextAction) override
|
||||
{
|
||||
if (! (isAddingNewProperty || isDeletingProperty))
|
||||
{
|
||||
|
|
@ -528,7 +528,7 @@ public:
|
|||
jassert (child != nullptr);
|
||||
}
|
||||
|
||||
bool perform()
|
||||
bool perform() override
|
||||
{
|
||||
if (isDeleting)
|
||||
target->removeChild (childIndex, nullptr);
|
||||
|
|
@ -538,7 +538,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool undo()
|
||||
bool undo() override
|
||||
{
|
||||
if (isDeleting)
|
||||
{
|
||||
|
|
@ -555,7 +555,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
int getSizeInUnits()
|
||||
int getSizeInUnits() override
|
||||
{
|
||||
return (int) sizeof (*this); //xxx should be more accurate
|
||||
}
|
||||
|
|
@ -577,24 +577,24 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
bool perform()
|
||||
bool perform() override
|
||||
{
|
||||
parent->moveChild (startIndex, endIndex, nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool undo()
|
||||
bool undo() override
|
||||
{
|
||||
parent->moveChild (endIndex, startIndex, nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
int getSizeInUnits()
|
||||
int getSizeInUnits() override
|
||||
{
|
||||
return (int) sizeof (*this); //xxx should be more accurate
|
||||
}
|
||||
|
||||
UndoableAction* createCoalescedAction (UndoableAction* nextAction)
|
||||
UndoableAction* createCoalescedAction (UndoableAction* nextAction) override
|
||||
{
|
||||
if (MoveChildAction* next = dynamic_cast<MoveChildAction*> (nextAction))
|
||||
if (next->parent == parent && next->startIndex == endIndex)
|
||||
|
|
@ -634,11 +634,11 @@ ValueTree::ValueTree (const Identifier& type) : object (new ValueTree::SharedOb
|
|||
jassert (type.toString().isNotEmpty()); // All objects must be given a sensible type name!
|
||||
}
|
||||
|
||||
ValueTree::ValueTree (SharedObject* so) : object (so)
|
||||
ValueTree::ValueTree (SharedObject* so) noexcept : object (so)
|
||||
{
|
||||
}
|
||||
|
||||
ValueTree::ValueTree (const ValueTree& other) : object (other.object)
|
||||
ValueTree::ValueTree (const ValueTree& other) noexcept : object (other.object)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -702,23 +702,23 @@ ValueTree ValueTree::createCopy() const
|
|||
return ValueTree (createCopyIfNotNull (object.get()));
|
||||
}
|
||||
|
||||
bool ValueTree::hasType (const Identifier& typeName) const
|
||||
bool ValueTree::hasType (const Identifier& typeName) const noexcept
|
||||
{
|
||||
return object != nullptr && object->type == typeName;
|
||||
}
|
||||
|
||||
Identifier ValueTree::getType() const
|
||||
Identifier ValueTree::getType() const noexcept
|
||||
{
|
||||
return object != nullptr ? object->type : Identifier();
|
||||
}
|
||||
|
||||
ValueTree ValueTree::getParent() const
|
||||
ValueTree ValueTree::getParent() const noexcept
|
||||
{
|
||||
return ValueTree (object != nullptr ? object->parent
|
||||
: static_cast<SharedObject*> (nullptr));
|
||||
}
|
||||
|
||||
ValueTree ValueTree::getSibling (const int delta) const
|
||||
ValueTree ValueTree::getSibling (const int delta) const noexcept
|
||||
{
|
||||
if (object == nullptr || object->parent == nullptr)
|
||||
return invalid;
|
||||
|
|
@ -727,12 +727,12 @@ ValueTree ValueTree::getSibling (const int delta) const
|
|||
return ValueTree (object->parent->children.getObjectPointer (index));
|
||||
}
|
||||
|
||||
const var& ValueTree::operator[] (const Identifier& name) const
|
||||
const var& ValueTree::operator[] (const Identifier& name) const noexcept
|
||||
{
|
||||
return object == nullptr ? var::null : object->properties[name];
|
||||
}
|
||||
|
||||
const var& ValueTree::getProperty (const Identifier& name) const
|
||||
const var& ValueTree::getProperty (const Identifier& name) const noexcept
|
||||
{
|
||||
return object == nullptr ? var::null : object->properties[name];
|
||||
}
|
||||
|
|
@ -754,7 +754,7 @@ ValueTree& ValueTree::setProperty (const Identifier& name, const var& newValue,
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool ValueTree::hasProperty (const Identifier& name) const
|
||||
bool ValueTree::hasProperty (const Identifier& name) const noexcept
|
||||
{
|
||||
return object != nullptr && object->hasProperty (name);
|
||||
}
|
||||
|
|
@ -771,12 +771,12 @@ void ValueTree::removeAllProperties (UndoManager* const undoManager)
|
|||
object->removeAllProperties (undoManager);
|
||||
}
|
||||
|
||||
int ValueTree::getNumProperties() const
|
||||
int ValueTree::getNumProperties() const noexcept
|
||||
{
|
||||
return object == nullptr ? 0 : object->properties.size();
|
||||
}
|
||||
|
||||
Identifier ValueTree::getPropertyName (const int index) const
|
||||
Identifier ValueTree::getPropertyName (const int index) const noexcept
|
||||
{
|
||||
return object == nullptr ? Identifier()
|
||||
: object->properties.getName (index);
|
||||
|
|
@ -841,7 +841,7 @@ Value ValueTree::getPropertyAsValue (const Identifier& name, UndoManager* const
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
int ValueTree::getNumChildren() const
|
||||
int ValueTree::getNumChildren() const noexcept
|
||||
{
|
||||
return object == nullptr ? 0 : object->children.size();
|
||||
}
|
||||
|
|
@ -867,12 +867,12 @@ ValueTree ValueTree::getChildWithProperty (const Identifier& propertyName, const
|
|||
return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree();
|
||||
}
|
||||
|
||||
bool ValueTree::isAChildOf (const ValueTree& possibleParent) const
|
||||
bool ValueTree::isAChildOf (const ValueTree& possibleParent) const noexcept
|
||||
{
|
||||
return object != nullptr && object->isAChildOf (possibleParent.object);
|
||||
}
|
||||
|
||||
int ValueTree::indexOf (const ValueTree& child) const
|
||||
int ValueTree::indexOf (const ValueTree& child) const noexcept
|
||||
{
|
||||
return object != nullptr ? object->indexOf (child) : -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public:
|
|||
explicit ValueTree (const Identifier& type);
|
||||
|
||||
/** Creates a reference to another ValueTree. */
|
||||
ValueTree (const ValueTree&);
|
||||
ValueTree (const ValueTree&) noexcept;
|
||||
|
||||
/** Makes this object reference another node. */
|
||||
ValueTree& operator= (const ValueTree&);
|
||||
|
|
@ -124,7 +124,7 @@ public:
|
|||
It's hard to create an invalid node, but you might get one returned, e.g. by an out-of-range
|
||||
call to getChild().
|
||||
*/
|
||||
bool isValid() const { return object != nullptr; }
|
||||
bool isValid() const noexcept { return object != nullptr; }
|
||||
|
||||
/** Returns a deep copy of this tree and all its sub-nodes. */
|
||||
ValueTree createCopy() const;
|
||||
|
|
@ -134,12 +134,12 @@ public:
|
|||
The type is specified when the ValueTree is created.
|
||||
@see hasType
|
||||
*/
|
||||
Identifier getType() const;
|
||||
Identifier getType() const noexcept;
|
||||
|
||||
/** Returns true if the node has this type.
|
||||
The comparison is case-sensitive.
|
||||
*/
|
||||
bool hasType (const Identifier& typeName) const;
|
||||
bool hasType (const Identifier& typeName) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the value of a named property.
|
||||
|
|
@ -147,7 +147,7 @@ public:
|
|||
You can also use operator[] to get a property.
|
||||
@see var, setProperty, hasProperty
|
||||
*/
|
||||
const var& getProperty (const Identifier& name) const;
|
||||
const var& getProperty (const Identifier& name) const noexcept;
|
||||
|
||||
/** Returns the value of a named property, or a user-specified default if the property doesn't exist.
|
||||
If no such property has been set, this will return the value of defaultReturnValue.
|
||||
|
|
@ -161,7 +161,7 @@ public:
|
|||
calling getProperty().
|
||||
@see getProperty
|
||||
*/
|
||||
const var& operator[] (const Identifier& name) const;
|
||||
const var& operator[] (const Identifier& name) const noexcept;
|
||||
|
||||
/** Changes a named property of the node.
|
||||
The name identifier must not be an empty string.
|
||||
|
|
@ -173,7 +173,7 @@ public:
|
|||
ValueTree& setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager);
|
||||
|
||||
/** Returns true if the node contains a named property. */
|
||||
bool hasProperty (const Identifier& name) const;
|
||||
bool hasProperty (const Identifier& name) const noexcept;
|
||||
|
||||
/** Removes a property from the node.
|
||||
If the undoManager parameter is non-null, its UndoManager::perform() method will be used,
|
||||
|
|
@ -190,7 +190,7 @@ public:
|
|||
/** Returns the total number of properties that the node contains.
|
||||
@see getProperty.
|
||||
*/
|
||||
int getNumProperties() const;
|
||||
int getNumProperties() const noexcept;
|
||||
|
||||
/** Returns the identifier of the property with a given index.
|
||||
Note that properties are not guaranteed to be stored in any particular order, so don't
|
||||
|
|
@ -198,7 +198,7 @@ public:
|
|||
that it will remain constant when other properties are added or removed.
|
||||
@see getNumProperties
|
||||
*/
|
||||
Identifier getPropertyName (int index) const;
|
||||
Identifier getPropertyName (int index) const noexcept;
|
||||
|
||||
/** Returns a Value object that can be used to control and respond to one of the tree's properties.
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ public:
|
|||
/** Returns the number of child nodes belonging to this one.
|
||||
@see getChild
|
||||
*/
|
||||
int getNumChildren() const;
|
||||
int getNumChildren() const noexcept;
|
||||
|
||||
/** Returns one of this node's child nodes.
|
||||
If the index is out of range, it'll return an invalid node. (See isValid() to find out
|
||||
|
|
@ -301,18 +301,18 @@ public:
|
|||
/** Returns true if this node is anywhere below the specified parent node.
|
||||
This returns true if the node is a child-of-a-child, as well as a direct child.
|
||||
*/
|
||||
bool isAChildOf (const ValueTree& possibleParent) const;
|
||||
bool isAChildOf (const ValueTree& possibleParent) const noexcept;
|
||||
|
||||
/** Returns the index of a child item in this parent.
|
||||
If the child isn't found, this returns -1.
|
||||
*/
|
||||
int indexOf (const ValueTree& child) const;
|
||||
int indexOf (const ValueTree& child) const noexcept;
|
||||
|
||||
/** Returns the parent node that contains this one.
|
||||
If the node has no parent, this will return an invalid node. (See isValid() to find out
|
||||
whether a node is valid).
|
||||
*/
|
||||
ValueTree getParent() const;
|
||||
ValueTree getParent() const noexcept;
|
||||
|
||||
/** Returns one of this node's siblings in its parent's child list.
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ public:
|
|||
that follows this one, -1 would return the node before it, 0 will return this node itself, etc.
|
||||
If the requested position is beyond the range of available nodes, this will return ValueTree::invalid.
|
||||
*/
|
||||
ValueTree getSibling (int delta) const;
|
||||
ValueTree getSibling (int delta) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Creates an XmlElement that holds a complete image of this node and all its children.
|
||||
|
|
@ -534,7 +534,7 @@ private:
|
|||
void createListOfChildren (OwnedArray<ValueTree>&) const;
|
||||
void reorderChildren (const OwnedArray<ValueTree>&, UndoManager*);
|
||||
|
||||
explicit ValueTree (SharedObject*);
|
||||
explicit ValueTree (SharedObject*) noexcept;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue