bool JucerDocument::reloadFromDocument() { const String cppContent (cpp->getCodeDocument().getAllContent()); ScopedPointer<XmlElement> newXML (pullMetaDataFromCppFile (cppContent)); if (newXML == nullptr || ! newXML->hasTagName (jucerCompXmlTag)) return false; if (currentXML != nullptr && currentXML->isEquivalentTo (newXML, true)) return true; currentXML = newXML; stopTimer(); resources.loadFromCpp (getCppFile(), cppContent); return loadFromXml (*currentXML); }
//============================================================================== bool JucerDocument::findTemplateFiles (String& headerContent, String& cppContent) const { if (templateFile.isNotEmpty()) { const File f (getCppFile().getSiblingFile (templateFile)); const File templateCpp (f.withFileExtension (".cpp")); const File templateH (f.withFileExtension (".h")); headerContent = templateH.loadFileAsString(); cppContent = templateCpp.loadFileAsString(); if (headerContent.isNotEmpty() && cppContent.isNotEmpty()) return true; } headerContent = BinaryData::jucer_ComponentTemplate_h; cppContent = BinaryData::jucer_ComponentTemplate_cpp; return true; }
bool JucerDocument::reloadFromDocument() { const String cppContent (cpp->getCodeDocument().getAllContent()); std::unique_ptr<XmlElement> newXML (pullMetaDataFromCppFile (cppContent)); if (newXML == nullptr || ! newXML->hasTagName (jucerCompXmlTag)) return false; if (currentXML != nullptr && currentXML->isEquivalentTo (newXML.get(), true)) return true; currentXML.reset (newXML.release()); stopTimer(); resources.loadFromCpp (getCppFile(), cppContent); bool result = loadFromXml (*currentXML); extractCustomPaintSnippetsFromCppFile (cppContent); return result; }