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;
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);
425 void removeAttribute (const
Identifier& attributeName) noexcept;
428 void removeAllAttributes() noexcept;
437 XmlElement* getFirstChildElement() const noexcept {
return firstChildElement; }
524 void addChildElement (
XmlElement* newChildElement) noexcept;
537 void insertChildElement (
XmlElement* newChildElement,
538 int indexToInsertAt) noexcept;
552 void prependChildElement (
XmlElement* newChildElement) noexcept;
577 bool replaceChildElement (
XmlElement* currentChildElement,
586 void removeChildElement (
XmlElement* childToRemove,
587 bool shouldDeleteTheChild) noexcept;
592 void deleteAllChildElements() noexcept;
597 void deleteAllChildElementsWithTagName (
StringRef tagName) 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);
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);
754 XmlElement (
int) noexcept;
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;
764 XmlElement (const
wchar_t*) JUCE_DELETED_FUNCTION;
770 #endif // JUCE_XMLELEMENT_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
#define false
Definition: ordinals.h:83
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_LinkedListPointer.h:61
Definition: juce_XmlElement.h:142
Definition: juce_NamedValueSet.h:39
XmlElement * getNextElement() const noexcept
Definition: juce_XmlElement.h:465
#define JUCE_DELETED_FUNCTION
Definition: juce_CompilerSupport.h:133
Definition: juce_OutputStream.h:42
Definition: juce_XmlDocument.h:69
const String & getTagName() const noexcept
Definition: juce_XmlElement.h:265
Definition: juce_HeapBlock.h:90
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
Definition: juce_File.h:45
Definition: juce_Identifier.h:43
Definition: juce_StringRef.h:65