29 #ifndef JUCE_XMLELEMENT_H_INCLUDED
30 #define JUCE_XMLELEMENT_H_INCLUDED
52 #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \
54 for (juce::XmlElement* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
55 childElementVariableName != nullptr; \
56 childElementVariableName = childElementVariableName->getNextElement())
81 #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \
83 for (juce::XmlElement* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
84 childElementVariableName != nullptr; \
85 childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))
159 XmlElement (String::CharPointerType tagNameBegin, String::CharPointerType tagNameEnd);
167 #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
188 bool ignoreOrderOfAttributes)
const noexcept;
209 bool allOnOneLine =
false,
210 bool includeXmlHeader =
true,
212 int lineWrapLength = 60)
const;
231 bool allOnOneLine =
false,
232 bool includeXmlHeader =
true,
234 int lineWrapLength = 60)
const;
255 bool writeToFile (
const File& destinationFile,
258 int lineWrapLength = 60)
const;
268 String getNamespace()
const;
271 String getTagNameWithoutNamespace()
const;
283 bool hasTagNameIgnoringNamespace (
StringRef possibleTagName)
const;
291 int getNumAttributes() const
noexcept;
300 const
String& getAttributeName (
int attributeIndex) const
noexcept;
309 const
String& getAttributeValue (
int attributeIndex) const
noexcept;
337 bool compareAttribute (
StringRef attributeName,
339 bool ignoreCase = false) const
noexcept;
351 int getIntAttribute (
StringRef attributeName,
int defaultReturnValue = 0) const;
363 double getDoubleAttribute (
StringRef attributeName,
double defaultReturnValue = 0.0) const;
375 bool getBoolAttribute (
StringRef attributeName,
bool defaultReturnValue = false) const;
390 void setAttribute (const
Identifier& attributeName, const
String& newValue);
404 void setAttribute (const
Identifier& attributeName,
int newValue);
418 void setAttribute (const
Identifier& attributeName,
double newValue);
428 void removeAllAttributes()
noexcept;
480 int getNumChildElements() const
noexcept;
537 void insertChildElement (
XmlElement* newChildElement,
577 bool replaceChildElement (
XmlElement* currentChildElement,
586 void removeChildElement (
XmlElement* childToRemove,
587 bool shouldDeleteTheChild)
noexcept;
592 void deleteAllChildElements()
noexcept;
637 template <class ElementComparator>
638 void sortChildElements (ElementComparator& comparator,
639 bool retainOrderOfEquivalentItems = false)
641 const int num = getNumChildElements();
646 getChildElementsAsArray (elems);
647 sortArray (comparator, (
XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
648 reorderChildElements (elems, num);
660 bool isTextElement() const
noexcept;
686 void setText (const
String& newText);
701 String getAllSubText() const;
712 const
String& defaultReturnValue) const;
717 void addTextElement (const
String& text);
722 void deleteAllTextElements()
noexcept;
729 struct XmlAttributeNode
731 XmlAttributeNode (
const XmlAttributeNode&)
noexcept;
733 XmlAttributeNode (String::CharPointerType, String::CharPointerType);
755 void copyChildrenAndAttributesFrom (const XmlElement&);
756 void writeElementAsText (OutputStream&, int indentationLevel, int lineWrapLength) const;
757 void getChildElementsAsArray (XmlElement**) const
noexcept;
758 void reorderChildElements (XmlElement**, int)
noexcept;
759 XmlAttributeNode* getAttribute (StringRef) const
noexcept;
770 #endif // JUCE_XMLELEMENT_H_INCLUDED