From 2d43125a9569bff768557abedffddebf23172785 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 17 Jan 2018 12:48:38 +0000 Subject: [PATCH] Projucer: Cleaned up the exporter code --- .../jucer_ProjectExport_Android.h | 241 ++++++++------- .../ProjectSaving/jucer_ProjectExport_CLion.h | 40 ++- .../jucer_ProjectExport_CodeBlocks.h | 50 +-- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 265 ++++++++-------- .../ProjectSaving/jucer_ProjectExport_Make.h | 79 ++--- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 291 +++++++++--------- .../ProjectSaving/jucer_ProjectExporter.h | 2 + 7 files changed, 483 insertions(+), 485 deletions(-) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index ac3d179fb9..960df9ebb1 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -111,37 +111,37 @@ public: //============================================================================== AndroidProjectExporter (Project& p, const ValueTree& t) : ProjectExporter (p, t), - androidRepositories (settings, Ids::androidRepositories, nullptr, ""), - androidDependencies (settings, Ids::androidDependencies, nullptr, ""), - androidScreenOrientation (settings, Ids::androidScreenOrientation, nullptr, "unspecified"), - androidActivityClass (settings, Ids::androidActivityClass, nullptr, createDefaultClassName()), - androidActivitySubClassName (settings, Ids::androidActivitySubClassName, nullptr), - androidManifestCustomXmlElements (settings, Ids::androidManifestCustomXmlElements, nullptr, ""), - androidVersionCode (settings, Ids::androidVersionCode, nullptr, "1"), - androidMinimumSDK (settings, Ids::androidMinimumSDK, nullptr, "10"), - androidTheme (settings, Ids::androidTheme, nullptr), - androidSharedLibraries (settings, Ids::androidSharedLibraries, nullptr, ""), - androidStaticLibraries (settings, Ids::androidStaticLibraries, nullptr, ""), - androidExtraAssetsFolder (settings, Ids::androidExtraAssetsFolder, nullptr, ""), - androidInternetNeeded (settings, Ids::androidInternetNeeded, nullptr, true), - androidMicNeeded (settings, Ids::microphonePermissionNeeded, nullptr, false), - androidBluetoothNeeded (settings, Ids::androidBluetoothNeeded, nullptr, true), - androidExternalReadPermission (settings, Ids::androidExternalReadNeeded, nullptr, true), - androidExternalWritePermission (settings, Ids::androidExternalWriteNeeded, nullptr, true), - androidInAppBillingPermission (settings, Ids::androidInAppBilling, nullptr, false), - androidVibratePermission (settings, Ids::androidVibratePermissionNeeded, nullptr, false), - androidOtherPermissions (settings, Ids::androidOtherPermissions, nullptr), - androidEnableRemoteNotifications (settings, Ids::androidEnableRemoteNotifications, nullptr, false), - androidRemoteNotificationsConfigFile (settings, Ids::androidRemoteNotificationsConfigFile, nullptr, ""), - androidEnableContentSharing (settings, Ids::androidEnableContentSharing, nullptr, false), - androidKeyStore (settings, Ids::androidKeyStore, nullptr, "${user.home}/.android/debug.keystore"), - androidKeyStorePass (settings, Ids::androidKeyStorePass, nullptr, "android"), - androidKeyAlias (settings, Ids::androidKeyAlias, nullptr, "androiddebugkey"), - androidKeyAliasPass (settings, Ids::androidKeyAliasPass, nullptr, "android"), - gradleVersion (settings, Ids::gradleVersion, nullptr, "4.1"), - gradleToolchain (settings, Ids::gradleToolchain, nullptr, "clang"), - androidPluginVersion (settings, Ids::androidPluginVersion, nullptr, "3.0.0"), - buildToolsVersion (settings, Ids::buildToolsVersion, nullptr, "27.0.0"), + androidRepositories (settings, Ids::androidRepositories, getUndoManager()), + androidDependencies (settings, Ids::androidDependencies, getUndoManager()), + androidScreenOrientation (settings, Ids::androidScreenOrientation, getUndoManager(), "unspecified"), + androidActivityClass (settings, Ids::androidActivityClass, getUndoManager(), createDefaultClassName()), + androidActivitySubClassName (settings, Ids::androidActivitySubClassName, getUndoManager()), + androidManifestCustomXmlElements (settings, Ids::androidManifestCustomXmlElements, getUndoManager()), + androidVersionCode (settings, Ids::androidVersionCode, getUndoManager(), "1"), + androidMinimumSDK (settings, Ids::androidMinimumSDK, getUndoManager(), "10"), + androidTheme (settings, Ids::androidTheme, getUndoManager()), + androidSharedLibraries (settings, Ids::androidSharedLibraries, getUndoManager()), + androidStaticLibraries (settings, Ids::androidStaticLibraries, getUndoManager()), + androidExtraAssetsFolder (settings, Ids::androidExtraAssetsFolder, getUndoManager()), + androidInternetNeeded (settings, Ids::androidInternetNeeded, getUndoManager(), true), + androidMicNeeded (settings, Ids::microphonePermissionNeeded, getUndoManager(), false), + androidBluetoothNeeded (settings, Ids::androidBluetoothNeeded, getUndoManager(), true), + androidExternalReadPermission (settings, Ids::androidExternalReadNeeded, getUndoManager(), true), + androidExternalWritePermission (settings, Ids::androidExternalWriteNeeded, getUndoManager(), true), + androidInAppBillingPermission (settings, Ids::androidInAppBilling, getUndoManager(), false), + androidVibratePermission (settings, Ids::androidVibratePermissionNeeded, getUndoManager(), false), + androidOtherPermissions (settings, Ids::androidOtherPermissions, getUndoManager()), + androidEnableRemoteNotifications (settings, Ids::androidEnableRemoteNotifications, getUndoManager(), false), + androidRemoteNotificationsConfigFile (settings, Ids::androidRemoteNotificationsConfigFile, getUndoManager()), + androidEnableContentSharing (settings, Ids::androidEnableContentSharing, getUndoManager(), false), + androidKeyStore (settings, Ids::androidKeyStore, getUndoManager(), "${user.home}/.android/debug.keystore"), + androidKeyStorePass (settings, Ids::androidKeyStorePass, getUndoManager(), "android"), + androidKeyAlias (settings, Ids::androidKeyAlias, getUndoManager(), "androiddebugkey"), + androidKeyAliasPass (settings, Ids::androidKeyAliasPass, getUndoManager(), "android"), + gradleVersion (settings, Ids::gradleVersion, getUndoManager(), "4.1"), + gradleToolchain (settings, Ids::gradleToolchain, getUndoManager(), "clang"), + androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "3.0.0"), + buildToolsVersion (settings, Ids::buildToolsVersion, getUndoManager(), "27.0.0"), AndroidExecutable (findAndroidExecutable()) { name = getName(); @@ -190,7 +190,7 @@ public: return false; } - const File targetFolder (getTargetFolder()); + auto targetFolder = getTargetFolder(); // we have to surround the path with extra quotes, otherwise Android Studio // will choke if there are any space characters in the path. @@ -200,8 +200,8 @@ public: //============================================================================== void create (const OwnedArray& modules) const override { - const File targetFolder (getTargetFolder()); - const File appFolder (targetFolder.getChildFile (isLibrary() ? "lib" : "app")); + auto targetFolder = getTargetFolder(); + auto appFolder = targetFolder.getChildFile (isLibrary() ? "lib" : "app"); removeOldFiles (targetFolder); @@ -210,16 +210,16 @@ public: copyExtraResourceFiles(); - writeFile (targetFolder, "settings.gradle", isLibrary() ? "include ':lib'" : "include ':app'"); - writeFile (targetFolder, "build.gradle", getProjectBuildGradleFileContent()); - writeFile (appFolder, "build.gradle", getAppBuildGradleFileContent()); - writeFile (targetFolder, "local.properties", getLocalPropertiesFileContent()); + writeFile (targetFolder, "settings.gradle", isLibrary() ? "include ':lib'" : "include ':app'"); + writeFile (targetFolder, "build.gradle", getProjectBuildGradleFileContent()); + writeFile (appFolder, "build.gradle", getAppBuildGradleFileContent()); + writeFile (targetFolder, "local.properties", getLocalPropertiesFileContent()); writeFile (targetFolder, "gradle/wrapper/gradle-wrapper.properties", getGradleWrapperPropertiesFileContent()); - writeBinaryFile (targetFolder, "gradle/wrapper/LICENSE-for-gradlewrapper.txt", BinaryData::LICENSE, BinaryData::LICENSESize); - writeBinaryFile (targetFolder, "gradle/wrapper/gradle-wrapper.jar", BinaryData::gradlewrapper_jar, BinaryData::gradlewrapper_jarSize); - writeBinaryFile (targetFolder, "gradlew", BinaryData::gradlew, BinaryData::gradlewSize); - writeBinaryFile (targetFolder, "gradlew.bat", BinaryData::gradlew_bat, BinaryData::gradlew_batSize); + writeBinaryFile (targetFolder, "gradle/wrapper/LICENSE-for-gradlewrapper.txt", BinaryData::LICENSE, BinaryData::LICENSESize); + writeBinaryFile (targetFolder, "gradle/wrapper/gradle-wrapper.jar", BinaryData::gradlewrapper_jar, BinaryData::gradlewrapper_jarSize); + writeBinaryFile (targetFolder, "gradlew", BinaryData::gradlew, BinaryData::gradlewSize); + writeBinaryFile (targetFolder, "gradlew.bat", BinaryData::gradlew_bat, BinaryData::gradlew_batSize); targetFolder.getChildFile ("gradlew").setExecutePermission (true); @@ -233,13 +233,16 @@ public: writeCmakeFile (appFolder.getChildFile ("CMakeLists.txt")); - const String androidExtraAssetsFolderValue = androidExtraAssetsFolder.get(); + auto androidExtraAssetsFolderValue = androidExtraAssetsFolder.get().toString(); + if (androidExtraAssetsFolderValue.isNotEmpty()) { - File extraAssets (getProject().getFile().getParentDirectory().getChildFile(androidExtraAssetsFolderValue)); + auto extraAssets = getProject().getFile().getParentDirectory().getChildFile (androidExtraAssetsFolderValue); + if (extraAssets.exists() && extraAssets.isDirectory()) { - const File assetsFolder (appFolder.getChildFile ("src/main/assets")); + auto assetsFolder = appFolder.getChildFile ("src/main/assets"); + if (assetsFolder.deleteRecursively()) extraAssets.copyDirectoryTo (assetsFolder); } @@ -273,26 +276,26 @@ public: static File findAndroidExecutable() { #if JUCE_WINDOWS - const File defaultInstallation ("C:\\Program Files\\Android\\Android Studio\\bin"); + File defaultInstallation ("C:\\Program Files\\Android\\Android Studio\\bin"); if (defaultInstallation.exists()) { { - const File studio64 = defaultInstallation.getChildFile ("studio64.exe"); + auto studio64 = defaultInstallation.getChildFile ("studio64.exe"); if (studio64.existsAsFile()) return studio64; } { - const File studio = defaultInstallation.getChildFile ("studio.exe"); + auto studio = defaultInstallation.getChildFile ("studio.exe"); if (studio.existsAsFile()) return studio; } } #elif JUCE_MAC - const File defaultInstallation ("/Applications/Android Studio.app"); + File defaultInstallation ("/Applications/Android Studio.app"); if (defaultInstallation.exists()) return defaultInstallation; @@ -308,10 +311,10 @@ protected: public: AndroidBuildConfiguration (Project& p, const ValueTree& settings, const ProjectExporter& e) : BuildConfiguration (p, settings, e), - androidArchitectures (config, Ids::androidArchitectures, nullptr, isDebug() ? "armeabi x86" : ""), - androidAdditionalXmlValueResources (config, Ids::androidAdditionalXmlValueResources, nullptr, {}), - androidAdditionalRawValueResources (config, Ids::androidAdditionalRawValueResources, nullptr, {}), - androidCustomStringXmlElements (config, Ids::androidCustomStringXmlElements, nullptr, {}) + androidArchitectures (config, Ids::androidArchitectures, getUndoManager(), isDebug() ? "armeabi x86" : ""), + androidAdditionalXmlValueResources (config, Ids::androidAdditionalXmlValueResources, getUndoManager()), + androidAdditionalRawValueResources (config, Ids::androidAdditionalRawValueResources, getUndoManager()), + androidCustomStringXmlElements (config, Ids::androidCustomStringXmlElements, getUndoManager()) { linkTimeOptimisationValue.setDefault (false); optimisationLevelValue.setDefault (isDebug() ? gccO0 : gccO3); @@ -386,7 +389,7 @@ private: << "set_source_files_properties(\"" << cpufeaturesPath << "\" PROPERTIES COMPILE_FLAGS \"-Wno-sign-conversion -Wno-gnu-statement-expression\")" << newLine << newLine; { - StringArray projectDefines (getEscapedPreprocessorDefs (getProjectPreprocessorDefs())); + auto projectDefines = getEscapedPreprocessorDefs (getProjectPreprocessorDefs()); if (projectDefines.size() > 0) mo << "add_definitions(" << projectDefines.joinIntoString (" ") << ")" << newLine << newLine; } @@ -401,7 +404,7 @@ private: mo << ")" << newLine << newLine; } - const String& cfgExtraLinkerFlags = getExtraLinkerFlagsString(); + auto cfgExtraLinkerFlags = getExtraLinkerFlagsString(); if (cfgExtraLinkerFlags.isNotEmpty()) { mo << "SET( JUCE_LDFLAGS \"" << cfgExtraLinkerFlags.replace ("\"", "\\\"") << "\")" << newLine; @@ -410,7 +413,7 @@ private: mo << "enable_language(ASM)" << newLine << newLine; - StringArray userLibraries = StringArray::fromTokens(getExternalLibrariesString(), ";", ""); + auto userLibraries = StringArray::fromTokens (getExternalLibrariesString(), ";", ""); userLibraries.addArray (androidLibs); if (getNumConfigurations() > 0) @@ -419,11 +422,11 @@ private: for (ConstConfigIterator config (*this); config.next();) { - const auto& cfg = dynamic_cast (*config); - const StringArray& libSearchPaths = cfg.getLibrarySearchPaths(); - const StringPairArray& cfgDefines = getConfigPreprocessorDefs (cfg); - const StringArray& cfgHeaderPaths = cfg.getHeaderSearchPaths(); - const StringArray& cfgLibraryPaths = cfg.getLibrarySearchPaths(); + auto& cfg = dynamic_cast (*config); + auto libSearchPaths = cfg.getLibrarySearchPaths(); + auto cfgDefines = getConfigPreprocessorDefs (cfg); + auto cfgHeaderPaths = cfg.getHeaderSearchPaths(); + auto cfgLibraryPaths = cfg.getLibrarySearchPaths(); if (! isLibrary() && libSearchPaths.size() == 0 && cfgDefines.size() == 0 && cfgHeaderPaths.size() == 0 && cfgLibraryPaths.size() == 0) @@ -480,7 +483,7 @@ private: if (config) { - if (const auto* cfg = dynamic_cast (config.get())) + if (auto* cfg = dynamic_cast (config.get())) { mo << "ELSE(JUCE_BUILD_CONFIGURATION MATCHES \"" << cfg->getProductFlavourCMakeIdentifier() <<"\")" << newLine; mo << " MESSAGE( FATAL_ERROR \"No matching build-configuration found.\" )" << newLine; @@ -507,7 +510,7 @@ private: mo << newLine; } - StringArray libraries (getAndroidLibraries()); + auto libraries = getAndroidLibraries(); if (libraries.size() > 0) { for (auto& lib : libraries) @@ -607,7 +610,7 @@ private: for (ConstConfigIterator config (*this); config.next();) { - const auto& cfg = dynamic_cast (*config); + auto& cfg = dynamic_cast (*config); mo << " " << cfg.getProductFlavourNameIdentifier() << " {" << newLine; @@ -645,8 +648,8 @@ private: { MemoryOutputStream mo; - String keyStoreFilePath = androidKeyStore.get().toString().replace ("${user.home}", "${System.properties['user.home']}") - .replace ("/", "${File.separator}"); + auto keyStoreFilePath = androidKeyStore.get().toString().replace ("${user.home}", "${System.properties['user.home']}") + .replace ("/", "${File.separator}"); mo << " signingConfigs {" << newLine; mo << " juceSigning {" << newLine; @@ -663,11 +666,11 @@ private: String getAndroidDefaultConfig() const { - const String bundleIdentifier = project.getBundleIdentifierString().toLowerCase(); - const StringArray& cmakeDefs = getCmakeDefinitions(); - const StringArray& cFlags = getProjectCompilerFlags(); - const StringArray& cxxFlags = getProjectCxxCompilerFlags(); - const int minSdkVersion = static_cast (androidMinimumSDK.get()); + auto bundleIdentifier = project.getBundleIdentifierString().toLowerCase(); + auto cmakeDefs = getCmakeDefinitions(); + auto cFlags = getProjectCompilerFlags(); + auto cxxFlags = getProjectCxxCompilerFlags(); + auto minSdkVersion = static_cast (androidMinimumSDK.get()); MemoryOutputStream mo; @@ -704,7 +707,7 @@ private: mo << " buildTypes {" << newLine; int numDebugConfigs = 0; - const int numConfigs = getNumConfigurations(); + auto numConfigs = getNumConfigurations(); for (int i = 0; i < numConfigs; ++i) { auto config = getConfiguration(i); @@ -736,7 +739,7 @@ private: for (ConstConfigIterator config (*this); config.next();) { - const auto& cfg = dynamic_cast (*config); + auto& cfg = dynamic_cast (*config); mo << " if (names.contains (\"" << cfg.getProductFlavourNameIdentifier() << "\")" << newLine; mo << " && variant.buildType.name != \"" << (cfg.isDebug() ? "debug" : "release") << "\") {" << newLine; @@ -753,12 +756,11 @@ private: { MemoryOutputStream mo; - juce::StringArray repositories; - repositories.addLines (androidRepositories.get().toString()); + auto repositories = StringArray::fromLines (androidRepositories.get().toString()); mo << "repositories {" << newLine; - for (const auto& r : repositories) + for (auto& r : repositories) mo << " " << r << newLine; mo << "}" << newLine; @@ -770,8 +772,7 @@ private: { MemoryOutputStream mo; - juce::StringArray dependencies; - dependencies.addLines (androidDependencies.get().toString()); + auto dependencies = StringArray::fromLines (androidDependencies.get().toString()); mo << "dependencies {" << newLine; @@ -781,7 +782,7 @@ private: mo << " compile 'com.google.firebase:firebase-messaging:11.4.0'" << newLine; } - for (const auto& d : dependencies) + for (auto& d : dependencies) mo << " " << d << newLine; mo << "}" << newLine; @@ -1055,7 +1056,7 @@ private: { MemoryOutputStream newFile; - for (const auto& line : javaSourceLines) + for (auto& line : javaSourceLines) { if (line.contains ("$$JuceAndroidMidiImports$$")) newFile << juceMidiImports; @@ -1104,8 +1105,8 @@ private: { if (androidEnableRemoteNotifications.get()) { - String instanceIdFileName = "JuceFirebaseInstanceIdService.java"; - String messagingFileName = "JuceFirebaseMessagingService.java"; + String instanceIdFileName ("JuceFirebaseInstanceIdService.java"); + String messagingFileName ("JuceFirebaseMessagingService.java"); File instanceIdFile (javaSourceFolder.getChildFile (instanceIdFileName)); File messagingFile (javaSourceFolder.getChildFile (messagingFileName)); @@ -1117,7 +1118,7 @@ private: files.add (instanceIdFile); files.add (messagingFile); - for (const auto& file : files) + for (auto& file : files) { auto newContent = file.loadFileAsString() .replace ("package com.juce;", "package " + package + ";"); @@ -1129,7 +1130,7 @@ private: void copyProviderJavaFile (const File& javaSourceFolder, const File& targetFolder, const String& package) const { - File providerFile (javaSourceFolder.getChildFile ("AndroidSharingContentProvider.java")); + auto providerFile = javaSourceFolder.getChildFile ("AndroidSharingContentProvider.java"); jassert (providerFile.existsAsFile()); @@ -1156,9 +1157,9 @@ private: { for (ConstConfigIterator config (*this); config.next();) { - const auto& cfg = dynamic_cast (*config); - const String xmlValuesPath = cfg.isDebug() ? "app/src/debug/res/values" : "app/src/release/res/values"; - const String rawPath = cfg.isDebug() ? "app/src/debug/res/raw" : "app/src/release/res/raw"; + auto& cfg = dynamic_cast (*config); + String xmlValuesPath = cfg.isDebug() ? "app/src/debug/res/values" : "app/src/release/res/values"; + String rawPath = cfg.isDebug() ? "app/src/debug/res/raw" : "app/src/release/res/raw"; copyExtraResourceFiles (cfg.getAdditionalXmlResources(), xmlValuesPath); copyExtraResourceFiles (cfg.getAdditionalRawResources(), rawPath); @@ -1176,16 +1177,15 @@ private: void copyExtraResourceFiles (const String& resources, const String& dstRelativePath) const { - StringArray resourcePaths; - resourcePaths.addTokens (resources, true); + auto resourcePaths = StringArray::fromTokens (resources, true); - const File parentFolder (getTargetFolder().getChildFile (dstRelativePath)); + auto parentFolder = getTargetFolder().getChildFile (dstRelativePath); parentFolder.createDirectory(); - for (const auto& path : resourcePaths) + for (auto& path : resourcePaths) { - File file (getProject().getFile().getChildFile (path)); + auto file = getProject().getFile().getChildFile (path); jassert (file.existsAsFile()); @@ -1201,7 +1201,7 @@ private: String getActivitySubClassName() const { - String activityPath = androidActivitySubClassName.get(); + auto activityPath = androidActivitySubClassName.get().toString(); return (activityPath.isEmpty()) ? getActivityName() : activityPath.fromLastOccurrenceOf (".", false, false); } @@ -1219,8 +1219,8 @@ private: static LibraryModule* getCoreModule (const OwnedArray& modules) { for (int i = modules.size(); --i >= 0;) - if (modules.getUnchecked(i)->getID() == "juce_core") - return modules.getUnchecked(i); + if (modules.getUnchecked (i)->getID() == "juce_core") + return modules.getUnchecked (i); return nullptr; } @@ -1233,7 +1233,7 @@ private: String getAppPlatform() const { - int ndkVersion = static_cast (androidMinimumSDK.get()); + auto ndkVersion = static_cast (androidMinimumSDK.get()); if (ndkVersion == 9) ndkVersion = 10; // (doesn't seem to be a version '9') @@ -1245,17 +1245,17 @@ private: { for (ConstConfigIterator config (*this); config.next();) { - const auto& cfg = dynamic_cast (*config); + auto& cfg = dynamic_cast (*config); - String customStringsXmlContent = "\n"; + String customStringsXmlContent ("\n"); customStringsXmlContent << "" << projectName << "\n"; customStringsXmlContent << cfg.getCustomStringsXml(); customStringsXmlContent << "\n"; ScopedPointer strings = XmlDocument::parse (customStringsXmlContent); - const juce::String dir = cfg.isDebug() ? "debug" : "release"; - const juce::String subPath = "app/src/" + dir + "/res/values/string.xml"; + String dir = cfg.isDebug() ? "debug" : "release"; + String subPath = "app/src/" + dir + "/res/values/string.xml"; writeXmlOrThrow (*strings, folder.getChildFile (subPath), "utf-8", 100, true); } @@ -1291,13 +1291,13 @@ private: if (bigIcon != nullptr && smallIcon != nullptr) { - const int step = jmax (bigIcon->getWidth(), bigIcon->getHeight()) / 8; + auto step = jmax (bigIcon->getWidth(), bigIcon->getHeight()) / 8; writeIcon (folder.getChildFile ("drawable-xhdpi/icon.png"), getBestIconForSize (step * 8, false)); writeIcon (folder.getChildFile ("drawable-hdpi/icon.png"), getBestIconForSize (step * 6, false)); writeIcon (folder.getChildFile ("drawable-mdpi/icon.png"), getBestIconForSize (step * 4, false)); writeIcon (folder.getChildFile ("drawable-ldpi/icon.png"), getBestIconForSize (step * 3, false)); } - else if (Drawable* icon = bigIcon != nullptr ? bigIcon : smallIcon) + else if (auto* icon = (bigIcon != nullptr ? bigIcon.get() : smallIcon.get())) { writeIcon (folder.getChildFile ("drawable-mdpi/icon.png"), rescaleImageForIcon (*icon, icon->getWidth())); } @@ -1315,7 +1315,7 @@ private: static String expandHomeFolderToken (const String& path) { - String homeFolder = File::getSpecialLocation (File::userHomeDirectory).getFullPathName(); + auto homeFolder = File::getSpecialLocation (File::userHomeDirectory).getFullPathName(); return path.replace ("${user.home}", homeFolder) .replace ("~", homeFolder); @@ -1331,8 +1331,8 @@ private: } else if (projectItem.shouldBeAddedToTargetProject()) { - const RelativePath file (projectItem.getFile(), getTargetFolder().getChildFile ("app"), RelativePath::buildTargetFolder); - const ProjectType::Target::Type targetType = getProject().getTargetTypeFromFilePath (projectItem.getFile(), true); + RelativePath file (projectItem.getFile(), getTargetFolder().getChildFile ("app"), RelativePath::buildTargetFolder); + auto targetType = getProject().getTargetTypeFromFilePath (projectItem.getFile(), true); mo << " \"" << file.toUnixStyle() << "\"" << newLine; @@ -1353,8 +1353,8 @@ private: //============================================================================== StringArray getCmakeDefinitions() const { - const String toolchain = gradleToolchain.get(); - const bool isClang = (toolchain == "clang"); + auto toolchain = gradleToolchain.get().toString(); + bool isClang = (toolchain == "clang"); StringArray cmakeArgs; @@ -1395,7 +1395,7 @@ private: StringArray getProjectCompilerFlags() const { - StringArray cFlags (getAndroidCompilerFlags()); + auto cFlags = getAndroidCompilerFlags(); cFlags.addArray (getEscapedFlags (StringArray::fromTokens (getExtraCompilerFlagsString(), true))); return cFlags; @@ -1403,7 +1403,7 @@ private: StringArray getProjectCxxCompilerFlags() const { - StringArray cxxFlags (getAndroidCxxCompilerFlags()); + auto cxxFlags = getAndroidCxxCompilerFlags(); cxxFlags.addArray (getEscapedFlags (StringArray::fromTokens (getExtraCompilerFlagsString(), true))); return cxxFlags; } @@ -1445,14 +1445,14 @@ private: StringPairArray getProjectPreprocessorDefs() const { - StringPairArray defines (getAndroidPreprocessorDefs()); + auto defines = getAndroidPreprocessorDefs(); return mergePreprocessorDefs (defines, getAllPreprocessorDefs()); } StringPairArray getConfigPreprocessorDefs (const BuildConfiguration& config) const { - StringPairArray cfgDefines (config.getUniquePreprocessorDefs()); + auto cfgDefines = config.getUniquePreprocessorDefs(); if (config.isDebug()) { @@ -1483,7 +1483,7 @@ private: //============================================================================== StringArray getHeaderSearchPaths (const BuildConfiguration& config) const { - StringArray paths (extraSearchPaths); + auto paths = extraSearchPaths; paths.addArray (config.getHeaderSearchPaths()); paths = getCleanedStringArray (paths); return paths; @@ -1492,7 +1492,7 @@ private: //============================================================================== String escapeDirectoryForCmake (const String& path) const { - RelativePath relative = + auto relative = RelativePath (path, RelativePath::buildTargetFolder) .rebased (getTargetFolder(), getTargetFolder().getChildFile ("app"), RelativePath::buildTargetFolder); @@ -1519,8 +1519,8 @@ private: for (int i = 0; i < defs.size(); ++i) { - String escaped ("\"-D" + defs.getAllKeys()[i]); - String value = defs.getAllValues()[i]; + auto escaped = "\"-D" + defs.getAllKeys()[i]; + auto value = defs.getAllValues()[i]; if (value.isNotEmpty()) { @@ -1550,7 +1550,7 @@ private: //============================================================================== XmlElement* createManifestXML() const { - XmlElement* manifest = createManifestElement(); + auto* manifest = createManifestElement(); createSupportsScreensElement (*manifest); createUsesSdkElement (*manifest); @@ -1573,7 +1573,7 @@ private: XmlElement* createManifestElement() const { - XmlElement* manifest = XmlDocument::parse (androidManifestCustomXmlElements.get()); + auto* manifest = XmlDocument::parse (androidManifestCustomXmlElements.get()); if (manifest == nullptr) manifest = new XmlElement ("manifest"); @@ -1592,7 +1592,7 @@ private: { if (manifest.getChildByName ("supports-screens") == nullptr) { - XmlElement* screens = manifest.createNewChildElement ("supports-screens"); + auto* screens = manifest.createNewChildElement ("supports-screens"); screens->setAttribute ("android:smallScreens", "true"); screens->setAttribute ("android:normalScreens", "true"); screens->setAttribute ("android:largeScreens", "true"); @@ -1610,7 +1610,7 @@ private: void createPermissionElements (XmlElement& manifest) const { - StringArray permissions (getPermissionsRequired()); + auto permissions = getPermissionsRequired(); forEachXmlChildElementWithTagName (manifest, child, "uses-permission") { @@ -1794,8 +1794,7 @@ private: StringArray getPermissionsRequired() const { - StringArray s; - s.addTokens (androidOtherPermissions.get().toString(), ", ", ""); + StringArray s = StringArray::fromTokens (androidOtherPermissions.get().toString(), ", ", {}); if (androidInternetNeeded.get()) s.add ("android.permission.INTERNET"); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h index bb112a92d5..7b6bdac102 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h @@ -157,9 +157,7 @@ public: { for (Project::ExporterIterator exporter (getProject()); exporter.next();) if (isExporterSupported (*exporter)) - properties.add (new BooleanPropertyComponent (getExporterEnabledValue (*exporter), - "Import settings from exporter", - exporter->getName()), + properties.add (new BooleanPropertyComponent (getExporterEnabledValue (*exporter), "Import settings from exporter", exporter->getName()), "If this is enabled then settings from the corresponding exporter will " "be used in the generated CMakeLists.txt"); } @@ -278,7 +276,7 @@ private: //============================================================================== static String setCMakeVariable (const String& variableName, const String& value) { - return String ("set (") + variableName + " \"" + value + "\")"; + return "set (" + variableName + " \"" + value + "\")"; } static String addToCMakeVariable (const String& variableName, const String& value) @@ -294,7 +292,7 @@ private: template void getFileInfoList (Target& target, Exporter& exporter, const Project::Item& projectItem, std::vector>& fileInfoList) const { - const auto targetType = (getProject().getProjectType().isAudioPlugin() ? target.type : Target::Type::SharedCodeTarget); + auto targetType = (getProject().getProjectType().isAudioPlugin() ? target.type : Target::Type::SharedCodeTarget); if (projectItem.isGroup()) { @@ -303,7 +301,7 @@ private: } else if (projectItem.shouldBeAddedToTargetProject() && getProject().getTargetTypeFromFilePath (projectItem.getFile(), true) == targetType ) { - const auto path = RelativePath (projectItem.getFile(), exporter.getTargetFolder(), RelativePath::buildTargetFolder).toUnixStyle(); + auto path = RelativePath (projectItem.getFile(), exporter.getTargetFolder(), RelativePath::buildTargetFolder).toUnixStyle(); fileInfoList.push_back ({ path, projectItem.shouldBeCompiled() }); } } @@ -412,7 +410,7 @@ private: << "#------------------------------------------------------------------------------" << newLine << newLine; - const auto buildTypeCondition = String ("CMAKE_BUILD_TYPE STREQUAL " + config.getName()); + auto buildTypeCondition = String ("CMAKE_BUILD_TYPE STREQUAL " + config.getName()); out << "if (" << buildTypeCondition << ")" << newLine << newLine; @@ -433,7 +431,7 @@ private: for (auto& library : exporter.getLibraryNames (config)) { - const String cmakeLibraryID (library.toUpperCase()); + String cmakeLibraryID (library.toUpperCase()); cmakeFoundLibraries.add (String ("${") + cmakeLibraryID + "}"); out << "find_library (" << cmakeLibraryID << " " << library << newLine; @@ -449,7 +447,7 @@ private: if (target->type == ProjectType::Target::Type::AggregateTarget) continue; - const auto targetVarName = getTargetVarName (*target); + auto targetVarName = getTargetVarName (*target); out << "set_target_properties (" << targetVarName << " PROPERTIES" << newLine << " OUTPUT_NAME " << config.getTargetBinaryNameString().quoted() << newLine; @@ -562,7 +560,7 @@ private: << "#------------------------------------------------------------------------------" << newLine << newLine; - const auto buildTypeCondition = String ("CMAKE_BUILD_TYPE STREQUAL " + config.getName()); + auto buildTypeCondition = String ("CMAKE_BUILD_TYPE STREQUAL " + config.getName()); out << "if (" << buildTypeCondition << ")" << newLine << newLine; @@ -578,7 +576,7 @@ private: if (target->type == ProjectType::Target::Type::AggregateTarget) continue; - const auto targetVarName = getTargetVarName (*target); + auto targetVarName = getTargetVarName (*target); out << "set_target_properties (" << targetVarName << " PROPERTIES" << newLine << " OUTPUT_NAME " << config.getTargetBinaryNameString().quoted() << newLine; @@ -664,8 +662,8 @@ private: || target->type == ProjectType::Target::Type::AudioUnitv3PlugIn) continue; - const auto targetAttributes = target->getTargetSettings (config); - const auto targetAttributeKeys = targetAttributes.getAllKeys(); + auto targetAttributes = target->getTargetSettings (config); + auto targetAttributeKeys = targetAttributes.getAllKeys(); if (targetAttributes.getAllKeys().contains ("SDKROOT")) { @@ -709,14 +707,14 @@ private: << "#------------------------------------------------------------------------------" << newLine << newLine; - const auto buildTypeCondition = String ("CMAKE_BUILD_TYPE STREQUAL " + config.getName()); + auto buildTypeCondition = String ("CMAKE_BUILD_TYPE STREQUAL " + config.getName()); out << "if (" << buildTypeCondition << ")" << newLine << newLine; out << "execute_process (COMMAND uname -m OUTPUT_VARIABLE JUCE_ARCH_LABEL OUTPUT_STRIP_TRAILING_WHITESPACE)" << newLine << newLine; - const auto configSettings = exporter.getProjectSettings (config); + auto configSettings = exporter.getProjectSettings (config); auto configSettingsKeys = configSettings.getAllKeys(); auto binaryName = config.getTargetBinaryNameString(); @@ -731,7 +729,7 @@ private: || target->type == ProjectType::Target::Type::AudioUnitv3PlugIn) continue; - const auto targetVarName = getTargetVarName (*target); + auto targetVarName = getTargetVarName (*target); auto targetAttributes = target->getTargetSettings (config); auto targetAttributeKeys = targetAttributes.getAllKeys(); @@ -897,8 +895,8 @@ private: { if (item.getName() == ProjectSaver::getJuceCodeGroupName()) { - String resSourcesVar (targetVarName + "_REZ_SOURCES"); - String resOutputVar (targetVarName + "_REZ_OUTPUT"); + auto resSourcesVar = targetVarName + "_REZ_SOURCES"; + auto resOutputVar = targetVarName + "_REZ_OUTPUT"; out << "if (RC_COMPILER)" << newLine << " set (" << resSourcesVar << newLine @@ -964,7 +962,7 @@ private: } } - File updatedPlist (getTargetFolder().getChildFile (config.getName() + "-" + plistFile.getFileName())); + auto updatedPlist = getTargetFolder().getChildFile (config.getName() + "-" + plistFile.getFileName()); plist->writeToFile (updatedPlist, ""); targetAttributes.set ("INFOPLIST_FILE", updatedPlist.getFullPathName().quoted()); } @@ -1035,8 +1033,8 @@ private: if (target->getTargetFileType() == ProjectType::Target::TargetFileType::pluginBundle && targetAttributeKeys.contains("INSTALL_PATH")) { - const auto installPath = targetAttributes["INSTALL_PATH"].unquoted().replace ("$(HOME)", "$ENV{HOME}"); - const auto productFilename = binaryName + (targetAttributeKeys.contains ("WRAPPER_EXTENSION") ? "." + targetAttributes["WRAPPER_EXTENSION"] : String()); + auto installPath = targetAttributes["INSTALL_PATH"].unquoted().replace ("$(HOME)", "$ENV{HOME}"); + auto productFilename = binaryName + (targetAttributeKeys.contains ("WRAPPER_EXTENSION") ? "." + targetAttributes["WRAPPER_EXTENSION"] : String()); auto productPath = (installPath + productFilename).quoted(); out << "add_custom_command (TARGET " << targetVarName << " POST_BUILD" << newLine << " COMMAND cmake -E remove_directory " << productPath << newLine diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h index 7e94bfec2a..b3edce9b11 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h @@ -96,7 +96,7 @@ public: targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderName (os)); if (isWindows()) - targetPlatformValue.referTo (settings, Ids::codeBlocksWindowsTarget, getProject().getUndoManagerFor (settings)); + targetPlatformValue.referTo (settings, Ids::codeBlocksWindowsTarget, getUndoManager()); } //============================================================================== @@ -194,8 +194,8 @@ public: //============================================================================== void initialiseDependencyPathValues() override { - DependencyPathOS pathOS = isLinux() ? TargetOS::linux - : TargetOS::windows; + auto pathOS = isLinux() ? TargetOS::linux + : TargetOS::windows; vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, pathOS))); @@ -333,7 +333,7 @@ private: StringArray getPackages() const { - StringArray result (linuxPackages); + auto result = linuxPackages; static String guiExtrasModule ("juce_gui_extra"); @@ -351,7 +351,7 @@ private: void addVersion (XmlElement& xml) const { - XmlElement* fileVersion = xml.createNewChildElement ("FileVersion"); + auto* fileVersion = xml.createNewChildElement ("FileVersion"); fileVersion->setAttribute ("major", 1); fileVersion->setAttribute ("minor", 6); } @@ -395,8 +395,8 @@ private: defines = mergePreprocessorDefs (defines, getAllPreprocessorDefs (config, target.type)); StringArray defs; - const auto keys = defines.getAllKeys(); - const auto values = defines.getAllValues(); + auto keys = defines.getAllKeys(); + auto values = defines.getAllValues(); for (int i = 0; i < defines.size(); ++i) { @@ -446,7 +446,7 @@ private: if (target.isDynamicLibrary() || getProject().getProjectType().isAudioPlugin()) flags.add ("-fPIC"); - const auto packages = getPackages(); + auto packages = getPackages(); if (packages.size() > 0) { @@ -467,7 +467,7 @@ private: StringArray getLinkerFlags (const BuildConfiguration& config, CodeBlocksTarget& target) const { - StringArray flags (makefileExtraLinkerFlags); + auto flags = makefileExtraLinkerFlags; if (auto* codeBlocksConfig = dynamic_cast (&config)) flags.add (codeBlocksConfig->getArchitectureTypeString()); @@ -480,7 +480,7 @@ private: flags.addTokens (replacePreprocessorTokens (config, getExtraLinkerFlagsString()).trim(), " \n", "\"'"); - const auto packages = getPackages(); + auto packages = getPackages(); if (config.exporter.isLinux()) { @@ -504,7 +504,7 @@ private: StringArray getLinkerSearchPaths (const BuildConfiguration& config, CodeBlocksTarget& target) const { - StringArray librarySearchPaths (config.getLibrarySearchPaths()); + auto librarySearchPaths = config.getLibrarySearchPaths(); if (getProject().getProjectType().isAudioPlugin() && target.type != ProjectType::Target::SharedCodeTarget) librarySearchPaths.add (RelativePath (getSharedCodePath (config), RelativePath::buildTargetFolder).getParentDirectory().toUnixStyle()); @@ -574,7 +574,7 @@ private: String getSharedCodePath (const BuildConfiguration& config) const { - const String outputPath = getOutputPathForTarget (getTargetWithType (ProjectType::Target::SharedCodeTarget), config); + auto outputPath = getOutputPathForTarget (getTargetWithType (ProjectType::Target::SharedCodeTarget), config); RelativePath path (outputPath, RelativePath::buildTargetFolder); auto filename = path.getFileName(); @@ -589,14 +589,14 @@ private: xml.setAttribute ("title", target.getTargetNameForConfiguration (config)); { - XmlElement* output = xml.createNewChildElement ("Option"); + auto* output = xml.createNewChildElement ("Option"); output->setAttribute ("output", getOutputPathForTarget (target, config)); if (isLinux()) { - const bool keepPrefix = (target.type == ProjectType::Target::VSTPlugIn || target.type == ProjectType::Target::VST3PlugIn - || target.type == ProjectType::Target::AAXPlugIn || target.type == ProjectType::Target::RTASPlugIn); + bool keepPrefix = (target.type == ProjectType::Target::VSTPlugIn || target.type == ProjectType::Target::VST3PlugIn + || target.type == ProjectType::Target::AAXPlugIn || target.type == ProjectType::Target::RTASPlugIn); output->setAttribute ("prefix_auto", keepPrefix ? 0 : 1); } @@ -618,7 +618,7 @@ private: xml.createNewChildElement ("Option")->setAttribute ("external_deps", getSharedCodePath (config)); { - XmlElement* const compiler = xml.createNewChildElement ("Compiler"); + auto* compiler = xml.createNewChildElement ("Compiler"); { StringArray flags; @@ -638,7 +638,7 @@ private: } { - const StringArray includePaths (getIncludePaths (config)); + auto includePaths = getIncludePaths (config); for (auto path : includePaths) setAddOption (*compiler, "directory", path); @@ -646,7 +646,7 @@ private: } { - XmlElement* const linker = xml.createNewChildElement ("Linker"); + auto* linker = xml.createNewChildElement ("Linker"); if (getProject().getProjectType().isAudioPlugin() && target.type != ProjectType::Target::SharedCodeTarget) setAddOption (*linker, "option", getSharedCodePath (config)); @@ -666,7 +666,7 @@ private: void addBuild (XmlElement& xml) const { - XmlElement* const build = xml.createNewChildElement ("Build"); + auto* build = xml.createNewChildElement ("Build"); for (ConstConfigIterator config (*this); config.next();) for (auto target : targets) @@ -676,7 +676,7 @@ private: void addVirtualTargets (XmlElement& xml) const { - XmlElement* const virtualTargets = xml.createNewChildElement ("VirtualTargets"); + auto* virtualTargets = xml.createNewChildElement ("VirtualTargets"); for (ConstConfigIterator config (*this); config.next();) { @@ -706,7 +706,7 @@ private: void addProjectCompilerOptions (XmlElement& xml) const { - XmlElement* const compiler = xml.createNewChildElement ("Compiler"); + auto* compiler = xml.createNewChildElement ("Compiler"); for (auto& option : getProjectCompilerOptions()) setAddOption (*compiler, "option", option); @@ -731,7 +731,7 @@ private: void addProjectLinkerOptions (XmlElement& xml) const { - XmlElement* const linker = xml.createNewChildElement ("Linker"); + auto* linker = xml.createNewChildElement ("Linker"); for (auto& lib : getProjectLinkerLibs()) setAddOption (*linker, "library", lib); @@ -794,14 +794,14 @@ private: } else if (projectItem.shouldBeAddedToTargetProject()) { - const RelativePath file (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder); + RelativePath file (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder); - XmlElement* unit = xml.createNewChildElement ("Unit"); + auto* unit = xml.createNewChildElement ("Unit"); unit->setAttribute ("filename", file.toUnixStyle()); for (ConstConfigIterator config (*this); config.next();) { - const String& targetName = getTargetForProjectItem (projectItem).getTargetNameForConfiguration (*config); + auto targetName = getTargetForProjectItem (projectItem).getTargetNameForConfiguration (*config); unit->createNewChildElement ("Option")->setAttribute ("target", targetName); } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index f1d8f26336..4a7a817159 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -33,10 +33,10 @@ class MSVCProjectExporterBase : public ProjectExporter public: MSVCProjectExporterBase (Project& p, const ValueTree& t, const char* const folderName) : ProjectExporter (p, t), - IPPLibraryValue (settings, Ids::IPPLibrary, getProject().getUndoManagerFor (settings)), - platformToolsetValue (settings, Ids::toolset, getProject().getUndoManagerFor (settings)), - targetPlatformVersion (settings, Ids::windowsTargetPlatformVersion, getProject().getUndoManagerFor (settings)), - manifestFileValue (settings, Ids::msvcManifestFile, getProject().getUndoManagerFor (settings)) + IPPLibraryValue (settings, Ids::IPPLibrary, getUndoManager()), + platformToolsetValue (settings, Ids::toolset, getUndoManager()), + targetPlatformVersion (settings, Ids::windowsTargetPlatformVersion, getUndoManager()), + manifestFileValue (settings, Ids::msvcManifestFile, getUndoManager()) { targetLocationValue.setDefault (getDefaultBuildsRootFolder() + folderName); @@ -95,7 +95,7 @@ public: void addIPPSettingToPropertyGroup (XmlElement& p) const { - String ippLibrary = getIPPLibrary(); + auto ippLibrary = getIPPLibrary(); if (ippLibrary.isNotEmpty()) forEachXmlChildElementWithTagName (p, e, "PropertyGroup") @@ -107,7 +107,7 @@ public: createResourcesAndIcon(); for (int i = 0; i < targets.size(); ++i) - if (MSVCTargetBase* target = targets[i]) + if (auto* target = targets[i]) target->writeProjectFile(); { @@ -205,7 +205,7 @@ public: String getOutputFilename (const String& suffix, bool forceSuffix) const { - const String target (File::createLegalFileName (getTargetBinaryNameString().trim())); + auto target = File::createLegalFileName (getTargetBinaryNameString().trim()); if (forceSuffix || ! target.containsChar ('.')) return target.upToLastOccurrenceOf (".", false, false) + suffix; @@ -312,8 +312,8 @@ public: void addVisualStudioPluginInstallPathProperties (PropertyListBuilder& props) { - auto isBuildingAnyPlugins = (project.shouldBuildVST() || project.shouldBuildVST3() - || project.shouldBuildRTAS() || project.shouldBuildAAX()); + auto isBuildingAnyPlugins = (project.shouldBuildVST() || project.shouldBuildVST3() + || project.shouldBuildRTAS() || project.shouldBuildAAX()); if (isBuildingAnyPlugins) props.add (new ChoicePropertyComponent (pluginBinaryCopyStepValue, "Enable Plugin Copy Step"), @@ -380,13 +380,13 @@ public: projectXml.setAttribute ("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); { - XmlElement* configsGroup = projectXml.createNewChildElement ("ItemGroup"); + auto* configsGroup = projectXml.createNewChildElement ("ItemGroup"); configsGroup->setAttribute ("Label", "ProjectConfigurations"); for (ConstConfigIterator i (owner); i.next();) { - const MSVCBuildConfiguration& config = dynamic_cast (*i); - XmlElement* e = configsGroup->createNewChildElement ("ProjectConfiguration"); + auto& config = dynamic_cast (*i); + auto* e = configsGroup->createNewChildElement ("ProjectConfiguration"); e->setAttribute ("Include", config.createMSVCConfigName()); e->createNewChildElement ("Configuration")->addTextElement (config.getName()); e->createNewChildElement ("Platform")->addTextElement (config.is64Bit() ? config.get64BitArchName() @@ -395,21 +395,21 @@ public: } { - XmlElement* globals = projectXml.createNewChildElement ("PropertyGroup"); + auto* globals = projectXml.createNewChildElement ("PropertyGroup"); globals->setAttribute ("Label", "Globals"); globals->createNewChildElement ("ProjectGuid")->addTextElement (getProjectGuid()); } { - XmlElement* imports = projectXml.createNewChildElement ("Import"); + auto* imports = projectXml.createNewChildElement ("Import"); imports->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); } for (ConstConfigIterator i (owner); i.next();) { - const MSVCBuildConfiguration& config = dynamic_cast (*i); + auto& config = dynamic_cast (*i); - XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); + auto* e = projectXml.createNewChildElement ("PropertyGroup"); setConditionAttribute (*e, config); e->setAttribute ("Label", "Configuration"); e->createNewChildElement ("ConfigurationType")->addTextElement (getProjectType()); @@ -430,50 +430,50 @@ public: } { - XmlElement* e = projectXml.createNewChildElement ("Import"); + auto* e = projectXml.createNewChildElement ("Import"); e->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); } { - XmlElement* e = projectXml.createNewChildElement ("ImportGroup"); + auto* e = projectXml.createNewChildElement ("ImportGroup"); e->setAttribute ("Label", "ExtensionSettings"); } { - XmlElement* e = projectXml.createNewChildElement ("ImportGroup"); + auto* e = projectXml.createNewChildElement ("ImportGroup"); e->setAttribute ("Label", "PropertySheets"); - XmlElement* p = e->createNewChildElement ("Import"); + auto* p = e->createNewChildElement ("Import"); p->setAttribute ("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"); p->setAttribute ("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')"); p->setAttribute ("Label", "LocalAppDataPlatform"); } { - XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); + auto* e = projectXml.createNewChildElement ("PropertyGroup"); e->setAttribute ("Label", "UserMacros"); } { - XmlElement* props = projectXml.createNewChildElement ("PropertyGroup"); + auto* props = projectXml.createNewChildElement ("PropertyGroup"); props->createNewChildElement ("_ProjectFileVersion")->addTextElement ("10.0.30319.1"); props->createNewChildElement ("TargetExt")->addTextElement (getTargetSuffix()); for (ConstConfigIterator i (owner); i.next();) { - const MSVCBuildConfiguration& config = dynamic_cast (*i); + auto& config = dynamic_cast (*i); if (getConfigTargetPath (config).isNotEmpty()) { - XmlElement* outdir = props->createNewChildElement ("OutDir"); + auto* outdir = props->createNewChildElement ("OutDir"); setConditionAttribute (*outdir, config); outdir->addTextElement (FileHelpers::windowsStylePath (getConfigTargetPath (config)) + "\\"); } { - XmlElement* intdir = props->createNewChildElement("IntDir"); + auto* intdir = props->createNewChildElement("IntDir"); setConditionAttribute (*intdir, config); - String intermediatesPath = getIntermediatesPath (config); + auto intermediatesPath = getIntermediatesPath (config); if (! intermediatesPath.endsWithChar (L'\\')) intermediatesPath += L'\\'; @@ -482,21 +482,21 @@ public: { - XmlElement* targetName = props->createNewChildElement ("TargetName"); + auto* targetName = props->createNewChildElement ("TargetName"); setConditionAttribute (*targetName, config); targetName->addTextElement (config.getOutputFilename ("", false)); } { - XmlElement* manifest = props->createNewChildElement ("GenerateManifest"); + auto* manifest = props->createNewChildElement ("GenerateManifest"); setConditionAttribute (*manifest, config); manifest->addTextElement (config.shouldGenerateManifest() ? "true" : "false"); } - const StringArray librarySearchPaths (getLibrarySearchPaths (config)); + auto librarySearchPaths = getLibrarySearchPaths (config); if (librarySearchPaths.size() > 0) { - XmlElement* libPath = props->createNewChildElement ("LibraryPath"); + auto* libPath = props->createNewChildElement ("LibraryPath"); setConditionAttribute (*libPath, config); libPath->addTextElement ("$(LibraryPath);" + librarySearchPaths.joinIntoString (";")); } @@ -505,15 +505,15 @@ public: for (ConstConfigIterator i (owner); i.next();) { - const MSVCBuildConfiguration& config = dynamic_cast (*i); + auto& config = dynamic_cast (*i); - const bool isDebug = config.isDebug(); + bool isDebug = config.isDebug(); - XmlElement* group = projectXml.createNewChildElement ("ItemDefinitionGroup"); + auto* group = projectXml.createNewChildElement ("ItemDefinitionGroup"); setConditionAttribute (*group, config); { - XmlElement* midl = group->createNewChildElement ("Midl"); + auto* midl = group->createNewChildElement ("Midl"); midl->createNewChildElement ("PreprocessorDefinitions")->addTextElement (isDebug ? "_DEBUG;%(PreprocessorDefinitions)" : "NDEBUG;%(PreprocessorDefinitions)"); midl->createNewChildElement ("MkTypLibCompatible")->addTextElement ("true"); @@ -525,7 +525,7 @@ public: bool isUsingEditAndContinue = false; { - XmlElement* cl = group->createNewChildElement ("ClCompile"); + auto* cl = group->createNewChildElement ("ClCompile"); cl->createNewChildElement ("Optimization")->addTextElement (getOptimisationLevelString (config.getOptimisationLevelInt())); @@ -535,14 +535,14 @@ public: ->addTextElement (config.getDebugInformationFormatString()); } - StringArray includePaths (getOwner().getHeaderSearchPaths (config)); + auto includePaths = getOwner().getHeaderSearchPaths (config); includePaths.addArray (getExtraSearchPaths()); includePaths.add ("%(AdditionalIncludeDirectories)"); cl->createNewChildElement ("AdditionalIncludeDirectories")->addTextElement (includePaths.joinIntoString (";")); cl->createNewChildElement ("PreprocessorDefinitions")->addTextElement (getPreprocessorDefs (config, ";") + ";%(PreprocessorDefinitions)"); - const bool runtimeDLL = config.isUsingRuntimeLibDLL(); + bool runtimeDLL = config.isUsingRuntimeLibDLL(); cl->createNewChildElement ("RuntimeLibrary")->addTextElement (runtimeDLL ? (isDebug ? "MultiThreadedDebugDLL" : "MultiThreadedDLL") : (isDebug ? "MultiThreadedDebug" : "MultiThreaded")); cl->createNewChildElement ("RuntimeTypeInfo")->addTextElement ("true"); @@ -557,7 +557,7 @@ public: if (config.isFastMathEnabled()) cl->createNewChildElement ("FloatingPointModel")->addTextElement ("Fast"); - const String extraFlags (getOwner().replacePreprocessorTokens (config, getOwner().getExtraCompilerFlagsString()).trim()); + auto extraFlags = getOwner().replacePreprocessorTokens (config, getOwner().getExtraCompilerFlagsString()).trim(); if (extraFlags.isNotEmpty()) cl->createNewChildElement ("AdditionalOptions")->addTextElement (extraFlags + " %(AdditionalOptions)"); @@ -573,20 +573,20 @@ public: } { - XmlElement* res = group->createNewChildElement ("ResourceCompile"); + auto* res = group->createNewChildElement ("ResourceCompile"); res->createNewChildElement ("PreprocessorDefinitions")->addTextElement (isDebug ? "_DEBUG;%(PreprocessorDefinitions)" : "NDEBUG;%(PreprocessorDefinitions)"); } - const String externalLibraries (getExternalLibraries (config, getOwner().getExternalLibrariesString())); - const auto additionalDependencies = externalLibraries.isNotEmpty() ? getOwner().replacePreprocessorTokens (config, externalLibraries).trim() + ";%(AdditionalDependencies)" + auto externalLibraries = getExternalLibraries (config, getOwner().getExternalLibrariesString()); + auto additionalDependencies = externalLibraries.isNotEmpty() ? getOwner().replacePreprocessorTokens (config, externalLibraries).trim() + ";%(AdditionalDependencies)" : String(); - const StringArray librarySearchPaths (config.getLibrarySearchPaths()); - const auto additionalLibraryDirs = librarySearchPaths.size() > 0 ? getOwner().replacePreprocessorTokens (config, librarySearchPaths.joinIntoString (";")) + ";%(AdditionalLibraryDirectories)" - : String(); + auto librarySearchPaths = config.getLibrarySearchPaths(); + auto additionalLibraryDirs = librarySearchPaths.size() > 0 ? getOwner().replacePreprocessorTokens (config, librarySearchPaths.joinIntoString (";")) + ";%(AdditionalLibraryDirectories)" + : String(); { - XmlElement* link = group->createNewChildElement ("Link"); + auto* link = group->createNewChildElement ("Link"); link->createNewChildElement ("OutputFile")->addTextElement (getOutputFilePath (config)); link->createNewChildElement ("SuppressStartupBanner")->addTextElement ("true"); link->createNewChildElement ("IgnoreSpecificDefaultLibraries")->addTextElement (isDebug ? "libcmt.lib; msvcrt.lib;;%(IgnoreSpecificDefaultLibraries)" @@ -615,29 +615,29 @@ public: if (additionalDependencies.isNotEmpty()) link->createNewChildElement ("AdditionalDependencies")->addTextElement (additionalDependencies); - String extraLinkerOptions (getOwner().getExtraLinkerFlagsString()); + auto extraLinkerOptions = getOwner().getExtraLinkerFlagsString(); if (extraLinkerOptions.isNotEmpty()) link->createNewChildElement ("AdditionalOptions")->addTextElement (getOwner().replacePreprocessorTokens (config, extraLinkerOptions).trim() + " %(AdditionalOptions)"); - const String delayLoadedDLLs (getDelayLoadedDLLs()); + auto delayLoadedDLLs = getDelayLoadedDLLs(); if (delayLoadedDLLs.isNotEmpty()) link->createNewChildElement ("DelayLoadDLLs")->addTextElement (delayLoadedDLLs); - const String moduleDefinitionsFile (getModuleDefinitions (config)); + auto moduleDefinitionsFile = getModuleDefinitions (config); if (moduleDefinitionsFile.isNotEmpty()) link->createNewChildElement ("ModuleDefinitionFile") ->addTextElement (moduleDefinitionsFile); } { - XmlElement* bsc = group->createNewChildElement ("Bscmake"); + auto* bsc = group->createNewChildElement ("Bscmake"); bsc->createNewChildElement ("SuppressStartupBanner")->addTextElement ("true"); bsc->createNewChildElement ("OutputFile")->addTextElement (getOwner().getIntDirFile (config, config.getOutputFilename (".bsc", true))); } { - XmlElement* lib = group->createNewChildElement ("Lib"); + auto* lib = group->createNewChildElement ("Lib"); if (additionalDependencies.isNotEmpty()) lib->createNewChildElement ("AdditionalDependencies")->addTextElement (additionalDependencies); @@ -646,10 +646,10 @@ public: lib->createNewChildElement ("AdditionalLibraryDirectories")->addTextElement (additionalLibraryDirs); } - const RelativePath& manifestFile = getOwner().getManifestPath(); + auto manifestFile = getOwner().getManifestPath(); if (manifestFile.getRoot() != RelativePath::unknown) { - XmlElement* bsc = group->createNewChildElement ("Manifest"); + auto* bsc = group->createNewChildElement ("Manifest"); bsc->createNewChildElement ("AdditionalManifestFiles") ->addTextElement (manifestFile.rebased (getOwner().getProject().getFile().getParentDirectory(), getOwner().getTargetFolder(), @@ -658,17 +658,17 @@ public: if (getTargetFileType() == staticLibrary && ! config.is64Bit()) { - XmlElement* lib = group->createNewChildElement ("Lib"); + auto* lib = group->createNewChildElement ("Lib"); lib->createNewChildElement ("TargetMachine")->addTextElement ("MachineX86"); } - const String preBuild = getPreBuildSteps (config); + auto preBuild = getPreBuildSteps (config); if (preBuild.isNotEmpty()) group->createNewChildElement ("PreBuildEvent") ->createNewChildElement ("Command") ->addTextElement (preBuild); - const String postBuild = getPostBuildSteps (config); + auto postBuild = getPostBuildSteps (config); if (postBuild.isNotEmpty()) group->createNewChildElement ("PostBuildEvent") ->createNewChildElement ("Command") @@ -678,12 +678,12 @@ public: ScopedPointer otherFilesGroup (new XmlElement ("ItemGroup")); { - XmlElement* cppFiles = projectXml.createNewChildElement ("ItemGroup"); - XmlElement* headerFiles = projectXml.createNewChildElement ("ItemGroup"); + auto* cppFiles = projectXml.createNewChildElement ("ItemGroup"); + auto* headerFiles = projectXml.createNewChildElement ("ItemGroup"); for (int i = 0; i < getOwner().getAllGroups().size(); ++i) { - const Project::Item& group = getOwner().getAllGroups().getReference (i); + auto& group = getOwner().getAllGroups().getReference (i); if (group.getNumChildren() > 0) addFilesToCompile (group, *cppFiles, *headerFiles, *otherFilesGroup); @@ -692,7 +692,7 @@ public: if (getOwner().iconFile != File()) { - XmlElement* e = otherFilesGroup->createNewChildElement ("None"); + auto* e = otherFilesGroup->createNewChildElement ("None"); e->setAttribute ("Include", prependDot (getOwner().iconFile.getFileName())); } @@ -701,18 +701,18 @@ public: if (getOwner().hasResourceFile()) { - XmlElement* rcGroup = projectXml.createNewChildElement ("ItemGroup"); - XmlElement* e = rcGroup->createNewChildElement ("ResourceCompile"); + auto* rcGroup = projectXml.createNewChildElement ("ItemGroup"); + auto* e = rcGroup->createNewChildElement ("ResourceCompile"); e->setAttribute ("Include", prependDot (getOwner().rcFile.getFileName())); } { - XmlElement* e = projectXml.createNewChildElement ("Import"); + auto* e = projectXml.createNewChildElement ("Import"); e->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); } { - XmlElement* e = projectXml.createNewChildElement ("ImportGroup"); + auto* e = projectXml.createNewChildElement ("ImportGroup"); e->setAttribute ("Label", "ExtensionTargets"); } @@ -739,7 +739,7 @@ public: //============================================================================== void addFilesToCompile (const Project::Item& projectItem, XmlElement& cpps, XmlElement& headers, XmlElement& otherFiles) const { - const Type targetType = (getOwner().getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); + auto targetType = (getOwner().getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); if (projectItem.isGroup()) { @@ -749,7 +749,7 @@ public: else if (projectItem.shouldBeAddedToTargetProject() && getOwner().getProject().getTargetTypeFromFilePath (projectItem.getFile(), true) == targetType) { - const RelativePath path (projectItem.getFile(), getOwner().getTargetFolder(), RelativePath::buildTargetFolder); + RelativePath path (projectItem.getFile(), getOwner().getTargetFolder(), RelativePath::buildTargetFolder); jassert (path.getRoot() == RelativePath::buildTargetFolder); @@ -780,14 +780,14 @@ public: void setConditionAttribute (XmlElement& xml, const BuildConfiguration& config) const { - const MSVCBuildConfiguration& msvcConfig = dynamic_cast (config); + auto& msvcConfig = dynamic_cast (config); xml.setAttribute ("Condition", "'$(Configuration)|$(Platform)'=='" + msvcConfig.createMSVCConfigName() + "'"); } //============================================================================== void addFilterGroup (XmlElement& groups, const String& path) const { - XmlElement* e = groups.createNewChildElement ("Filter"); + auto* e = groups.createNewChildElement ("Filter"); e->setAttribute ("Include", path); e->createNewChildElement ("UniqueIdentifier")->addTextElement (createGUID (path + "_guidpathsaltxhsdf")); } @@ -795,7 +795,7 @@ public: void addFileToFilter (const RelativePath& file, const String& groupPath, XmlElement& cpps, XmlElement& headers, XmlElement& otherFiles) const { - XmlElement* e; + XmlElement* e = nullptr; if (file.hasFileExtension (headerFileExtensions)) e = headers.createNewChildElement ("ClInclude"); @@ -812,7 +812,7 @@ public: bool addFilesToFilter (const Project::Item& projectItem, const String& path, XmlElement& cpps, XmlElement& headers, XmlElement& otherFiles, XmlElement& groups) const { - const Type targetType = (getOwner().getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); + auto targetType = (getOwner().getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); if (projectItem.isGroup()) { @@ -831,7 +831,7 @@ public: } else if (projectItem.shouldBeAddedToTargetProject()) { - const RelativePath relativePath (projectItem.getFile(), getOwner().getTargetFolder(), RelativePath::buildTargetFolder); + RelativePath relativePath (projectItem.getFile(), getOwner().getTargetFolder(), RelativePath::buildTargetFolder); jassert (relativePath.getRoot() == RelativePath::buildTargetFolder); @@ -867,22 +867,22 @@ public: filterXml.setAttribute ("ToolsVersion", getOwner().getToolsVersion()); filterXml.setAttribute ("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); - XmlElement* groupsXml = filterXml.createNewChildElement ("ItemGroup"); - XmlElement* cpps = filterXml.createNewChildElement ("ItemGroup"); - XmlElement* headers = filterXml.createNewChildElement ("ItemGroup"); + auto* groupsXml = filterXml.createNewChildElement ("ItemGroup"); + auto* cpps = filterXml.createNewChildElement ("ItemGroup"); + auto* headers = filterXml.createNewChildElement ("ItemGroup"); ScopedPointer otherFilesGroup (new XmlElement ("ItemGroup")); for (int i = 0; i < getOwner().getAllGroups().size(); ++i) { - const Project::Item& group = getOwner().getAllGroups().getReference(i); + auto& group = getOwner().getAllGroups().getReference(i); if (group.getNumChildren() > 0) addFilesToFilter (group, group.getName(), *cpps, *headers, *otherFilesGroup, *groupsXml); - } + } if (getOwner().iconFile.exists()) { - XmlElement* e = otherFilesGroup->createNewChildElement ("None"); + auto* e = otherFilesGroup->createNewChildElement ("None"); e->setAttribute ("Include", prependDot (getOwner().iconFile.getFileName())); e->createNewChildElement ("Filter")->addTextElement (ProjectSaver::getJuceCodeGroupName()); } @@ -892,15 +892,15 @@ public: if (getOwner().hasResourceFile()) { - XmlElement* rcGroup = filterXml.createNewChildElement ("ItemGroup"); - XmlElement* e = rcGroup->createNewChildElement ("ResourceCompile"); + auto* rcGroup = filterXml.createNewChildElement ("ItemGroup"); + auto* e = rcGroup->createNewChildElement ("ResourceCompile"); e->setAttribute ("Include", prependDot (getOwner().rcFile.getFileName())); e->createNewChildElement ("Filter")->addTextElement (ProjectSaver::getJuceCodeGroupName()); } } const MSVCProjectExporterBase& getOwner() const { return owner; } - const String& getProjectGuid() const { return projectGuid; } + const String& getProjectGuid() const { return projectGuid; } //============================================================================== void writeProjectFile() @@ -920,7 +920,7 @@ public: String getSolutionTargetPath (const BuildConfiguration& config) const { - const String binaryPath (config.getTargetBinaryRelativePathString().trim()); + auto binaryPath = config.getTargetBinaryRelativePathString().trim(); if (binaryPath.isEmpty()) return "$(SolutionDir)$(Platform)\\$(Configuration)"; @@ -935,8 +935,8 @@ public: String getConfigTargetPath (const BuildConfiguration& config) const { - String solutionTargetFolder (getSolutionTargetPath (config)); - return solutionTargetFolder + String ("\\") + getName(); + auto solutionTargetFolder = getSolutionTargetPath (config); + return solutionTargetFolder + "\\" + getName(); } String getIntermediatesPath (const MSVCBuildConfiguration& config) const @@ -963,7 +963,7 @@ public: String getTargetSuffix() const { - const ProjectType::Target::TargetFileType fileType = getTargetFileType(); + auto fileType = getTargetFileType(); switch (fileType) { @@ -991,14 +991,14 @@ public: XmlElement* createToolElement (XmlElement& parent, const String& toolName) const { - XmlElement* const e = parent.createNewChildElement ("Tool"); + auto* e = parent.createNewChildElement ("Tool"); e->setAttribute ("Name", toolName); return e; } String getPreprocessorDefs (const BuildConfiguration& config, const String& joinString) const { - StringPairArray defines (getOwner().msvcExtraPreprocessorDefs); + auto defines = getOwner().msvcExtraPreprocessorDefs; defines.set ("WIN32", ""); defines.set ("_WINDOWS", ""); @@ -1022,8 +1022,8 @@ public: for (int i = 0; i < defines.size(); ++i) { - String def (defines.getAllKeys()[i]); - const String value (defines.getAllValues()[i]); + auto def = defines.getAllKeys()[i]; + auto value = defines.getAllValues()[i]; if (value.isNotEmpty()) def << "=" << value; @@ -1036,8 +1036,8 @@ public: //============================================================================== RelativePath getAAXIconFile() const { - const RelativePath aaxSDK (getOwner().getAAXPathValue().toString(), RelativePath::projectFolder); - const RelativePath projectIcon ("icon.ico", RelativePath::buildTargetFolder); + RelativePath aaxSDK (getOwner().getAAXPathValue().toString(), RelativePath::projectFolder); + RelativePath projectIcon ("icon.ico", RelativePath::buildTargetFolder); if (getOwner().getTargetFolder().getChildFile ("icon.ico").existsAsFile()) return projectIcon.rebased (getOwner().getTargetFolder(), @@ -1051,10 +1051,10 @@ public: { if (type == AAXPlugIn) { - const RelativePath aaxSDK (getOwner().getAAXPathValue().toString(), RelativePath::projectFolder); - const RelativePath aaxLibsFolder = aaxSDK.getChildFile ("Libs"); - const RelativePath bundleScript = aaxSDK.getChildFile ("Utilities").getChildFile ("CreatePackage.bat"); - const RelativePath iconFilePath = getAAXIconFile(); + RelativePath aaxSDK (getOwner().getAAXPathValue().toString(), RelativePath::projectFolder); + RelativePath aaxLibsFolder = aaxSDK.getChildFile ("Libs"); + RelativePath bundleScript = aaxSDK.getChildFile ("Utilities").getChildFile ("CreatePackage.bat"); + RelativePath iconFilePath = getAAXIconFile(); auto is64Bit = (config.config [Ids::winArchitecture] == "x64"); @@ -1133,7 +1133,7 @@ public: break; case RTASPlugIn: { - const RelativePath rtasFolder (getOwner().getRTASPathValue().toString(), RelativePath::projectFolder); + RelativePath rtasFolder (getOwner().getRTASPathValue().toString(), RelativePath::projectFolder); defines.set ("JucePlugin_WinBag_path", createRebasedPath (rtasFolder.getChildFile ("WinBag"))); } break; @@ -1155,7 +1155,7 @@ public: StringArray searchPaths; if (type == RTASPlugIn) { - const RelativePath rtasFolder (getOwner().getRTASPathValue().toString(), RelativePath::projectFolder); + RelativePath rtasFolder (getOwner().getRTASPathValue().toString(), RelativePath::projectFolder); static const char* p[] = { "AlturaPorts/TDMPlugins/PluginLibrary/EffectClasses", "AlturaPorts/TDMPlugins/PluginLibrary/ProcessClasses", @@ -1203,10 +1203,10 @@ public: StringArray getLibrarySearchPaths (const BuildConfiguration& config) const { - StringArray librarySearchPaths (config.getLibrarySearchPaths()); + auto librarySearchPaths = config.getLibrarySearchPaths(); if (type != SharedCodeTarget) - if (const MSVCTargetBase* shared = getOwner().getSharedCodeTarget()) + if (auto* shared = getOwner().getSharedCodeTarget()) librarySearchPaths.add (shared->getConfigTargetPath (config)); return librarySearchPaths; @@ -1219,12 +1219,12 @@ public: if (otherLibs.isNotEmpty()) libraries.add (otherLibs); - StringArray moduleLibs = getOwner().getModuleLibs(); + auto moduleLibs = getOwner().getModuleLibs(); if (! moduleLibs.isEmpty()) libraries.addArray (moduleLibs); if (type != SharedCodeTarget) - if (const MSVCTargetBase* shared = getOwner().getSharedCodeTarget()) + if (auto* shared = getOwner().getSharedCodeTarget()) libraries.add (shared->getBinaryNameWithSuffix (config)); return libraries.joinIntoString (";"); @@ -1232,7 +1232,7 @@ public: String getDelayLoadedDLLs() const { - String delayLoadedDLLs = getOwner().msvcDelayLoadedDLLs; + auto delayLoadedDLLs = getOwner().msvcDelayLoadedDLLs; if (type == RTASPlugIn) delayLoadedDLLs += "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; " @@ -1243,16 +1243,16 @@ public: String getModuleDefinitions (const MSVCBuildConfiguration& config) const { - const String& moduleDefinitions = config.config [Ids::msvcModuleDefinitionFile].toString(); + auto moduleDefinitions = config.config [Ids::msvcModuleDefinitionFile].toString(); if (moduleDefinitions.isNotEmpty()) return moduleDefinitions; if (type == RTASPlugIn) { - const ProjectExporter& exp = getOwner(); + auto& exp = getOwner(); - RelativePath moduleDefPath + auto moduleDefPath = RelativePath (exp.getPathForModuleString ("juce_audio_plugin_client"), RelativePath::projectFolder) .getChildFile ("juce_audio_plugin_client").getChildFile ("RTAS").getChildFile ("juce_RTAS_WinExports.def"); @@ -1264,8 +1264,8 @@ public: return {}; } - File getVCProjFile() const { return getOwner().getProjectFile (getProjectFileSuffix(), getName()); } - File getVCProjFiltersFile() const { return getOwner().getProjectFile (getFiltersFileSuffix(), getName()); } + File getVCProjFile() const { return getOwner().getProjectFile (getProjectFileSuffix(), getName()); } + File getVCProjFiltersFile() const { return getOwner().getProjectFile (getFiltersFileSuffix(), getName()); } String createRebasedPath (const RelativePath& path) const { return getOwner().createRebasedPath (path); } @@ -1403,7 +1403,7 @@ private: //============================================================================== String createRebasedPath (const RelativePath& path) const { - String rebasedPath = rebaseFromProjectFolderToBuildTarget (path).toWindowsStyle(); + auto rebasedPath = rebaseFromProjectFolderToBuildTarget (path).toWindowsStyle(); return getVisualStudioVersion() < 10 // (VS10 automatically adds escape characters to the quotes for this definition) ? CppTokeniserFunctions::addEscapeChars (rebasedPath.quoted()) @@ -1443,7 +1443,7 @@ protected: void updateOldSettings() { { - const String oldStylePrebuildCommand (getSettingString (Ids::prebuildCommand)); + auto oldStylePrebuildCommand = getSettingString (Ids::prebuildCommand); settings.removeProperty (Ids::prebuildCommand, nullptr); if (oldStylePrebuildCommand.isNotEmpty()) @@ -1452,7 +1452,7 @@ protected: } { - const String oldStyleLibName (getSettingString ("libraryName_Debug")); + auto oldStyleLibName = getSettingString ("libraryName_Debug"); settings.removeProperty ("libraryName_Debug", nullptr); if (oldStyleLibName.isNotEmpty()) @@ -1462,7 +1462,7 @@ protected: } { - const String oldStyleLibName (getSettingString ("libraryName_Release")); + auto oldStyleLibName = getSettingString ("libraryName_Release"); settings.removeProperty ("libraryName_Release", nullptr); if (oldStyleLibName.isNotEmpty()) @@ -1479,7 +1479,7 @@ protected: StringArray getHeaderSearchPaths (const BuildConfiguration& config) const { - StringArray searchPaths (extraSearchPaths); + auto searchPaths = extraSearchPaths; searchPaths.addArray (config.getHeaderSearchPaths()); return getCleanedStringArray (searchPaths); } @@ -1489,7 +1489,7 @@ protected: String sharedCodeGuid; for (int i = 0; i < targets.size(); ++i) - if (MSVCTargetBase* target = targets[i]) + if (auto* target = targets[i]) if (target->type == ProjectType::Target::SharedCodeTarget) return target->getProjectGuid(); @@ -1499,13 +1499,13 @@ protected: //============================================================================== void writeProjectDependencies (OutputStream& out) const { - const String sharedCodeGuid = getSharedCodeGuid(); + auto sharedCodeGuid = getSharedCodeGuid(); for (int addingOtherTargets = 0; addingOtherTargets < (sharedCodeGuid.isNotEmpty() ? 2 : 1); ++addingOtherTargets) { for (int i = 0; i < targets.size(); ++i) { - if (MSVCTargetBase* target = targets[i]) + if (auto* target = targets[i]) { if (sharedCodeGuid.isEmpty() || (addingOtherTargets != 0) == (target->type != ProjectType::Target::StandalonePlugIn)) { @@ -1540,8 +1540,8 @@ protected: for (ConstConfigIterator i (*this); i.next();) { - const MSVCBuildConfiguration& config = dynamic_cast (*i); - const String configName = config.createMSVCConfigName(); + auto& config = dynamic_cast (*i); + auto configName = config.createMSVCConfigName(); out << "\t\t" << configName << " = " << configName << newLine; } @@ -1551,8 +1551,8 @@ protected: for (auto& target : targets) for (ConstConfigIterator i (*this); i.next();) { - const MSVCBuildConfiguration& config = dynamic_cast (*i); - const String configName = config.createMSVCConfigName(); + auto& config = dynamic_cast (*i); + auto configName = config.createMSVCConfigName(); for (auto& suffix : { "ActiveCfg", "Build.0" }) out << "\t\t" << target->getProjectGuid() << "." << configName << "." << suffix << " = " << configName << newLine; @@ -1569,7 +1569,7 @@ protected: //============================================================================== static void writeBMPImage (const Image& image, const int w, const int h, MemoryOutputStream& out) { - const int maskStride = (w / 8 + 3) & ~3; + int maskStride = (w / 8 + 3) & ~3; out.writeInt (40); // bitmapinfoheader size out.writeInt (w); @@ -1583,15 +1583,15 @@ protected: out.writeInt (0); // clr used out.writeInt (0); // clr important - const Image::BitmapData bitmap (image, Image::BitmapData::readOnly); - const int alphaThreshold = 5; + Image::BitmapData bitmap (image, Image::BitmapData::readOnly); + int alphaThreshold = 5; int y; for (y = h; --y >= 0;) { for (int x = 0; x < w; ++x) { - const Colour pixel (bitmap.getPixelColour (x, y)); + auto pixel = bitmap.getPixelColour (x, y); if (pixel.getAlpha() <= alphaThreshold) { @@ -1613,7 +1613,7 @@ protected: for (int x = 0; x < w; ++x) { - const Colour pixel (bitmap.getPixelColour (x, y)); + auto pixel = bitmap.getPixelColour (x, y); mask <<= 1; if (pixel.getAlpha() <= alphaThreshold) @@ -1643,16 +1643,16 @@ protected: MemoryOutputStream dataBlock; - const int imageDirEntrySize = 16; - const int dataBlockStart = 6 + images.size() * imageDirEntrySize; + int imageDirEntrySize = 16; + int dataBlockStart = 6 + images.size() * imageDirEntrySize; for (int i = 0; i < images.size(); ++i) { - const size_t oldDataSize = dataBlock.getDataSize(); + auto oldDataSize = dataBlock.getDataSize(); - const Image& image = images.getReference (i); - const int w = image.getWidth(); - const int h = image.getHeight(); + auto& image = images.getReference (i); + auto w = image.getWidth(); + auto h = image.getHeight(); if (w >= 256 || h >= 256) { @@ -1688,11 +1688,11 @@ protected: if (hasResourceFile()) { Array images; - const int sizes[] = { 16, 32, 48, 256 }; + int sizes[] = { 16, 32, 48, 256 }; for (int i = 0; i < numElementsInArray (sizes); ++i) { - Image im (getBestIconForSize (sizes[i], true)); + auto im = getBestIconForSize (sizes[i], true); if (im.isValid()) images.add (im); } @@ -1714,7 +1714,7 @@ protected: { rcFile = getTargetFolder().getChildFile ("resources.rc"); - const String version (project.getVersionString()); + auto version = project.getVersionString(); MemoryOutputStream mo; @@ -1770,8 +1770,7 @@ protected: static String getCommaSeparatedVersionNumber (const String& version) { - StringArray versionParts; - versionParts.addTokens (version, ",.", ""); + auto versionParts = StringArray::fromTokens (version, ",.", ""); versionParts.trim(); versionParts.removeEmptyStrings(); while (versionParts.size() < 4) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h index a8a733f6ec..04b4af4a81 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h @@ -146,7 +146,7 @@ public: StringArray s; - const String cppflagsVarName ("JUCE_CPPFLAGS_" + getTargetVarName()); + auto cppflagsVarName = "JUCE_CPPFLAGS_" + getTargetVarName(); s.add (cppflagsVarName + " := " + defines.joinIntoString (" ")); @@ -160,7 +160,7 @@ public: if (! ldflags.isEmpty()) s.add ("JUCE_LDFLAGS_" + getTargetVarName() + " := " + ldflags.joinIntoString (" ")); - String targetName (owner.replacePreprocessorTokens (config, config.getTargetBinaryNameString())); + auto targetName = owner.replacePreprocessorTokens (config, config.getTargetBinaryNameString()); if (owner.projectType.isStaticLibrary()) targetName = getStaticLibbedFilename (targetName); @@ -219,8 +219,8 @@ public: { if (projectItem.shouldBeCompiled()) { - const Type targetType = (owner.getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); - const File f = projectItem.getFile(); + auto targetType = (owner.getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); + auto f = projectItem.getFile(); RelativePath relativePath (f, owner.getTargetFolder(), RelativePath::buildTargetFolder); if (owner.shouldFileBeCompiledByDefault (relativePath) @@ -236,26 +236,28 @@ public: for (int i = 0; i < owner.getAllGroups().size(); ++i) findAllFilesToCompile (owner.getAllGroups().getReference(i), targetFiles); - const String cppflagsVarName = String ("JUCE_CPPFLAGS_") + getTargetVarName(); - const String cflagsVarName = String ("JUCE_CFLAGS_") + getTargetVarName(); + auto cppflagsVarName = "JUCE_CPPFLAGS_" + getTargetVarName(); + auto cflagsVarName = "JUCE_CFLAGS_" + getTargetVarName(); for (int i = 0; i < targetFiles.size(); ++i) { jassert (targetFiles.getReference(i).getRoot() == RelativePath::buildTargetFolder); out << "$(JUCE_OBJDIR)/" << escapeSpaces (owner.getObjectFileFor (targetFiles.getReference(i))) - << ": " << escapeSpaces (targetFiles.getReference(i).toUnixStyle()) << newLine - << "\t-$(V_AT)mkdir -p $(JUCE_OBJDIR)" << newLine - << "\t@echo \"Compiling " << targetFiles.getReference(i).getFileName() << "\"" << newLine - << (targetFiles.getReference(i).hasFileExtension ("c;s;S") ? "\t$(V_AT)$(CC) $(JUCE_CFLAGS) " : "\t$(V_AT)$(CXX) $(JUCE_CXXFLAGS) ") - << "$(" << cppflagsVarName << ") $(" << cflagsVarName << ") -o \"$@\" -c \"$<\"" - << newLine << newLine; + << ": " << escapeSpaces (targetFiles.getReference(i).toUnixStyle()) << newLine + << "\t-$(V_AT)mkdir -p $(JUCE_OBJDIR)" << newLine + << "\t@echo \"Compiling " << targetFiles.getReference(i).getFileName() << "\"" << newLine + << (targetFiles.getReference(i).hasFileExtension ("c;s;S") ? "\t$(V_AT)$(CC) $(JUCE_CFLAGS) " + : "\t$(V_AT)$(CXX) $(JUCE_CXXFLAGS) ") + << "$(" << cppflagsVarName << ") $(" << cflagsVarName << ") -o \"$@\" -c \"$<\"" + << newLine + << newLine; } } String getBuildProduct() const { - return String ("$(JUCE_OUTDIR)/$(JUCE_TARGET_") + getTargetVarName() + String (")"); + return "$(JUCE_OUTDIR)/$(JUCE_TARGET_" + getTargetVarName() + ")"; } String getPhonyName() const @@ -322,7 +324,7 @@ public: //============================================================================== MakefileProjectExporter (Project& p, const ValueTree& t) : ProjectExporter (p, t), - extraPkgConfigValue (settings, Ids::linuxExtraPkgConfig, getProject().getUndoManagerFor (settings)) + extraPkgConfigValue (settings, Ids::linuxExtraPkgConfig, getUndoManager()) { name = getNameLinux(); @@ -330,24 +332,24 @@ public: } //============================================================================== - bool canLaunchProject() override { return false; } - bool launchProject() override { return false; } - bool usesMMFiles() const override { return false; } - bool canCopeWithDuplicateFiles() override { return false; } + bool canLaunchProject() override { return false; } + bool launchProject() override { return false; } + bool usesMMFiles() const override { return false; } + bool canCopeWithDuplicateFiles() override { return false; } bool supportsUserDefinedConfigurations() const override { return true; } - bool isXcode() const override { return false; } - bool isVisualStudio() const override { return false; } - bool isCodeBlocks() const override { return false; } - bool isMakefile() const override { return true; } - bool isAndroidStudio() const override { return false; } - bool isCLion() const override { return false; } + bool isXcode() const override { return false; } + bool isVisualStudio() const override { return false; } + bool isCodeBlocks() const override { return false; } + bool isMakefile() const override { return true; } + bool isAndroidStudio() const override { return false; } + bool isCLion() const override { return false; } - bool isAndroid() const override { return false; } - bool isWindows() const override { return false; } - bool isLinux() const override { return true; } - bool isOSX() const override { return false; } - bool isiOS() const override { return false; } + bool isAndroid() const override { return false; } + bool isWindows() const override { return false; } + bool isLinux() const override { return true; } + bool isOSX() const override { return false; } + bool isiOS() const override { return false; } bool supportsTargetType (ProjectType::Target::Type type) const override { @@ -380,7 +382,7 @@ public: { for (auto* target : targets) { - const ProjectType::Target::TargetFileType fileType = target->getTargetFileType(); + auto fileType = target->getTargetFileType(); if (fileType == ProjectType::Target::sharedLibraryOrDLL || fileType == ProjectType::Target::pluginBundle) @@ -560,8 +562,7 @@ private: { StringArray result (linuxLibs); - StringArray libraries; - libraries.addTokens (getExternalLibrariesString(), ";", "\"'"); + auto libraries = StringArray::fromTokens (getExternalLibrariesString(), ";", "\"'"); libraries.removeEmptyStrings(); for (auto& lib : libraries) @@ -582,7 +583,7 @@ private: StringArray getLinkerFlags (const BuildConfiguration& config) const { - StringArray result (makefileExtraLinkerFlags); + auto result = makefileExtraLinkerFlags; if (! config.isDebug()) result.add ("-fvisibility=hidden"); @@ -669,7 +670,7 @@ private: void writeTargetLines (OutputStream& out, const bool useLinuxPackages) const { - const int n = targets.size(); + auto n = targets.size(); for (int i = 0; i < n; ++i) { @@ -712,9 +713,9 @@ private: void writeConfig (OutputStream& out, const MakeBuildConfiguration& config) const { - const String buildDirName ("build"); - const String intermediatesDirName (buildDirName + "/intermediate/" + config.getName()); - String outputDir (buildDirName); + String buildDirName ("build"); + auto intermediatesDirName = buildDirName + "/intermediate/" + config.getName(); + auto outputDir = buildDirName; if (config.getTargetBinaryRelativePathString().isNotEmpty()) { @@ -737,7 +738,7 @@ private: for (auto target : targets) { - StringArray lines = target->getTargetSettings (config); + auto lines = target->getTargetSettings (config); if (lines.size() > 0) out << " " << lines.joinIntoString ("\n ") << newLine; @@ -774,7 +775,7 @@ private: void writeIncludeLines (OutputStream& out) const { - const int n = targets.size(); + auto n = targets.size(); for (int i = 0; i < n; ++i) { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 436b1e37db..eaa68c1ea9 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -58,33 +58,33 @@ public: : ProjectExporter (p, t), xcodeCanUseDwarf (true), iOS (isIOS), - customPListValue (settings, Ids::customPList, project.getUndoManagerFor (settings)), - pListPrefixHeaderValue (settings, Ids::pListPrefixHeader, project.getUndoManagerFor (settings)), - pListPreprocessValue (settings, Ids::pListPreprocess, project.getUndoManagerFor (settings)), - extraFrameworksValue (settings, Ids::extraFrameworks, project.getUndoManagerFor (settings)), - postbuildCommandValue (settings, Ids::postbuildCommand, project.getUndoManagerFor (settings)), - prebuildCommandValue (settings, Ids::prebuildCommand, project.getUndoManagerFor (settings)), - iosAppExtensionDuplicateResourcesFolderValue (settings, Ids::iosAppExtensionDuplicateResourcesFolder, project.getUndoManagerFor (settings)), - iosDeviceFamilyValue (settings, Ids::iosDeviceFamily, project.getUndoManagerFor (settings), "1,2"), - iPhoneScreenOrientationValue (settings, Ids::iPhoneScreenOrientation, project.getUndoManagerFor (settings), "portraitlandscape"), - iPadScreenOrientationValue (settings, Ids::iPadScreenOrientation, project.getUndoManagerFor (settings), "portraitlandscape"), - customXcodeResourceFoldersValue (settings, Ids::customXcodeResourceFolders, project.getUndoManagerFor (settings)), - customXcassetsFolderValue (settings, Ids::customXcassetsFolder, project.getUndoManagerFor (settings)), - microphonePermissionNeededValue (settings, Ids::microphonePermissionNeeded, project.getUndoManagerFor (settings)), - uiFileSharingEnabledValue (settings, Ids::UIFileSharingEnabled, project.getUndoManagerFor (settings)), - uiSupportsDocumentBrowserValue (settings, Ids::UISupportsDocumentBrowser, project.getUndoManagerFor (settings)), - uiStatusBarHiddenValue (settings, Ids::UIStatusBarHidden, project.getUndoManagerFor (settings)), - documentExtensionsValue (settings, Ids::documentExtensions, project.getUndoManagerFor (settings)), - iosInAppPurchasesValue (settings, Ids::iosInAppPurchases, project.getUndoManagerFor (settings)), - iosBackgroundAudioValue (settings, Ids::iosBackgroundAudio, project.getUndoManagerFor (settings)), - iosBackgroundBleValue (settings, Ids::iosBackgroundBle, project.getUndoManagerFor (settings)), - iosPushNotificationsValue (settings, Ids::iosPushNotifications, project.getUndoManagerFor (settings)), - iosAppGroupsValue (settings, Ids::iosAppGroups, project.getUndoManagerFor (settings)), - iCloudPermissionsValue (settings, Ids::iCloudPermissions, project.getUndoManagerFor (settings)), - iosDevelopmentTeamIDValue (settings, Ids::iosDevelopmentTeamID, project.getUndoManagerFor (settings)), - iosAppGroupsIDValue (settings, Ids::iosAppGroupsId, project.getUndoManagerFor (settings)), - keepCustomXcodeSchemesValue (settings, Ids::keepCustomXcodeSchemes, project.getUndoManagerFor (settings)), - useHeaderMapValue (settings, Ids::useHeaderMap, project.getUndoManagerFor (settings)) + customPListValue (settings, Ids::customPList, getUndoManager()), + pListPrefixHeaderValue (settings, Ids::pListPrefixHeader, getUndoManager()), + pListPreprocessValue (settings, Ids::pListPreprocess, getUndoManager()), + extraFrameworksValue (settings, Ids::extraFrameworks, getUndoManager()), + postbuildCommandValue (settings, Ids::postbuildCommand, getUndoManager()), + prebuildCommandValue (settings, Ids::prebuildCommand, getUndoManager()), + iosAppExtensionDuplicateResourcesFolderValue (settings, Ids::iosAppExtensionDuplicateResourcesFolder, getUndoManager()), + iosDeviceFamilyValue (settings, Ids::iosDeviceFamily, getUndoManager(), "1,2"), + iPhoneScreenOrientationValue (settings, Ids::iPhoneScreenOrientation, getUndoManager(), "portraitlandscape"), + iPadScreenOrientationValue (settings, Ids::iPadScreenOrientation, getUndoManager(), "portraitlandscape"), + customXcodeResourceFoldersValue (settings, Ids::customXcodeResourceFolders, getUndoManager()), + customXcassetsFolderValue (settings, Ids::customXcassetsFolder, getUndoManager()), + microphonePermissionNeededValue (settings, Ids::microphonePermissionNeeded, getUndoManager()), + uiFileSharingEnabledValue (settings, Ids::UIFileSharingEnabled, getUndoManager()), + uiSupportsDocumentBrowserValue (settings, Ids::UISupportsDocumentBrowser, getUndoManager()), + uiStatusBarHiddenValue (settings, Ids::UIStatusBarHidden, getUndoManager()), + documentExtensionsValue (settings, Ids::documentExtensions, getUndoManager()), + iosInAppPurchasesValue (settings, Ids::iosInAppPurchases, getUndoManager()), + iosBackgroundAudioValue (settings, Ids::iosBackgroundAudio, getUndoManager()), + iosBackgroundBleValue (settings, Ids::iosBackgroundBle, getUndoManager()), + iosPushNotificationsValue (settings, Ids::iosPushNotifications, getUndoManager()), + iosAppGroupsValue (settings, Ids::iosAppGroups, getUndoManager()), + iCloudPermissionsValue (settings, Ids::iCloudPermissions, getUndoManager()), + iosDevelopmentTeamIDValue (settings, Ids::iosDevelopmentTeamID, getUndoManager()), + iosAppGroupsIDValue (settings, Ids::iosAppGroupsId, getUndoManager()), + keepCustomXcodeSchemesValue (settings, Ids::keepCustomXcodeSchemes, getUndoManager()), + useHeaderMapValue (settings, Ids::useHeaderMap, getUndoManager()) { name = iOS ? getNameiOS() : getNameMac(); @@ -131,22 +131,22 @@ public: String getAppGroupIdString() const { return iosAppGroupsIDValue.get(); } //============================================================================== - bool usesMMFiles() const override { return true; } - bool canCopeWithDuplicateFiles() override { return true; } + bool usesMMFiles() const override { return true; } + bool canCopeWithDuplicateFiles() override { return true; } bool supportsUserDefinedConfigurations() const override { return true; } - bool isXcode() const override { return true; } - bool isVisualStudio() const override { return false; } - bool isCodeBlocks() const override { return false; } - bool isMakefile() const override { return false; } - bool isAndroidStudio() const override { return false; } - bool isCLion() const override { return false; } + bool isXcode() const override { return true; } + bool isVisualStudio() const override { return false; } + bool isCodeBlocks() const override { return false; } + bool isMakefile() const override { return false; } + bool isAndroidStudio() const override { return false; } + bool isCLion() const override { return false; } - bool isAndroid() const override { return false; } - bool isWindows() const override { return false; } - bool isLinux() const override { return false; } - bool isOSX() const override { return ! iOS; } - bool isiOS() const override { return iOS; } + bool isAndroid() const override { return false; } + bool isWindows() const override { return false; } + bool isLinux() const override { return false; } + bool isOSX() const override { return ! iOS; } + bool isiOS() const override { return iOS; } bool supportsTargetType (ProjectType::Target::Type type) const override { @@ -329,12 +329,12 @@ public: createIconFile(); - File projectBundle (getProjectBundle()); + auto projectBundle = getProjectBundle(); createDirectoryOrThrow (projectBundle); createObjects(); - File projectFile (projectBundle.getChildFile ("project.pbxproj")); + auto projectFile = projectBundle.getChildFile ("project.pbxproj"); { MemoryOutputStream mo; @@ -773,7 +773,7 @@ public: { Array result; - const Type targetType = (owner.getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); + auto targetType = (owner.getProject().getProjectType().isAudioPlugin() ? type : SharedCodeTarget); if (projectItem.isGroup()) { @@ -806,7 +806,7 @@ public: if (ProjectExporter::BuildConfiguration::Ptr config = owner.getConfiguration(0)) { - String productName (owner.replacePreprocessorTokens (*config, config->getTargetBinaryNameString())); + auto productName = owner.replacePreprocessorTokens (*config, config->getTargetBinaryNameString()); if (xcodeFileType == "archive.ar") productName = getStaticLibbedFilename (productName); @@ -820,7 +820,7 @@ public: //============================================================================== void addBuildProduct (const String& fileType, const String& binaryName) const { - ValueTree* v = new ValueTree (owner.createID (String ("__productFileID") + getName())); + auto* v = new ValueTree (owner.createID (String ("__productFileID") + getName())); v->setProperty ("isa", "PBXFileReference", nullptr); v->setProperty ("explicitFileType", fileType, nullptr); v->setProperty ("includeInIndex", (int) 0, nullptr); @@ -835,7 +835,7 @@ public: jassert (dependencyID.isEmpty()); dependencyID = owner.createID (String ("__dependency") + getName()); - ValueTree* const v = new ValueTree (dependencyID); + auto* v = new ValueTree (dependencyID); v->setProperty ("isa", "PBXTargetDependency", nullptr); v->setProperty ("target", getID(), nullptr); @@ -853,9 +853,9 @@ public: //============================================================================== void addTargetConfig (const String& configName, const StringArray& buildSettings) { - String configID = owner.createID (String ("targetconfigid_") + getName() + String ("_") + configName); + auto configID = owner.createID (String ("targetconfigid_") + getName() + String ("_") + configName); - ValueTree* v = new ValueTree (configID); + auto* v = new ValueTree (configID); v->setProperty ("isa", "XCBuildConfiguration", nullptr); v->setProperty ("buildSettings", indentBracedList (buildSettings), nullptr); v->setProperty (Ids::name, configName, nullptr); @@ -903,8 +903,8 @@ public: //============================================================================== ValueTree& addBuildPhase (const String& buildPhaseType, const StringArray& fileIds, const StringRef humanReadableName = StringRef()) { - String buildPhaseName = buildPhaseType + String ("_") + getName() + String ("_") + (humanReadableName.isNotEmpty() ? String (humanReadableName) : String ("resbuildphase")); - String buildPhaseId (owner.createID (buildPhaseName)); + auto buildPhaseName = buildPhaseType + "_" + getName() + "_" + (humanReadableName.isNotEmpty() ? String (humanReadableName) : String ("resbuildphase")); + auto buildPhaseId (owner.createID (buildPhaseName)); int n = 0; while (buildPhaseIDs.contains (buildPhaseId)) @@ -912,7 +912,7 @@ public: buildPhaseIDs.add (buildPhaseId); - ValueTree* v = new ValueTree (buildPhaseId); + auto* v = new ValueTree (buildPhaseId); v->setProperty ("isa", buildPhaseType, nullptr); v->setProperty ("buildActionMask", "2147483647", nullptr); v->setProperty ("files", indentParenthesisedList (fileIds), nullptr); @@ -927,7 +927,7 @@ public: bool shouldCreatePList() const { - const ProjectType::Target::TargetFileType fileType = getTargetFileType(); + auto fileType = getTargetFileType(); return (fileType == executable && type != ConsoleApp) || fileType == pluginBundle || fileType == macOSAppex; } @@ -951,7 +951,7 @@ public: if (xcodeBundleIDSubPath.isNotEmpty()) { - StringArray bundleIdSegments = StringArray::fromTokens (bundleIdentifier, ".", StringRef()); + auto bundleIdSegments = StringArray::fromTokens (bundleIdentifier, ".", StringRef()); jassert (bundleIdSegments.size() > 0); bundleIdentifier += String (".") + bundleIdSegments[bundleIdSegments.size() - 1] + xcodeBundleIDSubPath; @@ -1008,8 +1008,8 @@ public: for (int i = 0; i < plistDefs.size(); ++i) { - String def (plistDefs.getAllKeys()[i]); - const String value (plistDefs.getAllValues()[i]); + auto def = plistDefs.getAllKeys()[i]; + auto value = plistDefs.getAllValues()[i]; if (value.isNotEmpty()) def << "=" << value.replace ("\"", "\\\\\\\""); @@ -1027,12 +1027,12 @@ public: if (config.isFastMathEnabled()) s.set ("GCC_FAST_MATH", "YES"); - const String extraFlags (owner.replacePreprocessorTokens (config, owner.getExtraCompilerFlagsString()).trim()); + auto extraFlags = owner.replacePreprocessorTokens (config, owner.getExtraCompilerFlagsString()).trim(); if (extraFlags.isNotEmpty()) s.set ("OTHER_CPLUSPLUSFLAGS", extraFlags.quoted()); - String installPath = getInstallPathForConfiguration (config); + auto installPath = getInstallPathForConfiguration (config); if (installPath.startsWith ("~")) installPath = installPath.replace ("~", "$(HOME)"); @@ -1058,7 +1058,7 @@ public: if (xcodeOtherRezFlags.isNotEmpty()) s.set ("OTHER_REZFLAGS", "\"" + xcodeOtherRezFlags + "\""); - String configurationBuildDir = "$(PROJECT_DIR)/build/$(CONFIGURATION)"; + String configurationBuildDir ("$(PROJECT_DIR)/build/$(CONFIGURATION)"); if (config.getTargetBinaryRelativePathString().isNotEmpty()) { @@ -1182,8 +1182,8 @@ public: for (int i = 0; i < defines.size(); ++i) { - String def (defines.getAllKeys()[i]); - const String value (defines.getAllValues()[i]); + auto def = defines.getAllKeys()[i]; + auto value = defines.getAllValues()[i]; if (value.isNotEmpty()) def << "=" << value.replace ("\"", "\\\\\\\""); @@ -1241,7 +1241,7 @@ public: { if (owner.getTargetOfType (Target::SharedCodeTarget) != nullptr) { - String productName (getStaticLibbedFilename (owner.replacePreprocessorTokens (config, config.getTargetBinaryNameString()))); + auto productName = getStaticLibbedFilename (owner.replacePreprocessorTokens (config, config.getTargetBinaryNameString())); RelativePath sharedCodelib (productName, RelativePath::buildTargetFolder); flags.add (getLinkerFlagForLib (sharedCodelib.getFileNameWithoutExtension())); @@ -1251,7 +1251,7 @@ public: flags.add (owner.replacePreprocessorTokens (config, owner.getExtraLinkerFlagsString())); flags.add (owner.getExternalLibraryFlags (config)); - StringArray libs (owner.xcodeLibs); + auto libs = owner.xcodeLibs; libs.addArray (xcodeLibs); for (auto& l : libs) @@ -1271,7 +1271,7 @@ public: if (plist == nullptr || ! plist->hasTagName ("plist")) plist = new XmlElement ("plist"); - XmlElement* dict = plist->getChildByName ("dict"); + auto* dict = plist->getChildByName ("dict"); if (dict == nullptr) dict = plist->createNewChildElement ("dict"); @@ -1303,19 +1303,18 @@ public: addPlistDictionaryKey (dict, "NSHumanReadableCopyright", owner.project.getCompanyCopyrightString()); addPlistDictionaryKeyBool (dict, "NSHighResolutionCapable", true); - StringArray documentExtensions; - documentExtensions.addTokens (replacePreprocessorDefs (owner.getAllPreprocessorDefs(), owner.settings ["documentExtensions"]), - ",", StringRef()); + auto documentExtensions = StringArray::fromTokens (replacePreprocessorDefs (owner.getAllPreprocessorDefs(), owner.settings ["documentExtensions"]), + ",", {}); documentExtensions.trim(); documentExtensions.removeEmptyStrings (true); if (documentExtensions.size() > 0 && type != AudioUnitv3PlugIn) { dict->createNewChildElement ("key")->addTextElement ("CFBundleDocumentTypes"); - XmlElement* dict2 = dict->createNewChildElement ("array")->createNewChildElement ("dict"); + auto* dict2 = dict->createNewChildElement ("array")->createNewChildElement ("dict"); XmlElement* arrayTag = nullptr; - for (String ex : documentExtensions) + for (auto ex : documentExtensions) { if (ex.startsWithChar ('.')) ex = ex.substring (1); @@ -1364,7 +1363,7 @@ public: dict->addChildElement (new XmlElement (audioComponentsPlistKey)); XmlElement audioComponentsPlistEntry ("array"); - XmlElement* audioComponentsDict = audioComponentsPlistEntry.createNewChildElement ("dict"); + auto* audioComponentsDict = audioComponentsPlistEntry.createNewChildElement ("dict"); addPlistDictionaryKey (audioComponentsDict, "name", owner.project.getIAAPluginName()); addPlistDictionaryKey (audioComponentsDict, "manufacturer", owner.project.getPluginManufacturerCodeString().substring (0, 4)); @@ -1419,7 +1418,7 @@ public: static void addArrayToPlist (XmlElement* dict, String arrayKey, const StringArray& arrayElements) { dict->createNewChildElement ("key")->addTextElement (arrayKey); - XmlElement* plistStringArray = dict->createNewChildElement ("array"); + auto* plistStringArray = dict->createNewChildElement ("array"); for (auto& e : arrayElements) plistStringArray->createNewChildElement ("string")->addTextElement (e); @@ -1430,7 +1429,7 @@ public: { if (script.trim().isNotEmpty()) { - ValueTree& v = addBuildPhase ("PBXShellScriptBuildPhase", StringArray()); + auto& v = addBuildPhase ("PBXShellScriptBuildPhase", {}); v.setProperty (Ids::name, phaseName, nullptr); v.setProperty ("shellPath", "/bin/sh", nullptr); v.setProperty ("shellScript", script.replace ("\\", "\\\\") @@ -1442,7 +1441,7 @@ public: void addCopyFilesPhase (const String& phaseName, const StringArray& files, XcodeCopyFilesDestinationIDs dst) { - ValueTree& v = addBuildPhase ("PBXCopyFilesBuildPhase", files, phaseName); + auto& v = addBuildPhase ("PBXCopyFilesBuildPhase", files, phaseName); v.setProperty ("dstPath", "", nullptr); v.setProperty ("dstSubfolderSpec", (int) dst, nullptr); } @@ -1491,7 +1490,7 @@ public: plistKey.addTextElement ("AudioComponents"); XmlElement plistEntry ("array"); - XmlElement* dict = plistEntry.createNewChildElement ("dict"); + auto* dict = plistEntry.createNewChildElement ("dict"); auto pluginManufacturerCode = owner.project.getPluginManufacturerCodeString().substring (0, 4); auto pluginSubType = owner.project.getPluginCodeString().substring (0, 4); @@ -1533,11 +1532,11 @@ public: addPlistDictionaryKey (&plistEntry, "NSExtensionPointIdentifier", "com.apple.AudioUnit-UI"); plistEntry.createNewChildElement ("key")->addTextElement ("NSExtensionAttributes"); - XmlElement* dict = plistEntry.createNewChildElement ("dict"); + auto* dict = plistEntry.createNewChildElement ("dict"); dict->createNewChildElement ("key")->addTextElement ("AudioComponents"); - XmlElement* componentArray = dict->createNewChildElement ("array"); + auto* componentArray = dict->createNewChildElement ("array"); - XmlElement* componentDict = componentArray->createNewChildElement ("dict"); + auto* componentDict = componentArray->createNewChildElement ("dict"); addPlistDictionaryKey (componentDict, "name", owner.project.getPluginManufacturerString() + ": " + owner.project.getPluginNameString()); @@ -1550,7 +1549,7 @@ public: addPlistDictionaryKeyBool (componentDict, "sandboxSafe", true); componentDict->createNewChildElement ("key")->addTextElement ("tags"); - XmlElement* tagsArray = componentDict->createNewChildElement ("array"); + auto* tagsArray = componentDict->createNewChildElement ("array"); tagsArray->createNewChildElement ("string") ->addTextElement (static_cast (owner.project.isPluginSynth()) ? "Synth" : "Effects"); @@ -1763,11 +1762,11 @@ private: target->addMainBuildProduct(); - String targetName = target->getName(); - String fileID (createID (targetName + String ("__targetbuildref"))); - String fileRefID (createID (String ("__productFileID") + targetName)); + auto targetName = target->getName(); + auto fileID = createID (targetName + String ("__targetbuildref")); + auto fileRefID = createID (String ("__productFileID") + targetName); - ValueTree* v = new ValueTree (fileID); + auto* v = new ValueTree (fileID); v->setProperty ("isa", "PBXBuildFile", nullptr); v->setProperty ("fileRef", fileRefID, nullptr); @@ -1821,9 +1820,9 @@ private: { for (ConstConfigIterator config (*this); config.next();) { - const auto& xcodeConfig = dynamic_cast (*config); + auto& xcodeConfig = dynamic_cast (*config); StringArray settingsLines; - const auto configSettings = getProjectSettings (xcodeConfig); + auto configSettings = getProjectSettings (xcodeConfig); for (auto& key : configSettings.getAllKeys()) settingsLines.add (key + " = " + configSettings[key]); @@ -1834,7 +1833,7 @@ private: void addFilesAndGroupsToProject (StringArray& topLevelGroupIDs) const { - StringPairArray entitlements = getEntitlements(); + auto entitlements = getEntitlements(); if (entitlements.size() > 0) topLevelGroupIDs.add (addEntitlementsFile (entitlements)); @@ -1846,19 +1845,19 @@ private: void addExtraGroupsToProject (StringArray& topLevelGroupIDs) const { { // Add 'resources' group - String resourcesGroupID (createID ("__resources")); + auto resourcesGroupID = createID ("__resources"); addGroup (resourcesGroupID, "Resources", resourceFileRefs); topLevelGroupIDs.add (resourcesGroupID); } { // Add 'frameworks' group - String frameworksGroupID (createID ("__frameworks")); + auto frameworksGroupID = createID ("__frameworks"); addGroup (frameworksGroupID, "Frameworks", frameworkFileIDs); topLevelGroupIDs.add (frameworksGroupID); } { // Add 'products' group - String productsGroupID (createID ("__products")); + auto productsGroupID = createID ("__products"); addGroup (productsGroupID, "Products", buildProducts); topLevelGroupIDs.add (productsGroupID); } @@ -1874,9 +1873,9 @@ private: for (ConstConfigIterator config (*this); config.next();) { - const XcodeBuildConfiguration& xcodeConfig = dynamic_cast (*config); + auto& xcodeConfig = dynamic_cast (*config); - const auto configSettings = target->getTargetSettings (xcodeConfig); + auto configSettings = target->getTargetSettings (xcodeConfig); StringArray settingsLines; for (auto& key : configSettings.getAllKeys()) @@ -1897,13 +1896,13 @@ private: if (! projectType.isStaticLibrary() && target->type != XcodeTarget::SharedCodeTarget && ! skipAUv3) target->addBuildPhase ("PBXResourcesBuildPhase", resourceIDs); - StringArray rezFiles (rezFileIDs); + auto rezFiles = rezFileIDs; rezFiles.addArray (target->rezFileIDs); if (rezFiles.size() > 0) target->addBuildPhase ("PBXRezBuildPhase", rezFiles); - StringArray sourceFiles (target->sourceIDs); + auto sourceFiles = target->sourceIDs; if (target->type == XcodeTarget::SharedCodeTarget || (! project.getProjectType().isAudioPlugin())) @@ -1942,8 +1941,8 @@ private: { const int validSizes[] = { 16, 32, 48, 128, 256, 512, 1024 }; - const int w = image.getWidth(); - const int h = image.getHeight(); + auto w = image.getWidth(); + auto h = image.getHeight(); int bestSize = 16; @@ -1974,10 +1973,10 @@ private: void addTargetObject (XcodeTarget& target) const { - String targetName = target.getName(); + auto targetName = target.getName(); - String targetID = target.getID(); - ValueTree* const v = new ValueTree (targetID); + auto targetID = target.getID(); + auto* v = new ValueTree (targetID); v->setProperty ("isa", target.type == XcodeTarget::AggregateTarget ? "PBXAggregateTarget" : "PBXNativeTarget", nullptr); v->setProperty ("buildConfigurationList", createID (String ("__configList") + targetName), nullptr); @@ -2008,10 +2007,10 @@ private: { if (target.type == XcodeTarget::StandalonePlugIn) // depends on AUv3 and shared code { - if (XcodeTarget* auv3Target = getTargetOfType (XcodeTarget::AudioUnitv3PlugIn)) + if (auto* auv3Target = getTargetOfType (XcodeTarget::AudioUnitv3PlugIn)) dependencies.add (auv3Target->getDependencyID()); - if (XcodeTarget* sharedCodeTarget = getTargetOfType (XcodeTarget::SharedCodeTarget)) + if (auto* sharedCodeTarget = getTargetOfType (XcodeTarget::SharedCodeTarget)) dependencies.add (sharedCodeTarget->getDependencyID()); } else if (target.type == XcodeTarget::AggregateTarget) // depends on all other targets @@ -2021,7 +2020,7 @@ private: } else if (target.type != XcodeTarget::SharedCodeTarget) // shared code doesn't depend on anything; all other targets depend only on the shared code { - if (XcodeTarget* sharedCodeTarget = getTargetOfType (XcodeTarget::SharedCodeTarget)) + if (auto* sharedCodeTarget = getTargetOfType (XcodeTarget::SharedCodeTarget)) dependencies.add (sharedCodeTarget->getDependencyID()); } } @@ -2031,19 +2030,19 @@ private: static void writeOldIconFormat (MemoryOutputStream& out, const Image& image, const char* type, const char* maskType) { - const int w = image.getWidth(); - const int h = image.getHeight(); + auto w = image.getWidth(); + auto h = image.getHeight(); out.write (type, 4); out.writeIntBigEndian (8 + 4 * w * h); - const Image::BitmapData bitmap (image, Image::BitmapData::readOnly); + Image::BitmapData bitmap (image, Image::BitmapData::readOnly); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { - const Colour pixel (bitmap.getPixelColour (x, y)); + auto pixel = bitmap.getPixelColour (x, y); out.writeByte ((char) pixel.getAlpha()); out.writeByte ((char) pixel.getRed()); out.writeByte ((char) pixel.getGreen()); @@ -2058,7 +2057,7 @@ private: { for (int x = 0; x < w; ++x) { - const Colour pixel (bitmap.getPixelColour (x, y)); + auto pixel = bitmap.getPixelColour (x, y); out.writeByte ((char) pixel.getAlpha()); } } @@ -2083,7 +2082,7 @@ private: for (int i = 0; i < images.size(); ++i) { - const Image image (fixMacIconImageSize (*images.getUnchecked(i))); + auto image = fixMacIconImageSize (*images.getUnchecked(i)); jassert (image.getWidth() == image.getHeight()); if (image.getWidth() < smallest) @@ -2186,7 +2185,7 @@ private: { for (DirectoryIterator di (folder, false, "*", File::findFilesAndDirectories); di.next();) { - const File& entry = di.getFile(); + auto& entry = di.getFile(); if (! entry.isSymbolicLink()) { @@ -2208,11 +2207,11 @@ private: String getSearchPathForStaticLibrary (const RelativePath& library) const { - String searchPath (library.toUnixStyle().upToLastOccurrenceOf ("/", false, false)); + auto searchPath = library.toUnixStyle().upToLastOccurrenceOf ("/", false, false); if (! library.isAbsolute()) { - String srcRoot (rebaseFromProjectFolderToBuildTarget (RelativePath (".", RelativePath::projectFolder)).toUnixStyle()); + auto srcRoot = rebaseFromProjectFolderToBuildTarget (RelativePath (".", RelativePath::projectFolder)).toUnixStyle(); if (srcRoot.endsWith ("/.")) srcRoot = srcRoot.dropLastCharacters (2); if (! srcRoot.endsWithChar ('/')) srcRoot << '/'; @@ -2313,7 +2312,7 @@ private: xcodeFrameworks.addTokens (getExtraFrameworksString(), ",;", "\"'"); xcodeFrameworks.trim(); - StringArray s (xcodeFrameworks); + auto s = xcodeFrameworks; for (auto& target : targets) s.addArray (target->xcodeFrameworks); @@ -2327,7 +2326,7 @@ private: for (auto& framework : s) { - String frameworkID = addFramework (framework); + auto frameworkID = addFramework (framework); // find all the targets that are referring to this object for (auto& target : targets) @@ -2355,7 +2354,7 @@ private: void addXcassets() const { - String customXcassetsPath = getCustomXcassetsFolderString(); + auto customXcassetsPath = getCustomXcassetsFolderString(); if (customXcassetsPath.isEmpty()) createXcassetsFolderFromIcons(); @@ -2365,11 +2364,11 @@ private: void addCustomResourceFolder (String folderPathRelativeToProjectFolder, const String fileType = "folder") const { - String folderPath = RelativePath (folderPathRelativeToProjectFolder, RelativePath::projectFolder) - .rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder) - .toUnixStyle(); + auto folderPath = RelativePath (folderPathRelativeToProjectFolder, RelativePath::projectFolder) + .rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder) + .toUnixStyle(); - const String fileRefID (createFileRefID (folderPath)); + auto fileRefID = createFileRefID (folderPath); addFileOrFolderReference (folderPath, "", fileType); @@ -2400,8 +2399,8 @@ private: for (int j = 0; j < o->getNumProperties(); ++j) { - const Identifier propertyName (o->getPropertyName(j)); - String val (o->getProperty (propertyName).toString()); + auto propertyName = o->getPropertyName(j); + auto val = o->getProperty (propertyName).toString(); if (val.isEmpty() || (val.containsAnyOf (" \t;<>()=,&+-_@~\r\n\\#%^`*") && ! (val.trimStart().startsWithChar ('(') @@ -2419,7 +2418,7 @@ private: String addBuildFile (const String& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings, XcodeTarget* xcodeTarget = nullptr) const { - String fileID (createID (path + "buildref")); + auto fileID = createID (path + "buildref"); if (addToSourceBuildPhase) { @@ -2429,7 +2428,7 @@ private: sourceIDs.add (fileID); } - ValueTree* v = new ValueTree (fileID); + auto* v = new ValueTree (fileID); v->setProperty ("isa", "PBXBuildFile", nullptr); v->setProperty ("fileRef", fileRefID, nullptr); @@ -2460,14 +2459,14 @@ private: sourceTree = ""; } - String fileType = getFileType (path); + auto fileType = getFileType (path); return addFileOrFolderReference (pathString, sourceTree, fileType); } String addFileOrFolderReference (String pathString, String sourceTree, String fileType) const { - const String fileRefID (createFileRefID (pathString)); + auto fileRefID = createFileRefID (pathString); ScopedPointer v (new ValueTree (fileRefID)); v->setProperty ("isa", "PBXFileReference", nullptr); @@ -2476,7 +2475,7 @@ private: v->setProperty ("path", pathString, nullptr); v->setProperty ("sourceTree", sourceTree, nullptr); - const int existing = pbxFileReferences.indexOfSorted (*this, v); + auto existing = pbxFileReferences.indexOfSorted (*this, v); if (existing >= 0) { @@ -2526,8 +2525,8 @@ private: String addFile (const RelativePath& path, bool shouldBeCompiled, bool shouldBeAddedToBinaryResources, bool shouldBeAddedToXcodeResources, bool inhibitWarnings, XcodeTarget* xcodeTarget) const { - const String pathAsString (path.toUnixStyle()); - const String refID (addFileReference (path.toUnixStyle())); + auto pathAsString = path.toUnixStyle(); + auto refID = addFileReference (path.toUnixStyle()); if (shouldBeCompiled) { @@ -2535,7 +2534,7 @@ private: } else if (! shouldBeAddedToBinaryResources || shouldBeAddedToXcodeResources) { - const String fileType (getFileType (path)); + auto fileType = getFileType (path); if (shouldBeAddedToXcodeResources) { @@ -2549,14 +2548,14 @@ private: String addRezFile (const Project::Item& projectItem, const RelativePath& path) const { - const String pathAsString (path.toUnixStyle()); - const String refID (addFileReference (path.toUnixStyle())); + auto pathAsString = path.toUnixStyle(); + auto refID = addFileReference (path.toUnixStyle()); if (projectItem.isModuleCode()) { - if (XcodeTarget* xcodeTarget = getTargetOfType (getProject().getTargetTypeFromFilePath (projectItem.getFile(), false))) + if (auto* xcodeTarget = getTargetOfType (getProject().getTargetTypeFromFilePath (projectItem.getFile(), false))) { - String rezFileID = addBuildFile (pathAsString, refID, false, false, xcodeTarget); + auto rezFileID = addBuildFile (pathAsString, refID, false, false, xcodeTarget); xcodeTarget->rezFileIDs.add (rezFileID); return refID; @@ -2636,7 +2635,7 @@ private: "\n" "\n"; - const auto keys = entitlements.getAllKeys(); + auto keys = entitlements.getAllKeys(); for (auto& key : keys) { @@ -2646,7 +2645,7 @@ private: content += "\n" "\n"; - File entitlementsFile = getTargetFolder().getChildFile (getEntitlementsFileName()); + auto entitlementsFile = getTargetFolder().getChildFile (getEntitlementsFileName()); overwriteFileIfDifferentOrThrow (entitlementsFile, content); RelativePath plistPath (entitlementsFile, getTargetFolder(), RelativePath::buildTargetFolder); @@ -2663,7 +2662,7 @@ private: StringArray childIDs; for (int i = 0; i < projectItem.getNumChildren(); ++i) { - const String childID (addProjectItem (projectItem.getChild(i))); + auto childID = addProjectItem (projectItem.getChild(i)); if (childID.isNotEmpty()) childIDs.add (childID); @@ -2674,7 +2673,7 @@ private: if (projectItem.shouldBeAddedToTargetProject()) { - const String itemPath (projectItem.getFilePath()); + auto itemPath = projectItem.getFilePath(); RelativePath path; if (itemPath.startsWith ("${")) @@ -2701,14 +2700,14 @@ private: String addFramework (const String& frameworkName) const { - String path (frameworkName); + auto path = frameworkName; if (! File::isAbsolutePath (path)) path = "System/Library/Frameworks/" + path; if (! path.endsWithIgnoreCase (".framework")) path << ".framework"; - const String fileRefID (createFileRefID (path)); + auto fileRefID = createFileRefID (path); addFileReference ((File::isAbsolutePath (frameworkName) ? "" : "${SDKROOT}/") + path); frameworkFileIDs.add (fileRefID); @@ -2718,7 +2717,7 @@ private: void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) const { - ValueTree* v = new ValueTree (groupID); + auto* v = new ValueTree (groupID); v->setProperty ("isa", "PBXGroup", nullptr); v->setProperty ("children", indentParenthesisedList (childIDs), nullptr); v->setProperty (Ids::name, groupName, nullptr); @@ -2728,15 +2727,15 @@ private: String addGroup (const Project::Item& item, StringArray& childIDs) const { - const String groupName (item.getName()); - const String groupID (getIDForGroup (item)); + auto groupName = item.getName(); + auto groupID = getIDForGroup (item); addGroup (groupID, groupName, childIDs); return groupID; } void addProjectConfig (const String& configName, const StringArray& buildSettings) const { - ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName)); + auto* v = new ValueTree (createID ("projectconfigid_" + configName)); v->setProperty ("isa", "XCBuildConfiguration", nullptr); v->setProperty ("buildSettings", indentBracedList (buildSettings), nullptr); v->setProperty (Ids::name, configName, nullptr); @@ -2745,7 +2744,7 @@ private: void addConfigList (XcodeTarget& target, const OwnedArray & configsToUse, const String& listID) const { - ValueTree* v = new ValueTree (listID); + auto* v = new ValueTree (listID); v->setProperty ("isa", "XCConfigurationList", nullptr); v->setProperty ("buildConfigurations", indentParenthesisedList (target.configIDs), nullptr); v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr); @@ -2763,7 +2762,7 @@ private: for (auto* c : configsToUse) configIDs.add (c->getType().toString()); - ValueTree* v = new ValueTree (listID); + auto* v = new ValueTree (listID); v->setProperty ("isa", "XCConfigurationList", nullptr); v->setProperty ("buildConfigurations", indentParenthesisedList (configIDs), nullptr); v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr); @@ -2776,7 +2775,7 @@ private: void addProjectObject() const { - ValueTree* const v = new ValueTree (createID ("__root")); + auto* v = new ValueTree (createID ("__root")); v->setProperty ("isa", "PBXProject", nullptr); v->setProperty ("buildConfigurationList", createID ("__projList"), nullptr); v->setProperty ("attributes", getProjectObjectAttributes(), nullptr); @@ -2786,7 +2785,7 @@ private: v->setProperty ("projectDirPath", "\"\"", nullptr); v->setProperty ("projectRoot", "\"\"", nullptr); - String targetString = "(" + targetIDs.joinIntoString (", ") + ")"; + auto targetString = "(" + targetIDs.joinIntoString (", ") + ")"; v->setProperty ("targets", targetString, nullptr); misc.add (v); } @@ -2797,7 +2796,7 @@ private: if (settings ["keepCustomXcodeSchemes"]) return; - File xcuserdata = getProjectBundle().getChildFile ("xcuserdata"); + auto xcuserdata = getProjectBundle().getChildFile ("xcuserdata"); if (! xcuserdata.exists()) return; @@ -3057,11 +3056,11 @@ private: if (list.size() == 0) return " "; - const String tabs ("\n" + String::repeatedString ("\t", extraTabs + 4)); + auto tabs = "\n" + String::repeatedString ("\t", extraTabs + 4); if (shouldSort) { - StringArray sorted (list); + auto sorted = list; sorted.sort (true); return tabs + sorted.joinIntoString (separator + tabs) + separator; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index 93299efcc6..6bf04fe271 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -137,6 +137,8 @@ public: Project& getProject() noexcept { return project; } const Project& getProject() const noexcept { return project; } + UndoManager* getUndoManager() const { return project.getUndoManagerFor (settings); } + Value getSetting (const Identifier& nm) { return settings.getPropertyAsValue (nm, project.getUndoManagerFor (settings)); } String getSettingString (const Identifier& nm) const { return settings [nm]; }