diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h index 5011a5ff92..5658d3a741 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h @@ -51,23 +51,23 @@ public: { name = getNameAndroid(); - if (getTargetLocation().toString().isEmpty()) - getTargetLocation() = getDefaultBuildsRootFolder() + "Android"; + if (getTargetLocationString().isEmpty()) + getTargetLocationValue() = getDefaultBuildsRootFolder() + "Android"; - if (getActivityClassPath().toString().isEmpty()) - getActivityClassPath() = createDefaultClassName(); + if (getActivityClassPath().isEmpty()) + getActivityClassPathValue() = createDefaultClassName(); - if (getSDKPath().toString().isEmpty()) - getSDKPath() = "${user.home}/SDKs/android-sdk-macosx"; + if (getSDKPathString().isEmpty()) + getSDKPathValue() = "${user.home}/SDKs/android-sdk-macosx"; - if (getNDKPath().toString().isEmpty()) - getNDKPath() = "${user.home}/SDKs/android-ndk-r7b"; + if (getNDKPathString().isEmpty()) + getNDKPathValue() = "${user.home}/SDKs/android-ndk-r7b"; - if (getMinimumSDKVersion().toString().isEmpty()) - getMinimumSDKVersion() = 8; + if (getMinimumSDKVersionString().isEmpty()) + getMinimumSDKVersionValue() = 8; - if (getInternetNeeded().toString().isEmpty()) - getInternetNeeded() = true; + if (getInternetNeededValue().toString().isEmpty()) + getInternetNeededValue() = true; } //============================================================================== @@ -92,35 +92,42 @@ public: { ProjectExporter::createPropertyEditors (props); - props.add (new TextPropertyComponent (getActivityClassPath(), "Android Activity class name", 256, false), + props.add (new TextPropertyComponent (getActivityClassPathValue(), "Android Activity class name", 256, false), "The full java class name to use for the app's Activity class."); - props.add (new TextPropertyComponent (getSDKPath(), "Android SDK Path", 1024, false), + props.add (new TextPropertyComponent (getSDKPathValue(), "Android SDK Path", 1024, false), "The path to the Android SDK folder on the target build machine"); - props.add (new TextPropertyComponent (getNDKPath(), "Android NDK Path", 1024, false), + props.add (new TextPropertyComponent (getNDKPathValue(), "Android NDK Path", 1024, false), "The path to the Android NDK folder on the target build machine"); - props.add (new TextPropertyComponent (getMinimumSDKVersion(), "Minimum SDK version", 32, false), + props.add (new TextPropertyComponent (getMinimumSDKVersionValue(), "Minimum SDK version", 32, false), "The number of the minimum version of the Android SDK that the app requires"); - props.add (new BooleanPropertyComponent (getInternetNeeded(), "Internet Access", "Specify internet access permission in the manifest"), + props.add (new BooleanPropertyComponent (getInternetNeededValue(), "Internet Access", "Specify internet access permission in the manifest"), "If enabled, this will set the android.permission.INTERNET flag in the manifest."); - props.add (new BooleanPropertyComponent (getAudioRecordNeeded(), "Audio Input Required", "Specify audio record permission in the manifest"), + props.add (new BooleanPropertyComponent (getAudioRecordNeededValue(), "Audio Input Required", "Specify audio record permission in the manifest"), "If enabled, this will set the android.permission.RECORD_AUDIO flag in the manifest."); - props.add (new TextPropertyComponent (getOtherPermissions(), "Custom permissions", 2048, false), + props.add (new TextPropertyComponent (getOtherPermissionsValue(), "Custom permissions", 2048, false), "A space-separated list of other permission flags that should be added to the manifest."); } - Value getActivityClassPath() const { return getSetting (Ids::androidActivityClass); } - Value getSDKPath() const { return getSetting (Ids::androidSDKPath); } - Value getNDKPath() const { return getSetting (Ids::androidNDKPath); } - Value getInternetNeeded() const { return getSetting (Ids::androidInternetNeeded); } - Value getAudioRecordNeeded() const { return getSetting (Ids::androidMicNeeded); } - Value getMinimumSDKVersion() const { return getSetting (Ids::androidMinimumSDK); } - Value getOtherPermissions() const { return getSetting (Ids::androidOtherPermissions); } + Value getActivityClassPathValue() { return getSetting (Ids::androidActivityClass); } + String getActivityClassPath() const { return settings [Ids::androidActivityClass]; } + Value getSDKPathValue() { return getSetting (Ids::androidSDKPath); } + String getSDKPathString() const { return settings [Ids::androidSDKPath]; } + Value getNDKPathValue() { return getSetting (Ids::androidNDKPath); } + String getNDKPathString() const { return settings [Ids::androidNDKPath]; } + Value getInternetNeededValue() { return getSetting (Ids::androidInternetNeeded); } + bool getInternetNeeded() const { return settings [Ids::androidInternetNeeded]; } + Value getAudioRecordNeededValue() { return getSetting (Ids::androidMicNeeded); } + bool getAudioRecordNeeded() const { return settings [Ids::androidMicNeeded]; } + Value getMinimumSDKVersionValue() { return getSetting (Ids::androidMinimumSDK); } + String getMinimumSDKVersionString() const { return settings [Ids::androidMinimumSDK]; } + Value getOtherPermissionsValue() { return getSetting (Ids::androidOtherPermissions); } + String getOtherPermissions() const { return settings [Ids::androidOtherPermissions]; } String createDefaultClassName() const { @@ -143,7 +150,7 @@ public: } //============================================================================== - void create (const OwnedArray& modules) + void create (const OwnedArray& modules) const { const File target (getTargetFolder()); const File jniFolder (target.getChildFile ("jni")); @@ -196,17 +203,18 @@ protected: AndroidBuildConfiguration (Project& project, const ValueTree& settings) : BuildConfiguration (project, settings) { - if (getArchitectures().toString().isEmpty()) - getArchitectures() = "armeabi armeabi-v7a"; + if (getArchitectures().isEmpty()) + getArchitecturesValue() = "armeabi armeabi-v7a"; } - Value getArchitectures() const { return getValue (Ids::androidArchitectures); } + Value getArchitecturesValue() { return getValue (Ids::androidArchitectures); } + String getArchitectures() const { return config [Ids::androidArchitectures]; } void createPropertyEditors (PropertyListBuilder& props) { createBasicPropertyEditors (props); - props.add (new TextPropertyComponent (getArchitectures(), "Architectures", 256, false), + props.add (new TextPropertyComponent (getArchitecturesValue(), "Architectures", 256, false), "A list of the ARM architectures to build (for a fat binary)."); } }; @@ -218,7 +226,7 @@ protected: private: //============================================================================== - XmlElement* createManifestXML() + XmlElement* createManifestXML() const { XmlElement* manifest = new XmlElement ("manifest"); @@ -234,7 +242,7 @@ private: //screens->setAttribute ("android:xlargeScreens", "true"); screens->setAttribute ("android:anyDensity", "true"); - manifest->createNewChildElement ("uses-sdk")->setAttribute ("android:minSdkVersion", getMinimumSDKVersion().toString()); + manifest->createNewChildElement ("uses-sdk")->setAttribute ("android:minSdkVersion", getMinimumSDKVersionString()); { const StringArray permissions (getPermissionsRequired()); @@ -268,10 +276,10 @@ private: StringArray getPermissionsRequired() const { StringArray s; - s.addTokens (getOtherPermissions().toString(), ", ", ""); + s.addTokens (getOtherPermissions(), ", ", ""); - if (getInternetNeeded().getValue()) s.add ("android.permission.INTERNET"); - if (getAudioRecordNeeded().getValue()) s.add ("android.permission.RECORD_AUDIO"); + if (getInternetNeeded()) s.add ("android.permission.INTERNET"); + if (getAudioRecordNeeded()) s.add ("android.permission.RECORD_AUDIO"); s.trim(); s.removeDuplicates (false); @@ -279,7 +287,7 @@ private: } //============================================================================== - void findAllFilesToCompile (const Project::Item& projectItem, Array& results) + void findAllFilesToCompile (const Project::Item& projectItem, Array& results) const { if (projectItem.isGroup()) { @@ -296,17 +304,17 @@ private: //============================================================================== String getActivityName() const { - return getActivityClassPath().toString().fromLastOccurrenceOf (".", false, false); + return getActivityClassPath().fromLastOccurrenceOf (".", false, false); } String getActivityClassPackage() const { - return getActivityClassPath().toString().upToLastOccurrenceOf (".", false, false); + return getActivityClassPath().upToLastOccurrenceOf (".", false, false); } String getJNIActivityClassName() const { - return getActivityClassPath().toString().replaceCharacter ('.', '/'); + return getActivityClassPath().replaceCharacter ('.', '/'); } static LibraryModule* getCoreModule (const OwnedArray& modules) @@ -318,14 +326,14 @@ private: return nullptr; } - void copyActivityJavaFiles (const OwnedArray& modules) + void copyActivityJavaFiles (const OwnedArray& modules) const { const String className (getActivityName()); const String package (getActivityClassPackage()); String path (package.replaceCharacter ('.', File::separator)); if (path.isEmpty() || className.isEmpty()) - throw SaveError ("Invalid Android Activity class name: " + getActivityClassPath().toString()); + throw SaveError ("Invalid Android Activity class name: " + getActivityClassPath()); const File classFolder (getTargetFolder().getChildFile ("src") .getChildFile (path)); @@ -350,7 +358,7 @@ private: overwriteFileIfDifferentOrThrow (javaDestFile, newFile); } - void writeApplicationMk (const File& file) + void writeApplicationMk (const File& file) const { MemoryOutputStream mo; @@ -364,7 +372,7 @@ private: overwriteFileIfDifferentOrThrow (file, mo); } - void writeAndroidMk (const File& file) + void writeAndroidMk (const File& file) const { Array files; @@ -377,7 +385,7 @@ private: overwriteFileIfDifferentOrThrow (file, mo); } - void writeAndroidMk (OutputStream& out, const Array& files) + void writeAndroidMk (OutputStream& out, const Array& files) const { out << "# Automatically generated makefile, created by the Introjucer" << newLine << "# Don't edit this file! Your changes will be overwritten when you re-save the Introjucer project!" << newLine @@ -404,16 +412,16 @@ private: << "include $(BUILD_SHARED_LIBRARY)" << newLine; } - void writeConfigSettings (OutputStream& out, bool forDebug) + void writeConfigSettings (OutputStream& out, bool forDebug) const { - for (ConfigIterator config (*this); config.next();) + for (ConstConfigIterator config (*this); config.next();) { if (config->isDebug() == forDebug) { const AndroidBuildConfiguration& androidConfig = dynamic_cast (*config); out << " LOCAL_CPPFLAGS += " << createCPPFlags (*config) << newLine - << " APP_ABI := " << androidConfig.getArchitectures().toString() << newLine + << " APP_ABI := " << androidConfig.getArchitectures() << newLine << getDynamicLibs (androidConfig); break; @@ -421,7 +429,7 @@ private: } } - String getDynamicLibs (const AndroidBuildConfiguration& config) + String getDynamicLibs (const AndroidBuildConfiguration& config) const { String flags (" LOCAL_LDLIBS :="); @@ -440,7 +448,7 @@ private: return flags + newLine; } - String createIncludePathFlags (const BuildConfiguration& config) + String createIncludePathFlags (const BuildConfiguration& config) const { String flags; StringArray searchPaths (extraSearchPaths); @@ -453,7 +461,7 @@ private: return flags; } - String createCPPFlags (const BuildConfiguration& config) + String createCPPFlags (const BuildConfiguration& config) const { StringPairArray defines; defines.set ("JUCE_ANDROID", "1"); @@ -462,7 +470,7 @@ private: String flags ("-fsigned-char -fexceptions -frtti"); - if (config.isDebug().getValue()) + if (config.isDebug()) { flags << " -g"; defines.set ("DEBUG", "1"); @@ -481,7 +489,7 @@ private: } //============================================================================== - XmlElement* createAntBuildXML() + XmlElement* createAntBuildXML() const { XmlElement* proj = new XmlElement ("project"); proj->setAttribute ("name", projectName); @@ -525,7 +533,7 @@ private: executable->createNewChildElement ("arg")->setAttribute ("value", arg); } - void writeProjectPropertiesFile (const File& file) + void writeProjectPropertiesFile (const File& file) const { MemoryOutputStream mo; mo << "# This file is used to override default values used by the Ant build system." << newLine @@ -537,20 +545,20 @@ private: overwriteFileIfDifferentOrThrow (file, mo); } - void writeLocalPropertiesFile (const File& file) + void writeLocalPropertiesFile (const File& file) const { MemoryOutputStream mo; mo << "# This file is used to override default values used by the Ant build system." << newLine << "# It is automatically generated by the Introjucer - DO NOT EDIT IT or your changes will be lost!." << newLine << newLine - << "sdk.dir=" << escapeSpaces (replacePreprocessorDefs (getAllPreprocessorDefs(), getSDKPath().toString())) << newLine - << "ndk.dir=" << escapeSpaces (replacePreprocessorDefs (getAllPreprocessorDefs(), getNDKPath().toString())) << newLine + << "sdk.dir=" << escapeSpaces (replacePreprocessorDefs (getAllPreprocessorDefs(), getSDKPathString())) << newLine + << "ndk.dir=" << escapeSpaces (replacePreprocessorDefs (getAllPreprocessorDefs(), getNDKPathString())) << newLine << newLine; overwriteFileIfDifferentOrThrow (file, mo); } - void writeIcon (const File& file, const Image& im) + void writeIcon (const File& file, const Image& im) const { if (im.isValid()) { @@ -566,7 +574,7 @@ private: } } - void writeStringsFile (const File& file) + void writeStringsFile (const File& file) const { XmlElement strings ("resources"); XmlElement* name = strings.createNewChildElement ("string"); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index 581eca2b26..e6e792eb55 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -36,8 +36,8 @@ public: MSVCProjectExporterBase (Project& project_, const ValueTree& settings_, const char* const folderName) : ProjectExporter (project_, settings_) { - if (getTargetLocation().toString().isEmpty()) - getTargetLocation() = getDefaultBuildsRootFolder() + folderName; + if (getTargetLocationString().isEmpty()) + getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName; if ((int) getLibraryType().getValue() <= 0) getLibraryType() = 1; @@ -68,12 +68,12 @@ public: protected: String projectGUID; - File rcFile, iconFile; + mutable File rcFile, iconFile; File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); } - Value getLibraryType() const { return getSetting (Ids::libraryType); } - bool isLibraryDLL() const { return msvcIsDLL || (projectType.isLibrary() && getLibraryType() == 2); } + Value getLibraryType() { return getSetting (Ids::libraryType); } + bool isLibraryDLL() const { return msvcIsDLL || (projectType.isLibrary() && (int) settings [Ids::libraryType] == 2); } void updateOldSettings() { @@ -92,7 +92,7 @@ protected: if (oldStyleLibName.isNotEmpty()) for (ConfigIterator config (*this); config.next();) - if (config->isDebug().getValue()) + if (config->isDebug()) config->getTargetBinaryName() = oldStyleLibName; } @@ -102,7 +102,7 @@ protected: if (oldStyleLibName.isNotEmpty()) for (ConfigIterator config (*this); config.next();) - if (! config->isDebug().getValue()) + if (! config->isDebug()) config->getTargetBinaryName() = oldStyleLibName; } } @@ -117,21 +117,24 @@ protected: if (getWarningLevel() == 0) getWarningLevelValue() = 4; - if (shouldGenerateManifest().getValue().isVoid()) - shouldGenerateManifest() = var (true); + if (shouldGenerateManifestValue().getValue().isVoid()) + shouldGenerateManifestValue() = var (true); } - Value getWarningLevelValue() const { return getValue (Ids::winWarningLevel); } - int getWarningLevel() const { return getWarningLevelValue().getValue(); } + Value getWarningLevelValue() { return getValue (Ids::winWarningLevel); } + int getWarningLevel() const { return config [Ids::winWarningLevel]; } - Value getPrebuildCommand() const { return getValue (Ids::prebuildCommand); } - Value getPostbuildCommand() const { return getValue (Ids::postbuildCommand); } + Value getPrebuildCommand() { return getValue (Ids::prebuildCommand); } + String getPrebuildCommandString() const { return config [Ids::prebuildCommand]; } + Value getPostbuildCommand() { return getValue (Ids::postbuildCommand); } + String getPostbuildCommandString() const { return config [Ids::postbuildCommand]; } - Value shouldGenerateManifest() const { return getValue (Ids::generateManifest); } + Value shouldGenerateManifestValue() { return getValue (Ids::generateManifest); } + bool shouldGenerateManifest() const { return config [Ids::generateManifest]; } String getOutputFilename (const String& suffix, bool forceSuffix) const { - const String target (File::createLegalFileName (getTargetBinaryName().toString().trim())); + const String target (File::createLegalFileName (getTargetBinaryNameString().trim())); if (forceSuffix || ! target.containsChar ('.')) return target.upToLastOccurrenceOf (".", false, false) + suffix; @@ -151,7 +154,7 @@ protected: props.add (new TextPropertyComponent (getPrebuildCommand(), "Pre-build Command", 2048, false)); props.add (new TextPropertyComponent (getPostbuildCommand(), "Post-build Command", 2048, false)); - props.add (new BooleanPropertyComponent (shouldGenerateManifest(), "Manifest", "Generate Manifest")); + props.add (new BooleanPropertyComponent (shouldGenerateManifestValue(), "Manifest", "Generate Manifest")); } }; @@ -168,12 +171,12 @@ protected: //============================================================================== String getIntermediatesPath (const BuildConfiguration& config) const { - return ".\\" + File::createLegalFileName (config.getName().toString().trim()); + return ".\\" + File::createLegalFileName (config.getName().trim()); } String getConfigTargetPath (const BuildConfiguration& config) const { - const String binaryPath (config.getTargetBinaryRelativePath().toString().trim()); + const String binaryPath (config.getTargetBinaryRelativePathString().trim()); if (binaryPath.isEmpty()) return getIntermediatesPath (config); @@ -192,7 +195,7 @@ protected: defines.set ("WIN32", ""); defines.set ("_WINDOWS", ""); - if (config.isDebug().getValue()) + if (config.isDebug()) { defines.set ("DEBUG", ""); defines.set ("_DEBUG", ""); @@ -229,11 +232,11 @@ protected: virtual String createConfigName (const BuildConfiguration& config) const { - return config.getName().toString() + "|Win32"; + return config.getName() + "|Win32"; } //============================================================================== - void writeSolutionFile (OutputStream& out, const String& versionString, String commentString, const File& vcProject) + void writeSolutionFile (OutputStream& out, const String& versionString, String commentString, const File& vcProject) const { if (commentString.isNotEmpty()) commentString += newLine; @@ -246,7 +249,7 @@ protected: << "Global" << newLine << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution" << newLine; - for (ConfigIterator i (*this); i.next();) + for (ConstConfigIterator i (*this); i.next();) { const String configName (createConfigName (*i)); out << "\t\t" << configName << " = " << configName << newLine; @@ -255,7 +258,7 @@ protected: out << "\tEndGlobalSection" << newLine << "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution" << newLine; - for (ConfigIterator i (*this); i.next();) + for (ConstConfigIterator i (*this); i.next();) { const String configName (createConfigName (*i)); out << "\t\t" << projectGUID << "." << configName << ".ActiveCfg = " << configName << newLine; @@ -386,7 +389,7 @@ protected: return ! projectType.isLibrary(); } - void createResourcesAndIcon() + void createResourcesAndIcon() const { if (hasResourceFile()) { @@ -413,11 +416,11 @@ protected: } } - void createRCFile() + void createRCFile() const { rcFile = getTargetFolder().getChildFile ("resources.rc"); - const String version (project.getVersion().toString()); + const String version (project.getVersionString()); MemoryOutputStream mo; @@ -512,7 +515,7 @@ public: } //============================================================================== - void create (const OwnedArray&) + void create (const OwnedArray&) const { createResourcesAndIcon(); @@ -560,7 +563,7 @@ protected: File getSLNFile() const { return getProjectFile (".sln"); } //============================================================================== - void fillInProjectXml (XmlElement& projectXml) + void fillInProjectXml (XmlElement& projectXml) const { projectXml.setAttribute ("ProjectType", "Visual C++"); projectXml.setAttribute ("Version", getProjectVersionString()); @@ -582,7 +585,7 @@ protected: } //============================================================================== - void addFile (const RelativePath& file, XmlElement& parent, const bool excludeFromBuild, const bool useStdcall) + void addFile (const RelativePath& file, XmlElement& parent, const bool excludeFromBuild, const bool useStdcall) const { jassert (file.getRoot() == RelativePath::buildTargetFolder); @@ -591,7 +594,7 @@ protected: if (excludeFromBuild || useStdcall) { - for (ConfigIterator i (*this); i.next();) + for (ConstConfigIterator i (*this); i.next();) { XmlElement* fileConfig = fileXml->createNewChildElement ("FileConfiguration"); fileConfig->setAttribute ("Name", createConfigName (*i)); @@ -607,18 +610,18 @@ protected: } } - XmlElement* createGroup (const String& groupName, XmlElement& parent) + XmlElement* createGroup (const String& groupName, XmlElement& parent) const { XmlElement* filter = parent.createNewChildElement ("Filter"); filter->setAttribute ("Name", groupName); return filter; } - void addFiles (const Project::Item& projectItem, XmlElement& parent) + void addFiles (const Project::Item& projectItem, XmlElement& parent) const { if (projectItem.isGroup()) { - XmlElement* filter = createGroup (projectItem.getName().toString(), parent); + XmlElement* filter = createGroup (projectItem.getName(), parent); for (int i = 0; i < projectItem.getNumChildren(); ++i) addFiles (projectItem.getChild(i), *filter); @@ -629,11 +632,11 @@ protected: addFile (path, parent, projectItem.shouldBeAddedToBinaryResources() || (shouldFileBeCompiledByDefault (path) && ! projectItem.shouldBeCompiled()), - shouldFileBeCompiledByDefault (path) && (bool) projectItem.getShouldUseStdCallValue().getValue()); + shouldFileBeCompiledByDefault (path) && (bool) projectItem.shouldUseStdCall()); } } - void createFiles (XmlElement& files) + void createFiles (XmlElement& files) const { for (int i = 0; i < groups.size(); ++i) if (groups.getReference(i).getNumChildren() > 0) @@ -652,7 +655,7 @@ protected: { String binariesPath (getConfigTargetPath (config)); String intermediatesPath (getIntermediatesPath (config)); - const bool isDebug = (bool) config.isDebug().getValue(); + const bool isDebug = config.isDebug(); xml.setAttribute ("Name", createConfigName (config)); xml.setAttribute ("OutputDirectory", FileHelpers::windowsStylePath (binariesPath)); @@ -667,10 +670,10 @@ protected: XmlElement* preBuildEvent = createToolElement (xml, "VCPreBuildEventTool"); - if (config.getPrebuildCommand().toString().isNotEmpty()) + if (config.getPrebuildCommandString().isNotEmpty()) { preBuildEvent->setAttribute ("Description", "Pre-build"); - preBuildEvent->setAttribute ("CommandLine", config.getPrebuildCommand().toString()); + preBuildEvent->setAttribute ("CommandLine", config.getPrebuildCommandString()); } createToolElement (xml, "VCCustomBuildTool"); @@ -692,7 +695,7 @@ protected: { XmlElement* compiler = createToolElement (xml, "VCCLCompilerTool"); - const int optimiseLevel = (int) config.getOptimisationLevel().getValue(); + const int optimiseLevel = config.getOptimisationLevelInt(); compiler->setAttribute ("Optimization", optimiseLevel <= 1 ? "0" : (optimiseLevel == 2 ? "1" : "2")); if (isDebug) @@ -720,7 +723,7 @@ protected: compiler->setAttribute ("WarningLevel", String (getWarningLevel (config))); compiler->setAttribute ("SuppressStartupBanner", "true"); - const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); + const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim()); if (extraFlags.isNotEmpty()) compiler->setAttribute ("AdditionalOptions", extraFlags); } @@ -751,7 +754,7 @@ protected: if (librarySearchPaths.size() > 0) linker->setAttribute ("AdditionalLibraryDirectories", librarySearchPaths.joinIntoString (";")); - linker->setAttribute ("GenerateManifest", config.shouldGenerateManifest().getValue() ? "true" : "false"); + linker->setAttribute ("GenerateManifest", config.shouldGenerateManifest() ? "true" : "false"); if (! isDebug) { @@ -764,10 +767,10 @@ protected: if (msvcDelayLoadedDLLs.isNotEmpty()) linker->setAttribute ("DelayLoadDLLs", msvcDelayLoadedDLLs); - if (config.getValue (Ids::msvcModuleDefinitionFile).toString().isNotEmpty()) - linker->setAttribute ("ModuleDefinitionFile", config.getValue (Ids::msvcModuleDefinitionFile).toString()); + if (config.config [Ids::msvcModuleDefinitionFile].toString().isNotEmpty()) + linker->setAttribute ("ModuleDefinitionFile", config.config [Ids::msvcModuleDefinitionFile].toString()); - String extraLinkerOptions (getExtraLinkerFlags().toString()); + String extraLinkerOptions (getExtraLinkerFlagsString()); if (extraLinkerOptions.isNotEmpty()) linker->setAttribute ("AdditionalOptions", replacePreprocessorTokens (config, extraLinkerOptions).trim()); @@ -778,7 +781,7 @@ protected: { XmlElement* linker = createToolElement (xml, "VCLinkerTool"); - String extraLinkerOptions (getExtraLinkerFlags().toString()); + String extraLinkerOptions (getExtraLinkerFlagsString()); extraLinkerOptions << " /IMPLIB:" << FileHelpers::windowsStylePath (binariesPath + "/" + config.getOutputFilename (".lib", true)); linker->setAttribute ("AdditionalOptions", replacePreprocessorTokens (config, extraLinkerOptions).trim()); @@ -812,16 +815,16 @@ protected: XmlElement* postBuildEvent = createToolElement (xml, "VCPostBuildEventTool"); - if (config.getPostbuildCommand().toString().isNotEmpty()) + if (config.getPostbuildCommandString().isNotEmpty()) { postBuildEvent->setAttribute ("Description", "Post-build"); - postBuildEvent->setAttribute ("CommandLine", config.getPostbuildCommand().toString()); + postBuildEvent->setAttribute ("CommandLine", config.getPostbuildCommandString()); } } - void createConfigs (XmlElement& xml) + void createConfigs (XmlElement& xml) const { - for (ConfigIterator config (*this); config.next();) + for (ConstConfigIterator config (*this); config.next();) createConfig (*xml.createNewChildElement ("Configuration"), dynamic_cast (*config)); } @@ -901,7 +904,7 @@ public: } //============================================================================== - void create (const OwnedArray&) + void create (const OwnedArray&) const { createResourcesAndIcon(); @@ -941,8 +944,8 @@ protected: static const char* get32BitArchName() { return "32-bit"; } static const char* get64BitArchName() { return "x64"; } - Value getArchitectureType() const { return getValue (Ids::winArchitecture); } - bool is64Bit() const { return getArchitectureType().toString() == get64BitArchName(); } + Value getArchitectureType() { return getValue (Ids::winArchitecture); } + bool is64Bit() const { return config [Ids::winArchitecture].toString() == get64BitArchName(); } //============================================================================== void createPropertyEditors (PropertyListBuilder& props) @@ -972,17 +975,17 @@ protected: String createConfigName (const BuildConfiguration& config) const { - return config.getName().toString() + (is64Bit (config) ? "|x64" - : "|Win32"); + return config.getName() + (is64Bit (config) ? "|x64" + : "|Win32"); } - void setConditionAttribute (XmlElement& xml, const BuildConfiguration& config) + void setConditionAttribute (XmlElement& xml, const BuildConfiguration& config) const { xml.setAttribute ("Condition", "'$(Configuration)|$(Platform)'=='" + createConfigName (config) + "'"); } //============================================================================== - void fillInProjectXml (XmlElement& projectXml) + void fillInProjectXml (XmlElement& projectXml) const { projectXml.setAttribute ("DefaultTargets", "Build"); projectXml.setAttribute ("ToolsVersion", "4.0"); @@ -992,11 +995,11 @@ protected: XmlElement* configsGroup = projectXml.createNewChildElement ("ItemGroup"); configsGroup->setAttribute ("Label", "ProjectConfigurations"); - for (ConfigIterator config (*this); config.next();) + for (ConstConfigIterator config (*this); config.next();) { XmlElement* e = configsGroup->createNewChildElement ("ProjectConfiguration"); e->setAttribute ("Include", createConfigName (*config)); - e->createNewChildElement ("Configuration")->addTextElement (config->getName().toString()); + e->createNewChildElement ("Configuration")->addTextElement (config->getName()); e->createNewChildElement ("Platform")->addTextElement (is64Bit (*config) ? "x64" : "Win32"); } } @@ -1012,7 +1015,7 @@ protected: imports->setAttribute ("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); } - for (ConfigIterator config (*this); config.next();) + for (ConstConfigIterator config (*this); config.next();) { XmlElement* e = projectXml.createNewChildElement ("PropertyGroup"); setConditionAttribute (*e, *config); @@ -1021,7 +1024,7 @@ protected: e->createNewChildElement ("UseOfMfc")->addTextElement ("false"); e->createNewChildElement ("CharacterSet")->addTextElement ("MultiByte"); - if (! config->isDebug().getValue()) + if (! config->isDebug()) e->createNewChildElement ("WholeProgramOptimization")->addTextElement ("true"); if (is64Bit (*config)) @@ -1056,7 +1059,7 @@ protected: XmlElement* props = projectXml.createNewChildElement ("PropertyGroup"); props->createNewChildElement ("_ProjectFileVersion")->addTextElement ("10.0.30319.1"); - for (ConfigIterator i (*this); i.next();) + for (ConstConfigIterator i (*this); i.next();) { const MSVCBuildConfiguration& config = dynamic_cast (*i); @@ -1081,7 +1084,7 @@ protected: { XmlElement* manifest = props->createNewChildElement ("GenerateManifest"); setConditionAttribute (*manifest, config); - manifest->addTextElement (config.shouldGenerateManifest().getValue() ? "true" : "false"); + manifest->addTextElement (config.shouldGenerateManifest() ? "true" : "false"); } const StringArray librarySearchPaths (config.getLibrarySearchPaths()); @@ -1095,13 +1098,13 @@ protected: } } - for (ConfigIterator i (*this); i.next();) + for (ConstConfigIterator i (*this); i.next();) { const MSVCBuildConfiguration& config = dynamic_cast (*i); String binariesPath (getConfigTargetPath (config)); String intermediatesPath (getIntermediatesPath (config)); - const bool isDebug = (bool) config.isDebug().getValue(); + const bool isDebug = config.isDebug(); XmlElement* group = projectXml.createNewChildElement ("ItemDefinitionGroup"); setConditionAttribute (*group, config); @@ -1139,7 +1142,7 @@ protected: cl->createNewChildElement ("SuppressStartupBanner")->addTextElement ("true"); cl->createNewChildElement ("MultiProcessorCompilation")->addTextElement ("true"); - const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); + const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim()); if (extraFlags.isNotEmpty()) cl->createNewChildElement ("AdditionalOptions")->addTextElement (extraFlags + " %(AdditionalOptions)"); } @@ -1171,7 +1174,7 @@ protected: link->createNewChildElement ("EnableCOMDATFolding")->addTextElement ("true"); } - String extraLinkerOptions (getExtraLinkerFlags().toString()); + String extraLinkerOptions (getExtraLinkerFlagsString()); if (extraLinkerOptions.isNotEmpty()) link->createNewChildElement ("AdditionalOptions")->addTextElement (replacePreprocessorTokens (config, extraLinkerOptions).trim() + " %(AdditionalOptions)"); @@ -1184,15 +1187,15 @@ protected: + "/" + config.getOutputFilename (".bsc", true))); } - if (config.getPrebuildCommand().toString().isNotEmpty()) + if (config.getPrebuildCommandString().isNotEmpty()) group->createNewChildElement ("PreBuildEvent") ->createNewChildElement ("Command") - ->addTextElement (config.getPrebuildCommand().toString()); + ->addTextElement (config.getPrebuildCommandString()); - if (config.getPostbuildCommand().toString().isNotEmpty()) + if (config.getPostbuildCommandString().isNotEmpty()) group->createNewChildElement ("PostBuildEvent") ->createNewChildElement ("Command") - ->addTextElement (config.getPostbuildCommand().toString()); + ->addTextElement (config.getPostbuildCommandString()); } { @@ -1240,7 +1243,7 @@ protected: } //============================================================================== - void addFileToCompile (const RelativePath& file, XmlElement& cpps, XmlElement& headers, const bool excludeFromBuild, const bool useStdcall) + void addFileToCompile (const RelativePath& file, XmlElement& cpps, XmlElement& headers, const bool excludeFromBuild, const bool useStdcall) const { jassert (file.getRoot() == RelativePath::buildTargetFolder); @@ -1263,13 +1266,13 @@ protected: } } - void addFilesToCompile (const Array& files, XmlElement& cpps, XmlElement& headers, bool useStdCall) + void addFilesToCompile (const Array& files, XmlElement& cpps, XmlElement& headers, bool useStdCall) const { for (int i = 0; i < files.size(); ++i) addFileToCompile (files.getReference(i), cpps, headers, false, useStdCall); } - void addFilesToCompile (const Project::Item& projectItem, XmlElement& cpps, XmlElement& headers, bool useStdCall) + void addFilesToCompile (const Project::Item& projectItem, XmlElement& cpps, XmlElement& headers, bool useStdCall) const { if (projectItem.isGroup()) { @@ -1289,14 +1292,14 @@ protected: } //============================================================================== - void addFilterGroup (XmlElement& groups, const String& path) + void addFilterGroup (XmlElement& groups, const String& path) const { XmlElement* e = groups.createNewChildElement ("Filter"); e->setAttribute ("Include", path); e->createNewChildElement ("UniqueIdentifier")->addTextElement (createGUID (path + "_guidpathsaltxhsdf")); } - void addFileToFilter (const RelativePath& file, const String& groupPath, XmlElement& cpps, XmlElement& headers) + void addFileToFilter (const RelativePath& file, const String& groupPath, XmlElement& cpps, XmlElement& headers) const { XmlElement* e; @@ -1310,7 +1313,7 @@ protected: e->createNewChildElement ("Filter")->addTextElement (groupPath); } - void addFilesToFilter (const Project::Item& projectItem, const String& path, XmlElement& cpps, XmlElement& headers, XmlElement& groups) + void addFilesToFilter (const Project::Item& projectItem, const String& path, XmlElement& cpps, XmlElement& headers, XmlElement& groups) const { if (projectItem.isGroup()) { @@ -1318,7 +1321,7 @@ protected: for (int i = 0; i < projectItem.getNumChildren(); ++i) addFilesToFilter (projectItem.getChild(i), - (path.isEmpty() ? String::empty : (path + "\\")) + projectItem.getChild(i).getName().toString(), + (path.isEmpty() ? String::empty : (path + "\\")) + projectItem.getChild(i).getName(), cpps, headers, groups); } else @@ -1342,7 +1345,7 @@ protected: } } - void fillInFiltersXml (XmlElement& filterXml) + void fillInFiltersXml (XmlElement& filterXml) const { filterXml.setAttribute ("ToolsVersion", "4.0"); filterXml.setAttribute ("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); @@ -1353,7 +1356,7 @@ protected: for (int i = 0; i < groups.size(); ++i) if (groups.getReference(i).getNumChildren() > 0) - addFilesToFilter (groups.getReference(i), groups.getReference(i).getName().toString(), *cpps, *headers, *groupsXml); + addFilesToFilter (groups.getReference(i), groups.getReference(i).getName(), *cpps, *headers, *groupsXml); if (iconFile.exists()) { diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h index 41aa34c9e9..c649a5fc9e 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h @@ -52,8 +52,8 @@ public: { name = getNameLinux(); - if (getTargetLocation().toString().isEmpty()) - getTargetLocation() = getDefaultBuildsRootFolder() + "Linux"; + if (getTargetLocationString().isEmpty()) + getTargetLocationValue() = getDefaultBuildsRootFolder() + "Linux"; } //============================================================================== @@ -82,7 +82,7 @@ public: } //============================================================================== - void create (const OwnedArray&) + void create (const OwnedArray&) const { Array files; for (int i = 0; i < groups.size(); ++i) @@ -102,8 +102,8 @@ protected: MakeBuildConfiguration (Project& project, const ValueTree& settings) : BuildConfiguration (project, settings) { - if (getLibrarySearchPath().getValue().isVoid()) - getLibrarySearchPath() = "/usr/X11R6/lib/"; + if (getLibrarySearchPathValue().getValue().isVoid()) + getLibrarySearchPathValue() = "/usr/X11R6/lib/"; } void createPropertyEditors (PropertyListBuilder& props) @@ -119,7 +119,7 @@ protected: private: //============================================================================== - void findAllFilesToCompile (const Project::Item& projectItem, Array& results) + void findAllFilesToCompile (const Project::Item& projectItem, Array& results) const { if (projectItem.isGroup()) { @@ -133,12 +133,12 @@ private: } } - void writeDefineFlags (OutputStream& out, const BuildConfiguration& config) + void writeDefineFlags (OutputStream& out, const BuildConfiguration& config) const { StringPairArray defines; defines.set ("LINUX", "1"); - if (config.isDebug().getValue()) + if (config.isDebug()) { defines.set ("DEBUG", "1"); defines.set ("_DEBUG", "1"); @@ -151,7 +151,7 @@ private: out << createGCCPreprocessorFlags (mergePreprocessorDefs (defines, getAllPreprocessorDefs (config))); } - void writeHeaderPathFlags (OutputStream& out, const BuildConfiguration& config) + void writeHeaderPathFlags (OutputStream& out, const BuildConfiguration& config) const { StringArray searchPaths (extraSearchPaths); searchPaths.addArray (config.getHeaderSearchPaths()); @@ -165,7 +165,7 @@ private: out << " -I " << addQuotesIfContainsSpaces (FileHelpers::unixStylePath (replacePreprocessorTokens (config, searchPaths[i]))); } - void writeCppFlags (OutputStream& out, const BuildConfiguration& config) + void writeCppFlags (OutputStream& out, const BuildConfiguration& config) const { out << " CPPFLAGS := $(DEPFLAGS)"; writeDefineFlags (out, config); @@ -173,7 +173,7 @@ private: out << newLine; } - void writeLinkerFlags (OutputStream& out, const BuildConfiguration& config) + void writeLinkerFlags (OutputStream& out, const BuildConfiguration& config) const { out << " LDFLAGS += -L$(BINDIR) -L$(LIBDIR)"; @@ -188,23 +188,23 @@ private: for (int i = 0; i < libs.size(); ++i) out << " -l" << libs[i]; - out << " " << replacePreprocessorTokens (config, getExtraLinkerFlags().toString()).trim() + out << " " << replacePreprocessorTokens (config, getExtraLinkerFlagsString()).trim() << newLine; } - void writeConfig (OutputStream& out, const BuildConfiguration& config) + void writeConfig (OutputStream& out, const BuildConfiguration& config) const { const String buildDirName ("build"); - const String intermediatesDirName (buildDirName + "/intermediate/" + config.getName().toString()); + const String intermediatesDirName (buildDirName + "/intermediate/" + config.getName()); String outputDir (buildDirName); - if (config.getTargetBinaryRelativePath().toString().isNotEmpty()) + if (config.getTargetBinaryRelativePathString().isNotEmpty()) { - RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder); + RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder); outputDir = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder).toUnixStyle(); } - out << "ifeq ($(CONFIG)," << escapeSpaces (config.getName().toString()) << ")" << newLine; + out << "ifeq ($(CONFIG)," << escapeSpaces (config.getName()) << ")" << newLine; out << " BINDIR := " << escapeSpaces (buildDirName) << newLine << " LIBDIR := " << escapeSpaces (buildDirName) << newLine << " OBJDIR := " << escapeSpaces (intermediatesDirName) << newLine @@ -214,7 +214,7 @@ private: out << " CFLAGS += $(CPPFLAGS) $(TARGET_ARCH)"; - if (config.isDebug().getValue()) + if (config.isDebug()) out << " -g -ggdb"; if (makefileIsDLL) @@ -222,7 +222,7 @@ private: out << " -O" << config.getGCCOptimisationFlag() << newLine; - out << " CXXFLAGS += $(CFLAGS) " << replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim() << newLine; + out << " CXXFLAGS += $(CFLAGS) " << replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim() << newLine; writeLinkerFlags (out, config); @@ -232,7 +232,7 @@ private: writeHeaderPathFlags (out, config); out << newLine; - String targetName (config.getTargetBinaryName().getValue().toString()); + String targetName (config.getTargetBinaryNameString()); if (projectType.isLibrary()) targetName = getLibbedFilename (targetName); @@ -249,7 +249,7 @@ private: out << "endif" << newLine << newLine; } - void writeObjects (OutputStream& out, const Array& files) + void writeObjects (OutputStream& out, const Array& files) const { out << "OBJECTS := \\" << newLine; @@ -260,14 +260,14 @@ private: out << newLine; } - void writeMakefile (OutputStream& out, const Array& files) + void writeMakefile (OutputStream& out, const Array& files) const { out << "# Automatically generated makefile, created by the Introjucer" << newLine << "# Don't edit this file! Your changes will be overwritten when you re-save the Introjucer project!" << newLine << newLine; out << "ifndef CONFIG" << newLine - << " CONFIG=" << escapeSpaces (getConfiguration(0)->getName().toString()) << newLine + << " CONFIG=" << escapeSpaces (getConfiguration(0)->getName()) << newLine << "endif" << newLine << newLine; @@ -280,7 +280,7 @@ private: << "DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)" << newLine << newLine; - for (ConfigIterator config (*this); config.next();) + for (ConstConfigIterator config (*this); config.next();) writeConfig (out, *config); writeObjects (out, files); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index bb3b4c7b36..84a7a0a434 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -59,11 +59,11 @@ public: { name = iOS ? getNameiOS() : getNameMac(); - if (getTargetLocation().toString().isEmpty()) - getTargetLocation() = getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX"); + if (getTargetLocationString().isEmpty()) + getTargetLocationValue() = getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX"); - if (getSettings() ["objCExtraSuffix"].isVoid()) - getObjCSuffix() = createAlphaNumericUID(); + if (settings ["objCExtraSuffix"].isVoid()) + getObjCSuffixValue() = createAlphaNumericUID(); } static XCodeProjectExporter* createForSettings (Project& project, const ValueTree& settings) @@ -77,9 +77,14 @@ public: } //============================================================================== - Value getObjCSuffix() { return getSetting ("objCExtraSuffix"); } - Value getPListToMerge() { return getSetting ("customPList"); } - Value getExtraFrameworks() { return getSetting (Ids::extraFrameworks); } + Value getObjCSuffixValue() { return getSetting ("objCExtraSuffix"); } + String getObjCSuffixString() const { return settings ["objCExtraSuffix"]; } + + Value getPListToMergeValue() { return getSetting ("customPList"); } + String getPListToMergeString() const { return settings ["customPList"]; } + + Value getExtraFrameworksValue() { return getSetting (Ids::extraFrameworks); } + String getExtraFrameworksString() const { return settings [Ids::extraFrameworks]; } int getLaunchPreferenceOrderForCurrentOS() { @@ -109,7 +114,7 @@ public: { ProjectExporter::createPropertyEditors (props); - props.add (new TextPropertyComponent (getObjCSuffix(), "Objective-C class name suffix", 64, false), + props.add (new TextPropertyComponent (getObjCSuffixValue(), "Objective-C class name suffix", 64, false), "Because objective-C linkage is done by string-matching, you can get horrible linkage mix-ups when different modules containing the " "same class-names are loaded simultaneously. This setting lets you provide a unique string that will be used in naming " "the obj-C classes in your executable to avoid this."); @@ -128,12 +133,12 @@ public: "Enable this to disable the status bar in your app."); } - props.add (new TextPropertyComponent (getPListToMerge(), "Custom PList", 8192, true), + props.add (new TextPropertyComponent (getPListToMergeValue(), "Custom PList", 8192, true), "You can paste the contents of an XML PList file in here, and the settings that it contains will override any " "settings that the Introjucer creates. BEWARE! When doing this, be careful to remove from the XML any " "values that you DO want the introjucer to change!"); - props.add (new TextPropertyComponent (getExtraFrameworks(), "Extra Frameworks", 2048, false), + props.add (new TextPropertyComponent (getExtraFrameworksValue(), "Extra Frameworks", 2048, false), "A comma-separated list of extra frameworks that should be added to the build. " "(Don't include the .framework extension in the name)"); } @@ -144,7 +149,7 @@ public: } //============================================================================== - void create (const OwnedArray&) + void create (const OwnedArray&) const { infoPlistFile = getTargetFolder().getChildFile ("Info.plist"); @@ -176,40 +181,44 @@ protected: { } - Value getMacSDKVersion() const { return getValue (Ids::osxSDK); } - Value getMacCompatibilityVersion() const { return getValue (Ids::osxCompatibility); } - Value getMacArchitecture() const { return getValue (Ids::osxArchitecture); } - Value getCustomXcodeFlags() const { return getValue (Ids::customXcodeFlags); } + Value getMacSDKVersionValue() { return getValue (Ids::osxSDK); } + String getMacSDKVersion() const { return config [Ids::osxSDK]; } + Value getMacCompatibilityVersionValue() { return getValue (Ids::osxCompatibility); } + String getMacCompatibilityVersion() const { return config [Ids::osxCompatibility]; } + Value getMacArchitectureValue() { return getValue (Ids::osxArchitecture); } + String getMacArchitecture() const { return config [Ids::osxArchitecture]; } + Value getCustomXcodeFlagsValue() { return getValue (Ids::customXcodeFlags); } + String getCustomXcodeFlags() const { return config [Ids::customXcodeFlags]; } void createPropertyEditors (PropertyListBuilder& props) { createBasicPropertyEditors (props); - if (getMacSDKVersion().toString().isEmpty()) - getMacSDKVersion() = osxVersionDefault; + if (getMacSDKVersion().isEmpty()) + getMacSDKVersionValue() = osxVersionDefault; const char* osxVersions[] = { "Use Default", osxVersion10_4, osxVersion10_5, osxVersion10_6, osxVersion10_7, 0 }; const char* osxVersionValues[] = { osxVersionDefault, osxVersion10_4, osxVersion10_5, osxVersion10_6, osxVersion10_7, 0 }; - props.add (new ChoicePropertyComponent (getMacSDKVersion(), "OSX Base SDK Version", StringArray (osxVersions), Array (osxVersionValues)), + props.add (new ChoicePropertyComponent (getMacSDKVersionValue(), "OSX Base SDK Version", StringArray (osxVersions), Array (osxVersionValues)), "The version of OSX to link against in the XCode build."); - if (getMacCompatibilityVersion().toString().isEmpty()) - getMacCompatibilityVersion() = osxVersionDefault; + if (getMacCompatibilityVersion().isEmpty()) + getMacCompatibilityVersionValue() = osxVersionDefault; - props.add (new ChoicePropertyComponent (getMacCompatibilityVersion(), "OSX Compatibility Version", StringArray (osxVersions), Array (osxVersionValues)), + props.add (new ChoicePropertyComponent (getMacCompatibilityVersionValue(), "OSX Compatibility Version", StringArray (osxVersions), Array (osxVersionValues)), "The minimum version of OSX that the target binary will be compatible with."); const char* osxArch[] = { "Use Default", "Native architecture of build machine", "Universal Binary (32-bit)", "Universal Binary (64-bit)", "64-bit Intel", 0 }; const char* osxArchValues[] = { osxArch_Default, osxArch_Native, osxArch_32BitUniversal, osxArch_64BitUniversal, osxArch_64Bit, 0 }; - if (getMacArchitecture().toString().isEmpty()) - getMacArchitecture() = osxArch_Default; + if (getMacArchitecture().isEmpty()) + getMacArchitectureValue() = osxArch_Default; - props.add (new ChoicePropertyComponent (getMacArchitecture(), "OSX Architecture", StringArray (osxArch), Array (osxArchValues)), + props.add (new ChoicePropertyComponent (getMacArchitectureValue(), "OSX Architecture", StringArray (osxArch), Array (osxArchValues)), "The type of OSX binary that will be produced."); - props.add (new TextPropertyComponent (getCustomXcodeFlags(), "Custom Xcode flags", 8192, false), + props.add (new TextPropertyComponent (getCustomXcodeFlagsValue(), "Custom Xcode flags", 8192, false), "A comma-separated list of custom Xcode setting flags which will be appended to the list of generated flags, " "e.g. MACOSX_DEPLOYMENT_TARGET_i386 = 10.5, VALID_ARCHS = \"ppc i386 x86_64\""); } @@ -221,10 +230,10 @@ protected: } private: - OwnedArray pbxBuildFiles, pbxFileReferences, pbxGroups, misc, projectConfigs, targetConfigs; - StringArray buildPhaseIDs, resourceIDs, sourceIDs, frameworkIDs; - StringArray frameworkFileIDs, rezFileIDs, resourceFileRefs; - File infoPlistFile, iconFile; + mutable OwnedArray pbxBuildFiles, pbxFileReferences, pbxGroups, misc, projectConfigs, targetConfigs; + mutable StringArray buildPhaseIDs, resourceIDs, sourceIDs, frameworkIDs; + mutable StringArray frameworkFileIDs, rezFileIDs, resourceFileRefs; + mutable File infoPlistFile, iconFile; const bool iOS; static String sanitisePath (const String& path) @@ -238,7 +247,7 @@ private: File getProjectBundle() const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (".xcodeproj"); } //============================================================================== - void createObjects() + void createObjects() const { addFrameworks(); addMainBuildProduct(); @@ -288,10 +297,10 @@ private: addGroup (createID ("__mainsourcegroup"), "Source", topLevelGroupIDs); } - for (ConfigIterator config (*this); config.next();) + for (ConstConfigIterator config (*this); config.next();) { - addProjectConfig (config->getName().getValue(), getProjectSettings (*config)); - addTargetConfig (config->getName().getValue(), getTargetSettings (dynamic_cast (*config))); + addProjectConfig (config->getName(), getProjectSettings (*config)); + addTargetConfig (config->getName(), getTargetSettings (dynamic_cast (*config))); } addConfigList (projectConfigs, createID ("__projList")); @@ -332,7 +341,7 @@ private: return image; } - void writeIcnsFile (const Array& images, OutputStream& out) + void writeIcnsFile (const Array& images, OutputStream& out) const { MemoryOutputStream data; @@ -395,7 +404,7 @@ private: out << data; } - void createIconFile() + void createIconFile() const { Array images; @@ -417,12 +426,12 @@ private: } } - void writeInfoPlistFile() + void writeInfoPlistFile() const { if (! xcodeCreatePList) return; - ScopedPointer plist (XmlDocument::parse (getPListToMerge().toString())); + ScopedPointer plist (XmlDocument::parse (getPListToMergeString())); if (plist == nullptr || ! plist->hasTagName ("plist")) plist = new XmlElement ("plist"); @@ -441,12 +450,12 @@ private: addPlistDictionaryKey (dict, "CFBundleName", projectName); addPlistDictionaryKey (dict, "CFBundlePackageType", xcodePackageType); addPlistDictionaryKey (dict, "CFBundleSignature", xcodeBundleSignature); - addPlistDictionaryKey (dict, "CFBundleShortVersionString", project.getVersion().toString()); - addPlistDictionaryKey (dict, "CFBundleVersion", project.getVersion().toString()); + addPlistDictionaryKey (dict, "CFBundleShortVersionString", project.getVersionString()); + addPlistDictionaryKey (dict, "CFBundleVersion", project.getVersionString()); addPlistDictionaryKey (dict, "NSHumanReadableCopyright", project.getCompanyName().toString()); StringArray documentExtensions; - documentExtensions.addTokens (replacePreprocessorDefs (getAllPreprocessorDefs(), getSetting ("documentExtensions").toString()), + documentExtensions.addTokens (replacePreprocessorDefs (getAllPreprocessorDefs(), settings ["documentExtensions"]), ",", String::empty); documentExtensions.trim(); documentExtensions.removeEmptyStrings (true); @@ -470,10 +479,10 @@ private: } } - if (getSetting ("UIFileSharingEnabled").getValue()) + if (settings ["UIFileSharingEnabled"]) addPlistDictionaryKeyBool (dict, "UIFileSharingEnabled", true); - if (getSetting ("UIStatusBarHidden").getValue()) + if (settings ["UIStatusBarHidden"]) addPlistDictionaryKeyBool (dict, "UIStatusBarHidden", true); for (int i = 0; i < xcodeExtraPListEntries.size(); ++i) @@ -485,7 +494,7 @@ private: overwriteFileIfDifferentOrThrow (infoPlistFile, mo); } - StringArray getHeaderSearchPaths (const BuildConfiguration& config) + StringArray getHeaderSearchPaths (const BuildConfiguration& config) const { StringArray searchPaths (extraSearchPaths); searchPaths.addArray (config.getHeaderSearchPaths()); @@ -506,22 +515,22 @@ private: librarySearchPaths.add (sanitisePath (searchPath)); } - void getLinkerFlags (const BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) + void getLinkerFlags (const BuildConfiguration& config, StringArray& flags, StringArray& librarySearchPaths) const { if (xcodeIsBundle) flags.add ("-bundle"); - const Array& extraLibs = config.isDebug().getValue() ? xcodeExtraLibrariesDebug - : xcodeExtraLibrariesRelease; + const Array& extraLibs = config.isDebug() ? xcodeExtraLibrariesDebug + : xcodeExtraLibrariesRelease; for (int i = 0; i < extraLibs.size(); ++i) getLinkerFlagsForStaticLibrary (extraLibs.getReference(i), flags, librarySearchPaths); - flags.add (replacePreprocessorTokens (config, getExtraLinkerFlags().toString())); + flags.add (replacePreprocessorTokens (config, getExtraLinkerFlagsString())); flags.removeEmptyStrings (true); } - StringArray getProjectSettings (const BuildConfiguration& config) + StringArray getProjectSettings (const BuildConfiguration& config) const { StringArray s; s.add ("ALWAYS_SEARCH_USER_PATHS = NO"); @@ -557,11 +566,11 @@ private: if (xcodeCanUseDwarf) s.add ("DEBUG_INFORMATION_FORMAT = \"dwarf\""); - s.add ("PRODUCT_NAME = \"" + config.getTargetBinaryName().toString() + "\""); + s.add ("PRODUCT_NAME = \"" + config.getTargetBinaryNameString() + "\""); return s; } - StringArray getTargetSettings (const XcodeBuildConfiguration& config) + StringArray getTargetSettings (const XcodeBuildConfiguration& config) const { StringArray s; @@ -573,7 +582,7 @@ private: s.add ("SRCROOT = " + srcRoot.quoted()); } - const String arch (config.getMacArchitecture().toString()); + const String arch (config.getMacArchitecture()); if (arch == osxArch_Native) s.add ("ARCHS = \"$(ARCHS_NATIVE)\""); else if (arch == osxArch_32BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_BIT)\""); else if (arch == osxArch_64BitUniversal) s.add ("ARCHS = \"$(ARCHS_STANDARD_32_64_BIT)\""); @@ -583,7 +592,7 @@ private: s.add ("GCC_OPTIMIZATION_LEVEL = " + config.getGCCOptimisationFlag()); s.add ("INFOPLIST_FILE = " + infoPlistFile.getFileName()); - const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); + const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlagsString()).trim()); if (extraFlags.isNotEmpty()) s.add ("OTHER_CPLUSPLUSFLAGS = \"" + extraFlags + "\""); @@ -602,9 +611,9 @@ private: if (projectType.isLibrary()) { - if (config.getTargetBinaryRelativePath().toString().isNotEmpty()) + if (config.getTargetBinaryRelativePathString().isNotEmpty()) { - RelativePath binaryPath (config.getTargetBinaryRelativePath().toString(), RelativePath::projectFolder); + RelativePath binaryPath (config.getTargetBinaryRelativePathString(), RelativePath::projectFolder); binaryPath = binaryPath.rebased (projectFolder, getTargetFolder(), RelativePath::buildTargetFolder); s.add ("DSTROOT = " + sanitisePath (binaryPath.toUnixStyle())); @@ -619,8 +628,8 @@ private: if (! iOS) { - const String sdk (config.getMacSDKVersion().toString()); - const String sdkCompat (config.getMacCompatibilityVersion().toString()); + const String sdk (config.getMacSDKVersion()); + const String sdkCompat (config.getMacCompatibilityVersion()); if (sdk == osxVersion10_4) { s.add ("SDKROOT = macosx10.4"); gccVersion = "4.0"; } else if (sdk == osxVersion10_5) s.add ("SDKROOT = macosx10.5"); @@ -667,7 +676,7 @@ private: StringPairArray defines; - if (config.isDebug().getValue()) + if (config.isDebug()) { defines.set ("_DEBUG", "1"); defines.set ("DEBUG", "1"); @@ -684,7 +693,7 @@ private: } { - const String objCSuffix (getObjCSuffix().toString().trim()); + const String objCSuffix (getObjCSuffixString().trim()); if (objCSuffix.isNotEmpty()) defines.set ("JUCE_ObjCExtraSuffix", replacePreprocessorTokens (config, objCSuffix)); } @@ -707,7 +716,7 @@ private: s.add ("GCC_PREPROCESSOR_DEFINITIONS = (" + indentList (defsList, ",") + ")"); } - s.addTokens (config.getCustomXcodeFlags().toString(), ",", "\"'"); + s.addTokens (config.getCustomXcodeFlags(), ",", "\"'"); s.trim(); s.removeEmptyStrings(); s.removeDuplicates (false); @@ -715,12 +724,12 @@ private: return s; } - void addFrameworks() + void addFrameworks() const { if (! projectType.isLibrary()) { StringArray s (xcodeFrameworks); - s.addTokens (getExtraFrameworks().toString(), ",;", "\"'"); + s.addTokens (getExtraFrameworksString(), ",;", "\"'"); s.trim(); s.removeDuplicates (true); @@ -732,7 +741,7 @@ private: } //============================================================================== - void writeProjectFile (OutputStream& output) + void writeProjectFile (OutputStream& output) const { output << "// !$*UTF8*$!\n{\n" "\tarchiveVersion = 1;\n" @@ -801,7 +810,7 @@ private: xml->createNewChildElement (value ? "true" : "false"); } - String addBuildFile (const String& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings) + String addBuildFile (const String& path, const String& fileRefID, bool addToSourceBuildPhase, bool inhibitWarnings) const { String fileID (createID (path + "buildref")); @@ -819,12 +828,12 @@ private: return fileID; } - String addBuildFile (const RelativePath& path, bool addToSourceBuildPhase, bool inhibitWarnings) + String addBuildFile (const RelativePath& path, bool addToSourceBuildPhase, bool inhibitWarnings) const { return addBuildFile (path.toUnixStyle(), createFileRefID (path), addToSourceBuildPhase, inhibitWarnings); } - String addFileReference (String pathString) + String addFileReference (String pathString) const { String sourceTree ("SOURCE_ROOT"); RelativePath path (pathString, RelativePath::unknown); @@ -891,7 +900,7 @@ private: return "file" + file.getFileExtension(); } - String addFile (const RelativePath& path, bool shouldBeCompiled, bool inhibitWarnings) + String addFile (const RelativePath& path, bool shouldBeCompiled, bool inhibitWarnings) const { const String pathAsString (path.toUnixStyle()); const String refID (addFileReference (path.toUnixStyle())); @@ -907,7 +916,7 @@ private: return refID; } - String addProjectItem (const Project::Item& projectItem) + String addProjectItem (const Project::Item& projectItem) const { if (projectItem.isGroup()) { @@ -927,7 +936,7 @@ private: if (projectItem.shouldBeAddedToTargetProject()) { String itemPath (projectItem.getFilePath()); - bool inhibitWarnings = projectItem.getShouldInhibitWarningsValue().getValue(); + bool inhibitWarnings = projectItem.shouldInhibitWarnings(); if (itemPath.startsWith ("${")) { @@ -945,7 +954,7 @@ private: return String::empty; } - void addFramework (const String& frameworkName) + void addFramework (const String& frameworkName) const { const String path ("System/Library/Frameworks/" + frameworkName + ".framework"); const String fileRefID (createFileRefID (path)); @@ -954,7 +963,7 @@ private: frameworkFileIDs.add (fileRefID); } - void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) + void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) const { ValueTree* v = new ValueTree (groupID); v->setProperty ("isa", "PBXGroup", 0); @@ -964,15 +973,15 @@ private: pbxGroups.add (v); } - String addGroup (const Project::Item& item, StringArray& childIDs) + String addGroup (const Project::Item& item, StringArray& childIDs) const { - const String groupName (item.getName().toString()); + const String groupName (item.getName()); const String groupID (getIDForGroup (item)); addGroup (groupID, groupName, childIDs); return groupID; } - void addMainBuildProduct() + void addMainBuildProduct() const { jassert (xcodeFileType.isNotEmpty()); jassert (xcodeBundleExtension.isEmpty() || xcodeBundleExtension.startsWithChar('.')); @@ -986,7 +995,7 @@ private: addBuildProduct (xcodeFileType, productName); } - void addBuildProduct (const String& fileType, const String& binaryName) + void addBuildProduct (const String& fileType, const String& binaryName) const { ValueTree* v = new ValueTree (createID ("__productFileID")); v->setProperty ("isa", "PBXFileReference", 0); @@ -997,7 +1006,7 @@ private: pbxFileReferences.add (v); } - void addTargetConfig (const String& configName, const StringArray& buildSettings) + void addTargetConfig (const String& configName, const StringArray& buildSettings) const { ValueTree* v = new ValueTree (createID ("targetconfigid_" + configName)); v->setProperty ("isa", "XCBuildConfiguration", 0); @@ -1006,7 +1015,7 @@ private: targetConfigs.add (v); } - void addProjectConfig (const String& configName, const StringArray& buildSettings) + void addProjectConfig (const String& configName, const StringArray& buildSettings) const { ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName)); v->setProperty ("isa", "XCBuildConfiguration", 0); @@ -1015,7 +1024,7 @@ private: projectConfigs.add (v); } - void addConfigList (const OwnedArray & configsToUse, const String& listID) + void addConfigList (const OwnedArray & configsToUse, const String& listID) const { StringArray configIDs; @@ -1033,7 +1042,7 @@ private: misc.add (v); } - ValueTree* addBuildPhase (const String& phaseType, const StringArray& fileIds) + ValueTree* addBuildPhase (const String& phaseType, const StringArray& fileIds) const { String phaseId (createID (phaseType + "resbuildphase")); buildPhaseIDs.add (phaseId); @@ -1047,7 +1056,7 @@ private: return v; } - void addTargetObject() + void addTargetObject() const { ValueTree* const v = new ValueTree (createID ("__target")); v->setProperty ("isa", "PBXNativeTarget", 0); @@ -1068,7 +1077,7 @@ private: misc.add (v); } - void addProjectObject() + void addProjectObject() const { ValueTree* const v = new ValueTree (createID ("__root")); v->setProperty ("isa", "PBXProject", 0); @@ -1082,7 +1091,7 @@ private: misc.add (v); } - void addShellScriptPhase() + void addShellScriptPhase() const { if (xcodeShellScript.isNotEmpty()) { diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp index 3409c0b517..cc6ad425a6 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp @@ -79,9 +79,9 @@ ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int File target (exp->getTargetFolder()); if (FileHelpers::shouldPathsBeRelative (juceFolder.getFullPathName(), project.getFile().getFullPathName())) - exp->getJuceFolder() = juceFolder.getRelativePathFrom (project.getFile().getParentDirectory()); + exp->getJuceFolderValue() = juceFolder.getRelativePathFrom (project.getFile().getParentDirectory()); else - exp->getJuceFolder() = juceFolder.getFullPathName(); + exp->getJuceFolderValue() = juceFolder.getFullPathName(); exp->createDefaultConfigs(); @@ -150,12 +150,12 @@ ProjectExporter::~ProjectExporter() File ProjectExporter::getTargetFolder() const { - return project.resolveFilename (getTargetLocation().toString()); + return project.resolveFilename (getTargetLocationString()); } String ProjectExporter::getIncludePathForFileInJuceFolder (const String& pathFromJuceFolder, const File& targetIncludeFile) const { - String juceFolderPath (getJuceFolder().toString()); + String juceFolderPath (getJuceFolderString()); if (juceFolderPath.startsWithChar ('<')) { @@ -177,7 +177,7 @@ String ProjectExporter::getIncludePathForFileInJuceFolder (const String& pathFro RelativePath ProjectExporter::getJucePathFromProjectFolder() const { - return RelativePath (getJuceFolder().toString(), RelativePath::projectFolder); + return RelativePath (getJuceFolderString(), RelativePath::projectFolder); } RelativePath ProjectExporter::getJucePathFromTargetFolder() const @@ -197,10 +197,10 @@ bool ProjectExporter::shouldFileBeCompiledByDefault (const RelativePath& file) c void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) { - props.add (new TextPropertyComponent (getTargetLocation(), "Target Project Folder", 1024, false), + props.add (new TextPropertyComponent (getTargetLocationValue(), "Target Project Folder", 1024, false), "The location of the folder in which the " + name + " project will be created. This path can be absolute, but it's much more sensible to make it relative to the jucer project directory."); - props.add (new TextPropertyComponent (getJuceFolder(), "Local JUCE folder", 1024, false), + props.add (new TextPropertyComponent (getJuceFolderValue(), "Local JUCE folder", 1024, false), "The location of the Juce library folder that the " + name + " project will use to when compiling. This can be an absolute path, or relative to the jucer project folder, but it must be valid on the filesystem of the machine you use to actually do the compiling."); OwnedArray modules; @@ -232,7 +232,7 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) for (int i = 0; i < images.size(); ++i) { - choices.add (images.getUnchecked(i)->getName().toString()); + choices.add (images.getUnchecked(i)->getName()); ids.add (images.getUnchecked(i)->getID()); } @@ -247,7 +247,7 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) StringPairArray ProjectExporter::getAllPreprocessorDefs (const ProjectExporter::BuildConfiguration& config) const { StringPairArray defs (mergePreprocessorDefs (config.getAllPreprocessorDefs(), - parsePreprocessorDefs (getExporterPreprocessorDefs().toString()))); + parsePreprocessorDefs (getExporterPreprocessorDefsString()))); defs.set (getExporterIdentifierMacro(), "1"); return defs; } @@ -255,7 +255,7 @@ StringPairArray ProjectExporter::getAllPreprocessorDefs (const ProjectExporter:: StringPairArray ProjectExporter::getAllPreprocessorDefs() const { StringPairArray defs (mergePreprocessorDefs (project.getPreprocessorDefs(), - parsePreprocessorDefs (getExporterPreprocessorDefs().toString()))); + parsePreprocessorDefs (getExporterPreprocessorDefsString()))); defs.set (getExporterIdentifierMacro(), "1"); return defs; } @@ -369,23 +369,23 @@ void ProjectExporter::createDefaultConfigs() const bool debugConfig = i == 0; config->getName() = debugConfig ? "Debug" : "Release"; - config->isDebug() = debugConfig; + config->isDebugValue() = debugConfig; config->getOptimisationLevel() = debugConfig ? 1 : 2; config->getTargetBinaryName() = project.getProjectFilenameRoot(); } } -Image ProjectExporter::getBigIcon() +Image ProjectExporter::getBigIcon() const { - return project.getMainGroup().findItemWithID (getBigIconImageItemID().toString()).loadAsImageFile(); + return project.getMainGroup().findItemWithID (settings [Ids::bigIcon]).loadAsImageFile(); } -Image ProjectExporter::getSmallIcon() +Image ProjectExporter::getSmallIcon() const { - return project.getMainGroup().findItemWithID (getSmallIconImageItemID().toString()).loadAsImageFile(); + return project.getMainGroup().findItemWithID (settings [Ids::smallIcon]).loadAsImageFile(); } -Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) +Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBigEnough) const { Image im; @@ -436,6 +436,20 @@ bool ProjectExporter::ConfigIterator::next() return true; } +ProjectExporter::ConstConfigIterator::ConstConfigIterator (const ProjectExporter& exporter_) + : index (-1), exporter (exporter_) +{ +} + +bool ProjectExporter::ConstConfigIterator::next() +{ + if (++index >= exporter.getNumConfigurations()) + return false; + + config = exporter.getConfiguration (index); + return true; +} + //============================================================================== ProjectExporter::BuildConfiguration::BuildConfiguration (Project& project_, const ValueTree& configNode) : config (configNode), project (project_) @@ -448,16 +462,16 @@ ProjectExporter::BuildConfiguration::~BuildConfiguration() String ProjectExporter::BuildConfiguration::getGCCOptimisationFlag() const { - const int level = (int) getOptimisationLevel().getValue(); + const int level = getOptimisationLevelInt(); return String (level <= 1 ? "0" : (level == 2 ? "s" : "3")); } void ProjectExporter::BuildConfiguration::createBasicPropertyEditors (PropertyListBuilder& props) { - props.add (new TextPropertyComponent (getName(), "Name", 96, false), + props.add (new TextPropertyComponent (getNameValue(), "Name", 96, false), "The name of this configuration."); - props.add (new BooleanPropertyComponent (isDebug(), "Debug mode", "Debugging enabled"), + props.add (new BooleanPropertyComponent (isDebugValue(), "Debug mode", "Debugging enabled"), "If enabled, this means that the configuration should be built with debug synbols."); const char* optimisationLevels[] = { "No optimisation", "Optimise for size and speed", "Optimise for maximum speed", 0 }; @@ -474,10 +488,10 @@ void ProjectExporter::BuildConfiguration::createBasicPropertyEditors (PropertyLi "The folder in which the finished binary should be placed. Leave this blank to cause the binary to be placed " "in its default location in the build folder."); - props.add (new TextPropertyComponent (getHeaderSearchPath(), "Header search paths", 16384, false), + props.add (new TextPropertyComponent (getHeaderSearchPathValue(), "Header search paths", 16384, false), "Extra header search paths. Use semi-colons to separate multiple paths."); - props.add (new TextPropertyComponent (getLibrarySearchPath(), "Extra library search paths", 16384, false), + props.add (new TextPropertyComponent (getLibrarySearchPathValue(), "Extra library search paths", 16384, false), "Extra library search paths. Use semi-colons to separate multiple paths."); props.add (new TextPropertyComponent (getBuildConfigPreprocessorDefs(), "Preprocessor definitions", 32768, false), @@ -490,13 +504,13 @@ void ProjectExporter::BuildConfiguration::createBasicPropertyEditors (PropertyLi StringPairArray ProjectExporter::BuildConfiguration::getAllPreprocessorDefs() const { return mergePreprocessorDefs (project.getPreprocessorDefs(), - parsePreprocessorDefs (getBuildConfigPreprocessorDefs().toString())); + parsePreprocessorDefs (getBuildConfigPreprocessorDefsString())); } StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const { StringArray s; - s.addTokens (getHeaderSearchPath().toString(), ";", String::empty); + s.addTokens (getHeaderSearchPathString(), ";", String::empty); s.trim(); s.removeEmptyStrings(); s.removeDuplicates (false); @@ -506,7 +520,7 @@ StringArray ProjectExporter::BuildConfiguration::getHeaderSearchPaths() const StringArray ProjectExporter::BuildConfiguration::getLibrarySearchPaths() const { StringArray s; - s.addTokens (getLibrarySearchPath().toString(), ";", String::empty); + s.addTokens (getLibrarySearchPathString(), ";", String::empty); s.trim(); s.removeEmptyStrings(); s.removeDuplicates (false); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h index 0486571be0..4bb17b2155 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.h @@ -55,7 +55,7 @@ public: virtual bool usesMMFiles() const = 0; virtual void createPropertyEditors (PropertyListBuilder&); virtual void launchProject() = 0; - virtual void create (const OwnedArray&) = 0; // may throw a SaveError + virtual void create (const OwnedArray&) const = 0; // may throw a SaveError virtual bool shouldFileBeCompiledByDefault (const RelativePath& path) const; virtual bool canCopeWithDuplicateFiles() = 0; @@ -71,14 +71,19 @@ public: Project& getProject() noexcept { return project; } const Project& getProject() const noexcept { return project; } - const ValueTree& getSettings() const { return settings; } - Value getSetting (const Identifier& name_) const { return settings.getPropertyAsValue (name_, project.getUndoManagerFor (settings)); } + Value getSetting (const Identifier& name_) { return settings.getPropertyAsValue (name_, project.getUndoManagerFor (settings)); } - Value getJuceFolder() const { return getSetting (Ids::juceFolder); } - Value getTargetLocation() const { return getSetting (Ids::targetFolder); } + Value getJuceFolderValue() { return getSetting (Ids::juceFolder); } + String getJuceFolderString() const { return settings [Ids::juceFolder]; } - Value getExtraCompilerFlags() const { return getSetting (Ids::extraCompilerFlags); } - Value getExtraLinkerFlags() const { return getSetting (Ids::extraLinkerFlags); } + Value getTargetLocationValue() { return getSetting (Ids::targetFolder); } + String getTargetLocationString() const { return settings [Ids::targetFolder]; } + + Value getExtraCompilerFlags() { return getSetting (Ids::extraCompilerFlags); } + String getExtraCompilerFlagsString() const { return settings [Ids::extraCompilerFlags]; } + + Value getExtraLinkerFlags() { return getSetting (Ids::extraLinkerFlags); } + String getExtraLinkerFlagsString() const { return settings [Ids::extraLinkerFlags]; } // This adds the quotes, and may return angle-brackets, eg: or normal quotes. String getIncludePathForFileInJuceFolder (const String& pathFromJuceFolder, const File& targetIncludeFile) const; @@ -86,11 +91,11 @@ public: RelativePath rebaseFromProjectFolderToBuildTarget (const RelativePath& path) const; void addToExtraSearchPaths (const RelativePath& pathFromProjectFolder); - Value getBigIconImageItemID() const { return getSetting (Ids::bigIcon); } - Value getSmallIconImageItemID() const { return getSetting (Ids::smallIcon); } - Image getBigIcon(); - Image getSmallIcon(); - Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough); + Value getBigIconImageItemID() { return getSetting (Ids::bigIcon); } + Value getSmallIconImageItemID() { return getSetting (Ids::smallIcon); } + Image getBigIcon() const; + Image getSmallIcon() const; + Image getBestIconForSize (int size, bool returnNullIfNothingBigEnough) const; String getExporterIdentifierMacro() const { @@ -155,22 +160,37 @@ public: virtual void createPropertyEditors (PropertyListBuilder&) = 0; //============================================================================== - Value getName() const { return getValue (Ids::name); } - Value isDebug() const { return getValue (Ids::isDebug); } - Value getTargetBinaryName() const { return getValue (Ids::targetName); } + Value getNameValue() { return getValue (Ids::name); } + String getName() const { return config [Ids::name]; } + + Value isDebugValue() { return getValue (Ids::isDebug); } + bool isDebug() const { return config [Ids::isDebug]; } + + Value getTargetBinaryName() { return getValue (Ids::targetName); } + String getTargetBinaryNameString() const { return config [Ids::targetName]; } + // the path relative to the build folder in which the binary should go - Value getTargetBinaryRelativePath() const { return getValue (Ids::binaryPath); } - Value getOptimisationLevel() const { return getValue (Ids::optimisation); } + Value getTargetBinaryRelativePath() { return getValue (Ids::binaryPath); } + String getTargetBinaryRelativePathString() const { return config [Ids::binaryPath]; } + + Value getOptimisationLevel() { return getValue (Ids::optimisation); } + int getOptimisationLevelInt() const { return config [Ids::optimisation]; } String getGCCOptimisationFlag() const; - Value getBuildConfigPreprocessorDefs() const { return getValue (Ids::defines); } + + Value getBuildConfigPreprocessorDefs() { return getValue (Ids::defines); } + String getBuildConfigPreprocessorDefsString() const { return config [Ids::defines]; } StringPairArray getAllPreprocessorDefs() const; // includes inherited definitions - Value getHeaderSearchPath() const { return getValue (Ids::headerPath); } + + Value getHeaderSearchPathValue() { return getValue (Ids::headerPath); } + String getHeaderSearchPathString() const { return config [Ids::headerPath]; } StringArray getHeaderSearchPaths() const; - Value getLibrarySearchPath() const { return getValue (Ids::libraryPath); } + + Value getLibrarySearchPathValue() { return getValue (Ids::libraryPath); } + String getLibrarySearchPathString() const { return config [Ids::libraryPath]; } StringArray getLibrarySearchPaths() const; String getGCCLibraryPathFlags() const; - Value getValue (const Identifier& name) const { return config.getPropertyAsValue (name, getUndoManager()); } + Value getValue (const Identifier& name) { return config.getPropertyAsValue (name, getUndoManager()); } UndoManager* getUndoManager() const { return project.getUndoManagerFor (config); } //============================================================================== @@ -207,6 +227,23 @@ public: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConfigIterator); }; + struct ConstConfigIterator + { + ConstConfigIterator (const ProjectExporter& exporter); + + bool next(); + + const BuildConfiguration& operator*() const { return *config; } + const BuildConfiguration* operator->() const { return config; } + + BuildConfiguration::Ptr config; + int index; + + private: + const ProjectExporter& exporter; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConstConfigIterator); + }; + int getNumConfigurations() const; BuildConfiguration::Ptr getConfiguration (int index) const; @@ -216,7 +253,8 @@ public: static const Identifier configurations, configuration; //============================================================================== - Value getExporterPreprocessorDefs() const { return getSetting (Ids::extraDefs); } + Value getExporterPreprocessorDefs() { return getSetting (Ids::extraDefs); } + String getExporterPreprocessorDefsString() const { return settings [Ids::extraDefs]; } // includes exporter, project + config defs StringPairArray getAllPreprocessorDefs (const BuildConfiguration& config) const; diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h index a46130214d..4cd74d8ad5 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h @@ -154,6 +154,7 @@ private: Project::Item generatedFilesGroup; String extraAppConfigContent; StringArray errors; + CriticalSection errorLock; File appConfigFile, binaryDataCpp; @@ -340,7 +341,7 @@ private: << "namespace ProjectInfo" << newLine << "{" << newLine << " const char* const projectName = " << CodeHelpers::addEscapeChars (project.getProjectName().toString()).quoted() << ";" << newLine - << " const char* const versionString = " << CodeHelpers::addEscapeChars (project.getVersion().toString()).quoted() << ";" << newLine + << " const char* const versionString = " << CodeHelpers::addEscapeChars (project.getVersionString()).quoted() << ";" << newLine << " const int versionNumber = " << project.getVersionAsHex() << ";" << newLine << "}" << newLine << newLine @@ -408,15 +409,21 @@ private: sortGroupRecursively (group.getChild(i)); } + void addError (const String& message) + { + const ScopedLock sl (errorLock); + errors.add (message); + } + void writeProjects (const OwnedArray& modules) { // keep a copy of the basic generated files group, as each exporter may modify it. const ValueTree originalGeneratedGroup (generatedFilesGroup.state.createCopy()); + ThreadPool threadPool (4, false, 30000); + for (Project::ExporterIterator exporter (project); exporter.next();) { - std::cout << "Writing files for: " << exporter->getName() << std::endl; - if (exporter->getTargetFolder().createDirectory()) { exporter->addToExtraSearchPaths (RelativePath ("JuceLibraryCode", RelativePath::projectFolder)); @@ -430,22 +437,52 @@ private: sortGroupRecursively (generatedFilesGroup); exporter->groups.add (generatedFilesGroup); - try - { - exporter->create (modules); - } - catch (ProjectExporter::SaveError& error) - { - errors.add (error.message); - } + threadPool.addJob (new ExporterJob (*this, exporter.exporter.release(), modules)); } else { - errors.add ("Can't create folder: " + exporter->getTargetFolder().getFullPathName()); + addError ("Can't create folder: " + exporter->getTargetFolder().getFullPathName()); } } + + while (threadPool.getNumJobs() > 0) + Thread::sleep (10); } + class ExporterJob : public ThreadPoolJob + { + public: + ExporterJob (ProjectSaver& owner_, ProjectExporter* exporter_, + const OwnedArray& modules_) + : ThreadPoolJob ("export"), + owner (owner_), exporter (exporter_), modules (modules_) + { + } + + JobStatus runJob() + { + try + { + exporter->create (modules); + std::cout << "Finished saving: " << exporter->getName() << std::endl; + } + catch (ProjectExporter::SaveError& error) + { + owner.addError (error.message); + } + + return jobHasFinishedAndShouldBeDeleted; + } + + private: + ProjectSaver& owner; + ScopedPointer exporter; + const OwnedArray& modules; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ExporterJob); + }; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProjectSaver); }; diff --git a/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h b/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h index a4f5473d6b..a352f49b3f 100644 --- a/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h +++ b/extras/Introjucer/Source/Project/jucer_AudioPluginModule.h @@ -30,27 +30,27 @@ //============================================================================== namespace { - Value shouldBuildVST (const Project& project) { return project.getProjectValue ("buildVST"); } - Value shouldBuildRTAS (const Project& project) { return project.getProjectValue ("buildRTAS"); } - Value shouldBuildAU (const Project& project) { return project.getProjectValue ("buildAU"); } + Value shouldBuildVST (Project& project) { return project.getProjectValue ("buildVST"); } + Value shouldBuildRTAS (Project& project) { return project.getProjectValue ("buildRTAS"); } + Value shouldBuildAU (Project& project) { return project.getProjectValue ("buildAU"); } - Value getPluginName (const Project& project) { return project.getProjectValue ("pluginName"); } - Value getPluginDesc (const Project& project) { return project.getProjectValue ("pluginDesc"); } - Value getPluginManufacturer (const Project& project) { return project.getProjectValue ("pluginManufacturer"); } - Value getPluginManufacturerCode (const Project& project) { return project.getProjectValue ("pluginManufacturerCode"); } - Value getPluginCode (const Project& project) { return project.getProjectValue ("pluginCode"); } - Value getPluginChannelConfigs (const Project& project) { return project.getProjectValue ("pluginChannelConfigs"); } - Value getPluginIsSynth (const Project& project) { return project.getProjectValue ("pluginIsSynth"); } - Value getPluginWantsMidiInput (const Project& project) { return project.getProjectValue ("pluginWantsMidiIn"); } - Value getPluginProducesMidiOut (const Project& project) { return project.getProjectValue ("pluginProducesMidiOut"); } - Value getPluginSilenceInProducesSilenceOut (const Project& project) { return project.getProjectValue ("pluginSilenceInIsSilenceOut"); } - Value getPluginTailLengthSeconds (const Project& project) { return project.getProjectValue ("pluginTailLength"); } - Value getPluginEditorNeedsKeyFocus (const Project& project) { return project.getProjectValue ("pluginEditorRequiresKeys"); } - Value getPluginAUExportPrefix (const Project& project) { return project.getProjectValue ("pluginAUExportPrefix"); } - Value getPluginAUCocoaViewClassName (const Project& project) { return project.getProjectValue ("pluginAUViewClass"); } - Value getPluginRTASCategory (const Project& project) { return project.getProjectValue ("pluginRTASCategory"); } + Value getPluginName (Project& project) { return project.getProjectValue ("pluginName"); } + Value getPluginDesc (Project& project) { return project.getProjectValue ("pluginDesc"); } + Value getPluginManufacturer (Project& project) { return project.getProjectValue ("pluginManufacturer"); } + Value getPluginManufacturerCode (Project& project) { return project.getProjectValue ("pluginManufacturerCode"); } + Value getPluginCode (Project& project) { return project.getProjectValue ("pluginCode"); } + Value getPluginChannelConfigs (Project& project) { return project.getProjectValue ("pluginChannelConfigs"); } + Value getPluginIsSynth (Project& project) { return project.getProjectValue ("pluginIsSynth"); } + Value getPluginWantsMidiInput (Project& project) { return project.getProjectValue ("pluginWantsMidiIn"); } + Value getPluginProducesMidiOut (Project& project) { return project.getProjectValue ("pluginProducesMidiOut"); } + Value getPluginSilenceInProducesSilenceOut (Project& project) { return project.getProjectValue ("pluginSilenceInIsSilenceOut"); } + Value getPluginTailLengthSeconds (Project& project) { return project.getProjectValue ("pluginTailLength"); } + Value getPluginEditorNeedsKeyFocus (Project& project) { return project.getProjectValue ("pluginEditorRequiresKeys"); } + Value getPluginAUExportPrefix (Project& project) { return project.getProjectValue ("pluginAUExportPrefix"); } + Value getPluginAUCocoaViewClassName (Project& project) { return project.getProjectValue ("pluginAUViewClass"); } + Value getPluginRTASCategory (Project& project) { return project.getProjectValue ("pluginRTASCategory"); } - String getPluginRTASCategoryCode (const Project& project) + String getPluginRTASCategoryCode (Project& project) { if (static_cast (getPluginIsSynth (project).getValue())) return "ePlugInCategory_SWGenerators"; @@ -105,7 +105,7 @@ namespace flags.set ("JucePlugin_TailLengthSeconds", String (static_cast (getPluginTailLengthSeconds (project).getValue()))); flags.set ("JucePlugin_EditorRequiresKeyboardFocus", valueToBool (getPluginEditorNeedsKeyFocus (project))); flags.set ("JucePlugin_VersionCode", project.getVersionAsHex()); - flags.set ("JucePlugin_VersionString", project.getVersion().toString().quoted()); + flags.set ("JucePlugin_VersionString", project.getVersionString().quoted()); flags.set ("JucePlugin_VSTUniqueID", "JucePlugin_PluginCode"); flags.set ("JucePlugin_VSTCategory", static_cast (getPluginIsSynth (project).getValue()) ? "kPlugCategSynth" : "kPlugCategEffect"); flags.set ("JucePlugin_AUMainType", static_cast (getPluginIsSynth (project).getValue()) ? "kAudioUnitType_MusicDevice" : "kAudioUnitType_Effect"); @@ -140,9 +140,9 @@ namespace //============================================================================== namespace VSTHelpers { - static Value getVSTFolder (const ProjectExporter& exporter) { return exporter.getSetting (Ids::vstFolder); } + static Value getVSTFolder (ProjectExporter& exporter) { return exporter.getSetting (Ids::vstFolder); } - static void addVSTFolderToPath (const ProjectExporter& exporter, StringArray& searchPaths) + static void addVSTFolderToPath (ProjectExporter& exporter, StringArray& searchPaths) { const String vstFolder (getVSTFolder (exporter).toString()); @@ -157,13 +157,13 @@ namespace VSTHelpers } } - static void createVSTPathEditor (const ProjectExporter& exporter, PropertyListBuilder& props) + static void createVSTPathEditor (ProjectExporter& exporter, PropertyListBuilder& props) { props.add (new TextPropertyComponent (getVSTFolder (exporter), "VST Folder", 1024, false), "If you're building a VST, this must be the folder containing the VST SDK. This should be an absolute path."); } - static void fixMissingVSTValues (const ProjectExporter& exporter) + static void fixMissingVSTValues (ProjectExporter& exporter) { if (getVSTFolder(exporter).toString().isEmpty()) getVSTFolder(exporter) = (exporter.isVisualStudio() ? "c:\\SDKs\\vstsdk2.4" @@ -191,7 +191,7 @@ namespace VSTHelpers exporter.extraSearchPaths.add (juceWrapperFolder.toUnixStyle()); } - static void createPropertyEditors (const ProjectExporter& exporter, PropertyListBuilder& props) + static void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props) { fixMissingVSTValues (exporter); createVSTPathEditor (exporter, props); @@ -201,9 +201,9 @@ namespace VSTHelpers //============================================================================== namespace RTASHelpers { - static Value getRTASFolder (const ProjectExporter& exporter) { return exporter.getSetting (Ids::rtasFolder); } + static Value getRTASFolder (ProjectExporter& exporter) { return exporter.getSetting (Ids::rtasFolder); } - static void fixMissingRTASValues (const ProjectExporter& exporter) + static void fixMissingRTASValues (ProjectExporter& exporter) { if (getRTASFolder (exporter).toString().isEmpty()) { @@ -331,7 +331,7 @@ namespace RTASHelpers addExtraSearchPaths (exporter); } - static void createPropertyEditors (const ProjectExporter& exporter, PropertyListBuilder& props) + static void createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props) { if (exporter.isXcode() || exporter.isVisualStudio()) { diff --git a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp index e9a90f7601..efa3af9f84 100644 --- a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp @@ -114,7 +114,7 @@ public: const int x2 = compileButton.isVisible() ? compileButton.getX() - 4 : getWidth() - 4; - g.drawText (item.getName().toString(), x, 0, x2 - x, getHeight(), Justification::centredLeft, true); + g.drawText (item.getName(), x, 0, x2 - x, getHeight(), Justification::centredLeft, true); g.setColour (Colours::lightgrey); g.fillRect (0, getHeight() - 1, getWidth(), 1); diff --git a/extras/Introjucer/Source/Project/jucer_Module.cpp b/extras/Introjucer/Source/Project/jucer_Module.cpp index 08594747b6..4dd6c3521f 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.cpp +++ b/extras/Introjucer/Source/Project/jucer_Module.cpp @@ -106,7 +106,7 @@ File ModuleList::getDefaultModulesFolder (Project* project) if (exp != nullptr) { - File f (project->resolveFilename (exp->getJuceFolder().toString())); + File f (project->resolveFilename (exp->getJuceFolderString())); f = getModulesFolderForJuceOrModulesFolder (f); if (ModuleList::isModulesFolder (f)) @@ -375,7 +375,7 @@ File LibraryModule::getInclude (const File& folder) const RelativePath LibraryModule::getModuleRelativeToProject (ProjectExporter& exporter) const { - RelativePath p (exporter.getJuceFolder().toString(), RelativePath::projectFolder); + RelativePath p (exporter.getJuceFolderString(), RelativePath::projectFolder); if (p.getFileName() != "modules") p = p.getChildFile ("modules"); @@ -512,7 +512,7 @@ void LibraryModule::prepareExporter (ProjectExporter& exporter, ProjectSaver& pr } } -void LibraryModule::createPropertyEditors (const ProjectExporter& exporter, PropertyListBuilder& props) const +void LibraryModule::createPropertyEditors (ProjectExporter& exporter, PropertyListBuilder& props) const { if (isVSTPluginHost (exporter.getProject())) VSTHelpers::createVSTPathEditor (exporter, props); diff --git a/extras/Introjucer/Source/Project/jucer_Module.h b/extras/Introjucer/Source/Project/jucer_Module.h index c8170b83ea..909a627ec6 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.h +++ b/extras/Introjucer/Source/Project/jucer_Module.h @@ -48,7 +48,7 @@ public: void writeIncludes (ProjectSaver&, OutputStream&); void prepareExporter (ProjectExporter&, ProjectSaver&) const; - void createPropertyEditors (const ProjectExporter&, PropertyListBuilder&) const; + void createPropertyEditors (ProjectExporter&, PropertyListBuilder&) const; void getConfigFlags (Project&, OwnedArray& flags) const; static String getInfoFileName() { return "juce_module_info"; } diff --git a/extras/Introjucer/Source/Project/jucer_Project.cpp b/extras/Introjucer/Source/Project/jucer_Project.cpp index 8fad704f57..e1a6f3ba53 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.cpp +++ b/extras/Introjucer/Source/Project/jucer_Project.cpp @@ -74,7 +74,7 @@ Project::~Project() void Project::setTitle (const String& newTitle) { projectRoot.setProperty (Ids::name, newTitle, getUndoManagerFor (projectRoot)); - getMainGroup().getName() = newTitle; + getMainGroup().getNameValue() = newTitle; } const String Project::getDocumentTitle() @@ -109,7 +109,7 @@ void Project::setMissingDefaultValues() getProjectTypeValue() = ProjectType::getGUIAppTypeName(); if (! projectRoot.hasProperty (Ids::version)) - getVersion() = "1.0.0"; + getVersionValue() = "1.0.0"; updateOldStyleConfigList(); moveOldPropertyFromProjectToAllExporters (Ids::bigIcon); @@ -327,7 +327,7 @@ String Project::getRelativePathForFile (const File& file) const //============================================================================== const ProjectType& Project::getProjectType() const { - const ProjectType* type = ProjectType::findType (getProjectTypeValue().toString()); + const ProjectType* type = ProjectType::findType (getProjectTypeString()); jassert (type != nullptr); if (type == nullptr) @@ -345,7 +345,7 @@ void Project::createPropertyEditors (PropertyListBuilder& props) props.add (new TextPropertyComponent (getProjectName(), "Project Name", 256, false), "The name of the project."); - props.add (new TextPropertyComponent (getVersion(), "Project Version", 16, false), + props.add (new TextPropertyComponent (getVersionValue(), "Project Version", 16, false), "The project's version number, This should be in the format major.minor.point"); props.add (new TextPropertyComponent (getCompanyName(), "Company Name", 256, false), @@ -380,7 +380,7 @@ void Project::createPropertyEditors (PropertyListBuilder& props) String Project::getVersionAsHex() const { StringArray configs; - configs.addTokens (getVersion().toString(), ",.", String::empty); + configs.addTokens (getVersionString(), ",.", String::empty); configs.trim(); configs.removeEmptyStrings(); @@ -394,7 +394,7 @@ String Project::getVersionAsHex() const StringPairArray Project::getPreprocessorDefs() const { - return parsePreprocessorDefs (getProjectPreprocessorDefs().toString()); + return parsePreprocessorDefs (projectRoot [Ids::defines]); } //============================================================================== @@ -450,7 +450,7 @@ Project::Item Project::Item::createGroup (Project& project, const String& name, Item group (project, ValueTree (Tags::group)); group.setID (uid); group.initialiseMissingProperties(); - group.getName() = name; + group.getNameValue() = name; return group; } @@ -491,14 +491,17 @@ bool Project::Item::canContain (const Item& child) const bool Project::Item::shouldBeAddedToTargetProject() const { return isFile(); } -bool Project::Item::shouldBeCompiled() const { return getShouldCompileValue().getValue(); } -Value Project::Item::getShouldCompileValue() const { return state.getPropertyAsValue (Ids::compile, getUndoManager()); } +Value Project::Item::getShouldCompileValue() { return state.getPropertyAsValue (Ids::compile, getUndoManager()); } +bool Project::Item::shouldBeCompiled() const { return state [Ids::compile]; } -bool Project::Item::shouldBeAddedToBinaryResources() const { return getShouldAddToResourceValue().getValue(); } -Value Project::Item::getShouldAddToResourceValue() const { return state.getPropertyAsValue (Ids::resource, getUndoManager()); } +Value Project::Item::getShouldAddToResourceValue() { return state.getPropertyAsValue (Ids::resource, getUndoManager()); } +bool Project::Item::shouldBeAddedToBinaryResources() const { return state [Ids::resource]; } -Value Project::Item::getShouldInhibitWarningsValue() const { return state.getPropertyAsValue (Ids::noWarnings, getUndoManager()); } -Value Project::Item::getShouldUseStdCallValue() const { return state.getPropertyAsValue (Ids::useStdCall, nullptr); } +Value Project::Item::getShouldInhibitWarningsValue() { return state.getPropertyAsValue (Ids::noWarnings, getUndoManager()); } +bool Project::Item::shouldInhibitWarnings() const { return state [Ids::noWarnings]; } + +Value Project::Item::getShouldUseStdCallValue() { return state.getPropertyAsValue (Ids::useStdCall, nullptr); } +bool Project::Item::shouldUseStdCall() const { return state [Ids::useStdCall]; } String Project::Item::getFilePath() const { @@ -586,8 +589,8 @@ File Project::Item::determineGroupFolder() const { f = parent.determineGroupFolder(); - if (f.getChildFile (getName().toString()).isDirectory()) - f = f.getChildFile (getName().toString()); + if (f.getChildFile (getName()).isDirectory()) + f = f.getChildFile (getName()); } else { @@ -616,11 +619,16 @@ void Project::Item::initialiseMissingProperties() } } -Value Project::Item::getName() const +Value Project::Item::getNameValue() { return state.getPropertyAsValue (Ids::name, getUndoManager()); } +String Project::Item::getName() const +{ + return state [Ids::name]; +} + void Project::Item::addChild (const Item& newChild, int insertIndex) { state.addChild (newChild.state, insertIndex, getUndoManager()); @@ -731,7 +739,7 @@ void Project::Item::addFileUnchecked (const File& file, int insertIndex, const b { Item item (project, ValueTree (Tags::file)); item.initialiseMissingProperties(); - item.getName() = file.getFileName(); + item.getNameValue() = file.getFileName(); item.getShouldCompileValue() = shouldCompile && file.hasFileExtension ("cpp;mm;c;m;cc;cxx;r"); item.getShouldAddToResourceValue() = project.shouldBeAddedToBinaryResourcesByDefault (file); @@ -746,7 +754,7 @@ bool Project::Item::addRelativeFile (const RelativePath& file, int insertIndex, { Item item (project, ValueTree (Tags::file)); item.initialiseMissingProperties(); - item.getName() = file.getFileName(); + item.getNameValue() = file.getFileName(); item.getShouldCompileValue() = shouldCompile; item.getShouldAddToResourceValue() = project.shouldBeAddedToBinaryResourcesByDefault (file); @@ -789,7 +797,7 @@ const char* const Project::configFlagDisabled = "disabled"; Value Project::getConfigFlag (const String& name) { - const ValueTree configNode (getConfigNode()); + ValueTree configNode (getConfigNode()); Value v (configNode.getPropertyAsValue (name, getUndoManagerFor (configNode))); if (v.getValue().toString().isEmpty()) @@ -918,7 +926,7 @@ void Project::addNewExporter (const String& exporterName) ScopedPointer exp (ProjectExporter::createNewExporter (*this, exporterName)); ValueTree exporters (getExporters()); - exporters.addChild (exp->getSettings(), -1, getUndoManagerFor (exporters)); + exporters.addChild (exp->settings, -1, getUndoManagerFor (exporters)); } void Project::deleteExporter (int index) diff --git a/extras/Introjucer/Source/Project/jucer_Project.h b/extras/Introjucer/Source/Project/jucer_Project.h index cf45c539c9..3e69cc26ed 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.h +++ b/extras/Introjucer/Source/Project/jucer_Project.h @@ -53,7 +53,7 @@ public: //============================================================================== ValueTree getProjectRoot() const { return projectRoot; } - Value getProjectName() { return getMainGroup().getName(); } + Value getProjectName() { return getMainGroup().getNameValue(); } String getProjectFilenameRoot() { return File::createLegalFileName (getDocumentTitle()); } String getProjectUID() const { return projectRoot [ComponentBuilder::idProperty]; } @@ -74,20 +74,22 @@ public: //============================================================================== // project types const ProjectType& getProjectType() const; - Value getProjectTypeValue() const { return getProjectValue (Ids::projectType); } + Value getProjectTypeValue() { return getProjectValue (Ids::projectType); } + String getProjectTypeString() const { return projectRoot [Ids::projectType]; } - Value getVersion() const { return getProjectValue (Ids::version); } + Value getVersionValue() { return getProjectValue (Ids::version); } + String getVersionString() const { return projectRoot [Ids::version]; } String getVersionAsHex() const; - Value getBundleIdentifier() const { return getProjectValue (Ids::bundleIdentifier); } + Value getBundleIdentifier() { return getProjectValue (Ids::bundleIdentifier); } void setBundleIdentifierToDefault() { getBundleIdentifier() = "com.yourcompany." + CodeHelpers::makeValidIdentifier (getProjectName().toString(), false, true, false); } - Value getCompanyName() const { return getProjectValue (Ids::companyName); } + Value getCompanyName() { return getProjectValue (Ids::companyName); } //============================================================================== - Value getProjectValue (const Identifier& name) const { return projectRoot.getPropertyAsValue (name, getUndoManagerFor (projectRoot)); } + Value getProjectValue (const Identifier& name) { return projectRoot.getPropertyAsValue (name, getUndoManagerFor (projectRoot)); } - Value getProjectPreprocessorDefs() const { return getProjectValue (Ids::defines); } + Value getProjectPreprocessorDefs() { return getProjectValue (Ids::defines); } StringPairArray getPreprocessorDefs() const; //============================================================================== @@ -134,7 +136,8 @@ public: Image loadAsImageFile() const; //============================================================================== - Value getName() const; + Value getNameValue(); + String getName() const; File getFile() const; String getFilePath() const; void setFile (const File& file); @@ -144,11 +147,13 @@ public: bool shouldBeAddedToTargetProject() const; bool shouldBeCompiled() const; - Value getShouldCompileValue() const; + Value getShouldCompileValue(); bool shouldBeAddedToBinaryResources() const; - Value getShouldAddToResourceValue() const; - Value getShouldInhibitWarningsValue() const; - Value getShouldUseStdCallValue() const; + Value getShouldAddToResourceValue(); + Value getShouldInhibitWarningsValue(); + bool shouldInhibitWarnings() const; + Value getShouldUseStdCallValue(); + bool shouldUseStdCall() const; //============================================================================== bool canContain (const Item& child) const; diff --git a/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp b/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp index 1dceb8b83e..375ed29853 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp @@ -601,7 +601,7 @@ public: for (int j = configList->groups.size(); --j >= 0;) { PropertyGroup& configGroup = *configList->groups.getUnchecked(j); - configGroup.setName ("Configuration: " + exp->getConfiguration (j)->getName().toString().quoted()); + configGroup.setName ("Configuration: " + exp->getConfiguration (j)->getName().quoted()); configGroup.repaint(); } } diff --git a/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp b/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp index 9392781df2..a18557aa83 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp @@ -42,7 +42,7 @@ ProjectTreeViewBase::~ProjectTreeViewBase() //============================================================================== String ProjectTreeViewBase::getDisplayName() const { - return item.getName().toString(); + return item.getName(); } void ProjectTreeViewBase::setName (const String& newName) @@ -50,7 +50,7 @@ void ProjectTreeViewBase::setName (const String& newName) if (item.isMainGroup()) item.project.setTitle (newName); else - item.getName() = newName; + item.getNameValue() = newName; } //============================================================================== diff --git a/extras/Introjucer/Source/Project/jucer_ProjectType.cpp b/extras/Introjucer/Source/Project/jucer_ProjectType.cpp index cf5a4cfb37..b44e4df8c4 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectType.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectType.cpp @@ -72,7 +72,7 @@ public: { } - void createPropertyEditors (const Project&, PropertyListBuilder&) const + void createPropertyEditors (Project&, PropertyListBuilder&) const { } @@ -104,7 +104,7 @@ public: { } - void createPropertyEditors (const Project& project, PropertyListBuilder& props) const + void createPropertyEditors (Project& project, PropertyListBuilder& props) const { } @@ -135,7 +135,7 @@ public: { } - void createPropertyEditors (const Project&, PropertyListBuilder&) const + void createPropertyEditors (Project&, PropertyListBuilder&) const { } @@ -191,7 +191,7 @@ public: } } - void createPropertyEditors (const Project& project, PropertyListBuilder& props) const + void createPropertyEditors (Project& project, PropertyListBuilder& props) const { props.add (new BooleanPropertyComponent (shouldBuildVST (project), "Build VST", "Enabled"), "Whether the project should produce a VST plugin."); diff --git a/extras/Introjucer/Source/Project/jucer_ProjectType.h b/extras/Introjucer/Source/Project/jucer_ProjectType.h index fb18b084b9..0239c63b6b 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectType.h +++ b/extras/Introjucer/Source/Project/jucer_ProjectType.h @@ -56,7 +56,7 @@ public: static const char* getAudioPluginTypeName(); virtual void setMissingProjectProperties (Project&) const = 0; - virtual void createPropertyEditors (const Project&, PropertyListBuilder&) const = 0; + virtual void createPropertyEditors (Project&, PropertyListBuilder&) const = 0; virtual void prepareExporter (ProjectExporter&) const = 0; protected: diff --git a/modules/juce_core/text/juce_StringPool.cpp b/modules/juce_core/text/juce_StringPool.cpp index ee02559c86..ce6336f168 100644 --- a/modules/juce_core/text/juce_StringPool.cpp +++ b/modules/juce_core/text/juce_StringPool.cpp @@ -30,8 +30,11 @@ StringPool::~StringPool() {} namespace StringPoolHelpers { template - const String::CharPointerType getPooledStringFromArray (Array& strings, StringType newString) + String::CharPointerType getPooledStringFromArray (Array& strings, + StringType newString, + const CriticalSection& lock) { + const ScopedLock sl (lock); int start = 0; int end = strings.size(); @@ -79,7 +82,7 @@ String::CharPointerType StringPool::getPooledString (const String& s) if (s.isEmpty()) return String::empty.getCharPointer(); - return StringPoolHelpers::getPooledStringFromArray (strings, s); + return StringPoolHelpers::getPooledStringFromArray (strings, s, lock); } String::CharPointerType StringPool::getPooledString (const char* const s) @@ -87,7 +90,7 @@ String::CharPointerType StringPool::getPooledString (const char* const s) if (s == nullptr || *s == 0) return String::empty.getCharPointer(); - return StringPoolHelpers::getPooledStringFromArray (strings, s); + return StringPoolHelpers::getPooledStringFromArray (strings, s, lock); } String::CharPointerType StringPool::getPooledString (const wchar_t* const s) @@ -95,7 +98,7 @@ String::CharPointerType StringPool::getPooledString (const wchar_t* const s) if (s == nullptr || *s == 0) return String::empty.getCharPointer(); - return StringPoolHelpers::getPooledStringFromArray (strings, s); + return StringPoolHelpers::getPooledStringFromArray (strings, s, lock); } int StringPool::size() const noexcept diff --git a/modules/juce_core/text/juce_StringPool.h b/modules/juce_core/text/juce_StringPool.h index 4268fac495..9e3aa80f6c 100644 --- a/modules/juce_core/text/juce_StringPool.h +++ b/modules/juce_core/text/juce_StringPool.h @@ -85,6 +85,7 @@ public: private: Array strings; + CriticalSection lock; }; diff --git a/modules/juce_core/threads/juce_ThreadPool.h b/modules/juce_core/threads/juce_ThreadPool.h index 8f5eb113e9..4895a8b032 100644 --- a/modules/juce_core/threads/juce_ThreadPool.h +++ b/modules/juce_core/threads/juce_ThreadPool.h @@ -242,7 +242,7 @@ public: bool removeAllJobs (bool interruptRunningJobs, int timeOutMilliseconds, bool deleteInactiveJobs = false, - JobSelector* selectedJobsToRemove = 0); + JobSelector* selectedJobsToRemove = nullptr); /** Returns the number of jobs currently running or queued. */ diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 6e69b08dab..b0fde91bf4 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -24,7 +24,7 @@ */ -class ValueTree::SharedObject : public SingleThreadedReferenceCountedObject +class ValueTree::SharedObject : public ReferenceCountedObject { public: typedef ReferenceCountedObjectPtr Ptr; @@ -828,7 +828,7 @@ private: JUCE_DECLARE_NON_COPYABLE (ValueTreePropertyValueSource); }; -Value ValueTree::getPropertyAsValue (const Identifier& name, UndoManager* const undoManager) const +Value ValueTree::getPropertyAsValue (const Identifier& name, UndoManager* const undoManager) { return Value (new ValueTreePropertyValueSource (*this, name, undoManager)); } diff --git a/modules/juce_data_structures/values/juce_ValueTree.h b/modules/juce_data_structures/values/juce_ValueTree.h index 184952a32a..d818c71518 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.h +++ b/modules/juce_data_structures/values/juce_ValueTree.h @@ -203,7 +203,7 @@ public: it needs to change the value. Attaching a Value::Listener to the value object will provide callbacks whenever the property changes. */ - Value getPropertyAsValue (const Identifier& name, UndoManager* undoManager) const; + Value getPropertyAsValue (const Identifier& name, UndoManager* undoManager); //============================================================================== /** Returns the number of child nodes belonging to this one. diff --git a/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp b/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp index 83bfc465ff..2eb4cf4a77 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp +++ b/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp @@ -261,7 +261,7 @@ RelativePoint DrawablePath::ValueTreeWrapper::Element::getControlPoint (const in return RelativePoint (state [index == 0 ? point1 : (index == 1 ? point2 : point3)].toString()); } -Value DrawablePath::ValueTreeWrapper::Element::getControlPointValue (int index, UndoManager* undoManager) const +Value DrawablePath::ValueTreeWrapper::Element::getControlPointValue (int index, UndoManager* undoManager) { jassert (index >= 0 && index < getNumControlPoints()); return state.getPropertyAsValue (index == 0 ? point1 : (index == 1 ? point2 : point3), undoManager); diff --git a/modules/juce_gui_basics/drawables/juce_DrawablePath.h b/modules/juce_gui_basics/drawables/juce_DrawablePath.h index c420c2d1bd..17ff27fd8a 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawablePath.h +++ b/modules/juce_gui_basics/drawables/juce_DrawablePath.h @@ -97,7 +97,7 @@ public: int getNumControlPoints() const noexcept; RelativePoint getControlPoint (int index) const; - Value getControlPointValue (int index, UndoManager*) const; + Value getControlPointValue (int index, UndoManager*); RelativePoint getStartPoint() const; RelativePoint getEndPoint() const; void setControlPoint (int index, const RelativePoint& point, UndoManager*); diff --git a/modules/juce_gui_basics/drawables/juce_DrawableRectangle.cpp b/modules/juce_gui_basics/drawables/juce_DrawableRectangle.cpp index 534926cc0c..c27cb0430f 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawableRectangle.cpp +++ b/modules/juce_gui_basics/drawables/juce_DrawableRectangle.cpp @@ -153,7 +153,7 @@ RelativePoint DrawableRectangle::ValueTreeWrapper::getCornerSize() const return RelativePoint (state [cornerSize]); } -Value DrawableRectangle::ValueTreeWrapper::getCornerSizeValue (UndoManager* undoManager) const +Value DrawableRectangle::ValueTreeWrapper::getCornerSizeValue (UndoManager* undoManager) { return state.getPropertyAsValue (cornerSize, undoManager); } diff --git a/modules/juce_gui_basics/drawables/juce_DrawableRectangle.h b/modules/juce_gui_basics/drawables/juce_DrawableRectangle.h index 0d01a2ebc7..1912c20324 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawableRectangle.h +++ b/modules/juce_gui_basics/drawables/juce_DrawableRectangle.h @@ -83,7 +83,7 @@ public: void setCornerSize (const RelativePoint& cornerSize, UndoManager*); RelativePoint getCornerSize() const; - Value getCornerSizeValue (UndoManager*) const; + Value getCornerSizeValue (UndoManager*); static const Identifier topLeft, topRight, bottomLeft, cornerSize; };