LMMS
Loading...
Searching...
No Matches
XmlElement.h File Reference

Go to the source code of this file.

Classes

class  water::XmlElement
struct  water::XmlElement::XmlAttributeNode

Namespaces

namespace  water

Macros

#define __forEachXmlChildElement(parentXmlElement, childElementVariableName)
#define __forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName)

Macro Definition Documentation

◆ __forEachXmlChildElement

#define __forEachXmlChildElement ( parentXmlElement,
childElementVariableName )
Value:
\
for (water::XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
childElementVariableName != nullptr; \
childElementVariableName = childElementVariableName->getNextElement())
Definition XmlElement.h:145
XmlElement * getNextElement() const noexcept
Definition XmlElement.h:464

A handy macro to make it easy to iterate all the child elements in an XmlElement.

The parentXmlElement should be a reference to the parent XML, and the childElementVariableName will be the name of a pointer to each child element.

E.g.

XmlElement* myParentXml = createSomeKindOfXmlDocument();
forEachXmlChildElement (*myParentXml, child)
{
if (child->hasTagName ("FOO"))
doSomethingWithXmlElement (child);
}
Definition XmlElement.h:145
#define forEachXmlChildElement(parentXmlElement, childElementVariableName)
Definition juce_XmlElement.h:824
See also
forEachXmlChildElementWithTagName

◆ __forEachXmlChildElementWithTagName

#define __forEachXmlChildElementWithTagName ( parentXmlElement,
childElementVariableName,
requiredTagName )
Value:
\
for (water::XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
childElementVariableName != nullptr; \
childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
XmlElement * getNextElementWithTagName(StringRef requiredTagName) const
Definition XmlElement.cpp:429

A macro that makes it easy to iterate all the child elements of an XmlElement which have a specified tag.

This does the same job as the forEachXmlChildElement macro, but only for those elements that have a particular tag name.

The parentXmlElement should be a reference to the parent XML, and the childElementVariableName will be the name of a pointer to each child element. The requiredTagName is the tag name to match.

E.g.

XmlElement* myParentXml = createSomeKindOfXmlDocument();
forEachXmlChildElementWithTagName (*myParentXml, child, "MYTAG")
{
// the child object is now guaranteed to be a <MYTAG> element..
doSomethingWithMYTAGElement (child);
}
#define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName)
Definition juce_XmlElement.h:852
See also
forEachXmlChildElement