//============================================================================== void GeneratedCode::applyToCode (String& code, const String& fileNameRoot, const bool isForPreview, const String& oldFileWithUserData) const { // header guard.. String headerGuard ("__JUCER_HEADER_"); headerGuard << className.toUpperCase().retainCharacters (T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) << "_" << fileNameRoot.toUpperCase().retainCharacters (T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) << "_" << String::toHexString (Random::getSystemRandom().nextInt()).toUpperCase() << "__"; replaceTemplate (code, "headerGuard", headerGuard); replaceTemplate (code, "creationTime", Time::getCurrentTime().toString (true, true, true)); replaceTemplate (code, "className", className); replaceTemplate (code, "constructorParams", constructorParams); replaceTemplate (code, "initialisers", getInitialiserList()); replaceTemplate (code, "classDeclaration", getClassDeclaration()); replaceTemplate (code, "privateMemberDeclarations", privateMemberDeclarations); replaceTemplate (code, "publicMemberDeclarations", getCallbackDeclarations() + "\n" + publicMemberDeclarations); replaceTemplate (code, "methodDefinitions", getCallbackDefinitions()); replaceTemplate (code, "includeFilesH", getIncludeFileCode (includeFilesH)); replaceTemplate (code, "includeFilesCPP", getIncludeFileCode (includeFilesCPP)); replaceTemplate (code, "constructor", constructorCode); replaceTemplate (code, "destructor", destructorCode); if (! isForPreview) { replaceTemplate (code, "metadata", jucerMetadata); replaceTemplate (code, "staticMemberDefinitions", staticMemberDefinitions); } else { replaceTemplate (code, "metadata", T(" << Metadata isn't shown in the code preview >>\n")); replaceTemplate (code, "staticMemberDefinitions", T("// Static member declarations and resources would go here... (these aren't shown in the code preview)")); } copyAcrossUserSections (code, oldFileWithUserData); }
//============================================================================== void GeneratedCode::applyToCode (String& code, const String& fileNameRoot, const bool isForPreview, const String& oldFileWithUserData) const { // header guard.. String headerGuard ("__JUCE_HEADER_"); headerGuard << String::toHexString ((className + "xx" + fileNameRoot).hashCode64()).toUpperCase() << "__"; replaceTemplate (code, "headerGuard", headerGuard); replaceTemplate (code, "version", JUCEApplicationBase::getInstance()->getApplicationVersion()); replaceTemplate (code, "creationTime", Time::getCurrentTime().toString (true, true, true)); replaceTemplate (code, "className", className); replaceTemplate (code, "constructorParams", constructorParams); replaceTemplate (code, "initialisers", getInitialiserList()); replaceTemplate (code, "classDeclaration", getClassDeclaration()); replaceTemplate (code, "privateMemberDeclarations", privateMemberDeclarations); replaceTemplate (code, "publicMemberDeclarations", getCallbackDeclarations() + "\n" + publicMemberDeclarations); replaceTemplate (code, "methodDefinitions", getCallbackDefinitions()); replaceTemplate (code, "includeFilesH", getIncludeFileCode (includeFilesH)); replaceTemplate (code, "includeFilesCPP", getIncludeFileCode (includeFilesCPP)); replaceTemplate (code, "constructor", constructorCode); replaceTemplate (code, "destructor", destructorCode); if (! isForPreview) { replaceTemplate (code, "metadata", jucerMetadata); replaceTemplate (code, "staticMemberDefinitions", staticMemberDefinitions); } else { replaceTemplate (code, "metadata", " << Metadata isn't shown in the code preview >>\n"); replaceTemplate (code, "staticMemberDefinitions", "// Static member declarations and resources would go here... (these aren't shown in the code preview)"); } copyAcrossUserSections (code, oldFileWithUserData); }