upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
		@ -40,6 +40,16 @@ XmlElement* XmlDocument::parse (const String& xmlData)
 | 
			
		||||
    return doc.getDocumentElement();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<XmlElement> parseXML (const String& textToParse)
 | 
			
		||||
{
 | 
			
		||||
    return std::unique_ptr<XmlElement> (XmlDocument::parse (textToParse));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<XmlElement> parseXML (const File& fileToParse)
 | 
			
		||||
{
 | 
			
		||||
    return std::unique_ptr<XmlElement> (XmlDocument::parse (fileToParse));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void XmlDocument::setInputSource (InputSource* newSource) noexcept
 | 
			
		||||
{
 | 
			
		||||
    inputSource.reset (newSource);
 | 
			
		||||
 | 
			
		||||
@ -47,14 +47,15 @@ namespace juce
 | 
			
		||||
 | 
			
		||||
    @endcode
 | 
			
		||||
 | 
			
		||||
    Or you can use the static helper methods for quick parsing..
 | 
			
		||||
    Or you can use the helper functions for much less verbose parsing..
 | 
			
		||||
 | 
			
		||||
    @code
 | 
			
		||||
    std::unique_ptr<XmlElement> xml (XmlDocument::parse (myXmlFile));
 | 
			
		||||
 | 
			
		||||
    if (xml != nullptr && xml->hasTagName ("foobar"))
 | 
			
		||||
    if (auto xml = parseXML (myXmlFile))
 | 
			
		||||
    {
 | 
			
		||||
        ...etc
 | 
			
		||||
        if (xml->hasTagName ("foobar"))
 | 
			
		||||
        {
 | 
			
		||||
            ...etc
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    @endcode
 | 
			
		||||
 | 
			
		||||
@ -132,12 +133,14 @@ public:
 | 
			
		||||
    //==============================================================================
 | 
			
		||||
    /** A handy static method that parses a file.
 | 
			
		||||
        This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it.
 | 
			
		||||
        An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>!
 | 
			
		||||
        @returns    a new XmlElement which the caller will need to delete, or null if there was an error.
 | 
			
		||||
    */
 | 
			
		||||
    static XmlElement* parse (const File& file);
 | 
			
		||||
 | 
			
		||||
    /** A handy static method that parses some XML data.
 | 
			
		||||
        This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it.
 | 
			
		||||
        An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>!
 | 
			
		||||
        @returns    a new XmlElement which the caller will need to delete, or null if there was an error.
 | 
			
		||||
    */
 | 
			
		||||
    static XmlElement* parse (const String& xmlData);
 | 
			
		||||
@ -172,4 +175,21 @@ private:
 | 
			
		||||
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (XmlDocument)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
/** Attempts to parse some XML text, returning a new XmlElement if it was valid.
 | 
			
		||||
    If the parse fails, this will return a nullptr - if you need more information about
 | 
			
		||||
    errors or more parsing options, see the XmlDocument instead.
 | 
			
		||||
    @see XmlDocument
 | 
			
		||||
*/
 | 
			
		||||
std::unique_ptr<XmlElement> parseXML (const String& textToParse);
 | 
			
		||||
 | 
			
		||||
/** Attempts to parse some XML text, returning a new XmlElement if it was valid.
 | 
			
		||||
    If the parse fails, this will return a nullptr - if you need more information about
 | 
			
		||||
    errors or more parsing options, see the XmlDocument instead.
 | 
			
		||||
    @see XmlDocument
 | 
			
		||||
*/
 | 
			
		||||
std::unique_ptr<XmlElement> parseXML (const File& fileToParse);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 | 
			
		||||
@ -127,10 +127,10 @@ XmlElement& XmlElement::operator= (const XmlElement& other)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
XmlElement::XmlElement (XmlElement&& other) noexcept
 | 
			
		||||
    : nextListItem      (static_cast<LinkedListPointer<XmlElement>&&> (other.nextListItem)),
 | 
			
		||||
      firstChildElement (static_cast<LinkedListPointer<XmlElement>&&> (other.firstChildElement)),
 | 
			
		||||
      attributes        (static_cast<LinkedListPointer<XmlAttributeNode>&&> (other.attributes)),
 | 
			
		||||
      tagName           (static_cast<String&&> (other.tagName))
 | 
			
		||||
    : nextListItem      (std::move (other.nextListItem)),
 | 
			
		||||
      firstChildElement (std::move (other.firstChildElement)),
 | 
			
		||||
      attributes        (std::move (other.attributes)),
 | 
			
		||||
      tagName           (std::move (other.tagName))
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -141,10 +141,10 @@ XmlElement& XmlElement::operator= (XmlElement&& other) noexcept
 | 
			
		||||
    removeAllAttributes();
 | 
			
		||||
    deleteAllChildElements();
 | 
			
		||||
 | 
			
		||||
    nextListItem      = static_cast<LinkedListPointer<XmlElement>&&> (other.nextListItem);
 | 
			
		||||
    firstChildElement = static_cast<LinkedListPointer<XmlElement>&&> (other.firstChildElement);
 | 
			
		||||
    attributes        = static_cast<LinkedListPointer<XmlAttributeNode>&&> (other.attributes);
 | 
			
		||||
    tagName           = static_cast<String&&> (other.tagName);
 | 
			
		||||
    nextListItem      = std::move (other.nextListItem);
 | 
			
		||||
    firstChildElement = std::move (other.firstChildElement);
 | 
			
		||||
    attributes        = std::move (other.attributes);
 | 
			
		||||
    tagName           = std::move (other.tagName);
 | 
			
		||||
 | 
			
		||||
    return *this;
 | 
			
		||||
}
 | 
			
		||||
@ -241,7 +241,7 @@ namespace XmlOutputFunctions
 | 
			
		||||
                            outputStream << (char) character;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        // Note: deliberate fall-through here!
 | 
			
		||||
                        // Note: Deliberate fall-through here!
 | 
			
		||||
                    default:
 | 
			
		||||
                        outputStream << "&#" << ((int) character) << ';';
 | 
			
		||||
                        break;
 | 
			
		||||
@ -580,7 +580,7 @@ void XmlElement::setAttribute (const Identifier& attributeName, const int number
 | 
			
		||||
 | 
			
		||||
void XmlElement::setAttribute (const Identifier& attributeName, const double number)
 | 
			
		||||
{
 | 
			
		||||
    setAttribute (attributeName, String (number, 20));
 | 
			
		||||
    setAttribute (attributeName, serialiseDouble (number));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void XmlElement::removeAttribute (const Identifier& attributeName) noexcept
 | 
			
		||||
@ -695,6 +695,8 @@ void XmlElement::removeChildElement (XmlElement* const childToRemove,
 | 
			
		||||
{
 | 
			
		||||
    if (childToRemove != nullptr)
 | 
			
		||||
    {
 | 
			
		||||
        jassert (containsChildElement (childToRemove));
 | 
			
		||||
 | 
			
		||||
        firstChildElement.remove (childToRemove);
 | 
			
		||||
 | 
			
		||||
        if (shouldDeleteTheChild)
 | 
			
		||||
@ -923,4 +925,49 @@ void XmlElement::deleteAllTextElements() noexcept
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//==============================================================================
 | 
			
		||||
#if JUCE_UNIT_TESTS
 | 
			
		||||
 | 
			
		||||
class XmlElementTests  : public UnitTest
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    XmlElementTests() : UnitTest ("XmlElement", "XML") {}
 | 
			
		||||
 | 
			
		||||
    void runTest() override
 | 
			
		||||
    {
 | 
			
		||||
        {
 | 
			
		||||
            beginTest ("Float formatting");
 | 
			
		||||
 | 
			
		||||
            auto element = std::make_unique<XmlElement> ("test");
 | 
			
		||||
            Identifier number ("number");
 | 
			
		||||
 | 
			
		||||
            std::map<double, String> tests;
 | 
			
		||||
            tests[1] = "1.0";
 | 
			
		||||
            tests[1.1] = "1.1";
 | 
			
		||||
            tests[1.01] = "1.01";
 | 
			
		||||
            tests[0.76378] = "0.76378";
 | 
			
		||||
            tests[-10] = "-10.0";
 | 
			
		||||
            tests[10.01] = "10.01";
 | 
			
		||||
            tests[0.0123] = "0.0123";
 | 
			
		||||
            tests[-3.7e-27] = "-3.7e-27";
 | 
			
		||||
            tests[1e+40] = "1.0e40";
 | 
			
		||||
            tests[-12345678901234567.0] = "-1.234567890123457e16";
 | 
			
		||||
            tests[192000] = "192000.0";
 | 
			
		||||
            tests[1234567] = "1.234567e6";
 | 
			
		||||
            tests[0.00006] = "0.00006";
 | 
			
		||||
            tests[0.000006] = "6.0e-6";
 | 
			
		||||
 | 
			
		||||
            for (auto& test : tests)
 | 
			
		||||
            {
 | 
			
		||||
                element->setAttribute (number, test.first);
 | 
			
		||||
                expectEquals (element->getStringAttribute (number), test.second);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static XmlElementTests xmlElementTests;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
} // namespace juce
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user