From 736a07e4ce132df9754efefae0e14d6e2132b056 Mon Sep 17 00:00:00 2001 From: hogliux Date: Wed, 4 Apr 2018 10:46:18 +0100 Subject: [PATCH] Added a setTagName method to XmlElement --- modules/juce_core/xml/juce_XmlElement.cpp | 6 ++++++ modules/juce_core/xml/juce_XmlElement.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/modules/juce_core/xml/juce_XmlElement.cpp b/modules/juce_core/xml/juce_XmlElement.cpp index b8afaf82b2..3e6a2fa954 100644 --- a/modules/juce_core/xml/juce_XmlElement.cpp +++ b/modules/juce_core/xml/juce_XmlElement.cpp @@ -439,6 +439,12 @@ XmlElement* XmlElement::getNextElementWithTagName (StringRef requiredTagName) co return e; } +void XmlElement::setTagName (StringRef newTagName) +{ + jassert (isValidXmlName (newTagName)); + tagName = StringPool::getGlobalPool().getPooledString (newTagName); +} + //============================================================================== int XmlElement::getNumAttributes() const noexcept { diff --git a/modules/juce_core/xml/juce_XmlElement.h b/modules/juce_core/xml/juce_XmlElement.h index 22c497439b..91de12781d 100644 --- a/modules/juce_core/xml/juce_XmlElement.h +++ b/modules/juce_core/xml/juce_XmlElement.h @@ -278,6 +278,11 @@ public: */ bool hasTagNameIgnoringNamespace (StringRef possibleTagName) const; + /** Changes this elements tag name. + @see getTagName + */ + void setTagName (StringRef newTagName); + //============================================================================== /** Returns the number of XML attributes this element contains.