mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-29 02:40:05 +00:00
Made a lot of the functions that used to return a raw XmlElement* instead return a std::unique_ptr<XmlElement> to make it safer and more concise to capture them. Also added new methods to XmlElement for generating text, and deprecated the old ones
This commit is contained in:
parent
bb5b534ab8
commit
2e2cfb5f6c
48 changed files with 373 additions and 362 deletions
|
|
@ -992,9 +992,9 @@ void ValueTree::sendPropertyChangeMessage (const Identifier& property)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
XmlElement* ValueTree::createXml() const
|
||||
std::unique_ptr<XmlElement> ValueTree::createXml() const
|
||||
{
|
||||
return object != nullptr ? object->createXml() : nullptr;
|
||||
return std::unique_ptr<XmlElement> (object != nullptr ? object->createXml() : nullptr);
|
||||
}
|
||||
|
||||
ValueTree ValueTree::fromXml (const XmlElement& xml)
|
||||
|
|
@ -1015,12 +1015,10 @@ ValueTree ValueTree::fromXml (const XmlElement& xml)
|
|||
return {};
|
||||
}
|
||||
|
||||
String ValueTree::toXmlString() const
|
||||
String ValueTree::toXmlString (const XmlElement::TextFormat& format) const
|
||||
{
|
||||
std::unique_ptr<XmlElement> xml (createXml());
|
||||
|
||||
if (xml != nullptr)
|
||||
return xml->createDocument ({});
|
||||
if (auto xml = createXml())
|
||||
return xml->toString (format);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
@ -1188,8 +1186,8 @@ public:
|
|||
}
|
||||
expect (v1.isEquivalentTo (ValueTree::readFromGZIPData (zipped.getData(), zipped.getDataSize())));
|
||||
|
||||
std::unique_ptr<XmlElement> xml1 (v1.createXml());
|
||||
std::unique_ptr<XmlElement> xml2 (v2.createCopy().createXml());
|
||||
auto xml1 = v1.createXml();
|
||||
auto xml2 = v2.createCopy().createXml();
|
||||
expect (xml1->isEquivalentTo (xml2.get(), false));
|
||||
|
||||
auto v4 = v2.createCopy();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue