Browse Source

Tried to improve the explanation for XmlElement::findParentElementOf.

tags/2021-05-28
jules 10 years ago
parent
commit
d42a606b99
2 changed files with 11 additions and 4 deletions
  1. +1
    -1
      modules/juce_core/xml/juce_XmlElement.cpp
  2. +10
    -3
      modules/juce_core/xml/juce_XmlElement.h

+ 1
- 1
modules/juce_core/xml/juce_XmlElement.cpp View File

@@ -714,7 +714,7 @@ bool XmlElement::isEquivalentTo (const XmlElement* const other,
{
if (thisAtt == nullptr || otherAtt == nullptr)
{
if (thisAtt == otherAtt) // both 0, so it's a match
if (thisAtt == otherAtt) // both nullptr, so it's a match
break;
return false;


+ 10
- 3
modules/juce_core/xml/juce_XmlElement.h View File

@@ -599,10 +599,17 @@ public:
/** Returns true if the given element is a child of this one. */
bool containsChildElement (const XmlElement* possibleChild) const noexcept;
/** Recursively searches all sub-elements to find one that contains the specified
child element.
/** Recursively searches all sub-elements of this one, looking for an element
which is the direct parent of the specified element.
Because elements don't store a pointer to their parent, if you have one
and need to find its parent, the only way to do so is to exhaustively
search the whole tree for it.
If the given child is found somewhere in this element's hierarchy, then
this method will return its parent. If not, it will return nullptr.
*/
XmlElement* findParentElementOf (const XmlElement* elementToLookFor) noexcept;
XmlElement* findParentElementOf (const XmlElement* childToSearchFor) noexcept;
//==============================================================================
/** Sorts the child elements using a comparator.


Loading…
Cancel
Save