| @@ -86,7 +86,7 @@ public: | |||||
| File getLastDocumentOpened() override | File getLastDocumentOpened() override | ||||
| { | { | ||||
| // not interested in this for now | // not interested in this for now | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| void setLastDocumentOpened (const File& /*file*/) override | void setLastDocumentOpened (const File& /*file*/) override | ||||
| @@ -456,14 +456,12 @@ namespace | |||||
| { | { | ||||
| File result; | File result; | ||||
| for (int i = 0; i < allFiles.size(); ++i) | |||||
| for (auto& f : allFiles) | |||||
| { | { | ||||
| const File& f = allFiles.getReference(i); | |||||
| if (f.getFileName().equalsIgnoreCase (name) && f != sourceFile) | if (f.getFileName().equalsIgnoreCase (name) && f != sourceFile) | ||||
| { | { | ||||
| if (result.exists()) | if (result.exists()) | ||||
| return File(); // multiple possible results, so don't change it! | |||||
| return {}; // multiple possible results, so don't change it! | |||||
| result = f; | result = f; | ||||
| } | } | ||||
| @@ -597,11 +597,11 @@ Project* MainWindowList::getFrontmostProject() | |||||
| File findDefaultModulesFolder (bool mustContainJuceCoreModule) | File findDefaultModulesFolder (bool mustContainJuceCoreModule) | ||||
| { | { | ||||
| const MainWindowList& windows = ProjucerApplication::getApp().mainWindowList; | |||||
| auto& windows = ProjucerApplication::getApp().mainWindowList; | |||||
| for (int i = windows.windows.size(); --i >= 0;) | for (int i = windows.windows.size(); --i >= 0;) | ||||
| { | { | ||||
| if (Project* p = windows.windows.getUnchecked (i)->getProject()) | |||||
| if (auto* p = windows.windows.getUnchecked (i)->getProject()) | |||||
| { | { | ||||
| const File f (EnabledModuleList::findDefaultModulesFolder (*p)); | const File f (EnabledModuleList::findDefaultModulesFolder (*p)); | ||||
| @@ -613,11 +613,11 @@ File findDefaultModulesFolder (bool mustContainJuceCoreModule) | |||||
| if (mustContainJuceCoreModule) | if (mustContainJuceCoreModule) | ||||
| return findDefaultModulesFolder (false); | return findDefaultModulesFolder (false); | ||||
| File f (File::getSpecialLocation (File::currentApplicationFile)); | |||||
| auto f = File::getSpecialLocation (File::currentApplicationFile); | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| File parent (f.getParentDirectory()); | |||||
| auto parent = f.getParentDirectory(); | |||||
| if (parent == f || ! parent.isDirectory()) | if (parent == f || ! parent.isDirectory()) | ||||
| break; | break; | ||||
| @@ -628,5 +628,5 @@ File findDefaultModulesFolder (bool mustContainJuceCoreModule) | |||||
| f = parent; | f = parent; | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| @@ -61,7 +61,7 @@ public: | |||||
| virtual void fileHasBeenRenamed (const File& newFile) = 0; | virtual void fileHasBeenRenamed (const File& newFile) = 0; | ||||
| virtual String getState() const = 0; | virtual String getState() const = 0; | ||||
| virtual void restoreState (const String& state) = 0; | virtual void restoreState (const String& state) = 0; | ||||
| virtual File getCounterpartFile() const { return File(); } | |||||
| virtual File getCounterpartFile() const { return {}; } | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -64,7 +64,7 @@ public: | |||||
| return findCounterpart (file, extensions); | return findCounterpart (file, extensions); | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| static File findCounterpart (const File& file, const char** extensions) | static File findCounterpart (const File& file, const char** extensions) | ||||
| @@ -77,7 +77,7 @@ public: | |||||
| return f; | return f; | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| void reloadFromFile() override; | void reloadFromFile() override; | ||||
| @@ -502,10 +502,10 @@ private: | |||||
| File getFile() const | File getFile() const | ||||
| { | { | ||||
| const String filename (getViewportJucerComponentFile (component)); | |||||
| auto filename = getViewportJucerComponentFile (component); | |||||
| if (filename.isEmpty()) | if (filename.isEmpty()) | ||||
| return File(); | |||||
| return {}; | |||||
| return document.getCppFile().getSiblingFile (filename); | return document.getCppFile().getSiblingFile (filename); | ||||
| } | } | ||||
| @@ -69,7 +69,7 @@ static StringArray recursiveFiles; | |||||
| File TestComponent::findFile() const | File TestComponent::findFile() const | ||||
| { | { | ||||
| if (filename.isEmpty()) | if (filename.isEmpty()) | ||||
| return File(); | |||||
| return {}; | |||||
| if (ownerDocument != nullptr) | if (ownerDocument != nullptr) | ||||
| return ownerDocument->getCppFile().getSiblingFile (filename); | return ownerDocument->getCppFile().getSiblingFile (filename); | ||||
| @@ -346,7 +346,7 @@ struct ClassDatabase | |||||
| if (m.definition.isValid() && File (m.definition.file).exists()) | if (m.definition.isValid() && File (m.definition.file).exists()) | ||||
| return m.definition.file; | return m.definition.file; | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| Array<File> getAllSourceFiles() const | Array<File> getAllSourceFiles() const | ||||
| @@ -127,7 +127,7 @@ private: | |||||
| if (tryFindDLLFileInAppConfigFolder(dllFile)) | if (tryFindDLLFileInAppConfigFolder(dllFile)) | ||||
| return dllFile; | return dllFile; | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| #if JUCE_MAC | #if JUCE_MAC | ||||
| @@ -284,7 +284,7 @@ public: | |||||
| return defaultInstallation; | return defaultInstallation; | ||||
| #endif | #endif | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| protected: | protected: | ||||
| @@ -96,21 +96,21 @@ File ModuleDescription::getHeader() const | |||||
| { | { | ||||
| const char* extensions[] = { ".h", ".hpp", ".hxx" }; | const char* extensions[] = { ".h", ".hpp", ".hxx" }; | ||||
| for (int i = 0; i < numElementsInArray (extensions); ++i) | |||||
| for (auto e : extensions) | |||||
| { | { | ||||
| File header (moduleFolder.getChildFile (moduleFolder.getFileName() + extensions[i])); | |||||
| File header (moduleFolder.getChildFile (moduleFolder.getFileName() + e)); | |||||
| if (header.existsAsFile()) | if (header.existsAsFile()) | ||||
| return header; | return header; | ||||
| } | } | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| StringArray ModuleDescription::getDependencies() const | StringArray ModuleDescription::getDependencies() const | ||||
| { | { | ||||
| StringArray deps = StringArray::fromTokens (moduleInfo ["dependencies"].toString(), " \t;,", "\"'"); | |||||
| auto deps = StringArray::fromTokens (moduleInfo ["dependencies"].toString(), " \t;,", "\"'"); | |||||
| deps.trim(); | deps.trim(); | ||||
| deps.removeEmptyStrings(); | deps.removeEmptyStrings(); | ||||
| return deps; | return deps; | ||||
| @@ -635,7 +635,7 @@ File EnabledModuleList::findLocalModuleFolder (const String& moduleID, bool useE | |||||
| } | } | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| File EnabledModuleList::getModuleFolder (const String& moduleID) | File EnabledModuleList::getModuleFolder (const String& moduleID) | ||||
| @@ -400,7 +400,7 @@ bool Project::hasProjectBeenModified() | |||||
| File Project::resolveFilename (String filename) const | File Project::resolveFilename (String filename) const | ||||
| { | { | ||||
| if (filename.isEmpty()) | if (filename.isEmpty()) | ||||
| return File(); | |||||
| return {}; | |||||
| filename = replacePreprocessorDefs (getPreprocessorDefs(), filename); | filename = replacePreprocessorDefs (getPreprocessorDefs(), filename); | ||||
| @@ -863,7 +863,7 @@ File Project::Item::getFile() const | |||||
| if (isFile()) | if (isFile()) | ||||
| return project.resolveFilename (state [Ids::file].toString()); | return project.resolveFilename (state [Ids::file].toString()); | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| void Project::Item::setFile (const File& file) | void Project::Item::setFile (const File& file) | ||||
| @@ -43,7 +43,7 @@ public: | |||||
| if (f.hasFileExtension (sourceFileExtensions)) return f.withFileExtension (".h"); | if (f.hasFileExtension (sourceFileExtensions)) return f.withFileExtension (".h"); | ||||
| if (f.hasFileExtension (headerFileExtensions)) return f.withFileExtension (".cpp"); | if (f.hasFileExtension (headerFileExtensions)) return f.withFileExtension (".cpp"); | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| void setName (const String& newName) override | void setName (const String& newName) override | ||||
| @@ -57,7 +57,7 @@ public: | |||||
| virtual void paintIcon (Graphics& g, Rectangle<int> area) { getIcon().draw (g, area.reduced (2).toFloat(), isIconCrossedOut()); } | virtual void paintIcon (Graphics& g, Rectangle<int> area) { getIcon().draw (g, area.reduced (2).toFloat(), isIconCrossedOut()); } | ||||
| virtual void paintContent (Graphics& g, const Rectangle<int>& area); | virtual void paintContent (Graphics& g, const Rectangle<int>& area); | ||||
| virtual int getMillisecsAllowedForDragGesture() { return 120; }; | virtual int getMillisecsAllowedForDragGesture() { return 120; }; | ||||
| virtual File getDraggableFile() const { return File(); } | |||||
| virtual File getDraggableFile() const { return {}; } | |||||
| void refreshSubItems(); | void refreshSubItems(); | ||||
| virtual void deleteItem(); | virtual void deleteItem(); | ||||
| @@ -225,7 +225,7 @@ File NewFileWizard::Type::askUserToChooseNewFile (const String& suggestedFilenam | |||||
| if (fc.browseForFileToSave (true)) | if (fc.browseForFileToSave (true)) | ||||
| return fc.getResult(); | return fc.getResult(); | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -253,7 +253,7 @@ public: | |||||
| appFolder = appFolder.getParentDirectory(); | appFolder = appFolder.getParentDirectory(); | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -698,7 +698,7 @@ bool File::hasFileExtension (StringRef possibleSuffix) const | |||||
| File File::withFileExtension (StringRef newExtension) const | File File::withFileExtension (StringRef newExtension) const | ||||
| { | { | ||||
| if (fullPath.isEmpty()) | if (fullPath.isEmpty()) | ||||
| return File(); | |||||
| return {}; | |||||
| String filePart (getFileName()); | String filePart (getFileName()); | ||||
| @@ -86,7 +86,7 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||||
| break; | break; | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| bool File::moveToTrash() const | bool File::moveToTrash() const | ||||
| @@ -114,10 +114,10 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||||
| if (const char* homeDir = getenv ("HOME")) | if (const char* homeDir = getenv ("HOME")) | ||||
| return File (CharPointer_UTF8 (homeDir)); | return File (CharPointer_UTF8 (homeDir)); | ||||
| if (struct passwd* const pw = getpwuid (getuid())) | |||||
| if (auto* pw = getpwuid (getuid())) | |||||
| return File (CharPointer_UTF8 (pw->pw_dir)); | return File (CharPointer_UTF8 (pw->pw_dir)); | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| case userDocumentsDirectory: return resolveXDGFolder ("XDG_DOCUMENTS_DIR", "~/Documents"); | case userDocumentsDirectory: return resolveXDGFolder ("XDG_DOCUMENTS_DIR", "~/Documents"); | ||||
| @@ -161,7 +161,7 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||||
| break; | break; | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -259,7 +259,7 @@ File File::getSpecialLocation (const SpecialLocationType type) | |||||
| return File (resultPath.convertToPrecomposedUnicode()); | return File (resultPath.convertToPrecomposedUnicode()); | ||||
| } | } | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -96,7 +96,7 @@ namespace WindowsFileHelpers | |||||
| if (SHGetSpecialFolderPath (0, path, type, FALSE)) | if (SHGetSpecialFolderPath (0, path, type, FALSE)) | ||||
| return File (String (path)); | return File (String (path)); | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| File getModuleFileName (HINSTANCE moduleHandle) | File getModuleFileName (HINSTANCE moduleHandle) | ||||
| @@ -599,7 +599,7 @@ File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type) | |||||
| default: | default: | ||||
| jassertfalse; // unknown type? | jassertfalse; // unknown type? | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| return WindowsFileHelpers::getSpecialFolderPath (csidlType); | return WindowsFileHelpers::getSpecialFolderPath (csidlType); | ||||
| @@ -92,7 +92,7 @@ File PropertiesFile::Options::getDefaultFile() const | |||||
| : File::userApplicationDataDirectory)); | : File::userApplicationDataDirectory)); | ||||
| if (dir == File()) | if (dir == File()) | ||||
| return File(); | |||||
| return {}; | |||||
| dir = dir.getChildFile (folderName.isNotEmpty() ? folderName | dir = dir.getChildFile (folderName.isNotEmpty() ? folderName | ||||
| : applicationName); | : applicationName); | ||||
| @@ -119,7 +119,7 @@ bool DirectoryContentsList::getFileInfo (const int index, FileInfo& result) cons | |||||
| { | { | ||||
| const ScopedLock sl (fileListLock); | const ScopedLock sl (fileListLock); | ||||
| if (const FileInfo* const info = files [index]) | |||||
| if (auto* info = files [index]) | |||||
| { | { | ||||
| result = *info; | result = *info; | ||||
| return true; | return true; | ||||
| @@ -132,10 +132,10 @@ File DirectoryContentsList::getFile (const int index) const | |||||
| { | { | ||||
| const ScopedLock sl (fileListLock); | const ScopedLock sl (fileListLock); | ||||
| if (const FileInfo* const info = files [index]) | |||||
| if (auto* info = files [index]) | |||||
| return root.getChildFile (info->filename); | return root.getChildFile (info->filename); | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| bool DirectoryContentsList::contains (const File& targetFile) const | bool DirectoryContentsList::contains (const File& targetFile) const | ||||
| @@ -282,10 +282,10 @@ void FileTreeComponent::refresh() | |||||
| //============================================================================== | //============================================================================== | ||||
| File FileTreeComponent::getSelectedFile (const int index) const | File FileTreeComponent::getSelectedFile (const int index) const | ||||
| { | { | ||||
| if (const FileListTreeItem* const item = dynamic_cast<const FileListTreeItem*> (getSelectedItem (index))) | |||||
| if (auto* item = dynamic_cast<const FileListTreeItem*> (getSelectedItem (index))) | |||||
| return item->file; | return item->file; | ||||
| return File(); | |||||
| return {}; | |||||
| } | } | ||||
| void FileTreeComponent::deselectAllFiles() | void FileTreeComponent::deselectAllFiles() | ||||
| @@ -59,7 +59,7 @@ public: | |||||
| and handle mouse clicks with listBoxItemClicked(). | and handle mouse clicks with listBoxItemClicked(). | ||||
| This method will be called whenever a custom component might need to be updated - e.g. | This method will be called whenever a custom component might need to be updated - e.g. | ||||
| when the table is changed, or TableListBox::updateContent() is called. | |||||
| when the list is changed, or ListBox::updateContent() is called. | |||||
| If you don't need a custom component for the specified row, then return nullptr. | If you don't need a custom component for the specified row, then return nullptr. | ||||
| (Bear in mind that even if you're not creating a new component, you may still need to | (Bear in mind that even if you're not creating a new component, you may still need to | ||||