1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +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:
jules 2018-10-16 15:37:55 +01:00
parent bb5b534ab8
commit 2e2cfb5f6c
48 changed files with 373 additions and 362 deletions

View file

@ -697,18 +697,15 @@ void Project::moveTemporaryDirectory (const File& newParentDirectory)
bool Project::saveProjectRootToFile()
{
std::unique_ptr<XmlElement> xml (projectRoot.createXml());
if (xml == nullptr)
if (auto xml = projectRoot.createXml())
{
jassertfalse;
return false;
MemoryOutputStream mo;
xml->writeTo (mo, {});
return FileHelpers::overwriteFileWithNewDataIfDifferent (getFile(), mo);
}
MemoryOutputStream mo;
xml->writeToStream (mo, {});
return FileHelpers::overwriteFileWithNewDataIfDifferent (getFile(), mo);
jassertfalse;
return false;
}
//==============================================================================