diff --git a/extras/Introjucer/Source/Application/jucer_Application.h b/extras/Introjucer/Source/Application/jucer_Application.h index 38ab66ebae..2cf949d4d9 100644 --- a/extras/Introjucer/Source/Application/jucer_Application.h +++ b/extras/Introjucer/Source/Application/jucer_Application.h @@ -86,9 +86,9 @@ public: void shutdown() { #if JUCE_MAC - MenuBarModel::setMacMainMenu (0); + MenuBarModel::setMacMainMenu (nullptr); #endif - menuModel = 0; + menuModel = nullptr; StoredSettings::deleteInstance(); mainWindows.clear(); @@ -365,7 +365,7 @@ public: MainWindow* mw = createNewMainWindow (false); ScopedPointer newProj (NewProjectWizard::runNewProjectWizard (mw)); - if (newProj != 0) + if (newProj != nullptr) { mw->setProject (newProj.release()); mw->setVisible (true); @@ -388,7 +388,7 @@ public: { for (int j = mainWindows.size(); --j >= 0;) { - if (mainWindows.getUnchecked(j)->getProject() != 0 + if (mainWindows.getUnchecked(j)->getProject() != nullptr && mainWindows.getUnchecked(j)->getProject()->getFile() == file) { mainWindows.getUnchecked(j)->toFront (true); @@ -442,7 +442,7 @@ public: { MainWindow* mw = mainWindows[i]; - if (mw != 0 && mw->getProject() != 0) + if (mw != nullptr && mw->getProject() != nullptr) projects.add (mw->getProject()->getFile()); } @@ -494,7 +494,7 @@ private: for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;) { MainWindow* mw = dynamic_cast (Desktop::getInstance().getComponent (i)); - if (mainWindows.contains (mw) && mw->getProject() == 0) + if (mainWindows.contains (mw) && mw->getProject() == nullptr) return mw; } diff --git a/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp b/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp index 650fce4476..2556144c47 100644 --- a/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp +++ b/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp @@ -43,10 +43,10 @@ void DocumentEditorComponent::documentAboutToClose (OpenDocumentManager::Documen { if (document == closingDoc) { - jassert (document != 0); + jassert (document != nullptr); ProjectContentComponent* pcc = findParentComponentOfClass ((ProjectContentComponent*) 0); - if (pcc != 0) + if (pcc != nullptr) { pcc->hideDocument (document); return; @@ -72,10 +72,10 @@ void DocumentEditorComponent::getAllCommands (Array & commands) void DocumentEditorComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result) { - result.setActive (document != 0); + result.setActive (document != nullptr); String name; - if (document != 0) + if (document != nullptr) name = " '" + document->getName().substring (0, 32) + "'"; switch (commandID) diff --git a/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp b/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp index 53bc249c7b..847d36db8e 100644 --- a/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp +++ b/extras/Introjucer/Source/Application/jucer_FilePreviewComponent.cpp @@ -42,14 +42,14 @@ void ItemPreviewComponent::tryToLoadImage() ScopedPointer input (file.createInputStream()); - if (input != 0) + if (input != nullptr) { const int64 totalSize = input->getTotalLength(); ImageFileFormat* format = ImageFileFormat::findImageFormatForStream (*input); - input = 0; + input = nullptr; String formatName; - if (format != 0) + if (format != nullptr) formatName = " " + format->getFormatName(); image = ImageCache::getFromFile (file); diff --git a/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp b/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp index 82eefe5ec8..d2f068f5b0 100644 --- a/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp +++ b/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp @@ -128,7 +128,7 @@ void JuceUpdater::buttonClicked (Button*) { ScopedPointer xml (downloadVersionList()); - if (xml == 0 || xml->hasTagName ("html")) + if (xml == nullptr || xml->hasTagName ("html")) { AlertWindow::showMessageBox (AlertWindow::WarningIcon, "Connection Problems...", "Couldn't connect to the Raw Material Software website!"); @@ -166,7 +166,7 @@ public: ScopedPointer input (url.createInputStream (false)); - if (input == 0) + if (input == nullptr) { error = "Couldn't connect to the website..."; return; @@ -180,7 +180,7 @@ public: ScopedPointer output (target.createOutputStream (32768)); - if (output == 0) + if (output == nullptr) { error = "Couldn't write to the destination file..."; return; @@ -336,7 +336,9 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte { public: UpdateListComponent (JuceUpdater& updater_) - : updater (updater_), version (0), applyButton ("Install this version...") + : updater (updater_), + version (nullptr), + applyButton ("Install this version...") { addAndMakeVisible (&applyButton); applyButton.addListener (this); @@ -360,7 +362,7 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte void paint (Graphics& g) { - if (version != 0) + if (version != nullptr) { g.setColour (Colours::green.withAlpha (0.12f)); @@ -379,7 +381,7 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte { applyButton.changeWidthToFitText (getHeight() - 4); applyButton.setTopRightPosition (getWidth(), 2); - applyButton.setVisible (version != 0); + applyButton.setVisible (version != nullptr); } void buttonClicked (Button*) @@ -394,7 +396,7 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte }; UpdateListComponent* c = dynamic_cast (existingComponentToUpdate); - if (c == 0) + if (c == nullptr) c = new UpdateListComponent (*this); c->setVersion (availableVersions [rowNumber]); diff --git a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp index 5830f49005..eeac652f1e 100644 --- a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp @@ -30,7 +30,7 @@ #include "../Code Editor/jucer_SourceCodeEditor.h" #include "../Project/jucer_NewProjectWizard.h" -ApplicationCommandManager* commandManager = 0; +ApplicationCommandManager* commandManager = nullptr; //============================================================================== @@ -59,7 +59,7 @@ MainWindow::MainWindow() ProjectContentComponent pcc; commandManager->registerAllCommandsForTarget (&pcc); - DocumentEditorComponent dec (0); + DocumentEditorComponent dec (nullptr); commandManager->registerAllCommandsForTarget (&dec); } @@ -67,7 +67,7 @@ MainWindow::MainWindow() ScopedPointer keys (StoredSettings::getInstance()->getProps().getXmlValue ("keyMappings")); - if (keys != 0) + if (keys != nullptr) commandManager->getKeyMappings()->restoreFromXml (*keys); addKeyListener (commandManager->getKeyMappings()); @@ -81,9 +81,9 @@ MainWindow::MainWindow() MainWindow::~MainWindow() { -#if ! JUCE_MAC - setMenuBar (0); -#endif + #if ! JUCE_MAC + setMenuBar (nullptr); + #endif removeKeyListener (commandManager->getKeyMappings()); @@ -92,7 +92,7 @@ MainWindow::~MainWindow() .setValue ("lastMainWindowPos", getWindowStateAsString()); clearContentComponent(); - currentProject = 0; + currentProject = nullptr; } ProjectContentComponent* MainWindow::getProjectContentComponent() const @@ -111,9 +111,9 @@ void MainWindow::closeButtonPressed() bool MainWindow::closeProject (Project* project) { - jassert (project == currentProject && project != 0); + jassert (project == currentProject && project != nullptr); - if (project == 0) + if (project == nullptr) return true; StoredSettings::getInstance()->getProps() @@ -126,7 +126,7 @@ bool MainWindow::closeProject (Project* project) if (r == FileBasedDocument::savedOk) { - setProject (0); + setProject (nullptr); return true; } @@ -135,7 +135,7 @@ bool MainWindow::closeProject (Project* project) bool MainWindow::closeCurrentProject() { - return currentProject == 0 || closeProject (currentProject); + return currentProject == nullptr || closeProject (currentProject); } void MainWindow::setProject (Project* newProject) @@ -146,7 +146,7 @@ void MainWindow::setProject (Project* newProject) // (mustn't do this when the project is 0, because that'll happen on shutdown, // which will erase the list of recent projects) - if (newProject != 0) + if (newProject != nullptr) static_cast (JUCEApplication::getInstance())->updateRecentProjectList(); } @@ -154,7 +154,7 @@ void MainWindow::restoreWindowPosition() { String windowState; - if (currentProject != 0) + if (currentProject != nullptr) windowState = StoredSettings::getInstance()->getProps().getValue (getProjectWindowPosName()); if (windowState.isEmpty()) @@ -217,7 +217,7 @@ void MainWindow::activeWindowStatusChanged() { DocumentWindow::activeWindowStatusChanged(); - if (getProjectContentComponent() != 0) + if (getProjectContentComponent() != nullptr) getProjectContentComponent()->updateMissingFileStatuses(); OpenDocumentManager::getInstance()->reloadModifiedFiles(); diff --git a/extras/Introjucer/Source/Application/jucer_MainWindow.h b/extras/Introjucer/Source/Application/jucer_MainWindow.h index b0e3530fb7..4dbd74c768 100644 --- a/extras/Introjucer/Source/Application/jucer_MainWindow.h +++ b/extras/Introjucer/Source/Application/jucer_MainWindow.h @@ -76,8 +76,8 @@ private: const String getProjectWindowPosName() const { - jassert (currentProject != 0); - if (currentProject == 0) + jassert (currentProject != nullptr); + if (currentProject == nullptr) return String::empty; return "projectWindowPos_" + currentProject->getProjectUID(); diff --git a/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp b/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp index f96e0136a7..18469a0d85 100644 --- a/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp +++ b/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp @@ -62,7 +62,7 @@ public: bool refersToProject (Project& project) const { return false; } const String getName() const { return modDetector.getFile().getFileName(); } const String getType() const { return modDetector.getFile().getFileExtension() + " file"; } - bool needsSaving() const { return codeDoc != 0 && codeDoc->hasChangedSinceSavePoint(); } + bool needsSaving() const { return codeDoc != nullptr && codeDoc->hasChangedSinceSavePoint(); } bool hasFileBeenModifiedExternally() { return modDetector.hasBeenModified(); } void fileHasBeenRenamed (const File& newFile) { modDetector.fileHasBeenRenamed (newFile); } @@ -72,7 +72,7 @@ public: ScopedPointer in (modDetector.getFile().createInputStream()); - if (in != 0) + if (in != nullptr) codeDoc->loadFromStream (*in); } @@ -81,10 +81,10 @@ public: TemporaryFile temp (modDetector.getFile()); ScopedPointer out (temp.getFile().createOutputStream()); - if (out == 0 || ! codeDoc->writeToStream (*out)) + if (out == nullptr || ! codeDoc->writeToStream (*out)) return false; - out = 0; + out = nullptr; if (! temp.overwriteTargetFileWithTemporary()) return false; @@ -94,7 +94,7 @@ public: Component* createEditor() { - CodeTokeniser* tokeniser = 0; + CodeTokeniser* tokeniser = nullptr; if (SourceCodeEditor::isCppFile (modDetector.getFile())) tokeniser = &cppTokeniser; @@ -212,20 +212,20 @@ OpenDocumentManager::Document* OpenDocumentManager::getDocumentForFile (Project* if (documents.getUnchecked(i)->isForFile (file)) return documents.getUnchecked(i); - Document* d = 0; + Document* d = nullptr; - for (int i = types.size(); --i >= 0 && d == 0;) + for (int i = types.size(); --i >= 0 && d == nullptr;) { if (types.getUnchecked(i)->canOpenFile (file)) { d = types.getUnchecked(i)->openFile (project, file); - jassert (d != 0); + jassert (d != nullptr); } } - jassert (d != 0); + jassert (d != nullptr); - if (d != 0) + if (d != nullptr) documents.add (d); commandManager->commandStatusChanged(); @@ -288,7 +288,7 @@ bool OpenDocumentManager::closeDocument (int index, bool saveIfNeeded) { Document* doc = documents [index]; - if (doc != 0) + if (doc != nullptr) { if (saveIfNeeded) { diff --git a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp index 1e07c44382..0b09ee0004 100644 --- a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.cpp @@ -140,7 +140,7 @@ Component* GroupInformationComponent::refreshComponentForRow (int rowNumber, boo { Project::Item child (item.getChild (rowNumber)); - if (existingComponentToUpdate == 0 + if (existingComponentToUpdate == nullptr || dynamic_cast (existingComponentToUpdate)->item != child) { delete existingComponentToUpdate; diff --git a/extras/Introjucer/Source/Project/jucer_NewFileWizard.cpp b/extras/Introjucer/Source/Project/jucer_NewFileWizard.cpp index ab01391699..b0b7109ad9 100644 --- a/extras/Introjucer/Source/Project/jucer_NewFileWizard.cpp +++ b/extras/Introjucer/Source/Project/jucer_NewFileWizard.cpp @@ -169,7 +169,7 @@ bool NewFileWizard::runWizardFromMenu (int chosenMenuItemID, const Project::Item { Type* wiz = wizards [chosenMenuItemID - menuBaseID]; - if (wiz != 0) + if (wiz != nullptr) { wiz->createNewFile (projectGroupToAddTo); return true; diff --git a/extras/Introjucer/Source/Project/jucer_NewProjectWizard.cpp b/extras/Introjucer/Source/Project/jucer_NewProjectWizard.cpp index 97056a63a6..14f60fb412 100644 --- a/extras/Introjucer/Source/Project/jucer_NewProjectWizard.cpp +++ b/extras/Introjucer/Source/Project/jucer_NewProjectWizard.cpp @@ -490,5 +490,5 @@ Project* NewProjectWizard::runNewProjectWizard (Component* ownerWindow) } } - return wizard != 0 ? wizard->runWizard (ownerWindow) : 0; + return wizard != nullptr ? wizard->runWizard (ownerWindow) : 0; } diff --git a/extras/Introjucer/Source/Project/jucer_Project.cpp b/extras/Introjucer/Source/Project/jucer_Project.cpp index 37a25aa825..67d1ff76f4 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.cpp +++ b/extras/Introjucer/Source/Project/jucer_Project.cpp @@ -159,7 +159,7 @@ const String Project::loadDocument (const File& file) { ScopedPointer xml (XmlDocument::parse (file)); - if (xml == 0 || ! xml->hasTagName (Tags::projectRoot.toString())) + if (xml == nullptr || ! xml->hasTagName (Tags::projectRoot.toString())) return "Not a valid Jucer project!"; ValueTree newTree (ValueTree::fromXml (*xml)); @@ -304,7 +304,7 @@ const File Project::getLocalJuceFolder() { ScopedPointer exp (ProjectExporter::createPlatformDefaultExporter (*this)); - if (exp != 0) + if (exp != nullptr) { File f (resolveFilename (exp->getJuceFolder().toString())); @@ -925,8 +925,8 @@ const String Project::getUniqueConfigName (String name) const void Project::addNewConfiguration (BuildConfiguration* configToCopy) { - const String configName (getUniqueConfigName (configToCopy != 0 ? configToCopy->config [Ids::name].toString() - : "New Build Configuration")); + const String configName (getUniqueConfigName (configToCopy != nullptr ? configToCopy->config [Ids::name].toString() + : "New Build Configuration")); ValueTree configs (getConfigurations()); @@ -937,7 +937,7 @@ void Project::addNewConfiguration (BuildConfiguration* configToCopy) } ValueTree newConfig (Tags::configuration); - if (configToCopy != 0) + if (configToCopy != nullptr) newConfig = configToCopy->config.createCopy(); newConfig.setProperty (Ids::name, configName, 0); @@ -955,7 +955,7 @@ void Project::createDefaultConfigs() { for (int i = 0; i < 2; ++i) { - addNewConfiguration (0); + addNewConfiguration (nullptr); BuildConfiguration config = getConfiguration (i); const bool debugConfig = i == 0; @@ -1128,7 +1128,7 @@ const String Project::getFileTemplate (const String& templateName) int dataSize; const char* data = BinaryData::getNamedResource (templateName.toUTF8(), dataSize); - if (data == 0) + if (data == nullptr) { jassertfalse; return String::empty; diff --git a/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp b/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp index 99b6fbcbd0..ffc4af1791 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp @@ -33,8 +33,8 @@ //============================================================================== ProjectContentComponent::ProjectContentComponent() - : project (0), - currentDocument (0) + : project (nullptr), + currentDocument (nullptr) { setOpaque (true); setWantsKeyboardFocus (true); @@ -45,8 +45,8 @@ ProjectContentComponent::ProjectContentComponent() ProjectContentComponent::~ProjectContentComponent() { - setProject (0); - contentView = 0; + setProject (nullptr); + contentView = nullptr; jassert (getNumChildComponents() == 0); } @@ -59,22 +59,22 @@ void ProjectContentComponent::setProject (Project* newProject) { if (project != newProject) { - if (project != 0) + if (project != nullptr) project->removeChangeListener (this); - contentView = 0; - resizerBar = 0; + contentView = nullptr; + resizerBar = nullptr; - if (projectTree != 0) + if (projectTree != nullptr) { StoredSettings::getInstance()->getProps().setValue ("projectTreeviewWidth", projectTree->getWidth()); projectTree->deleteRootItem(); - projectTree = 0; + projectTree = nullptr; } project = newProject; - if (project != 0) + if (project != nullptr) { addAndMakeVisible (projectTree = new TreeView()); projectTree->setComponentID ("tree"); @@ -100,7 +100,7 @@ void ProjectContentComponent::setProject (Project* newProject) project->addChangeListener (this); - if (currentDocument == 0) + if (currentDocument == nullptr) invokeDirectly (CommandIDs::showProjectSettings, true); updateMissingFileStatuses(); @@ -115,10 +115,10 @@ void ProjectContentComponent::changeListenerCallback (ChangeBroadcaster*) void ProjectContentComponent::updateMissingFileStatuses() { - if (projectTree != 0) + if (projectTree != nullptr) { ProjectTreeViewBase* p = dynamic_cast (projectTree->getRootItem()); - if (p != 0) + if (p != nullptr) p->checkFileStatus(); } } @@ -131,7 +131,7 @@ bool ProjectContentComponent::showEditorForFile (const File& f) bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc) { - if (doc == 0) + if (doc == nullptr) return false; OpenDocumentManager::getInstance()->moveDocumentToTopOfStack (doc); @@ -146,8 +146,8 @@ void ProjectContentComponent::hideDocument (OpenDocumentManager::Document* doc) { if (doc == currentDocument) { - currentDocument = 0; - contentView = 0; + currentDocument = nullptr; + contentView = nullptr; updateMainWindowTitle(); commandManager->commandStatusChanged(); } @@ -155,7 +155,7 @@ void ProjectContentComponent::hideDocument (OpenDocumentManager::Document* doc) bool ProjectContentComponent::setEditorComponent (Component* editor, OpenDocumentManager::Document* doc) { - if (editor != 0) + if (editor != nullptr) { contentView = editor; currentDocument = doc; @@ -176,8 +176,8 @@ void ProjectContentComponent::updateMainWindowTitle() { MainWindow* mw = Component::findParentComponentOfClass ((MainWindow*) 0); - if (mw != 0) - mw->updateTitle (currentDocument != 0 ? currentDocument->getName() : String::empty); + if (mw != nullptr) + mw->updateTitle (currentDocument != nullptr ? currentDocument->getName() : String::empty); } ApplicationCommandTarget* ProjectContentComponent::getNextCommandTarget() @@ -206,7 +206,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica result.setInfo ("Save Project", "Saves the current project", CommandCategories::general, 0); - result.setActive (project != 0); + result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0)); break; @@ -214,7 +214,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica result.setInfo ("Save Project As...", "Saves the current project to a different filename", CommandCategories::general, 0); - result.setActive (project != 0); + result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); break; @@ -222,7 +222,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica result.setInfo ("Close Project", "Closes the current project", CommandCategories::general, 0); - result.setActive (project != 0); + result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('w', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); break; @@ -236,7 +236,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica #endif "Launches the project in an external IDE", CommandCategories::general, 0); - result.setActive (project != 0); + result.setActive (project != nullptr); break; case CommandIDs::saveAndOpenInIDE: @@ -249,7 +249,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica #endif "Saves the project and launches it in an external IDE", CommandCategories::general, 0); - result.setActive (project != 0); + result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier, 0)); break; @@ -257,7 +257,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica result.setInfo ("Show Project Build Settings", "Shows the build options for the project", CommandCategories::general, 0); - result.setActive (project != 0); + result.setActive (project != nullptr); result.defaultKeypresses.add (KeyPress ('i', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)); break; @@ -265,7 +265,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica result.setInfo ("Delete", String::empty, CommandCategories::general, 0); result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0)); result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0)); - result.setActive (projectTree != 0); + result.setActive (projectTree != nullptr); break; default: @@ -275,7 +275,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica bool ProjectContentComponent::isCommandActive (const CommandID commandID) { - return project != 0; + return project != nullptr; } bool ProjectContentComponent::perform (const InvocationInfo& info) @@ -283,13 +283,13 @@ bool ProjectContentComponent::perform (const InvocationInfo& info) switch (info.commandID) { case CommandIDs::saveProject: - if (project != 0) + if (project != nullptr) project->save (true, true); break; case CommandIDs::saveProjectAs: - if (project != 0) + if (project != nullptr) project->saveAsInteractive (true); break; @@ -298,14 +298,14 @@ bool ProjectContentComponent::perform (const InvocationInfo& info) { MainWindow* mw = Component::findParentComponentOfClass ((MainWindow*) 0); - if (mw != 0) + if (mw != nullptr) mw->closeCurrentProject(); } break; case CommandIDs::openInIDE: - if (project != 0) + if (project != nullptr) { ScopedPointer exporter (ProjectExporter::createPlatformDefaultExporter (*project)); exporter->launchProject(); @@ -313,7 +313,7 @@ bool ProjectContentComponent::perform (const InvocationInfo& info) break; case CommandIDs::saveAndOpenInIDE: - if (project != 0 && project->save (true, true) == FileBasedDocument::savedOk) + if (project != nullptr && project->save (true, true) == FileBasedDocument::savedOk) { ScopedPointer exporter (ProjectExporter::createPlatformDefaultExporter (*project)); exporter->launchProject(); @@ -321,16 +321,16 @@ bool ProjectContentComponent::perform (const InvocationInfo& info) break; case CommandIDs::showProjectSettings: - if (projectTree != 0) + if (projectTree != nullptr) projectTree->getRootItem()->setSelected (true, true); break; case StandardApplicationCommandIDs::del: - if (projectTree != 0) + if (projectTree != nullptr) { ProjectTreeViewBase* p = dynamic_cast (projectTree->getRootItem()); - if (p != 0) + if (p != nullptr) p->deleteAllSelectedItems(); } diff --git a/extras/Introjucer/Source/Project/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project/jucer_ProjectExport_XCode.h index be46847fec..be2c0b38ca 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project/jucer_ProjectExport_XCode.h @@ -247,8 +247,8 @@ private: const int w = image.getWidth(); const int h = image.getHeight(); - const char* type = 0; - const char* maskType = 0; + const char* type = nullptr; + const char* maskType = nullptr; if (w == h) { @@ -258,7 +258,7 @@ private: if (w == 128) { type = "it32"; maskType = "t8mk"; } } - if (type != 0) + if (type != nullptr) { data.write (type, 4); data.writeIntBigEndian (8 + 4 * w * h); @@ -975,7 +975,7 @@ private: v->setProperty ("buildConfigurations", "(" + indentList (configIDs, ",") + " )", 0); v->setProperty ("defaultConfigurationIsVisible", (int) 0, 0); - if (configsToUse[0] != 0) + if (configsToUse[0] != nullptr) v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), 0); misc.add (v); diff --git a/extras/Introjucer/Source/Project/jucer_ProjectExporter.cpp b/extras/Introjucer/Source/Project/jucer_ProjectExporter.cpp index 25877fb8dd..0e3664d9c5 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectExporter.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectExporter.cpp @@ -62,7 +62,7 @@ const StringArray ProjectExporter::getExporterNames() ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int index) { - ProjectExporter* exp = 0; + ProjectExporter* exp = nullptr; switch (index) { @@ -91,14 +91,14 @@ ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int ProjectExporter* ProjectExporter::createExporter (Project& project, const ValueTree& settings) { ProjectExporter* exp = MSVCProjectExporterVC6::createForSettings (project, settings); - if (exp == 0) exp = MSVCProjectExporterVC2005::createForSettings (project, settings); - if (exp == 0) exp = MSVCProjectExporterVC2008::createForSettings (project, settings); - if (exp == 0) exp = MSVCProjectExporterVC2010::createForSettings (project, settings); - if (exp == 0) exp = XCodeProjectExporter::createForSettings (project, settings); - if (exp == 0) exp = MakefileProjectExporter::createForSettings (project, settings); - if (exp == 0) exp = AndroidProjectExporter::createForSettings (project, settings); - - jassert (exp != 0); + if (exp == nullptr) exp = MSVCProjectExporterVC2005::createForSettings (project, settings); + if (exp == nullptr) exp = MSVCProjectExporterVC2008::createForSettings (project, settings); + if (exp == nullptr) exp = MSVCProjectExporterVC2010::createForSettings (project, settings); + if (exp == nullptr) exp = XCodeProjectExporter::createForSettings (project, settings); + if (exp == nullptr) exp = MakefileProjectExporter::createForSettings (project, settings); + if (exp == nullptr) exp = AndroidProjectExporter::createForSettings (project, settings); + + jassert (exp != nullptr); return exp; } diff --git a/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp b/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp index 2bd730f8fd..fe0d76c534 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp @@ -76,7 +76,7 @@ public: // An export tab.. ScopedPointer exp (project.createExporter (tabIndex - (2 + project.getNumConfigurations()))); - if (exp != 0) + if (exp != nullptr) exp->createPropertyEditors (props); for (int i = props.size(); --i >= 0;) @@ -241,7 +241,7 @@ void ProjectInformationComponent::rebuildConfigTabs() { ScopedPointer exp (project.createExporter (i)); - if (exp != 0) + if (exp != nullptr) { panel = new PropertiesWithHelpComponent (project, index++); configTabBox.addTab (exp->getName(), Colours::lightsteelblue, panel, true, -1); @@ -298,7 +298,7 @@ void ProjectInformationComponent::showConfigMenu() } else if (r == 1) { - project.addNewConfiguration (0); + project.addNewConfiguration (nullptr); } } @@ -313,7 +313,7 @@ void ProjectInformationComponent::showExporterMenu() { ScopedPointer exp (project.createExporter (i)); - if (exp != 0) + if (exp != nullptr) removeMenu.addItem (i + 20000, "Delete " + exp->getName()); } diff --git a/extras/Introjucer/Source/Project/jucer_ProjectSaver.h b/extras/Introjucer/Source/Project/jucer_ProjectSaver.h index 0fde6082e9..d483b4de33 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectSaver.h +++ b/extras/Introjucer/Source/Project/jucer_ProjectSaver.h @@ -102,9 +102,9 @@ private: void writeMainProjectFile() { ScopedPointer xml (project.getProjectRoot().createXml()); - jassert (xml != 0); + jassert (xml != nullptr); - if (xml != 0) + if (xml != nullptr) { #if JUCE_DEBUG { @@ -249,7 +249,7 @@ private: { ScopedPointer exporter (project.createExporter (i)); - if (exporter != 0) + if (exporter != nullptr) { paths.add (exporter->getIncludePathForFileInJuceFolder (pathFromJuceFolder, juceHeaderFile)); guards.add ("defined (" + exporter->getExporterIdentifierMacro() + ")"); diff --git a/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp b/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp index cd037ce892..298664098c 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectTreeViewBase.cpp @@ -79,7 +79,7 @@ void ProjectTreeViewBase::addFiles (const StringArray& files, int insertIndex) { ProjectTreeViewBase* p = dynamic_cast (getParentItem()); - if (p != 0) + if (p != nullptr) p->addFiles (files, insertIndex); } @@ -104,11 +104,11 @@ ProjectTreeViewBase* ProjectTreeViewBase::findTreeViewItem (const Project::Item& { ProjectTreeViewBase* pg = dynamic_cast (getSubItem(i)); - if (pg != 0) + if (pg != nullptr) { pg = pg->findTreeViewItem (itemToFind); - if (pg != 0) + if (pg != nullptr) return pg; } } @@ -130,15 +130,15 @@ void ProjectTreeViewBase::triggerAsyncRename (const Project::Item& itemToRename) void messageCallback() { - if (tree != 0) + if (tree != nullptr) { ProjectTreeViewBase* pg = dynamic_cast (tree->getRootItem()); - if (pg != 0) + if (pg != nullptr) { pg = pg->findTreeViewItem (itemToRename); - if (pg != 0) + if (pg != nullptr) pg->showRenameBox(); } } @@ -187,7 +187,7 @@ void ProjectTreeViewBase::deleteAllSelectedItems() { const ProjectTreeViewBase* const p = dynamic_cast (tree->getSelectedItem (i)); - if (p != 0) + if (p != nullptr) { itemsToRemove.add (new Project::Item (p->item)); @@ -222,9 +222,9 @@ void ProjectTreeViewBase::deleteAllSelectedItems() } ProjectTreeViewBase* treeRootItem = dynamic_cast (tree->getRootItem()); - jassert (treeRootItem != 0); + jassert (treeRootItem != nullptr); - if (treeRootItem != 0) + if (treeRootItem != nullptr) { for (i = filesToTrash.size(); --i >= 0;) { @@ -242,7 +242,7 @@ void ProjectTreeViewBase::deleteAllSelectedItems() { ProjectTreeViewBase* itemToRemove = treeRootItem->findTreeViewItem (*itemsToRemove.getUnchecked(i)); - if (itemToRemove != 0) + if (itemToRemove != nullptr) { OpenDocumentManager::getInstance()->closeFile (itemToRemove->getFile(), false); itemToRemove->deleteItem(); @@ -319,10 +319,10 @@ void ProjectTreeViewBase::getAllSelectedNodesInTree (Component* componentInTree, { TreeView* tree = dynamic_cast (componentInTree); - if (tree == 0) + if (tree == nullptr) tree = componentInTree->findParentComponentOfClass ((TreeView*) 0); - if (tree != 0) + if (tree != nullptr) { const int numSelected = tree->getNumSelectedItems(); @@ -330,7 +330,7 @@ void ProjectTreeViewBase::getAllSelectedNodesInTree (Component* componentInTree, { const ProjectTreeViewBase* const p = dynamic_cast (tree->getSelectedItem (i)); - if (p != 0) + if (p != nullptr) selectedNodes.add (new Project::Item (p->item)); } } @@ -359,7 +359,7 @@ void ProjectTreeViewBase::itemDropped (const String& sourceDescription, Componen moveSelectedItemsTo (selectedNodes, insertIndex); - if (oldOpenness != 0) + if (oldOpenness != nullptr) tree->restoreOpennessState (*oldOpenness); } } @@ -424,7 +424,7 @@ void ProjectTreeViewBase::addSubItems() { ProjectTreeViewBase* p = createSubItem (item.getChild(i)); - if (p != 0) + if (p != nullptr) addSubItem (p); } } @@ -483,7 +483,7 @@ void ProjectTreeViewBase::itemSelectionChanged (bool isNowSelected) } else { - delayedSelectionTimer = 0; + delayedSelectionTimer = nullptr; } } @@ -494,13 +494,13 @@ const String ProjectTreeViewBase::getTooltip() const String ProjectTreeViewBase::getDragSourceDescription() { - delayedSelectionTimer = 0; + delayedSelectionTimer = nullptr; return projectItemDragType; } void ProjectTreeViewBase::invokeShowDocument() { - delayedSelectionTimer = 0; + delayedSelectionTimer = nullptr; showDocument(); } @@ -514,11 +514,11 @@ ProjectContentComponent* ProjectTreeViewBase::getProjectContentComponent() const { Component* c = getOwnerView(); - while (c != 0) + while (c != nullptr) { ProjectContentComponent* pcc = dynamic_cast (c); - if (pcc != 0) + if (pcc != nullptr) return pcc; c = c->getParentComponent(); diff --git a/extras/Introjucer/Source/Project/jucer_ResourceFile.cpp b/extras/Introjucer/Source/Project/jucer_ResourceFile.cpp index 048c3afc7f..89f5961ca3 100644 --- a/extras/Introjucer/Source/Project/jucer_ResourceFile.cpp +++ b/extras/Introjucer/Source/Project/jucer_ResourceFile.cpp @@ -48,7 +48,7 @@ bool ResourceFile::isResourceFile (const File& file) { ScopedPointer in (file.createInputStream()); - if (in != 0) + if (in != nullptr) { MemoryBlock mb; in->readIntoMemoryBlock (mb, 256); @@ -167,9 +167,9 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream& const int64 dataSize = file.getSize(); ScopedPointer fileStream (file.createInputStream()); - jassert (fileStream != 0); + jassert (fileStream != nullptr); - if (fileStream != 0) + if (fileStream != nullptr) { const String variableName (variableNames[i]); const String tempVariable ("temp_" + String::toHexString (file.hashCode())); @@ -209,12 +209,12 @@ bool ResourceFile::write (const File& cppFile) ScopedPointer cppOut (tempCpp.getFile().createOutputStream (32768)); ScopedPointer hppOut (tempH.getFile().createOutputStream (32768)); - if (cppOut != 0 && hppOut != 0) + if (cppOut != nullptr && hppOut != nullptr) { if (write (cppFile, *cppOut, *hppOut)) { - cppOut = 0; - hppOut = 0; + cppOut = nullptr; + hppOut = nullptr; return (tempCpp.getFile().hasIdenticalContentTo (tempCpp.getTargetFile()) || tempCpp.overwriteTargetFileWithTemporary()) && (tempH.getFile().hasIdenticalContentTo (tempH.getTargetFile()) || tempH.overwriteTargetFileWithTemporary()); diff --git a/extras/Introjucer/Source/Project/jucer_TreeViewTypes.cpp b/extras/Introjucer/Source/Project/jucer_TreeViewTypes.cpp index 7a1f7b988f..cae7ddfcbf 100644 --- a/extras/Introjucer/Source/Project/jucer_TreeViewTypes.cpp +++ b/extras/Introjucer/Source/Project/jucer_TreeViewTypes.cpp @@ -79,7 +79,7 @@ void GroupTreeViewItem::checkFileStatus() { ProjectTreeViewBase* p = dynamic_cast (getSubItem(i)); - if (p != 0) + if (p != nullptr) p->checkFileStatus(); } } @@ -100,7 +100,7 @@ void GroupTreeViewItem::showDocument() { ProjectContentComponent* pcc = getProjectContentComponent(); - if (pcc != 0) + if (pcc != nullptr) { if (isRoot()) pcc->setEditorComponent (new ProjectInformationComponent (item.getProject()), 0); @@ -237,7 +237,7 @@ void SourceFileTreeViewItem::showDocument() ProjectContentComponent* pcc = getProjectContentComponent(); const File f (getFile()); - if (pcc != 0 && f.exists()) + if (pcc != nullptr && f.exists()) pcc->showEditorForFile (f); } @@ -247,7 +247,7 @@ void SourceFileTreeViewItem::showPopupMenu() PopupMenu m; - if (parentGroup != 0) + if (parentGroup != nullptr) { parentGroup->addCreateFileMenuItems (m); m.addSeparator(); @@ -274,7 +274,7 @@ void SourceFileTreeViewItem::showPopupMenu() case 4: triggerAsyncRename (item); break; default: - if (parentGroup != 0) + if (parentGroup != nullptr) parentGroup->processCreateFileMenuItem (res); break; diff --git a/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp b/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp index cf2d5252cf..46d9a048ee 100644 --- a/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp +++ b/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp @@ -40,7 +40,7 @@ namespace FileHelpers int64 calculateFileHashCode (const File& file) { ScopedPointer stream (file.createInputStream()); - return stream != 0 ? calculateStreamHashCode (*stream) : 0; + return stream != nullptr ? calculateStreamHashCode (*stream) : 0; } bool overwriteFileWithNewDataIfDifferent (const File& file, const void* data, int numBytes) diff --git a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp index 70833cbd04..7b3756873c 100644 --- a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp +++ b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp @@ -169,7 +169,7 @@ void autoScrollForMouseEvent (const MouseEvent& e, bool scrollX, bool scrollY) { Viewport* const viewport = e.eventComponent->findParentComponentOfClass ((Viewport*) 0); - if (viewport != 0) + if (viewport != nullptr) { const MouseEvent e2 (e.getEventRelativeTo (viewport)); viewport->autoScroll (scrollX ? e2.x : 20, scrollY ? e2.y : 20, 8, 16); @@ -235,7 +235,7 @@ int indexOfLineStartingWith (const StringArray& lines, const String& text, int s //============================================================================== PropertyPanelWithTooltips::PropertyPanelWithTooltips() - : lastComp (0) + : lastComp (nullptr) { addAndMakeVisible (&panel); startTimer (150); @@ -270,8 +270,8 @@ void PropertyPanelWithTooltips::timerCallback() { Component* newComp = Desktop::getInstance().getMainMouseSource().getComponentUnderMouse(); - if (newComp != 0 && newComp->getTopLevelComponent() != getTopLevelComponent()) - newComp = 0; + if (newComp != nullptr && newComp->getTopLevelComponent() != getTopLevelComponent()) + newComp = nullptr; if (newComp != lastComp) { @@ -289,10 +289,10 @@ void PropertyPanelWithTooltips::timerCallback() const String PropertyPanelWithTooltips::findTip (Component* c) { - while (c != 0 && c != this) + while (c != nullptr && c != this) { TooltipClient* const tc = dynamic_cast (c); - if (tc != 0) + if (tc != nullptr) { const String tip (tc->getTooltip()); @@ -315,7 +315,7 @@ FloatingLabelComponent::FloatingLabelComponent() void FloatingLabelComponent::remove() { - if (getParentComponent() != 0) + if (getParentComponent() != nullptr) getParentComponent()->removeChildComponent (this); } diff --git a/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp b/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp index 7f27b76e90..39962cce2d 100644 --- a/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp +++ b/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp @@ -29,7 +29,6 @@ //============================================================================== StoredSettings::StoredSettings() - : props (0) { flush(); } @@ -37,7 +36,7 @@ StoredSettings::StoredSettings() StoredSettings::~StoredSettings() { flush(); - props = 0; + props = nullptr; clearSingletonInstance(); } @@ -47,28 +46,28 @@ juce_ImplementSingleton (StoredSettings); //============================================================================== PropertiesFile& StoredSettings::getProps() { - jassert (props != 0); + jassert (props != nullptr); return *props; } void StoredSettings::flush() { - if (props != 0) + if (props != nullptr) { props->setValue ("recentFiles", recentFiles.toString()); props->removeValue ("keyMappings"); - if (commandManager != 0) + if (commandManager != nullptr) { ScopedPointer keys (commandManager->getKeyMappings()->createXml (true)); - if (keys != 0) + if (keys != nullptr) props->setValue ("keyMappings", (XmlElement*) keys); } } - props = 0; + props = nullptr; props = PropertiesFile::createDefaultAppPropertiesFile ("Jucer2", "settings", String::empty, false, 3000, PropertiesFile::storeAsXML); @@ -155,7 +154,7 @@ const Image StoredSettings::getFallbackImage() const Drawable* StoredSettings::getImageFileIcon() { - if (imageFileIcon == 0) + if (imageFileIcon == nullptr) { static const unsigned char data[] = { 120,218,197,90,75,111,28,199,17,158,181,60,146,98,36,135,28,98,58,185,100,175,1,164,65,87,117,87,63,142,74,156,228,34,3,129,125,80,146,27,37,46,229,141,41,238,130,92,37,240,191,207,87,61,59,195,158,215,138,176,44,154,132,128,209,246,199,154,238,122,126, diff --git a/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm b/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm index 62799e4cca..d81d923fed 100644 --- a/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm +++ b/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm @@ -146,7 +146,7 @@ public: } juceFilter = createPluginFilter(); - jassert (juceFilter != 0); + jassert (juceFilter != nullptr); juceFilter->setPlayHead (this); juceFilter->addListener (this); @@ -166,7 +166,7 @@ public: for (int i = activeUIs.size(); --i >= 0;) [((JuceUIViewClass*) activeUIs.getUnchecked(i)) filterBeingDeleted: this]; - juceFilter = 0; + juceFilter = nullptr; jassert (activePlugins.contains (this)); activePlugins.removeValue (this); @@ -234,7 +234,7 @@ public: } else if (inID == kAudioUnitProperty_OfflineRender) { - *(UInt32*) outData = (juceFilter != 0 && juceFilter->isNonRealtime()) ? 1 : 0; + *(UInt32*) outData = (juceFilter != nullptr && juceFilter->isNonRealtime()) ? 1 : 0; return noErr; } else if (inID == kMusicDeviceProperty_InstrumentCount) @@ -276,7 +276,7 @@ public: { if (inScope == kAudioUnitScope_Global && inID == kAudioUnitProperty_OfflineRender) { - if (juceFilter != 0) + if (juceFilter != nullptr) juceFilter->setNonRealtime ((*(UInt32*) inData) != 0); return noErr; @@ -296,7 +296,7 @@ public: CFMutableDictionaryRef dict = (CFMutableDictionaryRef) *outData; - if (juceFilter != 0) + if (juceFilter != nullptr) { MemoryBlock state; juceFilter->getCurrentProgramStateInformation (state); @@ -319,7 +319,7 @@ public: if (err != noErr) return err; - if (juceFilter != 0) + if (juceFilter != nullptr) { CFDictionaryRef dict = (CFDictionaryRef) inData; CFDataRef data = 0; @@ -346,7 +346,7 @@ public: // value in your JucePluginCharacteristics.h file.. jassert (numChannelConfigs > 0); - if (outInfo != 0) + if (outInfo != nullptr) { *outInfo = channelInfo; @@ -372,7 +372,7 @@ public: const int index = (int) inParameterID; if (inScope == kAudioUnitScope_Global - && juceFilter != 0 + && juceFilter != nullptr && index < juceFilter->getNumParameters()) { outParameterInfo.flags = kAudioUnitParameterFlag_IsWritable @@ -410,7 +410,7 @@ public: AudioUnitElement inElement, Float32& outValue) { - if (inScope == kAudioUnitScope_Global && juceFilter != 0) + if (inScope == kAudioUnitScope_Global && juceFilter != nullptr) { outValue = juceFilter->getParameter ((int) inID); return noErr; @@ -425,7 +425,7 @@ public: Float32 inValue, UInt32 inBufferOffsetInFrames) { - if (inScope == kAudioUnitScope_Global && juceFilter != 0) + if (inScope == kAudioUnitScope_Global && juceFilter != nullptr) { juceFilter->setParameter ((int) inID, inValue); return noErr; @@ -594,7 +594,7 @@ public: { JuceAUBaseClass::Cleanup(); - if (juceFilter != 0) + if (juceFilter != nullptr) juceFilter->releaseResources(); bufferSpace.setSize (2, 16); @@ -608,7 +608,7 @@ public: if (! prepared) prepareToPlay(); - if (juceFilter != 0) + if (juceFilter != nullptr) juceFilter->reset(); return JuceAUBaseClass::Reset (inScope, inElement); @@ -616,7 +616,7 @@ public: void prepareToPlay() { - if (juceFilter != 0) + if (juceFilter != nullptr) { juceFilter->setPlayConfigDetails ( #if ! JucePlugin_IsSynth @@ -667,7 +667,7 @@ public: AudioBufferList& outBuffer, UInt32 numSamples) { - if (juceFilter != 0) + if (juceFilter != nullptr) { jassert (prepared); @@ -856,7 +856,7 @@ protected: //============================================================================== ComponentResult GetPresets (CFArrayRef* outData) const { - if (outData != 0) + if (outData != nullptr) { const int numPrograms = juceFilter->getNumPrograms(); presetsArray.ensureSize (sizeof (AUPreset) * numPrograms, true); @@ -950,7 +950,7 @@ public: { Component* editor = getChildComponent(0); - if (editor != 0) + if (editor != nullptr) { const int w = jmax (32, editor->getWidth()); const int h = jmax (32, editor->getHeight()); @@ -1017,7 +1017,7 @@ private: { // there's some kind of component currently modal, but the host // is trying to delete our plugin.. - jassert (Component::getCurrentlyModalComponent() == 0); + jassert (Component::getCurrentlyModalComponent() == nullptr); [[NSNotificationCenter defaultCenter] removeObserver: self]; [self deleteEditor]; @@ -1030,11 +1030,11 @@ private: - (void) viewDidMoveToWindow { - if ([self window] != 0) + if ([self window] != nil) { [[self window] setAcceptsMouseMovedEvents: YES]; - if (editorComp != 0) + if (editorComp != nullptr) [[self window] makeFirstResponder: (NSView*) editorComp->getWindowHandle()]; } } @@ -1046,16 +1046,16 @@ private: - (void) deleteEditor { - if (editorComp != 0) + if (editorComp != nullptr) { - if (editorComp->getChildComponent(0) != 0) + if (editorComp->getChildComponent(0) != nullptr) if (activePlugins.contains ((void*) au)) // plugin may have been deleted before the UI filter->editorBeingDeleted ((AudioProcessorEditor*) editorComp->getChildComponent(0)); deleteAndZero (editorComp); } - editorComp = 0; + editorComp = nullptr; } - (void) filterBeingDeleted: (JuceAU*) au_ @@ -1106,12 +1106,12 @@ private: AudioProcessor* filter = (AudioProcessor*) pointers[0]; JuceAU* au = (JuceAU*) pointers[1]; - if (filter == 0) + if (filter == nullptr) return 0; AudioProcessorEditor* editorComp = filter->createEditorIfNeeded(); - if (editorComp == 0) + if (editorComp == nullptr) return 0; return [[[JuceUIViewClass alloc] initWithFilter: filter @@ -1129,7 +1129,7 @@ class JuceAUView : public AUCarbonViewBase public: JuceAUView (AudioUnitCarbonView auview) : AUCarbonViewBase (auview), - juceFilter (0) + juceFilter (nullptr) { } @@ -1142,7 +1142,7 @@ public: { JUCE_AUTORELEASEPOOL - if (juceFilter == 0) + if (juceFilter == nullptr) { void* pointers[2]; UInt32 propertySize = sizeof (pointers); @@ -1157,7 +1157,7 @@ public: juceFilter = (AudioProcessor*) pointers[0]; } - if (juceFilter != 0) + if (juceFilter != nullptr) { deleteUI(); @@ -1184,7 +1184,7 @@ private: void deleteUI() { - if (windowComp != 0) + if (windowComp != nullptr) { PopupMenu::dismissAllActiveMenus(); @@ -1195,12 +1195,12 @@ private: will be performed on completion. (Note that this assertion could actually trigger a false alarm even if you're doing it correctly, but is here to catch people who aren't so careful) */ - jassert (Component::getCurrentlyModalComponent() == 0); + jassert (Component::getCurrentlyModalComponent() == nullptr); - if (windowComp != 0 && windowComp->getChildComponent(0) != 0) + if (windowComp != nullptr && windowComp->getChildComponent(0) != nullptr) juceFilter->editorBeingDeleted ((AudioProcessorEditor*) windowComp->getChildComponent(0)); - windowComp = 0; + windowComp = nullptr; } } @@ -1217,7 +1217,7 @@ private: { JUCE_AUTORELEASEPOOL - jassert (editor_ != 0); + jassert (editor_ != nullptr); addAndMakeVisible (&editor); setOpaque (true); setVisible (true); @@ -1299,7 +1299,7 @@ private: void resized() { Component* const child = getChildComponent (0); - if (child != 0) + if (child != nullptr) child->setBounds (getLocalBounds()); } diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp b/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp index 858a097bf1..7c9714b85e 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp @@ -161,8 +161,8 @@ public: if (mLoggedIn) MIDILogOut(); - midiBufferNode = 0; - midiTransport = 0; + midiBufferNode = nullptr; + midiTransport = nullptr; if (prepared) juceFilter->releaseResources(); @@ -172,11 +172,11 @@ public: if (--numInstances == 0) { -#if JUCE_MAC + #if JUCE_MAC // Hack to allow any NSWindows to clear themselves up before returning to PT.. for (int i = 20; --i >= 0;) MessageManager::getInstance()->runDispatchLoopUntil (1); -#endif + #endif shutdownJuce_GUI(); } @@ -204,10 +204,10 @@ public: //============================================================================== void updateSize() { - if (editorComp == 0) + if (editorComp == nullptr) { editorComp = filter->createEditorIfNeeded(); - jassert (editorComp != 0); + jassert (editorComp != nullptr); } if (editorComp->getWidth() != 0 && editorComp->getHeight() != 0) @@ -251,7 +251,7 @@ public: #else void* const hostWindow = (void*) GetWindowFromPort (port); #endif - wrapper = 0; + wrapper = nullptr; wrapper = new EditorCompWrapper (hostWindow, editorComp, this); process->touchAllParameters(); @@ -265,11 +265,11 @@ public: void DrawContents (Rect*) { #if JUCE_WINDOWS - if (wrapper != 0) + if (wrapper != nullptr) { ComponentPeer* const peer = wrapper->getPeer(); - if (peer != 0) + if (peer != nullptr) { // (seems to be required in PT6.4, but not in 7.x) peer->repaint (wrapper->getLocalBounds()); @@ -289,19 +289,19 @@ public: void deleteEditorComp() { - if (editorComp != 0 || wrapper != 0) + if (editorComp != 0 || wrapper != nullptr) { JUCE_AUTORELEASEPOOL PopupMenu::dismissAllActiveMenus(); JUCE_NAMESPACE::Component* const modalComponent = JUCE_NAMESPACE::Component::getCurrentlyModalComponent(); - if (modalComponent != 0) + if (modalComponent != nullptr) modalComponent->exitModalState (0); filter->editorBeingDeleted (editorComp); - editorComp = 0; - wrapper = 0; + editorComp = nullptr; + wrapper = nullptr; } } @@ -363,7 +363,7 @@ public: { JUCE_NAMESPACE::Component* const c = getChildComponent (0); - if (c != 0) + if (c != nullptr) c->setBounds (0, 0, getWidth(), getHeight()); repaint(); @@ -421,7 +421,7 @@ public: void GetViewRect (Rect* size) { - if (getView() != 0) + if (getView() != nullptr) getView()->updateSize(); CEffectProcessRTAS::GetViewRect (size); @@ -436,7 +436,7 @@ public: { CEffectProcessRTAS::SetViewPort (port); - if (getView() != 0) + if (getView() != nullptr) getView()->attachToWindow (port); } @@ -444,8 +444,8 @@ public: protected: ComponentResult GetDelaySamplesLong (long* aNumSamples) { - if (aNumSamples != 0) - *aNumSamples = juceFilter != 0 ? juceFilter->getLatencySamples() : 0; + if (aNumSamples != nullptr) + *aNumSamples = juceFilter != nullptr ? juceFilter->getLatencySamples() : 0; return noErr; } @@ -472,7 +472,7 @@ protected: #if JucePlugin_WantsMidiInput CEffectType* const type = dynamic_cast (this->GetProcessType()); - if (type != 0) + if (type != nullptr) { char nodeName [64]; type->GetProcessTypeName (63, nodeName); @@ -832,12 +832,12 @@ private: bool prepared; double sampleRate; - static float longToFloat (const long n) throw() + static float longToFloat (const long n) noexcept { return (float) ((((double) n) + (double) 0x80000000) / (double) 0xffffffff); } - static long floatToLong (const float n) throw() + static long floatToLong (const float n) noexcept { return roundToInt (jlimit (-(double) 0x80000000, (double) 0x7fffffff, n * (double) 0xffffffff - (double) 0x80000000)); @@ -992,7 +992,7 @@ private: + String (JucePlugin_Name).substring (0, 4); } - static EPlugIn_StemFormat getFormatForChans (const int numChans) throw() + static EPlugIn_StemFormat getFormatForChans (const int numChans) noexcept { switch (numChans) { diff --git a/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp b/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp index b6f55f4add..4e71f875bc 100644 --- a/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp +++ b/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp @@ -38,7 +38,7 @@ AudioFilterStreamingDeviceManager::AudioFilterStreamingDeviceManager() AudioFilterStreamingDeviceManager::~AudioFilterStreamingDeviceManager() { - setFilter (0); + setFilter (nullptr); removeMidiInputCallback (String::empty, player); removeAudioCallback (player); diff --git a/extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp b/extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp index cce8e215f4..64a9d90f2f 100644 --- a/extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp +++ b/extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp @@ -51,7 +51,7 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title, { filter = createPluginFilter(); - if (filter != 0) + if (filter != nullptr) { filter->setPlayConfigDetails (JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels, @@ -64,7 +64,7 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title, ScopedPointer savedState; - if (globalSettings != 0) + if (globalSettings != nullptr) savedState = globalSettings->getXmlValue ("audioSetup"); deviceManager->initialise (filter->getNumInputChannels(), @@ -72,7 +72,7 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title, savedState, true); - if (globalSettings != 0) + if (globalSettings != nullptr) { MemoryBlock data; @@ -96,7 +96,7 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title, } JUCE_CATCH_ALL - if (deviceManager == 0) + if (deviceManager == nullptr) { jassertfalse // Your filter didn't create correctly! In a standalone app that's not too great. JUCEApplication::quit(); @@ -107,18 +107,21 @@ StandaloneFilterWindow::~StandaloneFilterWindow() { PropertySet* const globalSettings = getGlobalSettings(); - globalSettings->setValue ("windowX", getX()); - globalSettings->setValue ("windowY", getY()); - - if (globalSettings != 0 && deviceManager != 0) + if (globalSettings != nullptr) { - ScopedPointer xml (deviceManager->createStateXml()); - globalSettings->setValue ("audioSetup", xml); + globalSettings->setValue ("windowX", getX()); + globalSettings->setValue ("windowY", getY()); + + if (deviceManager != nullptr) + { + ScopedPointer xml (deviceManager->createStateXml()); + globalSettings->setValue ("audioSetup", xml); + } } - deviceManager = 0; + deviceManager = nullptr; - if (globalSettings != 0 && filter != 0) + if (globalSettings != nullptr && filter != nullptr) { MemoryBlock data; filter->getStateInformation (data); @@ -132,16 +135,16 @@ StandaloneFilterWindow::~StandaloneFilterWindow() //============================================================================== void StandaloneFilterWindow::deleteFilter() { - if (deviceManager != 0) - deviceManager->setFilter (0); + if (deviceManager != nullptr) + deviceManager->setFilter (nullptr); - if (filter != 0 && getContentComponent() != 0) + if (filter != nullptr && getContentComponent() != nullptr) { filter->editorBeingDeleted (dynamic_cast (getContentComponent())); clearContentComponent(); } - filter = 0; + filter = nullptr; } void StandaloneFilterWindow::resetFilter() @@ -150,9 +153,9 @@ void StandaloneFilterWindow::resetFilter() filter = createPluginFilter(); - if (filter != 0) + if (filter != nullptr) { - if (deviceManager != 0) + if (deviceManager != nullptr) deviceManager->setFilter (filter); setContentOwned (filter->createEditorIfNeeded(), true); @@ -160,7 +163,7 @@ void StandaloneFilterWindow::resetFilter() PropertySet* const globalSettings = getGlobalSettings(); - if (globalSettings != 0) + if (globalSettings != nullptr) globalSettings->removeValue ("filterState"); } @@ -170,8 +173,8 @@ void StandaloneFilterWindow::saveState() PropertySet* const globalSettings = getGlobalSettings(); FileChooser fc (TRANS("Save current state"), - globalSettings != 0 ? File (globalSettings->getValue ("lastStateFile")) - : File::nonexistent); + globalSettings != nullptr ? File (globalSettings->getValue ("lastStateFile")) + : File::nonexistent); if (fc.browseForFileToSave (true)) { @@ -192,8 +195,8 @@ void StandaloneFilterWindow::loadState() PropertySet* const globalSettings = getGlobalSettings(); FileChooser fc (TRANS("Load a saved state"), - globalSettings != 0 ? File (globalSettings->getValue ("lastStateFile")) - : File::nonexistent); + globalSettings != nullptr ? File (globalSettings->getValue ("lastStateFile")) + : File::nonexistent); if (fc.browseForFileToOpen()) { @@ -255,7 +258,7 @@ void StandaloneFilterWindow::resized() void StandaloneFilterWindow::buttonClicked (Button*) { - if (filter == 0) + if (filter == nullptr) return; PopupMenu m; diff --git a/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp b/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp index a7fc0c3849..63f13c07ee 100644 --- a/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp +++ b/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp @@ -229,7 +229,7 @@ namespace Component* const comp = Desktop::getInstance().findComponentAt (Point (hs.pt.x, hs.pt.y)); - if (comp != 0 && comp->getWindowHandle() != 0) + if (comp != nullptr && comp->getWindowHandle() != 0) return PostMessage ((HWND) comp->getWindowHandle(), WM_MOUSEWHEEL, hs.mouseData & 0xffff0000, (hs.pt.x & 0xffff) | (hs.pt.y << 16)); } @@ -472,7 +472,7 @@ public: bool getInputProperties (VstInt32 index, VstPinProperties* properties) { - if (filter == 0 || index >= JucePlugin_MaxNumInputChannels) + if (filter == nullptr || index >= JucePlugin_MaxNumInputChannels) return false; setPinProperties (*properties, filter->getInputChannelName ((int) index), @@ -482,7 +482,7 @@ public: bool getOutputProperties (VstInt32 index, VstPinProperties* properties) { - if (filter == 0 || index >= JucePlugin_MaxNumOutputChannels) + if (filter == nullptr || index >= JucePlugin_MaxNumOutputChannels) return false; setPinProperties (*properties, filter->getOutputChannelName ((int) index), @@ -668,7 +668,7 @@ public: void resume() { - if (filter != 0) + if (filter != nullptr) { isProcessing = true; channels.calloc (numInChans + numOutChans); @@ -709,7 +709,7 @@ public: void suspend() { - if (filter != 0) + if (filter != nullptr) { AudioEffectX::suspend(); @@ -728,7 +728,7 @@ public: const VstTimeInfo* const ti = getTimeInfo (kVstPpqPosValid | kVstTempoValid | kVstBarsValid //| kVstCyclePosValid | kVstTimeSigValid | kVstSmpteValid | kVstClockValid); - if (ti == 0 || ti->sampleRate <= 0) + if (ti == nullptr || ti->sampleRate <= 0) return false; info.bpm = (ti->flags & kVstTempoValid) != 0 ? ti->tempo : 0.0; @@ -791,30 +791,30 @@ public: //============================================================================== VstInt32 getProgram() { - return filter != 0 ? filter->getCurrentProgram() : 0; + return filter != nullptr ? filter->getCurrentProgram() : 0; } void setProgram (VstInt32 program) { - if (filter != 0) + if (filter != nullptr) filter->setCurrentProgram (program); } void setProgramName (char* name) { - if (filter != 0) + if (filter != nullptr) filter->changeProgramName (filter->getCurrentProgram(), name); } void getProgramName (char* name) { - if (filter != 0) + if (filter != nullptr) filter->getProgramName (filter->getCurrentProgram()).copyToUTF8 (name, 24); } bool getProgramNameIndexed (VstInt32 /*category*/, VstInt32 index, char* text) { - if (filter != 0 && isPositiveAndBelow (index, filter->getNumPrograms())) + if (filter != nullptr && isPositiveAndBelow (index, filter->getNumPrograms())) { filter->getProgramName (index).copyToUTF8 (text, 24); return true; @@ -826,7 +826,7 @@ public: //============================================================================== float getParameter (VstInt32 index) { - if (filter == 0) + if (filter == nullptr) return 0.0f; jassert (isPositiveAndBelow (index, filter->getNumParameters())); @@ -835,7 +835,7 @@ public: void setParameter (VstInt32 index, float value) { - if (filter != 0) + if (filter != nullptr) { jassert (isPositiveAndBelow (index, filter->getNumParameters())); filter->setParameter (index, value); @@ -844,7 +844,7 @@ public: void getParameterDisplay (VstInt32 index, char* text) { - if (filter != 0) + if (filter != nullptr) { jassert (isPositiveAndBelow (index, filter->getNumParameters())); filter->getParameterText (index).copyToUTF8 (text, 24); // length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more. @@ -853,7 +853,7 @@ public: void getParameterName (VstInt32 index, char* text) { - if (filter != 0) + if (filter != nullptr) { jassert (isPositiveAndBelow (index, filter->getNumParameters())); filter->getParameterName (index).copyToUTF8 (text, 16); // length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more. @@ -875,13 +875,13 @@ public: bool canParameterBeAutomated (VstInt32 index) { - return filter != 0 && filter->isParameterAutomatable ((int) index); + return filter != nullptr && filter->isParameterAutomatable ((int) index); } class ChannelConfigComparator { public: - static int compareElements (const short* const first, const short* const second) throw() + static int compareElements (const short* const first, const short* const second) noexcept { if (first[0] < second[0]) return -1; else if (first[0] > second[0]) return 1; @@ -929,7 +929,7 @@ public: //============================================================================== VstInt32 getChunk (void** data, bool onlyStoreCurrentProgramData) { - if (filter == 0) + if (filter == nullptr) return 0; chunkMemory.setSize (0); @@ -949,13 +949,13 @@ public: VstInt32 setChunk (void* data, VstInt32 byteSize, bool onlyRestoreCurrentProgramData) { - if (filter == 0) + if (filter == nullptr) return 0; chunkMemory.setSize (0); chunkMemoryTime = 0; - if (byteSize > 0 && data != 0) + if (byteSize > 0 && data != nullptr) { if (onlyRestoreCurrentProgramData) filter->setCurrentProgramStateInformation (data, byteSize); @@ -996,7 +996,7 @@ public: { const JUCE_NAMESPACE::uint32 now = JUCE_NAMESPACE::Time::getMillisecondCounter(); - if (now > lastMasterIdleCall + 20 && editorComp != 0) + if (now > lastMasterIdleCall + 20 && editorComp != nullptr) { lastMasterIdleCall = now; @@ -1027,14 +1027,14 @@ public: void createEditorComp() { - if (hasShutdown || filter == 0) + if (hasShutdown || filter == nullptr) return; - if (editorComp == 0) + if (editorComp == nullptr) { AudioProcessorEditor* const ed = filter->createEditorIfNeeded(); - if (ed != 0) + if (ed != nullptr) { cEffect.flags |= effFlagsHasEditor; ed->setOpaque (true); @@ -1059,10 +1059,10 @@ public: jassert (! recursionCheck); recursionCheck = true; - if (editorComp != 0) + if (editorComp != nullptr) { Component* const modalComponent = Component::getCurrentlyModalComponent(); - if (modalComponent != 0) + if (modalComponent != nullptr) { modalComponent->exitModalState (0); @@ -1084,11 +1084,11 @@ public: filter->editorBeingDeleted (editorComp->getEditorComp()); - editorComp = 0; + editorComp = nullptr; // there's some kind of component currently modal, but the host // is trying to delete our plugin. You should try to avoid this happening.. - jassert (Component::getCurrentlyModalComponent() == 0); + jassert (Component::getCurrentlyModalComponent() == nullptr); } #if JUCE_LINUX @@ -1119,7 +1119,7 @@ public: deleteEditor (true); createEditorComp(); - if (editorComp != 0) + if (editorComp != nullptr) { editorComp->setOpaque (true); editorComp->setVisible (false); @@ -1153,7 +1153,7 @@ public: const MessageManagerLock mmLock; createEditorComp(); - if (editorComp != 0) + if (editorComp != nullptr) { editorSize.left = 0; editorSize.top = 0; @@ -1175,7 +1175,7 @@ public: void resizeHostWindow (int newWidth, int newHeight) { - if (editorComp != 0) + if (editorComp != nullptr) { if (! (canHostDo (const_cast ("sizeWindow")) && sizeWindow (newWidth, newHeight))) { @@ -1232,7 +1232,7 @@ public: #endif } - if (editorComp->getPeer() != 0) + if (editorComp->getPeer() != nullptr) editorComp->getPeer()->handleMovedOrResized(); } } @@ -1308,7 +1308,7 @@ public: { Component* const editor = getChildComponent(0); - if (editor != 0) + if (editor != nullptr) editor->setBounds (getLocalBounds()); } @@ -1428,7 +1428,7 @@ private: tempChannels.clear(); - if (filter != 0) + if (filter != nullptr) tempChannels.insertMultiple (0, 0, filter->getNumInputChannels() + filter->getNumOutputChannels()); } @@ -1460,7 +1460,7 @@ namespace AudioProcessor* const filter = createPluginFilter(); - if (filter != 0) + if (filter != nullptr) { JuceVSTWrapper* const wrapper = new JuceVSTWrapper (audioMaster, filter); return wrapper->getAeffect(); diff --git a/extras/audio plugins/wrapper/juce_PluginHeaders.h b/extras/audio plugins/wrapper/juce_PluginHeaders.h index d45b9c1c62..ac2b44d328 100644 --- a/extras/audio plugins/wrapper/juce_PluginHeaders.h +++ b/extras/audio plugins/wrapper/juce_PluginHeaders.h @@ -54,11 +54,11 @@ public: { Component* comp = Desktop::getInstance().findComponentAt (screenPos); - if (comp != 0) + if (comp != nullptr) { ComponentPeer* const peer = comp->getPeer(); - if (peer != 0 && ! peer->isFocused()) + if (peer != nullptr && ! peer->isFocused()) peer->handleMouseEvent (0, screenPos - peer->getScreenPosition(), mods, Time::currentTimeMillis()); } } diff --git a/extras/audio plugins/wrapper/juce_PluginHostType.h b/extras/audio plugins/wrapper/juce_PluginHostType.h index 7af6c4cf37..1f824d5f85 100644 --- a/extras/audio plugins/wrapper/juce_PluginHostType.h +++ b/extras/audio plugins/wrapper/juce_PluginHostType.h @@ -66,62 +66,62 @@ public: const HostType type; //============================================================================== - bool isAbletonLive() const throw() + bool isAbletonLive() const noexcept { return type == AbletonLive6 || type == AbletonLive7 || type == AbletonLive8 || type == AbletonLiveGeneric; } - bool isCubase() const throw() + bool isCubase() const noexcept { return type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase5Bridged || type == SteinbergCubaseGeneric; } - bool isCubaseBridged() const throw() + bool isCubaseBridged() const noexcept { return type == SteinbergCubase5Bridged; } - bool isTracktion() const throw() + bool isTracktion() const noexcept { return type == MackieTracktion3 || type == MackieTracktionGeneric; } - bool isSonar() const throw() + bool isSonar() const noexcept { return type == CakewalkSonar8 || type == CakewalkSonarGeneric; } - bool isWavelab() const throw() + bool isWavelab() const noexcept { return type == SteinbergWavelab5 || type == SteinbergWavelab6 || type == SteinbergWavelab7 || type == SteinbergWavelabGeneric; } - bool isWavelabLegacy() const throw() + bool isWavelabLegacy() const noexcept { return type == SteinbergWavelab5 || type == SteinbergWavelab6; } - bool isPremiere() const throw() + bool isPremiere() const noexcept { return type == AdobePremierePro; } - bool isLogic() const throw() + bool isLogic() const noexcept { return type == AppleLogic || type == EmagicLogic; } - bool isReceptor() const throw() + bool isReceptor() const noexcept { return type == MuseReceptorGeneric; } - bool isSamplitude() const throw() + bool isSamplitude() const noexcept { return type == MagixSamplitude; } - bool isFruityLoops() const throw() + bool isFruityLoops() const noexcept { return type == FruityLoops; } diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 99e8bd1794..10fd317316 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -1100,7 +1100,7 @@ public: startTimer (50); setSize (w, h); - if (getParentComponent() != 0) + if (getParentComponent() != nullptr) getParentComponent()->setSize (w, h); } else @@ -1293,9 +1293,9 @@ void FileLogger::trimFileSize (int maxFileSizeBytes) const if (fileSize > maxFileSizeBytes) { ScopedPointer in (logFile.createInputStream()); - jassert (in != 0); + jassert (in != nullptr); - if (in != 0) + if (in != nullptr) { in->setPosition (fileSize - maxFileSizeBytes); String content; @@ -1306,7 +1306,7 @@ void FileLogger::trimFileSize (int maxFileSizeBytes) const contentToSave.fillWith (0); in->read (contentToSave.getData(), maxFileSizeBytes); - in = 0; + in = nullptr; content = contentToSave.toString(); } @@ -1364,7 +1364,7 @@ Logger::~Logger() { } -Logger* Logger::currentLogger = 0; +Logger* Logger::currentLogger = nullptr; void Logger::setCurrentLogger (Logger* const newLogger, const bool deleteOldLogger) @@ -1378,14 +1378,14 @@ void Logger::setCurrentLogger (Logger* const newLogger, void Logger::writeToLog (const String& message) { - if (currentLogger != 0) + if (currentLogger != nullptr) currentLogger->logMessage (message); else outputDebugString (message); } #if JUCE_LOG_ASSERTIONS -void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) throw() +void JUCE_API juce_LogAssertion (const char* filename, const int lineNum) noexcept { String m ("JUCE Assertion failure in "); m << filename << ", line " << lineNum; @@ -1401,21 +1401,21 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_Random.cpp ***/ BEGIN_JUCE_NAMESPACE -Random::Random (const int64 seedValue) throw() +Random::Random (const int64 seedValue) noexcept : seed (seedValue) { } -Random::~Random() throw() +Random::~Random() noexcept { } -void Random::setSeed (const int64 newSeed) throw() +void Random::setSeed (const int64 newSeed) noexcept { seed = newSeed; } -void Random::combineSeed (const int64 seedValue) throw() +void Random::combineSeed (const int64 seedValue) noexcept { seed ^= nextInt64() ^ seedValue; } @@ -1429,35 +1429,35 @@ void Random::setSeedRandomly() combineSeed (Time::currentTimeMillis()); } -int Random::nextInt() throw() +int Random::nextInt() noexcept { seed = (seed * literal64bit (0x5deece66d) + 11) & literal64bit (0xffffffffffff); return (int) (seed >> 16); } -int Random::nextInt (const int maxValue) throw() +int Random::nextInt (const int maxValue) noexcept { jassert (maxValue > 0); return (nextInt() & 0x7fffffff) % maxValue; } -int64 Random::nextInt64() throw() +int64 Random::nextInt64() noexcept { return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt(); } -bool Random::nextBool() throw() +bool Random::nextBool() noexcept { return (nextInt() & 0x80000000) != 0; } -float Random::nextFloat() throw() +float Random::nextFloat() noexcept { return static_cast (nextInt()) / (float) 0xffffffff; } -double Random::nextDouble() throw() +double Random::nextDouble() noexcept { return static_cast (nextInt()) / (double) 0xffffffff; } @@ -1496,7 +1496,7 @@ void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numB arrayToChange.setBit (startBit + numBits, nextBool()); } -Random& Random::getSystemRandom() throw() +Random& Random::getSystemRandom() noexcept { static Random sysRand (1); return sysRand; @@ -1509,32 +1509,32 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_RelativeTime.cpp ***/ BEGIN_JUCE_NAMESPACE -RelativeTime::RelativeTime (const double seconds_) throw() +RelativeTime::RelativeTime (const double seconds_) noexcept : seconds (seconds_) { } -RelativeTime::RelativeTime (const RelativeTime& other) throw() +RelativeTime::RelativeTime (const RelativeTime& other) noexcept : seconds (other.seconds) { } -RelativeTime::~RelativeTime() throw() +RelativeTime::~RelativeTime() noexcept { } -const RelativeTime RelativeTime::milliseconds (const int milliseconds) throw() { return RelativeTime (milliseconds * 0.001); } -const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) throw() { return RelativeTime (milliseconds * 0.001); } -const RelativeTime RelativeTime::minutes (const double numberOfMinutes) throw() { return RelativeTime (numberOfMinutes * 60.0); } -const RelativeTime RelativeTime::hours (const double numberOfHours) throw() { return RelativeTime (numberOfHours * (60.0 * 60.0)); } -const RelativeTime RelativeTime::days (const double numberOfDays) throw() { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); } -const RelativeTime RelativeTime::weeks (const double numberOfWeeks) throw() { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); } +const RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } +const RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } +const RelativeTime RelativeTime::minutes (const double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); } +const RelativeTime RelativeTime::hours (const double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); } +const RelativeTime RelativeTime::days (const double numberOfDays) noexcept { return RelativeTime (numberOfDays * (60.0 * 60.0 * 24.0)); } +const RelativeTime RelativeTime::weeks (const double numberOfWeeks) noexcept { return RelativeTime (numberOfWeeks * (60.0 * 60.0 * 24.0 * 7.0)); } -int64 RelativeTime::inMilliseconds() const throw() { return (int64) (seconds * 1000.0); } -double RelativeTime::inMinutes() const throw() { return seconds / 60.0; } -double RelativeTime::inHours() const throw() { return seconds / (60.0 * 60.0); } -double RelativeTime::inDays() const throw() { return seconds / (60.0 * 60.0 * 24.0); } -double RelativeTime::inWeeks() const throw() { return seconds / (60.0 * 60.0 * 24.0 * 7.0); } +int64 RelativeTime::inMilliseconds() const noexcept { return (int64) (seconds * 1000.0); } +double RelativeTime::inMinutes() const noexcept { return seconds / 60.0; } +double RelativeTime::inHours() const noexcept { return seconds / (60.0 * 60.0); } +double RelativeTime::inDays() const noexcept { return seconds / (60.0 * 60.0 * 24.0); } +double RelativeTime::inWeeks() const noexcept { return seconds / (60.0 * 60.0 * 24.0 * 7.0); } const String RelativeTime::getDescription (const String& returnValueForZeroTime) const { @@ -1607,45 +1607,45 @@ const String RelativeTime::getDescription (const String& returnValueForZeroTime) return result.trimEnd(); } -RelativeTime& RelativeTime::operator= (const RelativeTime& other) throw() +RelativeTime& RelativeTime::operator= (const RelativeTime& other) noexcept { seconds = other.seconds; return *this; } -const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) throw() +const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) noexcept { seconds += timeToAdd.seconds; return *this; } -const RelativeTime& RelativeTime::operator-= (const RelativeTime& timeToSubtract) throw() +const RelativeTime& RelativeTime::operator-= (const RelativeTime& timeToSubtract) noexcept { seconds -= timeToSubtract.seconds; return *this; } -const RelativeTime& RelativeTime::operator+= (const double secondsToAdd) throw() +const RelativeTime& RelativeTime::operator+= (const double secondsToAdd) noexcept { seconds += secondsToAdd; return *this; } -const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) throw() +const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) noexcept { seconds -= secondsToSubtract; return *this; } -bool operator== (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() == t2.inSeconds(); } -bool operator!= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() != t2.inSeconds(); } -bool operator> (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() > t2.inSeconds(); } -bool operator< (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() < t2.inSeconds(); } -bool operator>= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() >= t2.inSeconds(); } -bool operator<= (const RelativeTime& t1, const RelativeTime& t2) throw() { return t1.inSeconds() <= t2.inSeconds(); } +bool operator== (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() == t2.inSeconds(); } +bool operator!= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() != t2.inSeconds(); } +bool operator> (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() > t2.inSeconds(); } +bool operator< (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() < t2.inSeconds(); } +bool operator>= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() >= t2.inSeconds(); } +bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); } -const RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) throw() { RelativeTime t (t1); return t += t2; } -const RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) throw() { RelativeTime t (t1); return t -= t2; } +const RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t += t2; } +const RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t -= t2; } END_JUCE_NAMESPACE /*** End of inlined file: juce_RelativeTime.cpp ***/ @@ -1713,7 +1713,7 @@ BEGIN_JUCE_NAMESPACE namespace TimeHelpers { - struct tm millisToLocal (const int64 millis) throw() + struct tm millisToLocal (const int64 millis) noexcept { struct tm result; const int64 seconds = millis / 1000; @@ -1767,13 +1767,13 @@ namespace TimeHelpers return result; } - int extendedModulo (const int64 value, const int modulo) throw() + int extendedModulo (const int64 value, const int modulo) noexcept { return (int) (value >= 0 ? (value % modulo) : (value - ((value / modulo) + 1) * modulo)); } - int doFTime (CharPointer_UTF32 dest, const int maxChars, const String& format, const struct tm* const tm) throw() + int doFTime (CharPointer_UTF32 dest, const int maxChars, const String& format, const struct tm* const tm) noexcept { #if JUCE_ANDROID HeapBlock tempDest; @@ -1797,17 +1797,17 @@ namespace TimeHelpers static uint32 lastMSCounterValue = 0; } -Time::Time() throw() +Time::Time() noexcept : millisSinceEpoch (0) { } -Time::Time (const Time& other) throw() +Time::Time (const Time& other) noexcept : millisSinceEpoch (other.millisSinceEpoch) { } -Time::Time (const int64 ms) throw() +Time::Time (const int64 ms) noexcept : millisSinceEpoch (ms) { } @@ -1819,7 +1819,7 @@ Time::Time (const int year, const int minutes, const int seconds, const int milliseconds, - const bool useLocalTime) throw() + const bool useLocalTime) noexcept { jassert (year > 100); // year must be a 4-digit version @@ -1859,17 +1859,17 @@ Time::Time (const int year, } } -Time::~Time() throw() +Time::~Time() noexcept { } -Time& Time::operator= (const Time& other) throw() +Time& Time::operator= (const Time& other) noexcept { millisSinceEpoch = other.millisSinceEpoch; return *this; } -int64 Time::currentTimeMillis() throw() +int64 Time::currentTimeMillis() noexcept { static uint32 lastCounterResult = 0xffffffff; static int64 correction = 0; @@ -1906,9 +1906,9 @@ int64 Time::currentTimeMillis() throw() return correction + now; } -uint32 juce_millisecondsSinceStartup() throw(); +uint32 juce_millisecondsSinceStartup() noexcept; -uint32 Time::getMillisecondCounter() throw() +uint32 Time::getMillisecondCounter() noexcept { const uint32 now = juce_millisecondsSinceStartup(); @@ -1928,13 +1928,13 @@ uint32 Time::getMillisecondCounter() throw() return now; } -uint32 Time::getApproximateMillisecondCounter() throw() +uint32 Time::getApproximateMillisecondCounter() noexcept { jassert (TimeHelpers::lastMSCounterValue != 0); return TimeHelpers::lastMSCounterValue; } -void Time::waitForMillisecondCounter (const uint32 targetTime) throw() +void Time::waitForMillisecondCounter (const uint32 targetTime) noexcept { for (;;) { @@ -1959,17 +1959,17 @@ void Time::waitForMillisecondCounter (const uint32 targetTime) throw() } } -double Time::highResolutionTicksToSeconds (const int64 ticks) throw() +double Time::highResolutionTicksToSeconds (const int64 ticks) noexcept { return ticks / (double) getHighResolutionTicksPerSecond(); } -int64 Time::secondsToHighResolutionTicks (const double seconds) throw() +int64 Time::secondsToHighResolutionTicks (const double seconds) noexcept { return (int64) (seconds * (double) getHighResolutionTicksPerSecond()); } -const Time JUCE_CALLTYPE Time::getCurrentTime() throw() +const Time JUCE_CALLTYPE Time::getCurrentTime() noexcept { return Time (currentTimeMillis()); } @@ -1977,7 +1977,7 @@ const Time JUCE_CALLTYPE Time::getCurrentTime() throw() const String Time::toString (const bool includeDate, const bool includeTime, const bool includeSeconds, - const bool use24HourClock) const throw() + const bool use24HourClock) const noexcept { String result; @@ -2027,16 +2027,16 @@ const String Time::formatted (const String& format) const return CharPointer_UTF32 (buffer.getData()); } -int Time::getYear() const throw() { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_year + 1900; } -int Time::getMonth() const throw() { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mon; } -int Time::getDayOfMonth() const throw() { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mday; } -int Time::getDayOfWeek() const throw() { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_wday; } -int Time::getHours() const throw() { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_hour; } -int Time::getMinutes() const throw() { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_min; } -int Time::getSeconds() const throw() { return TimeHelpers::extendedModulo (millisSinceEpoch / 1000, 60); } -int Time::getMilliseconds() const throw() { return TimeHelpers::extendedModulo (millisSinceEpoch, 1000); } +int Time::getYear() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_year + 1900; } +int Time::getMonth() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mon; } +int Time::getDayOfMonth() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mday; } +int Time::getDayOfWeek() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_wday; } +int Time::getHours() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_hour; } +int Time::getMinutes() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_min; } +int Time::getSeconds() const noexcept { return TimeHelpers::extendedModulo (millisSinceEpoch / 1000, 60); } +int Time::getMilliseconds() const noexcept { return TimeHelpers::extendedModulo (millisSinceEpoch, 1000); } -int Time::getHoursInAmPmFormat() const throw() +int Time::getHoursInAmPmFormat() const noexcept { const int hours = getHours(); @@ -2048,17 +2048,17 @@ int Time::getHoursInAmPmFormat() const throw() return hours - 12; } -bool Time::isAfternoon() const throw() +bool Time::isAfternoon() const noexcept { return getHours() >= 12; } -bool Time::isDaylightSavingTime() const throw() +bool Time::isDaylightSavingTime() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_isdst != 0; } -const String Time::getTimeZone() const throw() +const String Time::getTimeZone() const noexcept { String zone[2]; @@ -2206,7 +2206,7 @@ JUCE_API void JUCE_CALLTYPE shutdownJuce_NonGUI() JUCE_AUTORELEASEPOOL - LocalisedStrings::setCurrentMappings (0); + LocalisedStrings::setCurrentMappings (nullptr); Thread::stopAllThreads (3000); #if JUCE_DEBUG @@ -2229,7 +2229,7 @@ JUCE_API void JUCE_CALLTYPE initialiseJuce_GUI() initialiseJuce_NonGUI(); MessageManager::getInstance(); - LookAndFeel::setDefaultLookAndFeel (0); + LookAndFeel::setDefaultLookAndFeel (nullptr); #if JUCE_DEBUG try // This section is just a safety-net for catching builds without RTTI enabled.. @@ -2239,7 +2239,7 @@ JUCE_API void JUCE_CALLTYPE initialiseJuce_GUI() // Got an exception here? Then TURN ON RTTI in your compiler settings!! o = dynamic_cast (o); - jassert (o != 0); + jassert (o != nullptr); } catch (...) { @@ -2378,7 +2378,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_AbstractFifo.cpp ***/ BEGIN_JUCE_NAMESPACE -AbstractFifo::AbstractFifo (const int capacity) throw() +AbstractFifo::AbstractFifo (const int capacity) noexcept : bufferSize (capacity) { jassert (bufferSize > 0); @@ -2386,30 +2386,30 @@ AbstractFifo::AbstractFifo (const int capacity) throw() AbstractFifo::~AbstractFifo() {} -int AbstractFifo::getTotalSize() const throw() { return bufferSize; } -int AbstractFifo::getFreeSpace() const throw() { return bufferSize - getNumReady(); } +int AbstractFifo::getTotalSize() const noexcept { return bufferSize; } +int AbstractFifo::getFreeSpace() const noexcept { return bufferSize - getNumReady(); } -int AbstractFifo::getNumReady() const throw() +int AbstractFifo::getNumReady() const noexcept { const int vs = validStart.get(); const int ve = validEnd.get(); return ve >= vs ? (ve - vs) : (bufferSize - (vs - ve)); } -void AbstractFifo::reset() throw() +void AbstractFifo::reset() noexcept { validEnd = 0; validStart = 0; } -void AbstractFifo::setTotalSize (int newSize) throw() +void AbstractFifo::setTotalSize (int newSize) noexcept { jassert (newSize > 0); reset(); bufferSize = newSize; } -void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw() +void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const noexcept { const int vs = validStart.get(); const int ve = validEnd.value; @@ -2434,7 +2434,7 @@ void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockS } } -void AbstractFifo::finishedWrite (int numWritten) throw() +void AbstractFifo::finishedWrite (int numWritten) noexcept { jassert (numWritten >= 0 && numWritten < bufferSize); int newEnd = validEnd.value + numWritten; @@ -2444,7 +2444,7 @@ void AbstractFifo::finishedWrite (int numWritten) throw() validEnd = newEnd; } -void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw() +void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const noexcept { const int vs = validStart.value; const int ve = validEnd.get(); @@ -2469,7 +2469,7 @@ void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSiz } } -void AbstractFifo::finishedRead (int numRead) throw() +void AbstractFifo::finishedRead (int numRead) noexcept { jassert (numRead >= 0 && numRead <= bufferSize); @@ -2645,7 +2645,7 @@ BigInteger::~BigInteger() { } -void BigInteger::swapWith (BigInteger& other) throw() +void BigInteger::swapWith (BigInteger& other) noexcept { values.swapWith (other.values); std::swap (numValues, other.numValues); @@ -2680,13 +2680,13 @@ void BigInteger::ensureSize (const int numVals) } } -bool BigInteger::operator[] (const int bit) const throw() +bool BigInteger::operator[] (const int bit) const noexcept { return bit <= highestBit && bit >= 0 && ((values [bitToIndex (bit)] & bitToMask (bit)) != 0); } -int BigInteger::toInteger() const throw() +int BigInteger::toInteger() const noexcept { const int n = (int) (values[0] & 0x7fffffff); return negative ? -n : n; @@ -2711,7 +2711,7 @@ const BigInteger BigInteger::getBitRange (int startBit, int numBits) const return r; } -int BigInteger::getBitRangeAsInt (const int startBit, int numBits) const throw() +int BigInteger::getBitRangeAsInt (const int startBit, int numBits) const noexcept { if (numBits > 32) { @@ -2789,7 +2789,7 @@ void BigInteger::setBit (const int bit, const bool shouldBeSet) clearBit (bit); } -void BigInteger::clearBit (const int bit) throw() +void BigInteger::clearBit (const int bit) noexcept { if (bit >= 0 && bit <= highestBit) values [bitToIndex (bit)] &= ~bitToMask (bit); @@ -2809,27 +2809,27 @@ void BigInteger::insertBit (const int bit, const bool shouldBeSet) setBit (bit, shouldBeSet); } -bool BigInteger::isZero() const throw() +bool BigInteger::isZero() const noexcept { return getHighestBit() < 0; } -bool BigInteger::isOne() const throw() +bool BigInteger::isOne() const noexcept { return getHighestBit() == 0 && ! negative; } -bool BigInteger::isNegative() const throw() +bool BigInteger::isNegative() const noexcept { return negative && ! isZero(); } -void BigInteger::setNegative (const bool neg) throw() +void BigInteger::setNegative (const bool neg) noexcept { negative = neg; } -void BigInteger::negate() throw() +void BigInteger::negate() noexcept { negative = (! negative) && ! isZero(); } @@ -2840,7 +2840,7 @@ void BigInteger::negate() throw() namespace BitFunctions { - inline int countBitsInInt32 (uint32 n) throw() + inline int countBitsInInt32 (uint32 n) noexcept { n -= ((n >> 1) & 0x55555555); n = (((n >> 2) & 0x33333333) + (n & 0x33333333)); @@ -2850,7 +2850,7 @@ namespace BitFunctions return n & 0x3f; } - inline int highestBitInInt (uint32 n) throw() + inline int highestBitInInt (uint32 n) noexcept { jassert (n != 0); // (the built-in functions may not work for n = 0) @@ -2871,7 +2871,7 @@ namespace BitFunctions } } -int BigInteger::countNumberOfSetBits() const throw() +int BigInteger::countNumberOfSetBits() const noexcept { int total = 0; @@ -2881,7 +2881,7 @@ int BigInteger::countNumberOfSetBits() const throw() return total; } -int BigInteger::getHighestBit() const throw() +int BigInteger::getHighestBit() const noexcept { for (int i = bitToIndex (highestBit + 1); i >= 0; --i) { @@ -2894,7 +2894,7 @@ int BigInteger::getHighestBit() const throw() return -1; } -int BigInteger::findNextSetBit (int i) const throw() +int BigInteger::findNextSetBit (int i) const noexcept { for (; i <= highestBit; ++i) if ((values [bitToIndex (i)] & bitToMask (i)) != 0) @@ -2903,7 +2903,7 @@ int BigInteger::findNextSetBit (int i) const throw() return -1; } -int BigInteger::findNextClearBit (int i) const throw() +int BigInteger::findNextClearBit (int i) const noexcept { for (; i <= highestBit; ++i) if ((values [bitToIndex (i)] & bitToMask (i)) == 0) @@ -3189,7 +3189,7 @@ const BigInteger BigInteger::operator<< (const int numBits) const { BigIntege const BigInteger BigInteger::operator>> (const int numBits) const { BigInteger b (*this); return b >>= numBits; } const BigInteger BigInteger::operator-() const { BigInteger b (*this); b.negate(); return b; } -int BigInteger::compare (const BigInteger& other) const throw() +int BigInteger::compare (const BigInteger& other) const noexcept { if (isNegative() == other.isNegative()) { @@ -3202,7 +3202,7 @@ int BigInteger::compare (const BigInteger& other) const throw() } } -int BigInteger::compareAbsolute (const BigInteger& other) const throw() +int BigInteger::compareAbsolute (const BigInteger& other) const noexcept { const int h1 = getHighestBit(); const int h2 = other.getHighestBit(); @@ -3219,12 +3219,12 @@ int BigInteger::compareAbsolute (const BigInteger& other) const throw() return 0; } -bool BigInteger::operator== (const BigInteger& other) const throw() { return compare (other) == 0; } -bool BigInteger::operator!= (const BigInteger& other) const throw() { return compare (other) != 0; } -bool BigInteger::operator< (const BigInteger& other) const throw() { return compare (other) < 0; } -bool BigInteger::operator<= (const BigInteger& other) const throw() { return compare (other) <= 0; } -bool BigInteger::operator> (const BigInteger& other) const throw() { return compare (other) > 0; } -bool BigInteger::operator>= (const BigInteger& other) const throw() { return compare (other) >= 0; } +bool BigInteger::operator== (const BigInteger& other) const noexcept { return compare (other) == 0; } +bool BigInteger::operator!= (const BigInteger& other) const noexcept { return compare (other) != 0; } +bool BigInteger::operator< (const BigInteger& other) const noexcept { return compare (other) < 0; } +bool BigInteger::operator<= (const BigInteger& other) const noexcept { return compare (other) <= 0; } +bool BigInteger::operator> (const BigInteger& other) const noexcept { return compare (other) > 0; } +bool BigInteger::operator>= (const BigInteger& other) const noexcept { return compare (other) >= 0; } void BigInteger::shiftBits (int bits, const int startBit) { @@ -3565,7 +3565,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_MemoryBlock.cpp ***/ BEGIN_JUCE_NAMESPACE -MemoryBlock::MemoryBlock() throw() +MemoryBlock::MemoryBlock() noexcept : size (0) { } @@ -3588,7 +3588,7 @@ MemoryBlock::MemoryBlock (const MemoryBlock& other) { if (size > 0) { - jassert (other.data != 0); + jassert (other.data != nullptr); data.malloc (size); memcpy (data, other.data, size); } @@ -3601,19 +3601,19 @@ MemoryBlock::MemoryBlock (const void* const dataToInitialiseFrom, const size_t s if (size > 0) { - jassert (dataToInitialiseFrom != 0); // non-zero size, but a zero pointer passed-in? + jassert (dataToInitialiseFrom != nullptr); // non-zero size, but a zero pointer passed-in? data.malloc (size); - if (dataToInitialiseFrom != 0) + if (dataToInitialiseFrom != nullptr) memcpy (data, dataToInitialiseFrom, size); } } -MemoryBlock::~MemoryBlock() throw() +MemoryBlock::~MemoryBlock() noexcept { jassert (size >= 0); // should never happen - jassert (size == 0 || data != 0); // non-zero size but no data allocated? + jassert (size == 0 || data != nullptr); // non-zero size but no data allocated? } MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) @@ -3627,17 +3627,17 @@ MemoryBlock& MemoryBlock::operator= (const MemoryBlock& other) return *this; } -bool MemoryBlock::operator== (const MemoryBlock& other) const throw() +bool MemoryBlock::operator== (const MemoryBlock& other) const noexcept { return matches (other.data, other.size); } -bool MemoryBlock::operator!= (const MemoryBlock& other) const throw() +bool MemoryBlock::operator!= (const MemoryBlock& other) const noexcept { return ! operator== (other); } -bool MemoryBlock::matches (const void* dataToCompare, size_t dataSize) const throw() +bool MemoryBlock::matches (const void* dataToCompare, size_t dataSize) const noexcept { return size == dataSize && memcmp (data, dataToCompare, size) == 0; @@ -3655,7 +3655,7 @@ void MemoryBlock::setSize (const size_t newSize, const bool initialiseToZero) } else { - if (data != 0) + if (data != nullptr) { data.realloc (newSize); @@ -3678,13 +3678,13 @@ void MemoryBlock::ensureSize (const size_t minimumSize, const bool initialiseToZ setSize (minimumSize, initialiseToZero); } -void MemoryBlock::swapWith (MemoryBlock& other) throw() +void MemoryBlock::swapWith (MemoryBlock& other) noexcept { std::swap (size, other.size); data.swapWith (other.data); } -void MemoryBlock::fillWith (const uint8 value) throw() +void MemoryBlock::fillWith (const uint8 value) noexcept { memset (data, (int) value, size); } @@ -3699,7 +3699,7 @@ void MemoryBlock::append (const void* const srcData, const size_t numBytes) } } -void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw() +void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) noexcept { const char* d = static_cast (src); @@ -3717,7 +3717,7 @@ void MemoryBlock::copyFrom (const void* const src, int offset, size_t num) throw memcpy (data + offset, d, num); } -void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const throw() +void MemoryBlock::copyTo (void* const dst, int offset, size_t num) const noexcept { char* d = static_cast (dst); @@ -3762,7 +3762,7 @@ const String MemoryBlock::toString() const return String (static_cast (getData()), size); } -int MemoryBlock::getBitRange (const size_t bitRangeStart, size_t numBits) const throw() +int MemoryBlock::getBitRange (const size_t bitRangeStart, size_t numBits) const noexcept { int res = 0; @@ -3786,7 +3786,7 @@ int MemoryBlock::getBitRange (const size_t bitRangeStart, size_t numBits) const return res; } -void MemoryBlock::setBitRange (const size_t bitRangeStart, size_t numBits, int bitsToSet) throw() +void MemoryBlock::setBitRange (const size_t bitRangeStart, size_t numBits, int bitsToSet) noexcept { size_t byte = bitRangeStart >> 3; int offsetInByte = (int) bitRangeStart & 7; @@ -3919,7 +3919,7 @@ BEGIN_JUCE_NAMESPACE PropertySet::PropertySet (const bool ignoreCaseOfKeyNames) : properties (ignoreCaseOfKeyNames), - fallbackProperties (0), + fallbackProperties (nullptr), ignoreCaseOfKeys (ignoreCaseOfKeyNames) { } @@ -3957,7 +3957,7 @@ void PropertySet::clear() } const String PropertySet::getValue (const String& keyName, - const String& defaultValue) const throw() + const String& defaultValue) const noexcept { const ScopedLock sl (lock); @@ -3966,12 +3966,12 @@ const String PropertySet::getValue (const String& keyName, if (index >= 0) return properties.getAllValues() [index]; - return fallbackProperties != 0 ? fallbackProperties->getValue (keyName, defaultValue) - : defaultValue; + return fallbackProperties != nullptr ? fallbackProperties->getValue (keyName, defaultValue) + : defaultValue; } int PropertySet::getIntValue (const String& keyName, - const int defaultValue) const throw() + const int defaultValue) const noexcept { const ScopedLock sl (lock); const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys); @@ -3979,12 +3979,12 @@ int PropertySet::getIntValue (const String& keyName, if (index >= 0) return properties.getAllValues() [index].getIntValue(); - return fallbackProperties != 0 ? fallbackProperties->getIntValue (keyName, defaultValue) - : defaultValue; + return fallbackProperties != nullptr ? fallbackProperties->getIntValue (keyName, defaultValue) + : defaultValue; } double PropertySet::getDoubleValue (const String& keyName, - const double defaultValue) const throw() + const double defaultValue) const noexcept { const ScopedLock sl (lock); const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys); @@ -3992,12 +3992,12 @@ double PropertySet::getDoubleValue (const String& keyName, if (index >= 0) return properties.getAllValues()[index].getDoubleValue(); - return fallbackProperties != 0 ? fallbackProperties->getDoubleValue (keyName, defaultValue) - : defaultValue; + return fallbackProperties != nullptr ? fallbackProperties->getDoubleValue (keyName, defaultValue) + : defaultValue; } bool PropertySet::getBoolValue (const String& keyName, - const bool defaultValue) const throw() + const bool defaultValue) const noexcept { const ScopedLock sl (lock); const int index = properties.getAllKeys().indexOf (keyName, ignoreCaseOfKeys); @@ -4005,8 +4005,8 @@ bool PropertySet::getBoolValue (const String& keyName, if (index >= 0) return properties.getAllValues() [index].getIntValue() != 0; - return fallbackProperties != 0 ? fallbackProperties->getBoolValue (keyName, defaultValue) - : defaultValue; + return fallbackProperties != nullptr ? fallbackProperties->getBoolValue (keyName, defaultValue) + : defaultValue; } XmlElement* PropertySet::getXmlValue (const String& keyName) const @@ -4050,17 +4050,17 @@ void PropertySet::removeValue (const String& keyName) void PropertySet::setValue (const String& keyName, const XmlElement* const xml) { - setValue (keyName, xml == 0 ? var::null - : var (xml->createDocument (String::empty, true))); + setValue (keyName, xml == nullptr ? var::null + : var (xml->createDocument (String::empty, true))); } -bool PropertySet::containsKey (const String& keyName) const throw() +bool PropertySet::containsKey (const String& keyName) const noexcept { const ScopedLock sl (lock); return properties.getAllKeys().contains (keyName, ignoreCaseOfKeys); } -void PropertySet::setFallbackPropertySet (PropertySet* fallbackProperties_) throw() +void PropertySet::setFallbackPropertySet (PropertySet* fallbackProperties_) noexcept { const ScopedLock sl (lock); fallbackProperties = fallbackProperties_; @@ -4117,17 +4117,17 @@ StringPool& Identifier::getPool() return pool; } -Identifier::Identifier() throw() - : name (0) +Identifier::Identifier() noexcept + : name (nullptr) { } -Identifier::Identifier (const Identifier& other) throw() +Identifier::Identifier (const Identifier& other) noexcept : name (other.name) { } -Identifier& Identifier::operator= (const Identifier& other) throw() +Identifier& Identifier::operator= (const Identifier& other) noexcept { name = other.name; return *this; @@ -4183,18 +4183,18 @@ public: virtual bool toBool (const ValueUnion&) const { return false; } virtual DynamicObject* toObject (const ValueUnion&) const { return 0; } - virtual bool isVoid() const throw() { return false; } - virtual bool isInt() const throw() { return false; } - virtual bool isInt64() const throw() { return false; } - virtual bool isBool() const throw() { return false; } - virtual bool isDouble() const throw() { return false; } - virtual bool isString() const throw() { return false; } - virtual bool isObject() const throw() { return false; } - virtual bool isMethod() const throw() { return false; } + virtual bool isVoid() const noexcept { return false; } + virtual bool isInt() const noexcept { return false; } + virtual bool isInt64() const noexcept { return false; } + virtual bool isBool() const noexcept { return false; } + virtual bool isDouble() const noexcept { return false; } + virtual bool isString() const noexcept { return false; } + virtual bool isObject() const noexcept { return false; } + virtual bool isMethod() const noexcept { return false; } - virtual void cleanUp (ValueUnion&) const throw() {} + virtual void cleanUp (ValueUnion&) const noexcept {} virtual void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest = source; } - virtual bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() = 0; + virtual bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept = 0; virtual void writeToStream (const ValueUnion& data, OutputStream& output) const = 0; }; @@ -4204,8 +4204,8 @@ public: VariantType_Void() {} static const VariantType_Void instance; - bool isVoid() const throw() { return true; } - bool equals (const ValueUnion&, const ValueUnion&, const VariantType& otherType) const throw() { return otherType.isVoid(); } + bool isVoid() const noexcept { return true; } + bool equals (const ValueUnion&, const ValueUnion&, const VariantType& otherType) const noexcept { return otherType.isVoid(); } void writeToStream (const ValueUnion&, OutputStream& output) const { output.writeCompressedInt (0); } }; @@ -4220,9 +4220,9 @@ public: double toDouble (const ValueUnion& data) const { return (double) data.intValue; } const String toString (const ValueUnion& data) const { return String (data.intValue); } bool toBool (const ValueUnion& data) const { return data.intValue != 0; } - bool isInt() const throw() { return true; } + bool isInt() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.toInt (otherData) == data.intValue; } @@ -4246,9 +4246,9 @@ public: double toDouble (const ValueUnion& data) const { return (double) data.int64Value; } const String toString (const ValueUnion& data) const { return String (data.int64Value); } bool toBool (const ValueUnion& data) const { return data.int64Value != 0; } - bool isInt64() const throw() { return true; } + bool isInt64() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.toInt64 (otherData) == data.int64Value; } @@ -4272,9 +4272,9 @@ public: double toDouble (const ValueUnion& data) const { return data.doubleValue; } const String toString (const ValueUnion& data) const { return String (data.doubleValue); } bool toBool (const ValueUnion& data) const { return data.doubleValue != 0; } - bool isDouble() const throw() { return true; } + bool isDouble() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.toDouble (otherData) == data.doubleValue; } @@ -4298,9 +4298,9 @@ public: double toDouble (const ValueUnion& data) const { return data.boolValue ? 1.0 : 0.0; } const String toString (const ValueUnion& data) const { return String::charToString (data.boolValue ? '1' : '0'); } bool toBool (const ValueUnion& data) const { return data.boolValue; } - bool isBool() const throw() { return true; } + bool isBool() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.toBool (otherData) == data.boolValue; } @@ -4318,7 +4318,7 @@ public: VariantType_String() {} static const VariantType_String instance; - void cleanUp (ValueUnion& data) const throw() { delete data.stringValue; } + void cleanUp (ValueUnion& data) const noexcept { delete data.stringValue; } void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.stringValue = new String (*source.stringValue); } int toInt (const ValueUnion& data) const { return data.stringValue->getIntValue(); }; @@ -4328,9 +4328,9 @@ public: bool toBool (const ValueUnion& data) const { return data.stringValue->getIntValue() != 0 || data.stringValue->trim().equalsIgnoreCase ("true") || data.stringValue->trim().equalsIgnoreCase ("yes"); } - bool isString() const throw() { return true; } + bool isString() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.toString (otherData) == *data.stringValue; } @@ -4352,15 +4352,15 @@ public: VariantType_Object() {} static const VariantType_Object instance; - void cleanUp (ValueUnion& data) const throw() { if (data.objectValue != 0) data.objectValue->decReferenceCount(); } - void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.objectValue = source.objectValue; if (dest.objectValue != 0) dest.objectValue->incReferenceCount(); } + void cleanUp (ValueUnion& data) const noexcept { if (data.objectValue != nullptr) data.objectValue->decReferenceCount(); } + void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.objectValue = source.objectValue; if (dest.objectValue != nullptr) dest.objectValue->incReferenceCount(); } const String toString (const ValueUnion& data) const { return "Object 0x" + String::toHexString ((int) (pointer_sized_int) data.objectValue); } bool toBool (const ValueUnion& data) const { return data.objectValue != 0; } DynamicObject* toObject (const ValueUnion& data) const { return data.objectValue; } - bool isObject() const throw() { return true; } + bool isObject() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.toObject (otherData) == data.objectValue; } @@ -4380,9 +4380,9 @@ public: const String toString (const ValueUnion&) const { return "Method"; } bool toBool (const ValueUnion& data) const { return data.methodValue != 0; } - bool isMethod() const throw() { return true; } + bool isMethod() const noexcept { return true; } - bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const throw() + bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept { return otherType.isMethod() && otherData.methodValue == data.methodValue; } @@ -4403,11 +4403,11 @@ const var::VariantType_String var::VariantType_String::instance; const var::VariantType_Object var::VariantType_Object::instance; const var::VariantType_Method var::VariantType_Method::instance; -var::var() throw() : type (&VariantType_Void::instance) +var::var() noexcept : type (&VariantType_Void::instance) { } -var::~var() throw() +var::~var() noexcept { type->cleanUp (value); } @@ -4419,22 +4419,22 @@ var::var (const var& valueToCopy) : type (valueToCopy.type) type->createCopy (value, valueToCopy.value); } -var::var (const int value_) throw() : type (&VariantType_Int::instance) +var::var (const int value_) noexcept : type (&VariantType_Int::instance) { value.intValue = value_; } -var::var (const int64 value_) throw() : type (&VariantType_Int64::instance) +var::var (const int64 value_) noexcept : type (&VariantType_Int64::instance) { value.int64Value = value_; } -var::var (const bool value_) throw() : type (&VariantType_Bool::instance) +var::var (const bool value_) noexcept : type (&VariantType_Bool::instance) { value.boolValue = value_; } -var::var (const double value_) throw() : type (&VariantType_Double::instance) +var::var (const double value_) noexcept : type (&VariantType_Double::instance) { value.doubleValue = value_; } @@ -4458,23 +4458,23 @@ var::var (DynamicObject* const object) : type (&VariantType_Object::instance) { value.objectValue = object; - if (object != 0) + if (object != nullptr) object->incReferenceCount(); } -var::var (MethodFunction method_) throw() : type (&VariantType_Method::instance) +var::var (MethodFunction method_) noexcept : type (&VariantType_Method::instance) { value.methodValue = method_; } -bool var::isVoid() const throw() { return type->isVoid(); } -bool var::isInt() const throw() { return type->isInt(); } -bool var::isInt64() const throw() { return type->isInt64(); } -bool var::isBool() const throw() { return type->isBool(); } -bool var::isDouble() const throw() { return type->isDouble(); } -bool var::isString() const throw() { return type->isString(); } -bool var::isObject() const throw() { return type->isObject(); } -bool var::isMethod() const throw() { return type->isMethod(); } +bool var::isVoid() const noexcept { return type->isVoid(); } +bool var::isInt() const noexcept { return type->isInt(); } +bool var::isInt64() const noexcept { return type->isInt64(); } +bool var::isBool() const noexcept { return type->isBool(); } +bool var::isDouble() const noexcept { return type->isDouble(); } +bool var::isString() const noexcept { return type->isString(); } +bool var::isObject() const noexcept { return type->isObject(); } +bool var::isMethod() const noexcept { return type->isMethod(); } var::operator int() const { return type->toInt (value); } var::operator int64() const { return type->toInt64 (value); } @@ -4485,7 +4485,7 @@ const String var::toString() const { return type->toString (value); } var::operator const String() const { return type->toString (value); } DynamicObject* var::getObject() const { return type->toObject (value); } -void var::swapWith (var& other) throw() +void var::swapWith (var& other) noexcept { std::swap (type, other.type); std::swap (value, other.value); @@ -4502,20 +4502,20 @@ var& var::operator= (const String& newValue) { var v (newValue); swapWith (v); var& var::operator= (DynamicObject* newValue) { var v (newValue); swapWith (v); return *this; } var& var::operator= (MethodFunction newValue) { var v (newValue); swapWith (v); return *this; } -bool var::equals (const var& other) const throw() +bool var::equals (const var& other) const noexcept { return type->equals (value, other.value, *other.type); } -bool var::equalsWithSameType (const var& other) const throw() +bool var::equalsWithSameType (const var& other) const noexcept { return type == other.type && equals (other); } -bool operator== (const var& v1, const var& v2) throw() { return v1.equals (v2); } -bool operator!= (const var& v1, const var& v2) throw() { return ! v1.equals (v2); } -bool operator== (const var& v1, const String& v2) throw() { return v1.toString() == v2; } -bool operator!= (const var& v1, const String& v2) throw() { return v1.toString() != v2; } +bool operator== (const var& v1, const var& v2) noexcept { return v1.equals (v2); } +bool operator!= (const var& v1, const var& v2) noexcept { return ! v1.equals (v2); } +bool operator== (const var& v1, const String& v2) noexcept { return v1.toString() == v2; } +bool operator!= (const var& v1, const String& v2) noexcept { return v1.toString() != v2; } void var::writeToStream (OutputStream& output) const { @@ -4552,13 +4552,13 @@ const var var::readFromStream (InputStream& input) const var var::operator[] (const Identifier& propertyName) const { DynamicObject* const o = getObject(); - return o != 0 ? o->getProperty (propertyName) : var::null; + return o != nullptr ? o->getProperty (propertyName) : var::null; } const var var::invoke (const Identifier& method, const var* arguments, int numArguments) const { DynamicObject* const o = getObject(); - return o != 0 ? o->invokeMethod (method, arguments, numArguments) : var::null; + return o != nullptr ? o->invokeMethod (method, arguments, numArguments) : var::null; } const var var::invoke (const var& targetObject, const var* arguments, int numArguments) const @@ -4567,7 +4567,7 @@ const var var::invoke (const var& targetObject, const var* arguments, int numArg { DynamicObject* const target = targetObject.getObject(); - if (target != 0) + if (target != nullptr) return (target->*(value.methodValue)) (arguments, numArguments); } @@ -4615,7 +4615,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_NamedValueSet.cpp ***/ BEGIN_JUCE_NAMESPACE -NamedValueSet::NamedValue::NamedValue() throw() +NamedValueSet::NamedValue::NamedValue() noexcept { } @@ -4636,12 +4636,12 @@ NamedValueSet::NamedValue& NamedValueSet::NamedValue::operator= (const NamedValu return *this; } -bool NamedValueSet::NamedValue::operator== (const NamedValueSet::NamedValue& other) const throw() +bool NamedValueSet::NamedValue::operator== (const NamedValueSet::NamedValue& other) const noexcept { return name == other.name && value == other.value; } -NamedValueSet::NamedValueSet() throw() +NamedValueSet::NamedValueSet() noexcept { } @@ -4672,7 +4672,7 @@ bool NamedValueSet::operator== (const NamedValueSet& other) const const NamedValue* i1 = values; const NamedValue* i2 = other.values; - while (i1 != 0 && i2 != 0) + while (i1 != nullptr && i2 != nullptr) { if (! (*i1 == *i2)) return false; @@ -4689,14 +4689,14 @@ bool NamedValueSet::operator!= (const NamedValueSet& other) const return ! operator== (other); } -int NamedValueSet::size() const throw() +int NamedValueSet::size() const noexcept { return values.size(); } const var& NamedValueSet::operator[] (const Identifier& name) const { - for (NamedValue* i = values; i != 0; i = i->nextListItem) + for (NamedValue* i = values; i != nullptr; i = i->nextListItem) if (i->name == name) return i->value; @@ -4706,12 +4706,12 @@ const var& NamedValueSet::operator[] (const Identifier& name) const const var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const { const var* v = getVarPointer (name); - return v != 0 ? *v : defaultReturnValue; + return v != nullptr ? *v : defaultReturnValue; } var* NamedValueSet::getVarPointer (const Identifier& name) const { - for (NamedValue* i = values; i != 0; i = i->nextListItem) + for (NamedValue* i = values; i != nullptr; i = i->nextListItem) if (i->name == name) return &(i->value); @@ -4722,7 +4722,7 @@ bool NamedValueSet::set (const Identifier& name, const var& newValue) { LinkedListPointer* i = &values; - while (i->get() != 0) + while (i->get() != nullptr) { NamedValue* const v = i->get(); @@ -4744,7 +4744,7 @@ bool NamedValueSet::set (const Identifier& name, const var& newValue) bool NamedValueSet::contains (const Identifier& name) const { - return getVarPointer (name) != 0; + return getVarPointer (name) != nullptr; } bool NamedValueSet::remove (const Identifier& name) @@ -4755,7 +4755,7 @@ bool NamedValueSet::remove (const Identifier& name) { NamedValue* const v = i->get(); - if (v == 0) + if (v == nullptr) break; if (v->name == name) @@ -4773,14 +4773,14 @@ bool NamedValueSet::remove (const Identifier& name) const Identifier NamedValueSet::getName (const int index) const { const NamedValue* const v = values[index]; - jassert (v != 0); + jassert (v != nullptr); return v->name; } const var NamedValueSet::getValueAt (const int index) const { const NamedValue* const v = values[index]; - jassert (v != 0); + jassert (v != nullptr); return v->value; } @@ -4797,7 +4797,7 @@ void NamedValueSet::setFromXmlAttributes (const XmlElement& xml) void NamedValueSet::copyToXmlAttributes (XmlElement& xml) const { - for (NamedValue* i = values; i != 0; i = i->nextListItem) + for (NamedValue* i = values; i != nullptr; i = i->nextListItem) { jassert (! i->value.isObject()); // DynamicObjects can't be stored as XML! @@ -4824,7 +4824,7 @@ DynamicObject::~DynamicObject() bool DynamicObject::hasProperty (const Identifier& propertyName) const { var* const v = properties.getVarPointer (propertyName); - return v != 0 && ! v->isMethod(); + return v != nullptr && ! v->isMethod(); } const var DynamicObject::getProperty (const Identifier& propertyName) const @@ -4878,7 +4878,7 @@ public: Term() {} virtual ~Term() {} - virtual Type getType() const throw() = 0; + virtual Type getType() const noexcept = 0; virtual Term* clone() const = 0; virtual const ReferenceCountedObjectPtr resolve (const Scope&, int recursionDepth) = 0; virtual const String toString() const = 0; @@ -4931,7 +4931,7 @@ public: typedef ReferenceCountedObjectPtr TermPtr; // This helper function is needed to work around VC6 scoping bugs - static inline const TermPtr& getTermFor (const Expression& exp) throw() { return exp.term; } + static inline const TermPtr& getTermFor (const Expression& exp) noexcept { return exp.term; } static void checkRecursionDepth (const int depth) { @@ -4960,7 +4960,7 @@ public: Constant (const double value_, const bool isResolutionTarget_) : value (value_), isResolutionTarget (isResolutionTarget_) {} - Type getType() const throw() { return constantType; } + Type getType() const noexcept { return constantType; } Term* clone() const { return new Constant (value, isResolutionTarget); } const TermPtr resolve (const Scope&, int) { return this; } double toDouble() const { return value; } @@ -4984,7 +4984,7 @@ public: public: BinaryTerm (Term* const left_, Term* const right_) : left (left_), right (right_) { - jassert (left_ != 0 && right_ != 0); + jassert (left_ != nullptr && right_ != nullptr); } int getInputIndexFor (const Term* possibleInput) const @@ -4992,7 +4992,7 @@ public: return possibleInput == left ? 0 : (possibleInput == right ? 1 : -1); } - Type getType() const throw() { return operatorType; } + Type getType() const noexcept { return operatorType; } int getNumInputs() const { return 2; } Term* getInput (int index) const { return index == 0 ? left.getObject() : (index == 1 ? right.getObject() : 0); } @@ -5036,7 +5036,7 @@ public: const Term* const dest = findDestinationFor (topLevelTerm, this); - if (dest == 0) + if (dest == nullptr) return new Constant (overallTarget, false); return dest->createTermToEvaluateInput (scope, this, overallTarget, topLevelTerm); @@ -5054,7 +5054,7 @@ public: return getTermFor (scope.getSymbolValue (symbol))->resolve (scope, recursionDepth + 1); } - Type getType() const throw() { return symbolType; } + Type getType() const noexcept { return symbolType; } Term* clone() const { return new SymbolTerm (symbol); } const String toString() const { return symbol; } const String getName() const { return symbol; } @@ -5084,7 +5084,7 @@ public: : functionName (functionName_), parameters (parameters_) {} - Type getType() const throw() { return functionType; } + Type getType() const noexcept { return functionType; } Term* clone() const { return new Function (functionName, parameters); } int getNumInputs() const { return parameters.size(); } Term* getInput (int i) const { return getTermFor (parameters [i]); } @@ -5252,10 +5252,10 @@ public: public: explicit Negate (const TermPtr& input_) : input (input_) { - jassert (input_ != 0); + jassert (input_ != nullptr); } - Type getType() const throw() { return operatorType; } + Type getType() const noexcept { return operatorType; } int getInputIndexFor (const Term* possibleInput) const { return possibleInput == input ? 0 : -1; } int getNumInputs() const { return 1; } Term* getInput (int index) const { return index == 0 ? input.getObject() : 0; } @@ -5276,8 +5276,8 @@ public: const Term* const dest = findDestinationFor (topLevelTerm, this); - return new Negate (dest == 0 ? new Constant (overallTarget, false) - : dest->createTermToEvaluateInput (scope, this, overallTarget, topLevelTerm)); + return new Negate (dest == nullptr ? new Constant (overallTarget, false) + : dest->createTermToEvaluateInput (scope, this, overallTarget, topLevelTerm)); } const String toString() const @@ -5306,7 +5306,7 @@ public: const TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const { const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm)); - if (newDest == 0) + if (newDest == nullptr) return 0; return new Subtract (newDest, (input == left ? right : left)->clone()); @@ -5330,7 +5330,7 @@ public: const TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const { const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm)); - if (newDest == 0) + if (newDest == nullptr) return 0; if (input == left) @@ -5357,7 +5357,7 @@ public: const TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const { const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm)); - if (newDest == 0) + if (newDest == nullptr) return 0; return new Divide (newDest, (input == left ? right : left)->clone()); @@ -5381,7 +5381,7 @@ public: const TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const { const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm)); - if (newDest == 0) + if (newDest == nullptr) return 0; if (input == left) @@ -5404,7 +5404,7 @@ public: { Term* const t = findDestinationFor (topLevel->getInput (i), inputTerm); - if (t != 0) + if (t != nullptr) return t; } @@ -5415,11 +5415,11 @@ public: { { Constant* const c = dynamic_cast (term); - if (c != 0 && (c->isResolutionTarget || ! mustBeFlagged)) + if (c != nullptr && (c->isResolutionTarget || ! mustBeFlagged)) return c; } - if (dynamic_cast (term) != 0) + if (dynamic_cast (term) != nullptr) return 0; int i; @@ -5427,14 +5427,14 @@ public: for (i = 0; i < numIns; ++i) { Constant* const c = dynamic_cast (term->getInput (i)); - if (c != 0 && (c->isResolutionTarget || ! mustBeFlagged)) + if (c != nullptr && (c->isResolutionTarget || ! mustBeFlagged)) return c; } for (i = 0; i < numIns; ++i) { Constant* const c = findTermToAdjust (term->getInput (i), mustBeFlagged); - if (c != 0) + if (c != nullptr) return c; } @@ -5495,7 +5495,7 @@ public: const TermPtr e (readExpression()); - if (e == 0 || ((! readOperator (",")) && ! text.isEmpty())) + if (e == nullptr || ((! readOperator (",")) && ! text.isEmpty())) throw ParseError ("Syntax error: \"" + String (text) + "\""); return e; @@ -5504,12 +5504,12 @@ public: private: String::CharPointerType& text; - static inline bool isDecimalDigit (const juce_wchar c) throw() + static inline bool isDecimalDigit (const juce_wchar c) noexcept { return c >= '0' && c <= '9'; } - bool readChar (const juce_wchar required) throw() + bool readChar (const juce_wchar required) noexcept { if (*text == required) { @@ -5520,7 +5520,7 @@ public: return false; } - bool readOperator (const char* ops, char* const opType = 0) throw() + bool readOperator (const char* ops, char* const opType = nullptr) noexcept { text = text.findEndOfWhitespace(); @@ -5528,7 +5528,7 @@ public: { if (readChar (*ops)) { - if (opType != 0) + if (opType != nullptr) *opType = *ops; return true; @@ -5540,7 +5540,7 @@ public: return false; } - bool readIdentifier (String& identifier) throw() + bool readIdentifier (String& identifier) noexcept { text = text.findEndOfWhitespace(); String::CharPointerType t (text); @@ -5568,7 +5568,7 @@ public: return false; } - Term* readNumber() throw() + Term* readNumber() noexcept { text = text.findEndOfWhitespace(); String::CharPointerType t (text); @@ -5598,11 +5598,11 @@ public: TermPtr lhs (readMultiplyOrDivideExpression()); char opType; - while (lhs != 0 && readOperator ("+-", &opType)) + while (lhs != nullptr && readOperator ("+-", &opType)) { TermPtr rhs (readMultiplyOrDivideExpression()); - if (rhs == 0) + if (rhs == nullptr) throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\""); if (opType == '+') @@ -5619,11 +5619,11 @@ public: TermPtr lhs (readUnaryExpression()); char opType; - while (lhs != 0 && readOperator ("*/", &opType)) + while (lhs != nullptr && readOperator ("*/", &opType)) { TermPtr rhs (readUnaryExpression()); - if (rhs == 0) + if (rhs == nullptr) throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\""); if (opType == '*') @@ -5642,7 +5642,7 @@ public: { TermPtr term (readUnaryExpression()); - if (term == 0) + if (term == nullptr) throw ParseError ("Expected expression after \"" + String::charToString (opType) + "\""); if (opType == '-') @@ -5657,11 +5657,11 @@ public: const TermPtr readPrimaryExpression() { TermPtr e (readParenthesisedExpression()); - if (e != 0) + if (e != nullptr) return e; e = readNumber(); - if (e != 0) + if (e != nullptr) return e; return readSymbolOrFunction(); @@ -5679,7 +5679,7 @@ public: TermPtr param (readExpression()); - if (param == 0) + if (param == nullptr) { if (readOperator (")")) return func.release(); @@ -5693,7 +5693,7 @@ public: { param = readExpression(); - if (param == 0) + if (param == nullptr) throw ParseError ("Expected expression after \",\""); f->parameters.add (Expression (param)); @@ -5708,7 +5708,7 @@ public: { TermPtr rhs (readSymbolOrFunction()); - if (rhs == 0) + if (rhs == nullptr) throw ParseError ("Expected symbol or function after \".\""); if (identifier == "this") @@ -5732,7 +5732,7 @@ public: return 0; const TermPtr e (readExpression()); - if (e == 0 || ! readOperator (")")) + if (e == nullptr || ! readOperator (")")) return 0; return e; @@ -5754,7 +5754,7 @@ Expression::~Expression() Expression::Expression (Term* const term_) : term (term_) { - jassert (term != 0); + jassert (term != nullptr); } Expression::Expression (const double constant) @@ -5835,20 +5835,20 @@ const Expression Expression::adjustedToGiveNewResult (const double targetValue, Helpers::Constant* termToAdjust = Helpers::findTermToAdjust (newTerm, true); - if (termToAdjust == 0) + if (termToAdjust == nullptr) termToAdjust = Helpers::findTermToAdjust (newTerm, false); - if (termToAdjust == 0) + if (termToAdjust == nullptr) { newTerm = new Helpers::Add (newTerm.release(), new Helpers::Constant (0, false)); termToAdjust = Helpers::findTermToAdjust (newTerm, false); } - jassert (termToAdjust != 0); + jassert (termToAdjust != nullptr); const Term* const parent = Helpers::findDestinationFor (newTerm, termToAdjust); - if (parent == 0) + if (parent == nullptr) { termToAdjust->value = targetValue; } @@ -5856,7 +5856,7 @@ const Expression Expression::adjustedToGiveNewResult (const double targetValue, { const Helpers::TermPtr reverseTerm (parent->createTermToEvaluateInput (scope, termToAdjust, targetValue, newTerm)); - if (reverseTerm == 0) + if (reverseTerm == nullptr) return Expression (targetValue); termToAdjust->value = reverseTerm->resolve (scope, 0)->toDouble(); @@ -5904,7 +5904,7 @@ void Expression::findReferencedSymbols (Array& results, const Scope& sco const String Expression::toString() const { return term->toString(); } bool Expression::usesAnySymbols() const { return Helpers::containsAnySymbols (term); } -Expression::Type Expression::getType() const throw() { return term->getType(); } +Expression::Type Expression::getType() const noexcept { return term->getType(); } const String Expression::getSymbolOrFunction() const { return term->getName(); } int Expression::getNumInputs() const { return term->getNumInputs(); } const Expression Expression::getInput (int index) const { return Expression (term->getInput (index)); } @@ -5925,12 +5925,12 @@ Expression::Symbol::Symbol (const String& scopeUID_, const String& symbolName_) { } -bool Expression::Symbol::operator== (const Symbol& other) const throw() +bool Expression::Symbol::operator== (const Symbol& other) const noexcept { return symbolName == other.symbolName && scopeUID == other.scopeUID; } -bool Expression::Symbol::operator!= (const Symbol& other) const throw() +bool Expression::Symbol::operator!= (const Symbol& other) const noexcept { return ! operator== (other); } @@ -5994,7 +5994,7 @@ BEGIN_JUCE_NAMESPACE BlowFish::BlowFish (const void* const keyData, const int keyBytes) { - jassert (keyData != 0); + jassert (keyData != nullptr); jassert (keyBytes > 0); static const uint32 initialPValues [18] = @@ -6204,13 +6204,13 @@ BlowFish::~BlowFish() { } -uint32 BlowFish::F (const uint32 x) const throw() +uint32 BlowFish::F (const uint32 x) const noexcept { return ((s[0][(x >> 24) & 0xff] + s[1][(x >> 16) & 0xff]) ^ s[2][(x >> 8) & 0xff]) + s[3][x & 0xff]; } -void BlowFish::encrypt (uint32& data1, uint32& data2) const throw() +void BlowFish::encrypt (uint32& data1, uint32& data2) const noexcept { uint32 l = data1; uint32 r = data2; @@ -6226,7 +6226,7 @@ void BlowFish::encrypt (uint32& data1, uint32& data2) const throw() data2 = l ^ p[16]; } -void BlowFish::decrypt (uint32& data1, uint32& data2) const throw() +void BlowFish::decrypt (uint32& data1, uint32& data2) const noexcept { uint32 l = data1; uint32 r = data2; @@ -6328,7 +6328,7 @@ MD5::MD5 (const File& file) { const ScopedPointer fin (file.createInputStream()); - if (fin != 0) + if (fin != nullptr) processStream (*fin, -1); else zerostruct (result); @@ -6340,38 +6340,38 @@ MD5::~MD5() namespace MD5Functions { - void encode (void* const output, const void* const input, const int numBytes) throw() + void encode (void* const output, const void* const input, const int numBytes) noexcept { for (int i = 0; i < (numBytes >> 2); ++i) static_cast (output)[i] = ByteOrder::swapIfBigEndian (static_cast (input) [i]); } - inline uint32 rotateLeft (const uint32 x, const uint32 n) throw() { return (x << n) | (x >> (32 - n)); } + inline uint32 rotateLeft (const uint32 x, const uint32 n) noexcept { return (x << n) | (x >> (32 - n)); } - inline uint32 F (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & y) | (~x & z); } - inline uint32 G (const uint32 x, const uint32 y, const uint32 z) throw() { return (x & z) | (y & ~z); } - inline uint32 H (const uint32 x, const uint32 y, const uint32 z) throw() { return x ^ y ^ z; } - inline uint32 I (const uint32 x, const uint32 y, const uint32 z) throw() { return y ^ (x | ~z); } + inline uint32 F (const uint32 x, const uint32 y, const uint32 z) noexcept { return (x & y) | (~x & z); } + inline uint32 G (const uint32 x, const uint32 y, const uint32 z) noexcept { return (x & z) | (y & ~z); } + inline uint32 H (const uint32 x, const uint32 y, const uint32 z) noexcept { return x ^ y ^ z; } + inline uint32 I (const uint32 x, const uint32 y, const uint32 z) noexcept { return y ^ (x | ~z); } - void FF (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void FF (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) noexcept { a += F (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - void GG (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void GG (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) noexcept { a += G (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - void HH (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void HH (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) noexcept { a += H (b, c, d) + x + ac; a = rotateLeft (a, s) + b; } - void II (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) throw() + void II (uint32& a, const uint32 b, const uint32 c, const uint32 d, const uint32 x, const uint32 s, const uint32 ac) noexcept { a += I (b, c, d) + x + ac; a = rotateLeft (a, s) + b; @@ -6769,12 +6769,12 @@ RSAKey::~RSAKey() { } -bool RSAKey::operator== (const RSAKey& other) const throw() +bool RSAKey::operator== (const RSAKey& other) const noexcept { return part1 == other.part1 && part2 == other.part2; } -bool RSAKey::operator!= (const RSAKey& other) const throw() +bool RSAKey::operator!= (const RSAKey& other) const noexcept { return ! operator== (other); } @@ -6838,7 +6838,7 @@ void RSAKey::createKeyPair (RSAKey& publicKey, RSAKey& privateKey, jassert (numRandomSeeds == 0 || numRandomSeeds >= 2); // you need to provide plenty of seeds here! BigInteger p (Primes::createProbablePrime (numBits / 2, 30, randomSeeds, numRandomSeeds / 2)); - BigInteger q (Primes::createProbablePrime (numBits - numBits / 2, 30, randomSeeds == 0 ? 0 : (randomSeeds + numRandomSeeds / 2), numRandomSeeds - numRandomSeeds / 2)); + BigInteger q (Primes::createProbablePrime (numBits - numBits / 2, 30, randomSeeds == nullptr ? 0 : (randomSeeds + numRandomSeeds / 2), numRandomSeeds - numRandomSeeds / 2)); const BigInteger n (p * q); const BigInteger m (--p * --q); @@ -7328,7 +7328,7 @@ OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const File& fileTo { const ScopedPointer in (fileToRead.createInputStream()); - if (in != 0) + if (in != nullptr) stream.writeFromInputStream (*in, -1); return stream; @@ -7378,12 +7378,12 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul { hasBeenAdvanced = true; - if (subIterator != 0) + if (subIterator != nullptr) { if (subIterator->next (isDirResult, isHiddenResult, fileSize, modTime, creationTime, isReadOnly)) return true; - subIterator = 0; + subIterator = nullptr; } String filename; @@ -7419,12 +7419,12 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul if (matches) { currentFile = fileFound; - if (isHiddenResult != 0) *isHiddenResult = isHidden; - if (isDirResult != 0) *isDirResult = isDirectory; + if (isHiddenResult != nullptr) *isHiddenResult = isHidden; + if (isDirResult != nullptr) *isDirResult = isDirectory; return true; } - else if (subIterator != 0) + else if (subIterator != nullptr) { return next(); } @@ -7436,7 +7436,7 @@ bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResul const File DirectoryIterator::getFile() const { - if (subIterator != 0 && subIterator->hasBeenAdvanced) + if (subIterator != nullptr && subIterator->hasBeenAdvanced) return subIterator->getFile(); // You need to call DirectoryIterator::next() before asking it for the file that it found! @@ -7453,8 +7453,8 @@ float DirectoryIterator::getEstimatedProgress() const if (totalNumFiles <= 0) return 0.0f; - const float detailedIndex = (subIterator != 0) ? index + subIterator->getEstimatedProgress() - : (float) index; + const float detailedIndex = (subIterator != nullptr) ? index + subIterator->getEstimatedProgress() + : (float) index; return detailedIndex / totalNumFiles; } @@ -7566,7 +7566,7 @@ const String File::parseAbsolutePath (const String& p) const String userName (path.substring (1).upToFirstOccurrenceOf ("/", false, false)); struct passwd* const pw = getpwnam (userName.toUTF8()); - if (pw != 0) + if (pw != nullptr) path = addTrailingSeparator (pw->pw_dir) + path.fromFirstOccurrenceOf ("/", false, false); } } @@ -8140,7 +8140,7 @@ bool File::appendText (const String& text, { const ScopedPointer out (createOutputStream()); - if (out != 0) + if (out != nullptr) { out->writeText (text, asUnicode, writeUnicodeHeaderBytes); return true; @@ -8765,7 +8765,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE NamedPipe::NamedPipe() - : internal (0) + : internal (nullptr) { } @@ -8788,7 +8788,7 @@ bool NamedPipe::createNewPipe (const String& pipeName) bool NamedPipe::isOpen() const { - return internal != 0; + return internal != nullptr; } const String NamedPipe::getName() const @@ -8950,7 +8950,7 @@ namespace SocketHelpers #endif } - bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) throw() + bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) noexcept { const int sndBufSize = 65536; const int rcvBufSize = 65536; @@ -8963,7 +8963,7 @@ namespace SocketHelpers : (setsockopt (handle, IPPROTO_TCP, TCP_NODELAY, (const char*) &one, sizeof (one)) == 0)); } - bool bindSocketToPort (const int handle, const int port) throw() + bool bindSocketToPort (const int handle, const int port) noexcept { if (handle <= 0 || port <= 0) return false; @@ -8979,7 +8979,7 @@ namespace SocketHelpers int readSocket (const int handle, void* const destBuffer, const int maxBytesToRead, bool volatile& connected, - const bool blockUntilSpecifiedAmountHasArrived) throw() + const bool blockUntilSpecifiedAmountHasArrived) noexcept { int bytesRead = 0; @@ -9014,7 +9014,7 @@ namespace SocketHelpers return bytesRead; } - int waitForReadiness (const int handle, const bool forReading, const int timeoutMsecs) throw() + int waitForReadiness (const int handle, const bool forReading, const int timeoutMsecs) noexcept { struct timeval timeout; struct timeval* timeoutp; @@ -9067,7 +9067,7 @@ namespace SocketHelpers return FD_ISSET (handle, forReading ? &rset : &wset) ? 1 : 0; } - bool setSocketBlockingState (const int handle, const bool shouldBlock) throw() + bool setSocketBlockingState (const int handle, const bool shouldBlock) noexcept { #if JUCE_WINDOWS u_long nonBlocking = shouldBlock ? 0 : 1; @@ -9092,14 +9092,14 @@ namespace SocketHelpers void** serverAddress, const String& hostName, const int portNumber, - const int timeOutMillisecs) throw() + const int timeOutMillisecs) noexcept { struct addrinfo hints = { 0 }; hints.ai_family = AF_UNSPEC; hints.ai_socktype = isDatagram ? SOCK_DGRAM : SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV; - struct addrinfo* info = 0; + struct addrinfo* info = nullptr; if (getaddrinfo (hostName.toUTF8(), String (portNumber).toUTF8(), &hints, &info) != 0 || info == 0) return false; @@ -9328,7 +9328,7 @@ StreamingSocket* StreamingSocket::waitForNextConnection() const return 0; } -bool StreamingSocket::isLocal() const throw() +bool StreamingSocket::isLocal() const noexcept { return hostName == "127.0.0.1"; } @@ -9457,7 +9457,7 @@ int DatagramSocket::write (const void* sourceBuffer, const int numBytesToWrite) : -1; } -bool DatagramSocket::isLocal() const throw() +bool DatagramSocket::isLocal() const noexcept { return hostName == "127.0.0.1"; } @@ -9747,7 +9747,7 @@ bool URL::readEntireBinaryStream (MemoryBlock& destData, { const ScopedPointer in (createInputStream (usePostCommand)); - if (in != 0) + if (in != nullptr) { in->readIntoMemoryBlock (destData); return true; @@ -9760,7 +9760,7 @@ const String URL::readEntireTextStream (const bool usePostCommand) const { const ScopedPointer in (createInputStream (usePostCommand)); - if (in != 0) + if (in != nullptr) return in->readEntireStreamAsString(); return String::empty; @@ -9928,7 +9928,7 @@ const String MACAddress::toString() const return s; } -int64 MACAddress::toInt64() const throw() +int64 MACAddress::toInt64() const noexcept { int64 n = 0; @@ -9938,10 +9938,10 @@ int64 MACAddress::toInt64() const throw() return n; } -bool MACAddress::isNull() const throw() { return asInt64 == 0; } +bool MACAddress::isNull() const noexcept { return asInt64 == 0; } -bool MACAddress::operator== (const MACAddress& other) const throw() { return asInt64 == other.asInt64; } -bool MACAddress::operator!= (const MACAddress& other) const throw() { return asInt64 != other.asInt64; } +bool MACAddress::operator== (const MACAddress& other) const noexcept { return asInt64 == other.asInt64; } +bool MACAddress::operator!= (const MACAddress& other) const noexcept { return asInt64 != other.asInt64; } END_JUCE_NAMESPACE /*** End of inlined file: juce_MACAddress.cpp ***/ @@ -9952,10 +9952,10 @@ BEGIN_JUCE_NAMESPACE namespace { - int calcBufferStreamBufferSize (int requestedSize, InputStream* const source) throw() + int calcBufferStreamBufferSize (int requestedSize, InputStream* const source) noexcept { // You need to supply a real stream when creating a BufferedInputStream - jassert (source != 0); + jassert (source != nullptr); requestedSize = jmax (256, requestedSize); @@ -10326,7 +10326,7 @@ void MemoryOutputStream::preallocate (const size_t bytesToPreallocate) data.ensureSize (bytesToPreallocate + 1); } -void MemoryOutputStream::reset() throw() +void MemoryOutputStream::reset() noexcept { position = 0; size = 0; @@ -10349,7 +10349,7 @@ bool MemoryOutputStream::write (const void* const buffer, int howMany) return true; } -const void* MemoryOutputStream::getData() const throw() +const void* MemoryOutputStream::getData() const noexcept { void* const d = data.getData(); @@ -10590,7 +10590,7 @@ Uuid::Uuid() } } -Uuid::~Uuid() throw() +Uuid::~Uuid() noexcept { } @@ -10616,7 +10616,7 @@ bool Uuid::operator!= (const Uuid& other) const return ! operator== (other); } -bool Uuid::isNull() const throw() +bool Uuid::isNull() const noexcept { return (value.asInt64 [0] == 0) && (value.asInt64 [1] == 0); } @@ -10647,7 +10647,7 @@ Uuid::Uuid (const uint8* const rawData) Uuid& Uuid::operator= (const uint8* const rawData) { - if (rawData != 0) + if (rawData != nullptr) memcpy (value.asBytes, rawData, sizeof (value.asBytes)); else zeromem (value.asBytes, sizeof (value.asBytes)); @@ -10680,11 +10680,9 @@ public: zipEntryInfo (zei), pos (0), headerSize (0), - inputStream (0) + inputStream (file_.inputStream) { - inputStream = file_.inputStream; - - if (file_.inputSource != 0) + if (file_.inputSource != nullptr) { inputStream = streamToDelete = file.inputSource->createInputStream(); } @@ -10697,7 +10695,7 @@ public: char buffer [30]; - if (inputStream != 0 + if (inputStream != nullptr && inputStream->setPosition (zei.streamOffset) && inputStream->read (buffer, 30) == 30 && ByteOrder::littleEndianInt (buffer) == 0x04034b50) @@ -10710,7 +10708,7 @@ public: ~ZipInputStream() { #if JUCE_DEBUG - if (inputStream != 0 && inputStream == file.inputStream) + if (inputStream != nullptr && inputStream == file.inputStream) file.numOpenStreams--; #endif } @@ -10727,7 +10725,7 @@ public: howMany = (int) jmin ((int64) howMany, zipEntryInfo.compressedSize - pos); - if (inputStream == 0) + if (inputStream == nullptr) return 0; int num; @@ -10789,7 +10787,7 @@ ZipFile::ZipFile (InputStream* const source_, const bool deleteStreamWhenDestroy } ZipFile::ZipFile (const File& file) - : inputStream (0) + : inputStream (nullptr) #if JUCE_DEBUG , numOpenStreams (0) #endif @@ -10799,7 +10797,7 @@ ZipFile::ZipFile (const File& file) } ZipFile::ZipFile (InputSource* const inputSource_) - : inputStream (0), + : inputStream (nullptr), inputSource (inputSource_) #if JUCE_DEBUG , numOpenStreams (0) @@ -10822,18 +10820,18 @@ ZipFile::~ZipFile() #endif } -int ZipFile::getNumEntries() const throw() +int ZipFile::getNumEntries() const noexcept { return entries.size(); } -const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw() +const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const noexcept { ZipEntryInfo* const zei = entries [index]; - return zei != 0 ? &(zei->entry) : 0; + return zei != nullptr ? &(zei->entry) : 0; } -int ZipFile::getIndexOfFileName (const String& fileName) const throw() +int ZipFile::getIndexOfFileName (const String& fileName) const noexcept { for (int i = 0; i < entries.size(); ++i) if (entries.getUnchecked (i)->entry.filename == fileName) @@ -10842,7 +10840,7 @@ int ZipFile::getIndexOfFileName (const String& fileName) const throw() return -1; } -const ZipFile::ZipEntry* ZipFile::getEntry (const String& fileName) const throw() +const ZipFile::ZipEntry* ZipFile::getEntry (const String& fileName) const noexcept { return getEntry (getIndexOfFileName (fileName)); } @@ -10850,9 +10848,9 @@ const ZipFile::ZipEntry* ZipFile::getEntry (const String& fileName) const throw( InputStream* ZipFile::createStreamForEntry (const int index) { ZipEntryInfo* const zei = entries[index]; - InputStream* stream = 0; + InputStream* stream = nullptr; - if (zei != 0) + if (zei != nullptr) { stream = new ZipInputStream (*this, *zei); @@ -10889,13 +10887,13 @@ void ZipFile::init() ScopedPointer toDelete; InputStream* in = inputStream; - if (inputSource != 0) + if (inputSource != nullptr) { in = inputSource->createInputStream(); toDelete = in; } - if (in != 0) + if (in != nullptr) { int numEntries = 0; int pos = findEndOfZipEntryTable (*in, numEntries); @@ -11005,7 +11003,7 @@ bool ZipFile::uncompressEntry (const int index, { const ZipEntryInfo* zei = entries [index]; - if (zei != 0) + if (zei != nullptr) { const File targetFile (targetDirectory.getChildFile (zei->entry.filename)); @@ -11017,7 +11015,7 @@ bool ZipFile::uncompressEntry (const int index, { ScopedPointer in (createStreamForEntry (index)); - if (in != 0) + if (in != nullptr) { if (shouldOverwriteFiles && ! targetFile.deleteFile()) return false; @@ -11026,10 +11024,10 @@ bool ZipFile::uncompressEntry (const int index, { ScopedPointer out (targetFile.createOutputStream()); - if (out != 0) + if (out != nullptr) { out->writeFromInputStream (*in, -1); - out = 0; + out = nullptr; targetFile.setCreationTime (zei->entry.fileTime); targetFile.setLastModificationTime (zei->entry.fileTime); @@ -11120,7 +11118,7 @@ private: checksum = 0; ScopedPointer input (file.createInputStream()); - if (input == 0) + if (input == nullptr) return false; const int bufferSize = 2048; @@ -11212,17 +11210,17 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE -juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) throw() +juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) noexcept { return towupper ((wchar_t) character); } -juce_wchar CharacterFunctions::toLowerCase (const juce_wchar character) throw() +juce_wchar CharacterFunctions::toLowerCase (const juce_wchar character) noexcept { return towlower ((wchar_t) character); } -bool CharacterFunctions::isUpperCase (const juce_wchar character) throw() +bool CharacterFunctions::isUpperCase (const juce_wchar character) noexcept { #if JUCE_WINDOWS return iswupper ((wchar_t) character) != 0; @@ -11231,7 +11229,7 @@ bool CharacterFunctions::isUpperCase (const juce_wchar character) throw() #endif } -bool CharacterFunctions::isLowerCase (const juce_wchar character) throw() +bool CharacterFunctions::isLowerCase (const juce_wchar character) noexcept { #if JUCE_WINDOWS return iswlower ((wchar_t) character) != 0; @@ -11244,50 +11242,50 @@ bool CharacterFunctions::isLowerCase (const juce_wchar character) throw() #pragma warning (pop) #endif -bool CharacterFunctions::isWhitespace (const char character) throw() +bool CharacterFunctions::isWhitespace (const char character) noexcept { return character == ' ' || (character <= 13 && character >= 9); } -bool CharacterFunctions::isWhitespace (const juce_wchar character) throw() +bool CharacterFunctions::isWhitespace (const juce_wchar character) noexcept { return iswspace ((wchar_t) character) != 0; } -bool CharacterFunctions::isDigit (const char character) throw() +bool CharacterFunctions::isDigit (const char character) noexcept { return (character >= '0' && character <= '9'); } -bool CharacterFunctions::isDigit (const juce_wchar character) throw() +bool CharacterFunctions::isDigit (const juce_wchar character) noexcept { return iswdigit ((wchar_t) character) != 0; } -bool CharacterFunctions::isLetter (const char character) throw() +bool CharacterFunctions::isLetter (const char character) noexcept { return (character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z'); } -bool CharacterFunctions::isLetter (const juce_wchar character) throw() +bool CharacterFunctions::isLetter (const juce_wchar character) noexcept { return iswalpha ((wchar_t) character) != 0; } -bool CharacterFunctions::isLetterOrDigit (const char character) throw() +bool CharacterFunctions::isLetterOrDigit (const char character) noexcept { return (character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9'); } -bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) throw() +bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) noexcept { return iswalnum ((wchar_t) character) != 0; } -int CharacterFunctions::getHexDigitValue (const juce_wchar digit) throw() +int CharacterFunctions::getHexDigitValue (const juce_wchar digit) noexcept { unsigned int d = digit - '0'; if (d < (unsigned int) 10) @@ -11304,7 +11302,7 @@ int CharacterFunctions::getHexDigitValue (const juce_wchar digit) throw() return -1; } -double CharacterFunctions::mulexp10 (const double value, int exponent) throw() +double CharacterFunctions::mulexp10 (const double value, int exponent) noexcept { if (exponent == 0) return value; @@ -11451,7 +11449,7 @@ const String LocalisedStrings::translateWithCurrentMappings (const String& text) { const SpinLock::ScopedLockType sl (currentMappingsLock); - if (currentMappings != 0) + if (currentMappings != nullptr) return currentMappings->translate (text); return text; @@ -11490,7 +11488,7 @@ NewLine newLine; typedef CharPointer_UTF32 CharPointer_wchar_t; #endif -static inline CharPointer_wchar_t castToCharPointer_wchar_t (const void* t) throw() +static inline CharPointer_wchar_t castToCharPointer_wchar_t (const void* t) noexcept { return CharPointer_wchar_t (static_cast (t)); } @@ -11518,7 +11516,7 @@ public: template static const CharPointerType createFromCharPointer (const CharPointer& text) { - if (text.getAddress() == 0 || text.isEmpty()) + if (text.getAddress() == nullptr || text.isEmpty()) return getEmpty(); CharPointer t (text); @@ -11535,7 +11533,7 @@ public: template static const CharPointerType createFromCharPointer (const CharPointer& text, size_t maxChars) { - if (text.getAddress() == 0 || text.isEmpty() || maxChars == 0) + if (text.getAddress() == nullptr || text.isEmpty() || maxChars == 0) return getEmpty(); CharPointer end (text); @@ -11556,7 +11554,7 @@ public: template static const CharPointerType createFromCharPointer (const CharPointer& start, const CharPointer& end) { - if (start.getAddress() == 0 || start.isEmpty()) + if (start.getAddress() == nullptr || start.isEmpty()) return getEmpty(); CharPointer e (start); @@ -11581,23 +11579,23 @@ public: return dest; } - static inline const CharPointerType getEmpty() throw() + static inline const CharPointerType getEmpty() noexcept { return CharPointerType (empty.text); } - static void retain (const CharPointerType& text) throw() + static void retain (const CharPointerType& text) noexcept { ++(bufferFromText (text)->refCount); } - static inline void release (StringHolder* const b) throw() + static inline void release (StringHolder* const b) noexcept { if (--(b->refCount) == -1 && b != &empty) delete[] reinterpret_cast (b); } - static void release (const CharPointerType& text) throw() + static void release (const CharPointerType& text) noexcept { release (bufferFromText (text)); } @@ -11630,7 +11628,7 @@ public: return newText; } - static size_t getAllocatedNumBytes (const CharPointerType& text) throw() + static size_t getAllocatedNumBytes (const CharPointerType& text) noexcept { return bufferFromText (text)->allocatedNumBytes; } @@ -11642,7 +11640,7 @@ public: static StringHolder empty; private: - static inline StringHolder* bufferFromText (const CharPointerType& text) throw() + static inline StringHolder* bufferFromText (const CharPointerType& text) noexcept { // (Can't use offsetof() here because of warnings about this not being a POD) return reinterpret_cast (reinterpret_cast (text.getAddress()) @@ -11658,28 +11656,28 @@ void String::preallocateBytes (const size_t numBytesNeeded) text = StringHolder::makeUniqueWithByteSize (text, numBytesNeeded + sizeof (CharPointerType::CharType)); } -String::String() throw() +String::String() noexcept : text (StringHolder::getEmpty()) { } -String::~String() throw() +String::~String() noexcept { StringHolder::release (text); } -String::String (const String& other) throw() +String::String (const String& other) noexcept : text (other.text) { StringHolder::retain (text); } -void String::swapWith (String& other) throw() +void String::swapWith (String& other) noexcept { std::swap (text, other.text); } -String& String::operator= (const String& other) throw() +String& String::operator= (const String& other) noexcept { StringHolder::retain (other.text); StringHolder::release (text.atomicSwap (other.text)); @@ -11709,7 +11707,7 @@ String::String (const char* const t) because there's no other way to represent these strings in a way that isn't dependent on the compiler, source code editor and platform. */ - jassert (t == 0 || CharPointer_ASCII::isValidString (t, std::numeric_limits::max())); + jassert (t == nullptr || CharPointer_ASCII::isValidString (t, std::numeric_limits::max())); } String::String (const char* const t, const size_t maxChars) @@ -11728,7 +11726,7 @@ String::String (const char* const t, const size_t maxChars) because there's no other way to represent these strings in a way that isn't dependent on the compiler, source code editor and platform. */ - jassert (t == 0 || CharPointer_ASCII::isValidString (t, (int) maxChars)); + jassert (t == nullptr || CharPointer_ASCII::isValidString (t, (int) maxChars)); } String::String (const wchar_t* const t) : text (StringHolder::createFromCharPointer (castToCharPointer_wchar_t (t))) {} @@ -11758,7 +11756,7 @@ const String String::charToString (const juce_wchar character) namespace NumberToStringConverters { // pass in a pointer to the END of a buffer.. - char* numberToString (char* t, const int64 n) throw() + char* numberToString (char* t, const int64 n) noexcept { *--t = 0; int64 v = (n >= 0) ? n : -n; @@ -11776,7 +11774,7 @@ namespace NumberToStringConverters return t; } - char* numberToString (char* t, uint64 v) throw() + char* numberToString (char* t, uint64 v) noexcept { *--t = 0; @@ -11790,7 +11788,7 @@ namespace NumberToStringConverters return t; } - char* numberToString (char* t, const int n) throw() + char* numberToString (char* t, const int n) noexcept { if (n == (int) 0x80000000) // (would cause an overflow) return numberToString (t, (int64) n); @@ -11811,7 +11809,7 @@ namespace NumberToStringConverters return t; } - char* numberToString (char* t, unsigned int v) throw() + char* numberToString (char* t, unsigned int v) noexcept { *--t = 0; @@ -11837,7 +11835,7 @@ namespace NumberToStringConverters return dp; } - char* doubleToString (char* buffer, int numChars, double n, int numDecPlaces, size_t& len) throw() + char* doubleToString (char* buffer, int numChars, double n, int numDecPlaces, size_t& len) noexcept { if (numDecPlaces > 0 && n > -1.0e20 && n < 1.0e20) { @@ -11899,23 +11897,23 @@ String::String (const uint64 number) : text (NumberToStringConverters::createFr String::String (const float number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble ((double) number, numberOfDecimalPlaces)) {} String::String (const double number, const int numberOfDecimalPlaces) : text (NumberToStringConverters::createFromDouble (number, numberOfDecimalPlaces)) {} -int String::length() const throw() +int String::length() const noexcept { return (int) text.length(); } -size_t String::getByteOffsetOfEnd() const throw() +size_t String::getByteOffsetOfEnd() const noexcept { return ((char*) text.findTerminatingNull().getAddress()) - (char*) text.getAddress(); } -const juce_wchar String::operator[] (int index) const throw() +const juce_wchar String::operator[] (int index) const noexcept { jassert (index == 0 || (index > 0 && index <= (int) text.lengthUpTo (index + 1))); return text [index]; } -int String::hashCode() const throw() +int String::hashCode() const noexcept { CharPointerType t (text); int result = 0; @@ -11926,7 +11924,7 @@ int String::hashCode() const throw() return result; } -int64 String::hashCode64() const throw() +int64 String::hashCode64() const noexcept { CharPointerType t (text); int64 result = 0; @@ -11937,47 +11935,47 @@ int64 String::hashCode64() const throw() return result; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const String& s2) throw() { return s1.compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const char* const s2) throw() { return s1.compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const wchar_t* const s2) throw() { return s1.compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF16& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF32& s2) throw() { return s1.getCharPointer().compare (s2) == 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) throw() { return s1.compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* const s2) throw() { return s1.compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) throw() { return s1.compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32& s2) throw() { return s1.getCharPointer().compare (s2) != 0; } -JUCE_API bool JUCE_CALLTYPE operator> (const String& s1, const String& s2) throw() { return s1.compare (s2) > 0; } -JUCE_API bool JUCE_CALLTYPE operator< (const String& s1, const String& s2) throw() { return s1.compare (s2) < 0; } -JUCE_API bool JUCE_CALLTYPE operator>= (const String& s1, const String& s2) throw() { return s1.compare (s2) >= 0; } -JUCE_API bool JUCE_CALLTYPE operator<= (const String& s1, const String& s2) throw() { return s1.compare (s2) <= 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const String& s2) noexcept { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const char* const s2) noexcept { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF8& s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF16& s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator== (const String& s1, const CharPointer_UTF32& s2) noexcept { return s1.getCharPointer().compare (s2) == 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const char* const s2) noexcept { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8& s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16& s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32& s2) noexcept { return s1.getCharPointer().compare (s2) != 0; } +JUCE_API bool JUCE_CALLTYPE operator> (const String& s1, const String& s2) noexcept { return s1.compare (s2) > 0; } +JUCE_API bool JUCE_CALLTYPE operator< (const String& s1, const String& s2) noexcept { return s1.compare (s2) < 0; } +JUCE_API bool JUCE_CALLTYPE operator>= (const String& s1, const String& s2) noexcept { return s1.compare (s2) >= 0; } +JUCE_API bool JUCE_CALLTYPE operator<= (const String& s1, const String& s2) noexcept { return s1.compare (s2) <= 0; } -bool String::equalsIgnoreCase (const wchar_t* const t) const throw() +bool String::equalsIgnoreCase (const wchar_t* const t) const noexcept { - return t != 0 ? text.compareIgnoreCase (castToCharPointer_wchar_t (t)) == 0 - : isEmpty(); + return t != nullptr ? text.compareIgnoreCase (castToCharPointer_wchar_t (t)) == 0 + : isEmpty(); } -bool String::equalsIgnoreCase (const char* const t) const throw() +bool String::equalsIgnoreCase (const char* const t) const noexcept { - return t != 0 ? text.compareIgnoreCase (CharPointer_UTF8 (t)) == 0 - : isEmpty(); + return t != nullptr ? text.compareIgnoreCase (CharPointer_UTF8 (t)) == 0 + : isEmpty(); } -bool String::equalsIgnoreCase (const String& other) const throw() +bool String::equalsIgnoreCase (const String& other) const noexcept { return text == other.text || text.compareIgnoreCase (other.text) == 0; } -int String::compare (const String& other) const throw() { return (text == other.text) ? 0 : text.compare (other.text); } -int String::compare (const char* const other) const throw() { return text.compare (CharPointer_UTF8 (other)); } -int String::compare (const wchar_t* const other) const throw() { return text.compare (castToCharPointer_wchar_t (other)); } -int String::compareIgnoreCase (const String& other) const throw() { return (text == other.text) ? 0 : text.compareIgnoreCase (other.text); } +int String::compare (const String& other) const noexcept { return (text == other.text) ? 0 : text.compare (other.text); } +int String::compare (const char* const other) const noexcept { return text.compare (CharPointer_UTF8 (other)); } +int String::compare (const wchar_t* const other) const noexcept { return text.compare (castToCharPointer_wchar_t (other)); } +int String::compareIgnoreCase (const String& other) const noexcept { return (text == other.text) ? 0 : text.compareIgnoreCase (other.text); } -int String::compareLexicographically (const String& other) const throw() +int String::compareLexicographically (const String& other) const noexcept { CharPointerType s1 (text); @@ -12018,7 +12016,7 @@ String& String::operator+= (const char* const t) because there's no other way to represent these strings in a way that isn't dependent on the compiler, source code editor and platform. */ - jassert (t == 0 || CharPointer_ASCII::isValidString (t, std::numeric_limits::max())); + jassert (t == nullptr || CharPointer_ASCII::isValidString (t, std::numeric_limits::max())); appendCharPointer (CharPointer_ASCII (t)); return *this; @@ -12143,12 +12141,12 @@ JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, const NewLine&) return string1 += NewLine::getDefault(); } -int String::indexOfChar (const juce_wchar character) const throw() +int String::indexOfChar (const juce_wchar character) const noexcept { return text.indexOf (character); } -int String::indexOfChar (const int startIndex, const juce_wchar character) const throw() +int String::indexOfChar (const int startIndex, const juce_wchar character) const noexcept { CharPointerType t (text); @@ -12168,7 +12166,7 @@ int String::indexOfChar (const int startIndex, const juce_wchar character) const return -1; } -int String::lastIndexOfChar (const juce_wchar character) const throw() +int String::lastIndexOfChar (const juce_wchar character) const noexcept { CharPointerType t (text); int last = -1; @@ -12180,7 +12178,7 @@ int String::lastIndexOfChar (const juce_wchar character) const throw() return last; } -int String::indexOfAnyOf (const String& charactersToLookFor, const int startIndex, const bool ignoreCase) const throw() +int String::indexOfAnyOf (const String& charactersToLookFor, const int startIndex, const bool ignoreCase) const noexcept { CharPointerType t (text); @@ -12200,17 +12198,17 @@ int String::indexOfAnyOf (const String& charactersToLookFor, const int startInde return -1; } -int String::indexOf (const String& other) const throw() +int String::indexOf (const String& other) const noexcept { return other.isEmpty() ? 0 : text.indexOf (other.text); } -int String::indexOfIgnoreCase (const String& other) const throw() +int String::indexOfIgnoreCase (const String& other) const noexcept { return other.isEmpty() ? 0 : CharacterFunctions::indexOfIgnoreCase (text, other.text); } -int String::indexOf (const int startIndex, const String& other) const throw() +int String::indexOf (const int startIndex, const String& other) const noexcept { if (other.isEmpty()) return -1; @@ -12231,7 +12229,7 @@ int String::indexOf (const int startIndex, const String& other) const throw() return found; } -int String::indexOfIgnoreCase (const int startIndex, const String& other) const throw() +int String::indexOfIgnoreCase (const int startIndex, const String& other) const noexcept { if (other.isEmpty()) return -1; @@ -12252,7 +12250,7 @@ int String::indexOfIgnoreCase (const int startIndex, const String& other) const return found; } -int String::lastIndexOf (const String& other) const throw() +int String::lastIndexOf (const String& other) const noexcept { if (other.isNotEmpty()) { @@ -12277,7 +12275,7 @@ int String::lastIndexOf (const String& other) const throw() return -1; } -int String::lastIndexOfIgnoreCase (const String& other) const throw() +int String::lastIndexOfIgnoreCase (const String& other) const noexcept { if (other.isNotEmpty()) { @@ -12302,7 +12300,7 @@ int String::lastIndexOfIgnoreCase (const String& other) const throw() return -1; } -int String::lastIndexOfAnyOf (const String& charactersToLookFor, const bool ignoreCase) const throw() +int String::lastIndexOfAnyOf (const String& charactersToLookFor, const bool ignoreCase) const noexcept { CharPointerType t (text); int last = -1; @@ -12314,22 +12312,22 @@ int String::lastIndexOfAnyOf (const String& charactersToLookFor, const bool igno return last; } -bool String::contains (const String& other) const throw() +bool String::contains (const String& other) const noexcept { return indexOf (other) >= 0; } -bool String::containsChar (const juce_wchar character) const throw() +bool String::containsChar (const juce_wchar character) const noexcept { return text.indexOf (character) >= 0; } -bool String::containsIgnoreCase (const String& t) const throw() +bool String::containsIgnoreCase (const String& t) const noexcept { return indexOfIgnoreCase (t) >= 0; } -int String::indexOfWholeWord (const String& word) const throw() +int String::indexOfWholeWord (const String& word) const noexcept { if (word.isNotEmpty()) { @@ -12351,7 +12349,7 @@ int String::indexOfWholeWord (const String& word) const throw() return -1; } -int String::indexOfWholeWordIgnoreCase (const String& word) const throw() +int String::indexOfWholeWordIgnoreCase (const String& word) const noexcept { if (word.isNotEmpty()) { @@ -12373,12 +12371,12 @@ int String::indexOfWholeWordIgnoreCase (const String& word) const throw() return -1; } -bool String::containsWholeWord (const String& wordToLookFor) const throw() +bool String::containsWholeWord (const String& wordToLookFor) const noexcept { return indexOfWholeWord (wordToLookFor) >= 0; } -bool String::containsWholeWordIgnoreCase (const String& wordToLookFor) const throw() +bool String::containsWholeWordIgnoreCase (const String& wordToLookFor) const noexcept { return indexOfWholeWordIgnoreCase (wordToLookFor) >= 0; } @@ -12387,7 +12385,7 @@ namespace WildCardHelpers { int indexOfMatch (const String::CharPointerType& wildcard, String::CharPointerType test, - const bool ignoreCase) throw() + const bool ignoreCase) noexcept { int start = 0; @@ -12428,7 +12426,7 @@ namespace WildCardHelpers } } -bool String::matchesWildcard (const String& wildcard, const bool ignoreCase) const throw() +bool String::matchesWildcard (const String& wildcard, const bool ignoreCase) const noexcept { CharPointerType w (wildcard.text); CharPointerType t (text); @@ -12613,14 +12611,14 @@ class StringCreationHelper { public: StringCreationHelper (const size_t initialBytes) - : source (0), dest (0), allocatedBytes (initialBytes), bytesWritten (0) + : source (nullptr), dest (nullptr), allocatedBytes (initialBytes), bytesWritten (0) { result.preallocateBytes (allocatedBytes); dest = result.getCharPointer(); } StringCreationHelper (const String::CharPointerType& source_) - : source (source_), dest (0), allocatedBytes (StringHolder::getAllocatedNumBytes (source)), bytesWritten (0) + : source (source_), dest (nullptr), allocatedBytes (StringHolder::getAllocatedNumBytes (source)), bytesWritten (0) { result.preallocateBytes (allocatedBytes); dest = result.getCharPointer(); @@ -12694,24 +12692,24 @@ const String String::replaceCharacters (const String& charactersToReplace, return builder.result; } -bool String::startsWith (const String& other) const throw() +bool String::startsWith (const String& other) const noexcept { return text.compareUpTo (other.text, other.length()) == 0; } -bool String::startsWithIgnoreCase (const String& other) const throw() +bool String::startsWithIgnoreCase (const String& other) const noexcept { return text.compareIgnoreCaseUpTo (other.text, other.length()) == 0; } -bool String::startsWithChar (const juce_wchar character) const throw() +bool String::startsWithChar (const juce_wchar character) const noexcept { jassert (character != 0); // strings can't contain a null character! return *text == character; } -bool String::endsWithChar (const juce_wchar character) const throw() +bool String::endsWithChar (const juce_wchar character) const noexcept { jassert (character != 0); // strings can't contain a null character! @@ -12722,7 +12720,7 @@ bool String::endsWithChar (const juce_wchar character) const throw() return *--t == character; } -bool String::endsWith (const String& other) const throw() +bool String::endsWith (const String& other) const noexcept { CharPointerType end (text.findTerminatingNull()); CharPointerType otherEnd (other.text.findTerminatingNull()); @@ -12739,7 +12737,7 @@ bool String::endsWith (const String& other) const throw() return otherEnd == other.text; } -bool String::endsWithIgnoreCase (const String& other) const throw() +bool String::endsWithIgnoreCase (const String& other) const noexcept { CharPointerType end (text.findTerminatingNull()); CharPointerType otherEnd (other.text.findTerminatingNull()); @@ -12790,7 +12788,7 @@ const String String::toLowerCase() const return builder.result; } -juce_wchar String::getLastCharacter() const throw() +juce_wchar String::getLastCharacter() const noexcept { return isEmpty() ? juce_wchar() : text [length() - 1]; } @@ -13112,7 +13110,7 @@ const String String::initialSectionNotContaining (const String& charactersToStop return *this; } -bool String::containsOnly (const String& chars) const throw() +bool String::containsOnly (const String& chars) const noexcept { CharPointerType t (text); @@ -13123,7 +13121,7 @@ bool String::containsOnly (const String& chars) const throw() return true; } -bool String::containsAnyOf (const String& chars) const throw() +bool String::containsAnyOf (const String& chars) const noexcept { CharPointerType t (text); @@ -13134,7 +13132,7 @@ bool String::containsAnyOf (const String& chars) const throw() return false; } -bool String::containsNonWhitespaceChars() const throw() +bool String::containsNonWhitespaceChars() const noexcept { CharPointerType t (text); @@ -13184,12 +13182,12 @@ const String String::formatted (const String pf, ... ) return empty; } -int String::getIntValue() const throw() +int String::getIntValue() const noexcept { return text.getIntValue32(); } -int String::getTrailingIntValue() const throw() +int String::getTrailingIntValue() const noexcept { int n = 0; int mult = 1; @@ -13212,17 +13210,17 @@ int String::getTrailingIntValue() const throw() return n; } -int64 String::getLargeIntValue() const throw() +int64 String::getLargeIntValue() const noexcept { return text.getIntValue64(); } -float String::getFloatValue() const throw() +float String::getFloatValue() const noexcept { return (float) getDoubleValue(); } -double String::getDoubleValue() const throw() +double String::getDoubleValue() const noexcept { return text.getDoubleValue(); } @@ -13249,7 +13247,7 @@ struct HexConverter return String (t, (int) (end - t) - 1); } - static Type stringToHex (String::CharPointerType t) throw() + static Type stringToHex (String::CharPointerType t) noexcept { Type result = 0; @@ -13307,12 +13305,12 @@ const String String::toHexString (const unsigned char* data, const int size, con return s; } -int String::getHexValue32() const throw() +int String::getHexValue32() const noexcept { return HexConverter::stringToHex (text); } -int64 String::getHexValue64() const throw() +int64 String::getHexValue64() const noexcept { return HexConverter::stringToHex (text); } @@ -13321,7 +13319,7 @@ const String String::createStringFromData (const void* const data_, const int si { const uint8* const data = static_cast (data_); - if (size <= 0 || data == 0) + if (size <= 0 || data == nullptr) { return empty; } @@ -13406,19 +13404,19 @@ struct StringEncodingConverter template <> struct StringEncodingConverter { - static const CharPointer_UTF8 convert (const String& source) throw() { return CharPointer_UTF8 ((CharPointer_UTF8::CharType*) source.getCharPointer().getAddress()); } + static const CharPointer_UTF8 convert (const String& source) noexcept { return CharPointer_UTF8 ((CharPointer_UTF8::CharType*) source.getCharPointer().getAddress()); } }; template <> struct StringEncodingConverter { - static const CharPointer_UTF16 convert (const String& source) throw() { return CharPointer_UTF16 ((CharPointer_UTF16::CharType*) source.getCharPointer().getAddress()); } + static const CharPointer_UTF16 convert (const String& source) noexcept { return CharPointer_UTF16 ((CharPointer_UTF16::CharType*) source.getCharPointer().getAddress()); } }; template <> struct StringEncodingConverter { - static const CharPointer_UTF32 convert (const String& source) throw() { return CharPointer_UTF32 ((CharPointer_UTF32::CharType*) source.getCharPointer().getAddress()); } + static const CharPointer_UTF32 convert (const String& source) noexcept { return CharPointer_UTF32 ((CharPointer_UTF32::CharType*) source.getCharPointer().getAddress()); } }; const CharPointer_UTF8 String::toUTF8() const @@ -13448,36 +13446,36 @@ struct StringCopier { jassert (maxBufferSizeBytes >= 0); // keep this value positive, or no characters will be copied! - if (buffer == 0) + if (buffer == nullptr) return (int) CharPointerType_Dest::getBytesRequiredFor (source); return CharPointerType_Dest (buffer).writeWithDestByteLimit (source, maxBufferSizeBytes); } }; -int String::copyToUTF8 (CharPointer_UTF8::CharType* const buffer, const int maxBufferSizeBytes) const throw() +int String::copyToUTF8 (CharPointer_UTF8::CharType* const buffer, const int maxBufferSizeBytes) const noexcept { return StringCopier ::copyToBuffer (text, buffer, maxBufferSizeBytes); } -int String::copyToUTF16 (CharPointer_UTF16::CharType* const buffer, int maxBufferSizeBytes) const throw() +int String::copyToUTF16 (CharPointer_UTF16::CharType* const buffer, int maxBufferSizeBytes) const noexcept { return StringCopier ::copyToBuffer (text, buffer, maxBufferSizeBytes); } -int String::copyToUTF32 (CharPointer_UTF32::CharType* const buffer, int maxBufferSizeBytes) const throw() +int String::copyToUTF32 (CharPointer_UTF32::CharType* const buffer, int maxBufferSizeBytes) const noexcept { return StringCopier ::copyToBuffer (text, buffer, maxBufferSizeBytes); } -int String::getNumBytesAsUTF8() const throw() +int String::getNumBytesAsUTF8() const noexcept { return (int) CharPointer_UTF8::getBytesRequiredFor (text); } const String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) { - if (buffer != 0) + if (buffer != nullptr) { if (bufferSizeBytes < 0) return String (CharPointer_UTF8 (buffer)); @@ -13827,7 +13825,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_StringArray.cpp ***/ BEGIN_JUCE_NAMESPACE -StringArray::StringArray() throw() +StringArray::StringArray() noexcept { } @@ -13846,8 +13844,8 @@ namespace StringArrayHelpers template void addArray (Array& dest, const CharType* const* strings) { - if (strings != 0) - while (*strings != 0) + if (strings != nullptr) + while (*strings != nullptr) dest.add (*strings++); } @@ -13889,7 +13887,7 @@ StringArray::~StringArray() { } -bool StringArray::operator== (const StringArray& other) const throw() +bool StringArray::operator== (const StringArray& other) const noexcept { if (other.size() != size()) return false; @@ -13901,7 +13899,7 @@ bool StringArray::operator== (const StringArray& other) const throw() return true; } -bool StringArray::operator!= (const StringArray& other) const throw() +bool StringArray::operator!= (const StringArray& other) const noexcept { return ! operator== (other); } @@ -13911,7 +13909,7 @@ void StringArray::clear() strings.clear(); } -const String& StringArray::operator[] (const int index) const throw() +const String& StringArray::operator[] (const int index) const noexcept { if (isPositiveAndBelow (index, strings.size())) return strings.getReference (index); @@ -13919,7 +13917,7 @@ const String& StringArray::operator[] (const int index) const throw() return String::empty; } -String& StringArray::getReference (const int index) throw() +String& StringArray::getReference (const int index) noexcept { jassert (isPositiveAndBelow (index, strings.size())); return strings.getReference (index); @@ -14088,7 +14086,7 @@ void StringArray::sort (const bool ignoreCase) } } -void StringArray::move (const int currentIndex, int newIndex) throw() +void StringArray::move (const int currentIndex, int newIndex) noexcept { strings.move (currentIndex, newIndex); } @@ -14230,10 +14228,10 @@ void StringArray::appendNumbersToDuplicates (const bool ignoreCase, { CharPointer_UTF8 defaultPre (" ("), defaultPost (")"); - if (preNumberString.getAddress() == 0) + if (preNumberString.getAddress() == nullptr) preNumberString = defaultPre; - if (postNumberString.getAddress() == 0) + if (postNumberString.getAddress() == nullptr) postNumberString = defaultPost; for (int i = 0; i < size() - 1; ++i) @@ -14396,7 +14394,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_StringPool.cpp ***/ BEGIN_JUCE_NAMESPACE -StringPool::StringPool() throw() {} +StringPool::StringPool() noexcept {} StringPool::~StringPool() {} namespace StringPoolHelpers @@ -14456,7 +14454,7 @@ const String::CharPointerType StringPool::getPooledString (const String& s) const String::CharPointerType StringPool::getPooledString (const char* const s) { - if (s == 0 || *s == 0) + if (s == nullptr || *s == 0) return String::empty.getCharPointer(); return StringPoolHelpers::getPooledStringFromArray (strings, s); @@ -14464,18 +14462,18 @@ const String::CharPointerType StringPool::getPooledString (const char* const s) const String::CharPointerType StringPool::getPooledString (const wchar_t* const s) { - if (s == 0 || *s == 0) + if (s == nullptr || *s == 0) return String::empty.getCharPointer(); return StringPoolHelpers::getPooledStringFromArray (strings, s); } -int StringPool::size() const throw() +int StringPool::size() const noexcept { return strings.size(); } -const String::CharPointerType StringPool::operator[] (const int index) const throw() +const String::CharPointerType StringPool::operator[] (const int index) const noexcept { return strings [index].getCharPointer(); } @@ -14489,13 +14487,13 @@ BEGIN_JUCE_NAMESPACE XmlDocument::XmlDocument (const String& documentText) : originalText (documentText), - input (0), + input (nullptr), ignoreEmptyTextElements (true) { } XmlDocument::XmlDocument (const File& file) - : input (0), + : input (nullptr), ignoreEmptyTextElements (true), inputSource (new FileInputSource (file)) { @@ -14517,25 +14515,25 @@ XmlElement* XmlDocument::parse (const String& xmlData) return doc.getDocumentElement(); } -void XmlDocument::setInputSource (InputSource* const newSource) throw() +void XmlDocument::setInputSource (InputSource* const newSource) noexcept { inputSource = newSource; } -void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) throw() +void XmlDocument::setEmptyTextElementsIgnored (const bool shouldBeIgnored) noexcept { ignoreEmptyTextElements = shouldBeIgnored; } namespace XmlIdentifierChars { - bool isIdentifierCharSlow (const juce_wchar c) throw() + bool isIdentifierCharSlow (const juce_wchar c) noexcept { return CharacterFunctions::isLetterOrDigit (c) || c == '_' || c == '-' || c == ':' || c == '.'; } - bool isIdentifierChar (const juce_wchar c) throw() + bool isIdentifierChar (const juce_wchar c) noexcept { static const uint32 legalChars[] = { 0, 0x7ff6000, 0x87fffffe, 0x7fffffe, 0 }; @@ -14562,11 +14560,11 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle { String textToParse (originalText); - if (textToParse.isEmpty() && inputSource != 0) + if (textToParse.isEmpty() && inputSource != nullptr) { ScopedPointer in (inputSource->createInputStream()); - if (in != 0) + if (in != nullptr) { MemoryOutputStream data; data.writeFromInputStream (*in, onlyReadOuterDocumentElement ? 8192 : -1); @@ -14591,7 +14589,7 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle { skipHeader(); - if (input.getAddress() != 0) + if (input.getAddress() != nullptr) { ScopedPointer result (readNextElement (! onlyReadOuterDocumentElement)); @@ -14607,7 +14605,7 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle return 0; } -const String& XmlDocument::getLastParseError() const throw() +const String& XmlDocument::getLastParseError() const noexcept { return lastError; } @@ -14620,18 +14618,18 @@ void XmlDocument::setLastError (const String& desc, const bool carryOn) const String XmlDocument::getFileContents (const String& filename) const { - if (inputSource != 0) + if (inputSource != nullptr) { const ScopedPointer in (inputSource->createInputStreamFor (filename.trim().unquoted())); - if (in != 0) + if (in != nullptr) return in->readEntireStreamAsString(); } return String::empty; } -juce_wchar XmlDocument::readNextChar() throw() +juce_wchar XmlDocument::readNextChar() noexcept { if (*input != 0) return *input++; @@ -14640,7 +14638,7 @@ juce_wchar XmlDocument::readNextChar() throw() return 0; } -int XmlDocument::findNextTokenLength() throw() +int XmlDocument::findNextTokenLength() noexcept { int len = 0; juce_wchar c = *input; @@ -14810,7 +14808,7 @@ void XmlDocument::readQuotedString (String& result) XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) { - XmlElement* node = 0; + XmlElement* node = nullptr; skipNextWhiteSpace(); if (outOfData) @@ -14977,7 +14975,7 @@ void XmlDocument::readChildElements (XmlElement* parent) // this is some other element, so parse and add it.. XmlElement* const n = readNextElement (true); - if (n != 0) + if (n != nullptr) childAppender.append (n); else return; @@ -15019,7 +15017,7 @@ void XmlDocument::readChildElements (XmlElement* parent) { XmlElement* const n = readNextElement (true); - if (n == 0) + if (n == nullptr) break; childAppender.append (n); @@ -15315,13 +15313,13 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_XmlElement.cpp ***/ BEGIN_JUCE_NAMESPACE -XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) throw() +XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) noexcept : name (other.name), value (other.value) { } -XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const String& value_) throw() +XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const String& value_) noexcept : name (name_), value (value_) { @@ -15332,12 +15330,12 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const Strin #endif } -inline bool XmlElement::XmlAttributeNode::hasName (const String& nameToMatch) const throw() +inline bool XmlElement::XmlAttributeNode::hasName (const String& nameToMatch) const noexcept { return name.equalsIgnoreCase (nameToMatch); } -XmlElement::XmlElement (const String& tagName_) throw() +XmlElement::XmlElement (const String& tagName_) noexcept : tagName (tagName_) { // the tag name mustn't be empty, or it'll look like a text element! @@ -15347,7 +15345,7 @@ XmlElement::XmlElement (const String& tagName_) throw() jassert (! tagName_.containsAnyOf (" <>/&")); } -XmlElement::XmlElement (int /*dummy*/) throw() +XmlElement::XmlElement (int /*dummy*/) noexcept { } @@ -15374,14 +15372,14 @@ XmlElement& XmlElement::operator= (const XmlElement& other) void XmlElement::copyChildrenAndAttributesFrom (const XmlElement& other) { - jassert (firstChildElement.get() == 0); + jassert (firstChildElement.get() == nullptr); firstChildElement.addCopyOfList (other.firstChildElement); - jassert (attributes.get() == 0); + jassert (attributes.get() == nullptr); attributes.addCopyOfList (other.attributes); } -XmlElement::~XmlElement() throw() +XmlElement::~XmlElement() noexcept { firstChildElement.deleteAll(); attributes.deleteAll(); @@ -15389,7 +15387,7 @@ XmlElement::~XmlElement() throw() namespace XmlOutputFunctions { - /*bool isLegalXmlCharSlow (const juce_wchar character) throw() + /*bool isLegalXmlCharSlow (const juce_wchar character) noexcept { if ((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') @@ -15422,7 +15420,7 @@ namespace XmlOutputFunctions DBG (s); }*/ - bool isLegalXmlChar (const uint32 c) throw() + bool isLegalXmlChar (const uint32 c) noexcept { static const unsigned char legalChars[] = { 0, 0, 0, 0, 187, 255, 255, 175, 255, 255, 255, 191, 254, 255, 255, 127 }; @@ -15504,7 +15502,7 @@ void XmlElement::writeElementAsText (OutputStream& outputStream, const int attIndent = indentationLevel + tagName.length() + 1; int lineLen = 0; - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) { if (lineLen > lineWrapLength && indentationLevel >= 0) { @@ -15523,14 +15521,14 @@ void XmlElement::writeElementAsText (OutputStream& outputStream, } } - if (firstChildElement != 0) + if (firstChildElement != nullptr) { outputStream.writeByte ('>'); XmlElement* child = firstChildElement; bool lastWasTextNode = false; - while (child != 0) + while (child != nullptr) { if (child->isTextElement()) { @@ -15628,10 +15626,10 @@ bool XmlElement::writeToFile (const File& file, TemporaryFile tempFile (file); ScopedPointer out (tempFile.getFile().createOutputStream()); - if (out != 0) + if (out != nullptr) { writeToStream (*out, dtdToUse, false, true, encodingType, lineWrapLength); - out = 0; + out = nullptr; return tempFile.overwriteTargetFileWithTemporary(); } @@ -15640,7 +15638,7 @@ bool XmlElement::writeToFile (const File& file, return false; } -bool XmlElement::hasTagName (const String& tagNameWanted) const throw() +bool XmlElement::hasTagName (const String& tagNameWanted) const noexcept { #if JUCE_DEBUG // if debugging, check that the case is actually the same, because @@ -15664,41 +15662,41 @@ XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName { XmlElement* e = nextListItem; - while (e != 0 && ! e->hasTagName (requiredTagName)) + while (e != nullptr && ! e->hasTagName (requiredTagName)) e = e->nextListItem; return e; } -int XmlElement::getNumAttributes() const throw() +int XmlElement::getNumAttributes() const noexcept { return attributes.size(); } -const String& XmlElement::getAttributeName (const int index) const throw() +const String& XmlElement::getAttributeName (const int index) const noexcept { const XmlAttributeNode* const att = attributes [index]; - return att != 0 ? att->name : String::empty; + return att != nullptr ? att->name : String::empty; } -const String& XmlElement::getAttributeValue (const int index) const throw() +const String& XmlElement::getAttributeValue (const int index) const noexcept { const XmlAttributeNode* const att = attributes [index]; - return att != 0 ? att->value : String::empty; + return att != nullptr ? att->value : String::empty; } -bool XmlElement::hasAttribute (const String& attributeName) const throw() +bool XmlElement::hasAttribute (const String& attributeName) const noexcept { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) if (att->hasName (attributeName)) return true; return false; } -const String& XmlElement::getStringAttribute (const String& attributeName) const throw() +const String& XmlElement::getStringAttribute (const String& attributeName) const noexcept { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) if (att->hasName (attributeName)) return att->value; @@ -15707,7 +15705,7 @@ const String& XmlElement::getStringAttribute (const String& attributeName) const const String XmlElement::getStringAttribute (const String& attributeName, const String& defaultReturnValue) const { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) if (att->hasName (attributeName)) return att->value; @@ -15716,7 +15714,7 @@ const String XmlElement::getStringAttribute (const String& attributeName, const int XmlElement::getIntAttribute (const String& attributeName, const int defaultReturnValue) const { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) if (att->hasName (attributeName)) return att->value.getIntValue(); @@ -15725,7 +15723,7 @@ int XmlElement::getIntAttribute (const String& attributeName, const int defaultR double XmlElement::getDoubleAttribute (const String& attributeName, const double defaultReturnValue) const { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) if (att->hasName (attributeName)) return att->value.getDoubleValue(); @@ -15734,7 +15732,7 @@ double XmlElement::getDoubleAttribute (const String& attributeName, const double bool XmlElement::getBoolAttribute (const String& attributeName, const bool defaultReturnValue) const { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) { if (att->hasName (attributeName)) { @@ -15756,9 +15754,9 @@ bool XmlElement::getBoolAttribute (const String& attributeName, const bool defau bool XmlElement::compareAttribute (const String& attributeName, const String& stringToCompareAgainst, - const bool ignoreCase) const throw() + const bool ignoreCase) const noexcept { - for (const XmlAttributeNode* att = attributes; att != 0; att = att->nextListItem) + for (const XmlAttributeNode* att = attributes; att != nullptr; att = att->nextListItem) if (att->hasName (attributeName)) return ignoreCase ? att->value.equalsIgnoreCase (stringToCompareAgainst) : att->value == stringToCompareAgainst; @@ -15768,7 +15766,7 @@ bool XmlElement::compareAttribute (const String& attributeName, void XmlElement::setAttribute (const String& attributeName, const String& value) { - if (attributes == 0) + if (attributes == nullptr) { attributes = new XmlAttributeNode (attributeName, value); } @@ -15783,7 +15781,7 @@ void XmlElement::setAttribute (const String& attributeName, const String& value) att->value = value; break; } - else if (att->nextListItem == 0) + else if (att->nextListItem == nullptr) { att->nextListItem = new XmlAttributeNode (attributeName, value); break; @@ -15804,11 +15802,11 @@ void XmlElement::setAttribute (const String& attributeName, const double number) setAttribute (attributeName, String (number)); } -void XmlElement::removeAttribute (const String& attributeName) throw() +void XmlElement::removeAttribute (const String& attributeName) noexcept { LinkedListPointer* att = &attributes; - while (att->get() != 0) + while (att->get() != nullptr) { if (att->get()->hasName (attributeName)) { @@ -15820,26 +15818,26 @@ void XmlElement::removeAttribute (const String& attributeName) throw() } } -void XmlElement::removeAllAttributes() throw() +void XmlElement::removeAllAttributes() noexcept { attributes.deleteAll(); } -int XmlElement::getNumChildElements() const throw() +int XmlElement::getNumChildElements() const noexcept { return firstChildElement.size(); } -XmlElement* XmlElement::getChildElement (const int index) const throw() +XmlElement* XmlElement::getChildElement (const int index) const noexcept { return firstChildElement [index].get(); } -XmlElement* XmlElement::getChildByName (const String& childName) const throw() +XmlElement* XmlElement::getChildByName (const String& childName) const noexcept { XmlElement* child = firstChildElement; - while (child != 0) + while (child != nullptr) { if (child->hasTagName (childName)) break; @@ -15850,16 +15848,16 @@ XmlElement* XmlElement::getChildByName (const String& childName) const throw() return child; } -void XmlElement::addChildElement (XmlElement* const newNode) throw() +void XmlElement::addChildElement (XmlElement* const newNode) noexcept { - if (newNode != 0) + if (newNode != nullptr) firstChildElement.append (newNode); } void XmlElement::insertChildElement (XmlElement* const newNode, - int indexToInsertAt) throw() + int indexToInsertAt) noexcept { - if (newNode != 0) + if (newNode != nullptr) { removeChildElement (newNode, false); firstChildElement.insertAtIndex (indexToInsertAt, newNode); @@ -15874,13 +15872,13 @@ XmlElement* XmlElement::createNewChildElement (const String& childTagName) } bool XmlElement::replaceChildElement (XmlElement* const currentChildElement, - XmlElement* const newNode) throw() + XmlElement* const newNode) noexcept { - if (newNode != 0) + if (newNode != nullptr) { LinkedListPointer* const p = firstChildElement.findPointerTo (currentChildElement); - if (p != 0) + if (p != nullptr) { if (currentChildElement != newNode) delete p->replaceNext (newNode); @@ -15893,9 +15891,9 @@ bool XmlElement::replaceChildElement (XmlElement* const currentChildElement, } void XmlElement::removeChildElement (XmlElement* const childToRemove, - const bool shouldDeleteTheChild) throw() + const bool shouldDeleteTheChild) noexcept { - if (childToRemove != 0) + if (childToRemove != nullptr) { firstChildElement.remove (childToRemove); @@ -15905,11 +15903,11 @@ void XmlElement::removeChildElement (XmlElement* const childToRemove, } bool XmlElement::isEquivalentTo (const XmlElement* const other, - const bool ignoreOrderOfAttributes) const throw() + const bool ignoreOrderOfAttributes) const noexcept { if (this != other) { - if (other == 0 || tagName != other->tagName) + if (other == nullptr || tagName != other->tagName) return false; if (ignoreOrderOfAttributes) @@ -15917,7 +15915,7 @@ bool XmlElement::isEquivalentTo (const XmlElement* const other, int totalAtts = 0; const XmlAttributeNode* att = attributes; - while (att != 0) + while (att != nullptr) { if (! other->compareAttribute (att->name, att->value)) return false; @@ -15936,7 +15934,7 @@ bool XmlElement::isEquivalentTo (const XmlElement* const other, for (;;) { - if (thisAtt == 0 || otherAtt == 0) + if (thisAtt == nullptr || otherAtt == nullptr) { if (thisAtt == otherAtt) // both 0, so it's a match break; @@ -15960,7 +15958,7 @@ bool XmlElement::isEquivalentTo (const XmlElement* const other, for (;;) { - if (thisChild == 0 || otherChild == 0) + if (thisChild == nullptr || otherChild == nullptr) { if (thisChild == otherChild) // both 0, so it's a match break; @@ -15979,16 +15977,16 @@ bool XmlElement::isEquivalentTo (const XmlElement* const other, return true; } -void XmlElement::deleteAllChildElements() throw() +void XmlElement::deleteAllChildElements() noexcept { firstChildElement.deleteAll(); } -void XmlElement::deleteAllChildElementsWithTagName (const String& name) throw() +void XmlElement::deleteAllChildElementsWithTagName (const String& name) noexcept { XmlElement* child = firstChildElement; - while (child != 0) + while (child != nullptr) { XmlElement* const nextChild = child->nextListItem; @@ -15999,26 +15997,26 @@ void XmlElement::deleteAllChildElementsWithTagName (const String& name) throw() } } -bool XmlElement::containsChildElement (const XmlElement* const possibleChild) const throw() +bool XmlElement::containsChildElement (const XmlElement* const possibleChild) const noexcept { return firstChildElement.contains (possibleChild); } -XmlElement* XmlElement::findParentElementOf (const XmlElement* const elementToLookFor) throw() +XmlElement* XmlElement::findParentElementOf (const XmlElement* const elementToLookFor) noexcept { - if (this == elementToLookFor || elementToLookFor == 0) + if (this == elementToLookFor || elementToLookFor == nullptr) return 0; XmlElement* child = firstChildElement; - while (child != 0) + while (child != nullptr) { if (elementToLookFor == child) return this; XmlElement* const found = child->findParentElementOf (elementToLookFor); - if (found != 0) + if (found != nullptr) return found; child = child->nextListItem; @@ -16027,12 +16025,12 @@ XmlElement* XmlElement::findParentElementOf (const XmlElement* const elementToLo return 0; } -void XmlElement::getChildElementsAsArray (XmlElement** elems) const throw() +void XmlElement::getChildElementsAsArray (XmlElement** elems) const noexcept { firstChildElement.copyToArray (elems); } -void XmlElement::reorderChildElements (XmlElement** const elems, const int num) throw() +void XmlElement::reorderChildElements (XmlElement** const elems, const int num) noexcept { XmlElement* e = firstChildElement = elems[0]; @@ -16042,17 +16040,17 @@ void XmlElement::reorderChildElements (XmlElement** const elems, const int num) e = e->nextListItem; } - e->nextListItem = 0; + e->nextListItem = nullptr; } -bool XmlElement::isTextElement() const throw() +bool XmlElement::isTextElement() const noexcept { return tagName.isEmpty(); } static const String juce_xmltextContentAttributeName ("text"); -const String& XmlElement::getText() const throw() +const String& XmlElement::getText() const noexcept { jassert (isTextElement()); // you're trying to get the text from an element that // isn't actually a text element.. If this contains text sub-nodes, you @@ -16078,7 +16076,7 @@ const String XmlElement::getAllSubText() const String::Concatenator concatenator (result); const XmlElement* child = firstChildElement; - while (child != 0) + while (child != nullptr) { concatenator.append (child->getAllSubText()); child = child->nextListItem; @@ -16092,7 +16090,7 @@ const String XmlElement::getChildElementAllSubText (const String& childTagName, { const XmlElement* const child = getChildByName (childTagName); - if (child != 0) + if (child != nullptr) return child->getAllSubText(); return defaultReturnValue; @@ -16110,11 +16108,11 @@ void XmlElement::addTextElement (const String& text) addChildElement (createTextElement (text)); } -void XmlElement::deleteAllTextElements() throw() +void XmlElement::deleteAllTextElements() noexcept { XmlElement* child = firstChildElement; - while (child != 0) + while (child != nullptr) { XmlElement* const next = child->nextListItem; @@ -16132,20 +16130,20 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_ReadWriteLock.cpp ***/ BEGIN_JUCE_NAMESPACE -ReadWriteLock::ReadWriteLock() throw() +ReadWriteLock::ReadWriteLock() noexcept : numWaitingWriters (0), numWriters (0), writerThreadId (0) { } -ReadWriteLock::~ReadWriteLock() throw() +ReadWriteLock::~ReadWriteLock() noexcept { jassert (readerThreads.size() == 0); jassert (numWriters == 0); } -void ReadWriteLock::enterRead() const throw() +void ReadWriteLock::enterRead() const noexcept { const Thread::ThreadID threadId = Thread::getCurrentThreadId(); const SpinLock::ScopedLockType sl (accessLock); @@ -16181,7 +16179,7 @@ void ReadWriteLock::enterRead() const throw() } } -void ReadWriteLock::exitRead() const throw() +void ReadWriteLock::exitRead() const noexcept { const Thread::ThreadID threadId = Thread::getCurrentThreadId(); const SpinLock::ScopedLockType sl (accessLock); @@ -16209,7 +16207,7 @@ void ReadWriteLock::exitRead() const throw() jassertfalse; // unlocking a lock that wasn't locked.. } -void ReadWriteLock::enterWrite() const throw() +void ReadWriteLock::enterWrite() const noexcept { const Thread::ThreadID threadId = Thread::getCurrentThreadId(); const SpinLock::ScopedLockType sl (accessLock); @@ -16234,7 +16232,7 @@ void ReadWriteLock::enterWrite() const throw() } } -bool ReadWriteLock::tryEnterWrite() const throw() +bool ReadWriteLock::tryEnterWrite() const noexcept { const Thread::ThreadID threadId = Thread::getCurrentThreadId(); const SpinLock::ScopedLockType sl (accessLock); @@ -16252,7 +16250,7 @@ bool ReadWriteLock::tryEnterWrite() const throw() return false; } -void ReadWriteLock::exitWrite() const throw() +void ReadWriteLock::exitWrite() const noexcept { const SpinLock::ScopedLockType sl (accessLock); @@ -16294,12 +16292,12 @@ public: threads.removeValue (thread); } - int size() const throw() + int size() const noexcept { return threads.size(); } - Thread* getThreadWithID (const Thread::ThreadID targetID) const throw() + Thread* getThreadWithID (const Thread::ThreadID targetID) const noexcept { const SpinLock::ScopedLockType sl (lock); @@ -16322,7 +16320,7 @@ public: { Thread* firstThread = getFirstThread(); - if (firstThread != 0) + if (firstThread != nullptr) firstThread->stopThread (timeOutMilliseconds); else break; @@ -16387,7 +16385,7 @@ void JUCE_API juce_threadEntryPoint (void* userData) Thread::Thread (const String& threadName) : threadName_ (threadName), - threadHandle_ (0), + threadHandle_ (nullptr), threadId_ (0), threadPriority_ (5), affinityMask_ (0), @@ -16547,7 +16545,7 @@ void Thread::stopAllThreads (const int timeOutMilliseconds) RunningThreadsList::getInstance().stopAll (timeOutMilliseconds); } -void SpinLock::enter() const throw() +void SpinLock::enter() const noexcept { if (! lock.compareAndSetBool (1, 0)) { @@ -16560,7 +16558,7 @@ void SpinLock::enter() const throw() } } -bool SpinLock::tryEnter() const throw() +bool SpinLock::tryEnter() const noexcept { return lock.compareAndSetBool (1, 0); } @@ -16574,7 +16572,7 @@ BEGIN_JUCE_NAMESPACE ThreadPoolJob::ThreadPoolJob (const String& name) : jobName (name), - pool (0), + pool (nullptr), shouldStop (false), isActive (false), shouldBeDeleted (false) @@ -16585,7 +16583,7 @@ ThreadPoolJob::~ThreadPoolJob() { // you mustn't delete a job while it's still in a pool! Use ThreadPool::removeJob() // to remove it first! - jassert (pool == 0 || ! pool->contains (this)); + jassert (pool == nullptr || ! pool->contains (this)); } const String ThreadPoolJob::getJobName() const @@ -16659,10 +16657,10 @@ ThreadPool::~ThreadPool() void ThreadPool::addJob (ThreadPoolJob* const job) { - jassert (job != 0); - jassert (job->pool == 0); + jassert (job != nullptr); + jassert (job->pool == nullptr); - if (job->pool == 0) + if (job->pool == nullptr) { job->pool = this; job->shouldStop = false; @@ -16732,7 +16730,7 @@ bool ThreadPool::isJobRunning (const ThreadPoolJob* const job) const bool ThreadPool::waitForJobToFinish (const ThreadPoolJob* const job, const int timeOutMs) const { - if (job != 0) + if (job != nullptr) { const uint32 start = Time::getMillisecondCounter(); @@ -16754,7 +16752,7 @@ bool ThreadPool::removeJob (ThreadPoolJob* const job, { bool dontWait = true; - if (job != 0) + if (job != nullptr) { const ScopedLock sl (lock); @@ -16770,7 +16768,7 @@ bool ThreadPool::removeJob (ThreadPoolJob* const job, else { jobs.removeValue (job); - job->pool = 0; + job->pool = nullptr; } } } @@ -16792,7 +16790,7 @@ bool ThreadPool::removeAllJobs (const bool interruptRunningJobs, { ThreadPoolJob* const job = jobs.getUnchecked(i); - if (selectedJobsToRemove == 0 || selectedJobsToRemove->isJobSuitable (job)) + if (selectedJobsToRemove == nullptr || selectedJobsToRemove->isJobSuitable (job)) { if (job->isActive) { @@ -16808,7 +16806,7 @@ bool ThreadPool::removeAllJobs (const bool interruptRunningJobs, if (deleteInactiveJobs) delete job; else - job->pool = 0; + job->pool = nullptr; } } } @@ -16867,7 +16865,7 @@ bool ThreadPool::setThreadPriorities (const int newPriority) bool ThreadPool::runNextJob() { - ThreadPoolJob* job = 0; + ThreadPoolJob* job = nullptr; { const ScopedLock sl (lock); @@ -16876,18 +16874,18 @@ bool ThreadPool::runNextJob() { job = jobs[i]; - if (job != 0 && ! (job->isActive || job->shouldStop)) + if (job != nullptr && ! (job->isActive || job->shouldStop)) break; - job = 0; + job = nullptr; } - if (job != 0) + if (job != nullptr) job->isActive = true; } - if (job != 0) + if (job != nullptr) { JUCE_TRY { @@ -16903,7 +16901,7 @@ bool ThreadPool::runNextJob() if (result != ThreadPoolJob::jobNeedsRunningAgain || job->shouldStop) { - job->pool = 0; + job->pool = nullptr; job->shouldStop = true; jobs.removeValue (job); @@ -16956,7 +16954,7 @@ BEGIN_JUCE_NAMESPACE TimeSliceThread::TimeSliceThread (const String& threadName) : Thread (threadName), - clientBeingCalled (0) + clientBeingCalled (nullptr) { } @@ -16967,7 +16965,7 @@ TimeSliceThread::~TimeSliceThread() void TimeSliceThread::addTimeSliceClient (TimeSliceClient* const client, int millisecondsBeforeStarting) { - if (client != 0) + if (client != nullptr) { const ScopedLock sl (listLock); client->nextCallTime = Time::getCurrentTime() + RelativeTime::milliseconds (millisecondsBeforeStarting); @@ -17011,13 +17009,13 @@ TimeSliceClient* TimeSliceThread::getClient (const int i) const TimeSliceClient* TimeSliceThread::getNextClient (int index) const { Time soonest; - TimeSliceClient* client = 0; + TimeSliceClient* client = nullptr; for (int i = clients.size(); --i >= 0;) { TimeSliceClient* const c = clients.getUnchecked ((i + index) % clients.size()); - if (client == 0 || c->nextCallTime < soonest) + if (client == nullptr || c->nextCallTime < soonest) { client = c; soonest = c->nextCallTime; @@ -17044,7 +17042,7 @@ void TimeSliceThread::run() index = clients.size() > 0 ? ((index + 1) % clients.size()) : 0; TimeSliceClient* const firstClient = getNextClient (index); - if (firstClient != 0) + if (firstClient != nullptr) nextClientTime = firstClient->nextCallTime; } @@ -17065,7 +17063,7 @@ void TimeSliceThread::run() clientBeingCalled = getNextClient (index); } - if (clientBeingCalled != 0) + if (clientBeingCalled != nullptr) { const int msUntilNextCall = clientBeingCalled->useTimeSlice(); @@ -17076,7 +17074,7 @@ void TimeSliceThread::run() else clients.removeValue (clientBeingCalled); - clientBeingCalled = 0; + clientBeingCalled = nullptr; } } } @@ -17112,9 +17110,9 @@ public: jassert (! (isAddingNewProperty && target->hasProperty (name))); if (isDeletingProperty) - target->removeProperty (name, 0); + target->removeProperty (name, nullptr); else - target->setProperty (name, newValue, 0); + target->setProperty (name, newValue, nullptr); return true; } @@ -17122,9 +17120,9 @@ public: bool undo() { if (isAddingNewProperty) - target->removeProperty (name, 0); + target->removeProperty (name, nullptr); else - target->setProperty (name, oldValue, 0); + target->setProperty (name, oldValue, nullptr); return true; } @@ -17140,14 +17138,14 @@ public: { SetPropertyAction* next = dynamic_cast (nextAction); - if (next != 0 && next->target == target && next->name == name + if (next != nullptr && next->target == target && next->name == name && ! (next->isAddingNewProperty || next->isDeletingProperty)) { return new SetPropertyAction (target, name, next->newValue, oldValue, false, false); } } - return 0; + return nullptr; } private: @@ -17166,19 +17164,19 @@ public: AddOrRemoveChildAction (const SharedObjectPtr& target_, const int childIndex_, const SharedObjectPtr& newChild_) : target (target_), - child (newChild_ != 0 ? newChild_ : target_->children [childIndex_]), + child (newChild_ != nullptr ? newChild_ : target_->children [childIndex_]), childIndex (childIndex_), - isDeleting (newChild_ == 0) + isDeleting (newChild_ == nullptr) { - jassert (child != 0); + jassert (child != nullptr); } bool perform() { if (isDeleting) - target->removeChild (childIndex, 0); + target->removeChild (childIndex, nullptr); else - target->addChild (child, childIndex, 0); + target->addChild (child, childIndex, nullptr); return true; } @@ -17187,14 +17185,14 @@ public: { if (isDeleting) { - target->addChild (child, childIndex, 0); + target->addChild (child, childIndex, nullptr); } else { // If you hit this, it seems that your object's state is getting confused - probably // because you've interleaved some undoable and non-undoable operations? jassert (childIndex < target->children.size()); - target->removeChild (childIndex, 0); + target->removeChild (childIndex, nullptr); } return true; @@ -17226,13 +17224,13 @@ public: bool perform() { - parent->moveChild (startIndex, endIndex, 0); + parent->moveChild (startIndex, endIndex, nullptr); return true; } bool undo() { - parent->moveChild (endIndex, startIndex, 0); + parent->moveChild (endIndex, startIndex, nullptr); return true; } @@ -17245,10 +17243,10 @@ public: { MoveChildAction* next = dynamic_cast (nextAction); - if (next != 0 && next->parent == parent && next->startIndex == endIndex) + if (next != nullptr && next->parent == parent && next->startIndex == endIndex) return new MoveChildAction (parent, startIndex, next->endIndex); - return 0; + return nullptr; } private: @@ -17259,12 +17257,12 @@ private: }; ValueTree::SharedObject::SharedObject (const Identifier& type_) - : type (type_), parent (0) + : type (type_), parent (nullptr) { } ValueTree::SharedObject::SharedObject (const SharedObject& other) - : type (other.type), properties (other.properties), parent (0) + : type (other.type), properties (other.properties), parent (nullptr) { for (int i = 0; i < other.children.size(); ++i) { @@ -17276,12 +17274,12 @@ ValueTree::SharedObject::SharedObject (const SharedObject& other) ValueTree::SharedObject::~SharedObject() { - jassert (parent == 0); // this should never happen unless something isn't obeying the ref-counting! + jassert (parent == nullptr); // this should never happen unless something isn't obeying the ref-counting! for (int i = children.size(); --i >= 0;) { const SharedObjectPtr c (children.getUnchecked(i)); - c->parent = 0; + c->parent = nullptr; children.remove (i); c->sendParentChangeMessage(); } @@ -17292,7 +17290,7 @@ void ValueTree::SharedObject::sendPropertyChangeMessage (ValueTree& tree, const for (int i = valueTreesWithListeners.size(); --i >= 0;) { ValueTree* const v = valueTreesWithListeners[i]; - if (v != 0) + if (v != nullptr) v->listeners.call (&ValueTree::Listener::valueTreePropertyChanged, tree, property); } } @@ -17301,7 +17299,7 @@ void ValueTree::SharedObject::sendPropertyChangeMessage (const Identifier& prope { ValueTree tree (this); - for (ValueTree::SharedObject* t = this; t != 0; t = t->parent) + for (ValueTree::SharedObject* t = this; t != nullptr; t = t->parent) t->sendPropertyChangeMessage (tree, property); } @@ -17310,7 +17308,7 @@ void ValueTree::SharedObject::sendChildAddedMessage (ValueTree& tree, ValueTree& for (int i = valueTreesWithListeners.size(); --i >= 0;) { ValueTree* const v = valueTreesWithListeners[i]; - if (v != 0) + if (v != nullptr) v->listeners.call (&ValueTree::Listener::valueTreeChildAdded, tree, child); } } @@ -17319,7 +17317,7 @@ void ValueTree::SharedObject::sendChildAddedMessage (ValueTree child) { ValueTree tree (this); - for (ValueTree::SharedObject* t = this; t != 0; t = t->parent) + for (ValueTree::SharedObject* t = this; t != nullptr; t = t->parent) t->sendChildAddedMessage (tree, child); } @@ -17328,7 +17326,7 @@ void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree& tree, ValueTre for (int i = valueTreesWithListeners.size(); --i >= 0;) { ValueTree* const v = valueTreesWithListeners[i]; - if (v != 0) + if (v != nullptr) v->listeners.call (&ValueTree::Listener::valueTreeChildRemoved, tree, child); } } @@ -17337,7 +17335,7 @@ void ValueTree::SharedObject::sendChildRemovedMessage (ValueTree child) { ValueTree tree (this); - for (ValueTree::SharedObject* t = this; t != 0; t = t->parent) + for (ValueTree::SharedObject* t = this; t != nullptr; t = t->parent) t->sendChildRemovedMessage (tree, child); } @@ -17346,7 +17344,7 @@ void ValueTree::SharedObject::sendChildOrderChangedMessage (ValueTree& tree) for (int i = valueTreesWithListeners.size(); --i >= 0;) { ValueTree* const v = valueTreesWithListeners[i]; - if (v != 0) + if (v != nullptr) v->listeners.call (&ValueTree::Listener::valueTreeChildOrderChanged, tree); } } @@ -17355,7 +17353,7 @@ void ValueTree::SharedObject::sendChildOrderChangedMessage() { ValueTree tree (this); - for (ValueTree::SharedObject* t = this; t != 0; t = t->parent) + for (ValueTree::SharedObject* t = this; t != nullptr; t = t->parent) t->sendChildOrderChangedMessage (tree); } @@ -17367,14 +17365,14 @@ void ValueTree::SharedObject::sendParentChangeMessage() for (i = children.size(); --i >= 0;) { SharedObject* const t = children[i]; - if (t != 0) + if (t != nullptr) t->sendParentChangeMessage(); } for (i = valueTreesWithListeners.size(); --i >= 0;) { ValueTree* const v = valueTreesWithListeners[i]; - if (v != 0) + if (v != nullptr) v->listeners.call (&ValueTree::Listener::valueTreeParentChanged, tree); } } @@ -17391,7 +17389,7 @@ const var ValueTree::SharedObject::getProperty (const Identifier& name, const va void ValueTree::SharedObject::setProperty (const Identifier& name, const var& newValue, UndoManager* const undoManager) { - if (undoManager == 0) + if (undoManager == nullptr) { if (properties.set (name, newValue)) sendPropertyChangeMessage (name); @@ -17400,7 +17398,7 @@ void ValueTree::SharedObject::setProperty (const Identifier& name, const var& ne { var* const existingValue = properties.getVarPointer (name); - if (existingValue != 0) + if (existingValue != nullptr) { if (*existingValue != newValue) undoManager->perform (new SetPropertyAction (this, name, newValue, properties [name], false, false)); @@ -17419,7 +17417,7 @@ bool ValueTree::SharedObject::hasProperty (const Identifier& name) const void ValueTree::SharedObject::removeProperty (const Identifier& name, UndoManager* const undoManager) { - if (undoManager == 0) + if (undoManager == nullptr) { if (properties.remove (name)) sendPropertyChangeMessage (name); @@ -17433,7 +17431,7 @@ void ValueTree::SharedObject::removeProperty (const Identifier& name, UndoManage void ValueTree::SharedObject::removeAllProperties (UndoManager* const undoManager) { - if (undoManager == 0) + if (undoManager == nullptr) { while (properties.size() > 0) { @@ -17483,7 +17481,7 @@ bool ValueTree::SharedObject::isAChildOf (const SharedObject* const possiblePare { const SharedObject* p = parent; - while (p != 0) + while (p != nullptr) { if (p == possibleParent) return true; @@ -17501,22 +17499,22 @@ int ValueTree::SharedObject::indexOf (const ValueTree& child) const void ValueTree::SharedObject::addChild (SharedObject* child, int index, UndoManager* const undoManager) { - if (child != 0 && child->parent != this) + if (child != nullptr && child->parent != this) { if (child != this && ! isAChildOf (child)) { // You should always make sure that a child is removed from its previous parent before // adding it somewhere else - otherwise, it's ambiguous as to whether a different // undomanager should be used when removing it from its current parent.. - jassert (child->parent == 0); + jassert (child->parent == nullptr); - if (child->parent != 0) + if (child->parent != nullptr) { jassert (child->parent->children.indexOf (child) >= 0); child->parent->removeChild (child->parent->children.indexOf (child), undoManager); } - if (undoManager == 0) + if (undoManager == nullptr) { children.insert (index, child); child->parent = this; @@ -17544,18 +17542,18 @@ void ValueTree::SharedObject::removeChild (const int childIndex, UndoManager* co { const SharedObjectPtr child (children [childIndex]); - if (child != 0) + if (child != nullptr) { - if (undoManager == 0) + if (undoManager == nullptr) { children.remove (childIndex); - child->parent = 0; + child->parent = nullptr; sendChildRemovedMessage (ValueTree (child)); child->sendParentChangeMessage(); } else { - undoManager->perform (new AddOrRemoveChildAction (this, childIndex, 0)); + undoManager->perform (new AddOrRemoveChildAction (this, childIndex, nullptr)); } } } @@ -17574,7 +17572,7 @@ void ValueTree::SharedObject::moveChild (int currentIndex, int newIndex, UndoMan if (currentIndex != newIndex && isPositiveAndBelow (currentIndex, children.size())) { - if (undoManager == 0) + if (undoManager == nullptr) { children.move (currentIndex, newIndex); sendChildOrderChangedMessage(); @@ -17593,7 +17591,7 @@ void ValueTree::SharedObject::reorderChildren (const ReferenceCountedArray 0) { - if (object != 0) + if (object != nullptr) object->valueTreesWithListeners.removeValue (this); - if (other.object != 0) + if (other.object != nullptr) other.object->valueTreesWithListeners.add (this); } @@ -17670,16 +17667,16 @@ ValueTree& ValueTree::operator= (const ValueTree& other) ValueTree::~ValueTree() { - if (listeners.size() > 0 && object != 0) + if (listeners.size() > 0 && object != nullptr) object->valueTreesWithListeners.removeValue (this); } -bool ValueTree::operator== (const ValueTree& other) const throw() +bool ValueTree::operator== (const ValueTree& other) const noexcept { return object == other.object; } -bool ValueTree::operator!= (const ValueTree& other) const throw() +bool ValueTree::operator!= (const ValueTree& other) const noexcept { return object != other.object; } @@ -17687,32 +17684,32 @@ bool ValueTree::operator!= (const ValueTree& other) const throw() bool ValueTree::isEquivalentTo (const ValueTree& other) const { return object == other.object - || (object != 0 && other.object != 0 && object->isEquivalentTo (*other.object)); + || (object != nullptr && other.object != nullptr && object->isEquivalentTo (*other.object)); } ValueTree ValueTree::createCopy() const { - return ValueTree (object != 0 ? new SharedObject (*object) : 0); + return ValueTree (object != nullptr ? new SharedObject (*object) : nullptr); } bool ValueTree::hasType (const Identifier& typeName) const { - return object != 0 && object->type == typeName; + return object != nullptr && object->type == typeName; } const Identifier ValueTree::getType() const { - return object != 0 ? object->type : Identifier(); + return object != nullptr ? object->type : Identifier(); } ValueTree ValueTree::getParent() const { - return ValueTree (object != 0 ? object->parent : (SharedObject*) 0); + return ValueTree (object != nullptr ? object->parent : (SharedObject*) nullptr); } ValueTree ValueTree::getSibling (const int delta) const { - if (object == 0 || object->parent == 0) + if (object == nullptr || object->parent == nullptr) return invalid; const int index = object->parent->indexOf (*this) + delta; @@ -17721,53 +17718,53 @@ ValueTree ValueTree::getSibling (const int delta) const const var& ValueTree::operator[] (const Identifier& name) const { - return object == 0 ? var::null : object->getProperty (name); + return object == nullptr ? var::null : object->getProperty (name); } const var& ValueTree::getProperty (const Identifier& name) const { - return object == 0 ? var::null : object->getProperty (name); + return object == nullptr ? var::null : object->getProperty (name); } const var ValueTree::getProperty (const Identifier& name, const var& defaultReturnValue) const { - return object == 0 ? defaultReturnValue : object->getProperty (name, defaultReturnValue); + return object == nullptr ? defaultReturnValue : object->getProperty (name, defaultReturnValue); } void ValueTree::setProperty (const Identifier& name, const var& newValue, UndoManager* const undoManager) { jassert (name.toString().isNotEmpty()); - if (object != 0 && name.toString().isNotEmpty()) + if (object != nullptr && name.toString().isNotEmpty()) object->setProperty (name, newValue, undoManager); } bool ValueTree::hasProperty (const Identifier& name) const { - return object != 0 && object->hasProperty (name); + return object != nullptr && object->hasProperty (name); } void ValueTree::removeProperty (const Identifier& name, UndoManager* const undoManager) { - if (object != 0) + if (object != nullptr) object->removeProperty (name, undoManager); } void ValueTree::removeAllProperties (UndoManager* const undoManager) { - if (object != 0) + if (object != nullptr) object->removeAllProperties (undoManager); } int ValueTree::getNumProperties() const { - return object == 0 ? 0 : object->properties.size(); + return object == nullptr ? 0 : object->properties.size(); } const Identifier ValueTree::getPropertyName (const int index) const { - return object == 0 ? Identifier() - : object->properties.getName (index); + return object == nullptr ? Identifier() + : object->properties.getName (index); } class ValueTreePropertyValueSource : public Value::ValueSource, @@ -17825,74 +17822,74 @@ Value ValueTree::getPropertyAsValue (const Identifier& name, UndoManager* const int ValueTree::getNumChildren() const { - return object == 0 ? 0 : object->children.size(); + return object == nullptr ? 0 : object->children.size(); } ValueTree ValueTree::getChild (int index) const { - return ValueTree (object != 0 ? (SharedObject*) object->children [index] : (SharedObject*) 0); + return ValueTree (object != nullptr ? (SharedObject*) object->children [index] : (SharedObject*) nullptr); } ValueTree ValueTree::getChildWithName (const Identifier& type) const { - return object != 0 ? object->getChildWithName (type) : ValueTree::invalid; + return object != nullptr ? object->getChildWithName (type) : ValueTree::invalid; } ValueTree ValueTree::getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager) { - return object != 0 ? object->getOrCreateChildWithName (type, undoManager) : ValueTree::invalid; + return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree::invalid; } ValueTree ValueTree::getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const { - return object != 0 ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree::invalid; + return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree::invalid; } bool ValueTree::isAChildOf (const ValueTree& possibleParent) const { - return object != 0 && object->isAChildOf (possibleParent.object); + return object != nullptr && object->isAChildOf (possibleParent.object); } int ValueTree::indexOf (const ValueTree& child) const { - return object != 0 ? object->indexOf (child) : -1; + return object != nullptr ? object->indexOf (child) : -1; } void ValueTree::addChild (const ValueTree& child, int index, UndoManager* const undoManager) { - if (object != 0) + if (object != nullptr) object->addChild (child.object, index, undoManager); } void ValueTree::removeChild (const int childIndex, UndoManager* const undoManager) { - if (object != 0) + if (object != nullptr) object->removeChild (childIndex, undoManager); } void ValueTree::removeChild (const ValueTree& child, UndoManager* const undoManager) { - if (object != 0) + if (object != nullptr) object->removeChild (object->children.indexOf (child.object), undoManager); } void ValueTree::removeAllChildren (UndoManager* const undoManager) { - if (object != 0) + if (object != nullptr) object->removeAllChildren (undoManager); } void ValueTree::moveChild (int currentIndex, int newIndex, UndoManager* undoManager) { - if (object != 0) + if (object != nullptr) object->moveChild (currentIndex, newIndex, undoManager); } void ValueTree::addListener (Listener* listener) { - if (listener != 0) + if (listener != nullptr) { - if (listeners.size() == 0 && object != 0) + if (listeners.size() == 0 && object != nullptr) object->valueTreesWithListeners.add (this); listeners.add (listener); @@ -17903,7 +17900,7 @@ void ValueTree::removeListener (Listener* listener) { listeners.remove (listener); - if (listeners.size() == 0 && object != 0) + if (listeners.size() == 0 && object != nullptr) object->valueTreesWithListeners.removeValue (this); } @@ -17920,7 +17917,7 @@ XmlElement* ValueTree::SharedObject::createXml() const XmlElement* ValueTree::createXml() const { - return object != 0 ? object->createXml() : 0; + return object != nullptr ? object->createXml() : nullptr; } ValueTree ValueTree::fromXml (const XmlElement& xml) @@ -17929,7 +17926,7 @@ ValueTree ValueTree::fromXml (const XmlElement& xml) v.object->properties.setFromXmlAttributes (xml); forEachXmlChildElement (xml, e) - v.addChild (fromXml (*e), -1, 0); + v.addChild (fromXml (*e), -1, nullptr); return v; } @@ -18028,7 +18025,7 @@ void Value::ValueSource::sendChangeMessage (const bool synchronous) { Value* const v = valuesWithListeners[i]; - if (v != 0) + if (v != nullptr) v->callListeners(); } } @@ -18083,7 +18080,7 @@ Value::Value() Value::Value (ValueSource* const value_) : value (value_) { - jassert (value_ != 0); + jassert (value_ != nullptr); } Value::Value (const var& initialValue) @@ -18166,7 +18163,7 @@ bool Value::operator!= (const Value& other) const void Value::addListener (ValueListener* const listener) { - if (listener != 0) + if (listener != nullptr) { if (listeners.size() == 0) value->valuesWithListeners.add (this); @@ -18209,24 +18206,24 @@ JUCEApplication::JUCEApplication() : appReturnValue (0), stillInitialising (true) { - jassert (isStandaloneApp() && appInstance == 0); + jassert (isStandaloneApp() && appInstance == nullptr); appInstance = this; } JUCEApplication::~JUCEApplication() { - if (appLock != 0) + if (appLock != nullptr) { appLock->exit(); - appLock = 0; + appLock = nullptr; } jassert (appInstance == this); - appInstance = 0; + appInstance = nullptr; } JUCEApplication::CreateInstanceFunction JUCEApplication::createInstance = 0; -JUCEApplication* JUCEApplication::appInstance = 0; +JUCEApplication* JUCEApplication::appInstance = nullptr; bool JUCEApplication::moreThanOneInstanceAllowed() { @@ -18247,7 +18244,7 @@ void JUCEApplication::quit() MessageManager::getInstance()->stopDispatchLoop(); } -void JUCEApplication::setApplicationReturnValue (const int newReturnValue) throw() +void JUCEApplication::setApplicationReturnValue (const int newReturnValue) noexcept { appReturnValue = newReturnValue; } @@ -18269,7 +18266,7 @@ void JUCEApplication::sendUnhandledException (const std::exception* const e, const char* const sourceFile, const int lineNumber) { - if (appInstance != 0) + if (appInstance != nullptr) appInstance->unhandledException (e, sourceFile, lineNumber); } @@ -18312,7 +18309,7 @@ bool JUCEApplication::initialiseApp (const String& commandLine) commandLineParameters = commandLine.trim(); #if ! JUCE_IOS - jassert (appLock == 0); // initialiseApp must only be called once! + jassert (appLock == nullptr); // initialiseApp must only be called once! if (! moreThanOneInstanceAllowed()) { @@ -18320,7 +18317,7 @@ bool JUCEApplication::initialiseApp (const String& commandLine) if (! appLock->enter(0)) { - appLock = 0; + appLock = nullptr; MessageManager::broadcastMessage (getApplicationName() + "/" + commandLineParameters); DBG ("Another instance is running - quitting..."); @@ -18365,7 +18362,7 @@ void JUCEApplication::appWillTerminateByForce() { const ScopedPointer app (JUCEApplication::getInstance()); - if (app != 0) + if (app != nullptr) app->shutdownApp(); } @@ -18376,7 +18373,7 @@ void JUCEApplication::appWillTerminateByForce() int JUCEApplication::main (const String& commandLine) { ScopedJuceInitialiser_GUI libraryInitialiser; - jassert (createInstance != 0); + jassert (createInstance != nullptr); int returnCode = 0; { @@ -18411,7 +18408,7 @@ int JUCEApplication::main (int argc, const char* argv[]) JUCE_AUTORELEASEPOOL #if ! JUCE_WINDOWS - jassert (createInstance != 0); + jassert (createInstance != nullptr); juce_Argv0 = argv[0]; #endif @@ -18434,7 +18431,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_ApplicationCommandInfo.cpp ***/ BEGIN_JUCE_NAMESPACE -ApplicationCommandInfo::ApplicationCommandInfo (const CommandID commandID_) throw() +ApplicationCommandInfo::ApplicationCommandInfo (const CommandID commandID_) noexcept : commandID (commandID_), flags (0) { @@ -18443,7 +18440,7 @@ ApplicationCommandInfo::ApplicationCommandInfo (const CommandID commandID_) thro void ApplicationCommandInfo::setInfo (const String& shortName_, const String& description_, const String& categoryName_, - const int flags_) throw() + const int flags_) noexcept { shortName = shortName_; description = description_; @@ -18451,7 +18448,7 @@ void ApplicationCommandInfo::setInfo (const String& shortName_, flags = flags_; } -void ApplicationCommandInfo::setActive (const bool b) throw() +void ApplicationCommandInfo::setActive (const bool b) noexcept { if (b) flags &= ~isDisabled; @@ -18459,7 +18456,7 @@ void ApplicationCommandInfo::setActive (const bool b) throw() flags |= isDisabled; } -void ApplicationCommandInfo::setTicked (const bool b) throw() +void ApplicationCommandInfo::setTicked (const bool b) noexcept { if (b) flags |= isTicked; @@ -18467,7 +18464,7 @@ void ApplicationCommandInfo::setTicked (const bool b) throw() flags &= ~isTicked; } -void ApplicationCommandInfo::addDefaultKeypress (const int keyCode, const ModifierKeys& modifiers) throw() +void ApplicationCommandInfo::addDefaultKeypress (const int keyCode, const ModifierKeys& modifiers) noexcept { defaultKeypresses.add (KeyPress (keyCode, modifiers, 0)); } @@ -18480,7 +18477,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE ApplicationCommandManager::ApplicationCommandManager() - : firstTarget (0) + : firstTarget (nullptr) { keyMappings = new KeyPressMappingSet (this); @@ -18490,7 +18487,7 @@ ApplicationCommandManager::ApplicationCommandManager() ApplicationCommandManager::~ApplicationCommandManager() { Desktop::getInstance().removeFocusChangeListener (this); - keyMappings = 0; + keyMappings = nullptr; } void ApplicationCommandManager::clearCommands() @@ -18532,7 +18529,7 @@ void ApplicationCommandManager::registerCommand (const ApplicationCommandInfo& n void ApplicationCommandManager::registerAllCommandsForTarget (ApplicationCommandTarget* target) { - if (target != 0) + if (target != nullptr) { Array commandIDs; target->getAllCommands (commandIDs); @@ -18569,7 +18566,7 @@ void ApplicationCommandManager::commandStatusChanged() triggerAsyncUpdate(); } -const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (const CommandID commandID) const throw() +const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (const CommandID commandID) const noexcept { for (int i = commands.size(); --i >= 0;) if (commands.getUnchecked(i)->commandID == commandID) @@ -18578,19 +18575,19 @@ const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (const return 0; } -const String ApplicationCommandManager::getNameOfCommand (const CommandID commandID) const throw() +const String ApplicationCommandManager::getNameOfCommand (const CommandID commandID) const noexcept { const ApplicationCommandInfo* const ci = getCommandForID (commandID); - return (ci != 0) ? ci->shortName : String::empty; + return ci != nullptr ? ci->shortName : String::empty; } -const String ApplicationCommandManager::getDescriptionOfCommand (const CommandID commandID) const throw() +const String ApplicationCommandManager::getDescriptionOfCommand (const CommandID commandID) const noexcept { const ApplicationCommandInfo* const ci = getCommandForID (commandID); - return (ci != 0) ? (ci->description.isNotEmpty() ? ci->description : ci->shortName) - : String::empty; + return ci != nullptr ? (ci->description.isNotEmpty() ? ci->description : ci->shortName) + : String::empty; } const StringArray ApplicationCommandManager::getCommandCategories() const @@ -18631,7 +18628,7 @@ bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::Invocati ApplicationCommandInfo commandInfo (0); ApplicationCommandTarget* const target = getTargetForCommand (info_.commandID, commandInfo); - if (target == 0) + if (target == nullptr) return false; ApplicationCommandTarget::InvocationInfo info (info_); @@ -18648,11 +18645,11 @@ bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::Invocati ApplicationCommandTarget* ApplicationCommandManager::getFirstCommandTarget (const CommandID) { - return firstTarget != 0 ? firstTarget - : findDefaultComponentTarget(); + return firstTarget != nullptr ? firstTarget + : findDefaultComponentTarget(); } -void ApplicationCommandManager::setFirstCommandTarget (ApplicationCommandTarget* const newTarget) throw() +void ApplicationCommandManager::setFirstCommandTarget (ApplicationCommandTarget* const newTarget) noexcept { firstTarget = newTarget; } @@ -18662,13 +18659,13 @@ ApplicationCommandTarget* ApplicationCommandManager::getTargetForCommand (const { ApplicationCommandTarget* target = getFirstCommandTarget (commandID); - if (target == 0) + if (target == nullptr) target = JUCEApplication::getInstance(); - if (target != 0) + if (target != nullptr) target = target->getTargetForCommand (commandID); - if (target != 0) + if (target != nullptr) target->getCommandInfo (commandID, upToDateInfo); return target; @@ -18678,7 +18675,7 @@ ApplicationCommandTarget* ApplicationCommandManager::findTargetForComponent (Com { ApplicationCommandTarget* target = dynamic_cast (c); - if (target == 0 && c != 0) + if (target == nullptr && c != nullptr) // (unable to use the syntax findParentComponentOfClass () because of a VC6 compiler bug) target = c->findParentComponentOfClass ((ApplicationCommandTarget*) 0); @@ -18689,20 +18686,20 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( { Component* c = Component::getCurrentlyFocusedComponent(); - if (c == 0) + if (c == nullptr) { TopLevelWindow* const activeWindow = TopLevelWindow::getActiveTopLevelWindow(); - if (activeWindow != 0) + if (activeWindow != nullptr) { c = activeWindow->getPeer()->getLastFocusedSubcomponent(); - if (c == 0) + if (c == nullptr) c = activeWindow; } } - if (c == 0 && Process::isForegroundProcess()) + if (c == nullptr && Process::isForegroundProcess()) { // getting a bit desperate now - try all desktop comps.. for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;) @@ -18711,12 +18708,12 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( = findTargetForComponent (Desktop::getInstance().getComponent (i) ->getPeer()->getLastFocusedSubcomponent()); - if (target != 0) + if (target != nullptr) return target; } } - if (c != 0) + if (c != nullptr) { ResizableWindow* const resizableWindow = dynamic_cast (c); @@ -18724,12 +18721,12 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget( // component that really should get the event. And if not, the event will // still be passed up to the top level window anyway, so let's send it to the // content comp. - if (resizableWindow != 0 && resizableWindow->getContentComponent() != 0) + if (resizableWindow != nullptr && resizableWindow->getContentComponent() != nullptr) c = resizableWindow->getContentComponent(); ApplicationCommandTarget* const target = findTargetForComponent (c); - if (target != 0) + if (target != nullptr) return target; } @@ -18774,7 +18771,7 @@ ApplicationCommandTarget::ApplicationCommandTarget() ApplicationCommandTarget::~ApplicationCommandTarget() { - messageInvoker = 0; + messageInvoker = nullptr; } bool ApplicationCommandTarget::tryToInvoke (const InvocationInfo& info, const bool async) @@ -18783,7 +18780,7 @@ bool ApplicationCommandTarget::tryToInvoke (const InvocationInfo& info, const bo { if (async) { - if (messageInvoker == 0) + if (messageInvoker == nullptr) messageInvoker = new CommandTargetMessageInvoker (this); messageInvoker->postMessage (new Message (0, 0, 0, new ApplicationCommandTarget::InvocationInfo (info))); @@ -18807,7 +18804,7 @@ ApplicationCommandTarget* ApplicationCommandTarget::findFirstTargetParentCompone { Component* c = dynamic_cast (this); - if (c != 0) + if (c != nullptr) // (unable to use the syntax findParentComponentOfClass () because of a VC6 compiler bug) return c->findParentComponentOfClass ((ApplicationCommandTarget*) 0); @@ -18819,7 +18816,7 @@ ApplicationCommandTarget* ApplicationCommandTarget::getTargetForCommand (const C ApplicationCommandTarget* target = this; int depth = 0; - while (target != 0) + while (target != nullptr) { Array commandIDs; target->getAllCommands (commandIDs); @@ -18837,11 +18834,11 @@ ApplicationCommandTarget* ApplicationCommandTarget::getTargetForCommand (const C break; } - if (target == 0) + if (target == nullptr) { target = JUCEApplication::getInstance(); - if (target != 0) + if (target != nullptr) { Array commandIDs; target->getAllCommands (commandIDs); @@ -18869,7 +18866,7 @@ bool ApplicationCommandTarget::invoke (const InvocationInfo& info, const bool as ApplicationCommandTarget* target = this; int depth = 0; - while (target != 0) + while (target != nullptr) { if (target->tryToInvoke (info, async)) return true; @@ -18884,11 +18881,11 @@ bool ApplicationCommandTarget::invoke (const InvocationInfo& info, const bool as break; } - if (target == 0) + if (target == nullptr) { target = JUCEApplication::getInstance(); - if (target != 0) + if (target != nullptr) return target->tryToInvoke (info, async); } @@ -18907,7 +18904,7 @@ ApplicationCommandTarget::InvocationInfo::InvocationInfo (const CommandID comman : commandID (commandID_), commandFlags (0), invocationMethod (direct), - originatingComponent (0), + originatingComponent (nullptr), isKeyDown (false), millisecsSinceKeyPressed (0) { @@ -18941,7 +18938,7 @@ ApplicationProperties::ApplicationProperties() : msBeforeSaving (3000), options (PropertiesFile::storeAsBinary), commonSettingsAreReadOnly (0), - processLock (0) + processLock (nullptr) { } @@ -18979,10 +18976,10 @@ bool ApplicationProperties::testWriteAccess (const bool testUserSettings, { String filenames; - if (userProps != 0 && ! userOk) + if (userProps != nullptr && ! userOk) filenames << '\n' << userProps->getFile().getFullPathName(); - if (commonProps != 0 && ! commonOk) + if (commonProps != nullptr && ! commonOk) filenames << '\n' << commonProps->getFile().getFullPathName(); AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, @@ -19007,11 +19004,11 @@ void ApplicationProperties::openFiles() if (appName.isNotEmpty()) { - if (userProps == 0) + if (userProps == nullptr) userProps = PropertiesFile::createDefaultAppPropertiesFile (appName, fileSuffix, folderName, false, msBeforeSaving, options, processLock); - if (commonProps == 0) + if (commonProps == nullptr) commonProps = PropertiesFile::createDefaultAppPropertiesFile (appName, fileSuffix, folderName, true, msBeforeSaving, options, processLock); @@ -19021,7 +19018,7 @@ void ApplicationProperties::openFiles() PropertiesFile* ApplicationProperties::getUserSettings() { - if (userProps == 0) + if (userProps == nullptr) openFiles(); return userProps; @@ -19029,7 +19026,7 @@ PropertiesFile* ApplicationProperties::getUserSettings() PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserPropsIfReadOnly) { - if (commonProps == 0) + if (commonProps == nullptr) openFiles(); if (returnUserPropsIfReadOnly) @@ -19046,14 +19043,14 @@ PropertiesFile* ApplicationProperties::getCommonSettings (const bool returnUserP bool ApplicationProperties::saveIfNeeded() { - return (userProps == 0 || userProps->saveIfNeeded()) - && (commonProps == 0 || commonProps->saveIfNeeded()); + return (userProps == nullptr || userProps->saveIfNeeded()) + && (commonProps == nullptr || commonProps->saveIfNeeded()); } void ApplicationProperties::closeFiles() { - userProps = 0; - commonProps = 0; + userProps = nullptr; + commonProps = nullptr; } END_JUCE_NAMESPACE @@ -19091,12 +19088,12 @@ PropertiesFile::PropertiesFile (const File& f, const int millisecondsBeforeSavin ProcessScopedLock pl (createProcessLock()); - if (pl != 0 && ! pl->isLocked()) + if (pl != nullptr && ! pl->isLocked()) return; // locking failure.. ScopedPointer fileStream (f.createInputStream()); - if (fileStream != 0) + if (fileStream != nullptr) { int magicNumber = fileStream->readInt(); @@ -19126,16 +19123,16 @@ PropertiesFile::PropertiesFile (const File& f, const int millisecondsBeforeSavin else { // Not a binary props file - let's see if it's XML.. - fileStream = 0; + fileStream = nullptr; XmlDocument parser (f); ScopedPointer doc (parser.getDocumentElement (true)); - if (doc != 0 && doc->hasTagName (PropertyFileConstants::fileTag)) + if (doc != nullptr && doc->hasTagName (PropertyFileConstants::fileTag)) { doc = parser.getDocumentElement(); - if (doc != 0) + if (doc != nullptr) { loadedOk = true; @@ -19146,7 +19143,7 @@ PropertiesFile::PropertiesFile (const File& f, const int millisecondsBeforeSavin if (name.isNotEmpty()) { getAllProperties().set (name, - e->getFirstChildElement() != 0 + e->getFirstChildElement() != nullptr ? e->getFirstChildElement()->createDocument (String::empty, true) : e->getStringAttribute (PropertyFileConstants::valueAttribute)); } @@ -19176,7 +19173,7 @@ PropertiesFile::~PropertiesFile() InterProcessLock::ScopedLockType* PropertiesFile::createProcessLock() const { - return processLock != 0 ? new InterProcessLock::ScopedLockType (*processLock) : 0; + return processLock != nullptr ? new InterProcessLock::ScopedLockType (*processLock) : 0; } bool PropertiesFile::saveIfNeeded() @@ -19220,7 +19217,7 @@ bool PropertiesFile::save() // if the value seems to contain xml, store it as such.. XmlElement* const childElement = XmlDocument::parse (getAllProperties().getAllValues() [i]); - if (childElement != 0) + if (childElement != nullptr) e->addChildElement (childElement); else e->setAttribute (PropertyFileConstants::valueAttribute, @@ -19229,7 +19226,7 @@ bool PropertiesFile::save() ProcessScopedLock pl (createProcessLock()); - if (pl != 0 && ! pl->isLocked()) + if (pl != nullptr && ! pl->isLocked()) return false; // locking failure.. if (doc.writeToFile (file, String::empty)) @@ -19242,13 +19239,13 @@ bool PropertiesFile::save() { ProcessScopedLock pl (createProcessLock()); - if (pl != 0 && ! pl->isLocked()) + if (pl != nullptr && ! pl->isLocked()) return false; // locking failure.. TemporaryFile tempFile (file); ScopedPointer out (tempFile.getFile().createOutputStream()); - if (out != 0) + if (out != nullptr) { if ((options & storeAsCompressedBinary) != 0) { @@ -19275,7 +19272,7 @@ bool PropertiesFile::save() out->writeString (getAllProperties().getAllValues() [i]); } - out = 0; + out = nullptr; if (tempFile.overwriteTargetFileWithTemporary()) { @@ -19696,9 +19693,9 @@ int RecentlyOpenedFilesList::createPopupMenuItems (PopupMenu& menuToAddTo, { bool needsAvoiding = false; - if (filesToAvoid != 0) + if (filesToAvoid != nullptr) { - for (const File** avoid = filesToAvoid; *avoid != 0; ++avoid) + for (const File** avoid = filesToAvoid; *avoid != nullptr; ++avoid) { if (f == **avoid) { @@ -19780,7 +19777,7 @@ void UndoManager::setMaxNumberOfStoredUnits (const int maxNumberOfUnitsToKeep, bool UndoManager::perform (UndoableAction* const command_, const String& actionName) { - if (command_ != 0) + if (command_ != nullptr) { ScopedPointer command (command_); @@ -19798,15 +19795,15 @@ bool UndoManager::perform (UndoableAction* const command_, const String& actionN { OwnedArray* commandSet = transactions [nextIndex - 1]; - if (commandSet != 0 && ! newTransaction) + if (commandSet != nullptr && ! newTransaction) { UndoableAction* lastAction = commandSet->getLast(); - if (lastAction != 0) + if (lastAction != nullptr) { UndoableAction* coalescedAction = lastAction->createCoalescedAction (command); - if (coalescedAction != 0) + if (coalescedAction != nullptr) { command = coalescedAction; totalUnitsStored -= lastAction->getSizeInUnits(); @@ -19897,7 +19894,7 @@ bool UndoManager::undo() { const OwnedArray* const commandSet = transactions [nextIndex - 1]; - if (commandSet == 0) + if (commandSet == nullptr) return false; bool failed = false; @@ -19931,7 +19928,7 @@ bool UndoManager::redo() { const OwnedArray* const commandSet = transactions [nextIndex]; - if (commandSet == 0) + if (commandSet == nullptr) return false; bool failed = false; @@ -19970,7 +19967,7 @@ void UndoManager::getActionsInCurrentTransaction (Array & { const OwnedArray * const commandSet = transactions [nextIndex - 1]; - if (commandSet != 0 && ! newTransaction) + if (commandSet != nullptr && ! newTransaction) { for (int i = 0; i < commandSet->size(); ++i) actionsFound.add (commandSet->getUnchecked(i)); @@ -19981,7 +19978,7 @@ int UndoManager::getNumActionsInCurrentTransaction() const { const OwnedArray * const commandSet = transactions [nextIndex - 1]; - if (commandSet != 0 && ! newTransaction) + if (commandSet != nullptr && ! newTransaction) return commandSet->size(); return 0; @@ -19995,7 +19992,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE UnitTest::UnitTest (const String& name_) - : name (name_), runner (0) + : name (name_), runner (nullptr) { getAllTests().add (this); } @@ -20016,7 +20013,7 @@ void UnitTest::shutdown() {} void UnitTest::performTest (UnitTestRunner* const runner_) { - jassert (runner_ != 0); + jassert (runner_ != nullptr); runner = runner_; initialise(); @@ -20043,7 +20040,7 @@ void UnitTest::expect (const bool result, const String& failureMessage) } UnitTestRunner::UnitTestRunner() - : currentTest (0), assertOnFailure (false) + : currentTest (nullptr), assertOnFailure (false) { } @@ -20051,12 +20048,12 @@ UnitTestRunner::~UnitTestRunner() { } -int UnitTestRunner::getNumResults() const throw() +int UnitTestRunner::getNumResults() const noexcept { return results.size(); } -const UnitTestRunner::TestResult* UnitTestRunner::getResult (int index) const throw() +const UnitTestRunner::TestResult* UnitTestRunner::getResult (int index) const noexcept { return results [index]; } @@ -20143,7 +20140,7 @@ void UnitTestRunner::addPass() const ScopedLock sl (results.getLock()); TestResult* const r = results.getLast(); - jassert (r != 0); // You need to call UnitTest::beginTest() before performing any tests! + jassert (r != nullptr); // You need to call UnitTest::beginTest() before performing any tests! r->passes++; @@ -20161,7 +20158,7 @@ void UnitTestRunner::addFail (const String& failureMessage) const ScopedLock sl (results.getLock()); TestResult* const r = results.getLast(); - jassert (r != 0); // You need to call UnitTest::beginTest() before performing any tests! + jassert (r != nullptr); // You need to call UnitTest::beginTest() before performing any tests! r->failures++; @@ -20223,7 +20220,7 @@ void DeletedAtShutdown::deleteAll() { const SpinLock::ScopedLockType sl (deletedAtShutdownLock); if (! getObjects().contains (deletee)) - deletee = 0; + deletee = nullptr; } delete deletee; @@ -20366,7 +20363,7 @@ public: if (samplesAvailable < numSamples) { for (int i = numDestChannels; --i >= 0;) - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples); numSamples = (int) samplesAvailable; @@ -20453,7 +20450,7 @@ public: bool write (const int** data, int numSamples) { - jassert (data != 0 && *data != 0); // the input must contain at least one channel! + jassert (data != nullptr && *data != nullptr); // the input must contain at least one channel! if (writeFailed) return false; @@ -20617,7 +20614,7 @@ AudioFormatReader* AiffAudioFormat::createReaderFor (InputStream* sourceStream, return w.release(); if (! deleteStreamIfOpeningFails) - w->input = 0; + w->input = nullptr; return 0; } @@ -20705,7 +20702,7 @@ bool AudioFormatReader::read (int* const* destSamples, const int silence = (int) jmin (-startSampleInSource, (int64) numSamplesToRead); for (int i = numDestChannels; --i >= 0;) - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) zeromem (destSamples[i], sizeof (int) * silence); startOffsetInDestBuffer += silence; @@ -20729,22 +20726,22 @@ bool AudioFormatReader::read (int* const* destSamples, for (int i = (int) numChannels; --i > 0;) { - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) { lastFullChannel = destSamples[i]; break; } } - if (lastFullChannel != 0) + if (lastFullChannel != nullptr) for (int i = numChannels; i < numDestChannels; ++i) - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) memcpy (destSamples[i], lastFullChannel, sizeof (int) * numSamplesToRead); } else { for (int i = numChannels; i < numDestChannels; ++i) - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) zeromem (destSamples[i], sizeof (int) * numSamplesToRead); } } @@ -21028,7 +21025,7 @@ bool AudioFormatWriter::writeFromAudioReader (AudioFormatReader& reader, { int** bufferChan = buffers; - while (*bufferChan != 0) + while (*bufferChan != nullptr) { int* b = *bufferChan++; @@ -21136,7 +21133,7 @@ public: buffer (numChannels, bufferSize_), timeSliceThread (timeSliceThread_), writer (writer_), - thumbnailToUpdate (0), + thumbnailToUpdate (nullptr), samplesWritten (0), isRunning (true) { @@ -21189,7 +21186,7 @@ public: writer->writeFromAudioSampleBuffer (buffer, start1, size1); const ScopedLock sl (thumbnailLock); - if (thumbnailToUpdate != 0) + if (thumbnailToUpdate != nullptr) thumbnailToUpdate->addBlock (samplesWritten, buffer, start1, size1); samplesWritten += size1; @@ -21198,7 +21195,7 @@ public: { writer->writeFromAudioSampleBuffer (buffer, start2, size2); - if (thumbnailToUpdate != 0) + if (thumbnailToUpdate != nullptr) thumbnailToUpdate->addBlock (samplesWritten, buffer, start2, size2); samplesWritten += size2; @@ -21210,7 +21207,7 @@ public: void setThumbnail (AudioThumbnail* thumb) { - if (thumb != 0) + if (thumb != nullptr) thumb->reset (buffer.getNumChannels(), writer->getSampleRate(), 0); const ScopedLock sl (thumbnailLock); @@ -21267,9 +21264,9 @@ AudioFormatManager::~AudioFormatManager() void AudioFormatManager::registerFormat (AudioFormat* newFormat, const bool makeThisTheDefaultFormat) { - jassert (newFormat != 0); + jassert (newFormat != nullptr); - if (newFormat != 0) + if (newFormat != nullptr) { #if JUCE_DEBUG for (int i = getNumKnownFormats(); --i >= 0;) @@ -21383,11 +21380,11 @@ AudioFormatReader* AudioFormatManager::createReaderFor (const File& file) { InputStream* const in = file.createInputStream(); - if (in != 0) + if (in != nullptr) { AudioFormatReader* const r = af->createReaderFor (in, true); - if (r != 0) + if (r != nullptr) return r; } } @@ -21404,7 +21401,7 @@ AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* audioFileSt ScopedPointer in (audioFileStream); - if (in != 0) + if (in != nullptr) { const int64 originalStreamPos = in->getPosition(); @@ -21412,7 +21409,7 @@ AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* audioFileSt { AudioFormatReader* const r = getKnownFormat(i)->createReaderFor (in, false); - if (r != 0) + if (r != nullptr) { in.release(); return r; @@ -21466,7 +21463,7 @@ bool AudioSubsectionReader::readSamples (int** destSamples, int numDestChannels, if (startSampleInFile + numSamples > length) { for (int i = numDestChannels; --i >= 0;) - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) zeromem (destSamples[i], sizeof (int) * numSamples); numSamples = jmin (numSamples, (int) (length - startSampleInFile)); @@ -21513,13 +21510,13 @@ struct AudioThumbnail::MinMaxValue { } - inline void set (const char newMin, const char newMax) throw() + inline void set (const char newMin, const char newMax) noexcept { minValue = newMin; maxValue = newMax; } - inline void setFloat (const float newMin, const float newMax) throw() + inline void setFloat (const float newMin, const float newMax) noexcept { minValue = (char) jlimit (-128, 127, roundFloatToInt (newMin * 127.0f)); maxValue = (char) jlimit (-128, 127, roundFloatToInt (newMax * 127.0f)); @@ -21528,12 +21525,12 @@ struct AudioThumbnail::MinMaxValue maxValue = (char) jmin (127, maxValue + 1); } - inline bool isNonZero() const throw() + inline bool isNonZero() const noexcept { return maxValue > minValue; } - inline int getPeak() const throw() + inline int getPeak() const noexcept { return jmax (std::abs ((int) minValue), std::abs ((int) maxValue)); @@ -21582,14 +21579,14 @@ public: createReader(); - if (reader != 0) + if (reader != nullptr) { lengthInSamples = reader->lengthInSamples; numChannels = reader->numChannels; sampleRate = reader->sampleRate; if (lengthInSamples <= 0 || isFullyLoaded()) - reader = 0; + reader = nullptr; else owner.cache.addTimeSliceClient (this); } @@ -21599,15 +21596,15 @@ public: { const ScopedLock sl (readerLock); - if (reader == 0) + if (reader == nullptr) { createReader(); - if (reader != 0) + if (reader != nullptr) owner.cache.addTimeSliceClient (this); } - if (reader != 0) + if (reader != nullptr) { float l[4] = { 0 }; reader->readMaxLevels (startSample, numSamples, l[0], l[1], l[2], l[3]); @@ -21620,14 +21617,14 @@ public: void releaseResources() { const ScopedLock sl (readerLock); - reader = 0; + reader = nullptr; } int useTimeSlice() { if (isFullyLoaded()) { - if (reader != 0 && source != 0) + if (reader != nullptr && source != nullptr) releaseResources(); return -1; @@ -21640,7 +21637,7 @@ public: createReader(); - if (reader != 0) + if (reader != nullptr) { if (! readNextBlock()) return 0; @@ -21655,12 +21652,12 @@ public: return timeBeforeDeletingReader; } - bool isFullyLoaded() const throw() + bool isFullyLoaded() const noexcept { return numSamplesFinished >= lengthInSamples; } - inline int sampleToThumbSample (const int64 originalSample) const throw() + inline int sampleToThumbSample (const int64 originalSample) const noexcept { return (int) (originalSample / owner.samplesPerThumbSample); } @@ -21678,18 +21675,18 @@ private: void createReader() { - if (reader == 0 && source != 0) + if (reader == nullptr && source != nullptr) { InputStream* audioFileStream = source->createInputStream(); - if (audioFileStream != 0) + if (audioFileStream != nullptr) reader = owner.formatManagerToUse.createReaderFor (audioFileStream); } } bool readNextBlock() { - jassert (reader != 0); + jassert (reader != nullptr); if (! isFullyLoaded()) { @@ -21739,18 +21736,18 @@ public: ensureSize (numThumbSamples); } - inline MinMaxValue* getData (const int thumbSampleIndex) throw() + inline MinMaxValue* getData (const int thumbSampleIndex) noexcept { jassert (thumbSampleIndex < data.size()); return data.getRawDataPointer() + thumbSampleIndex; } - int getSize() const throw() + int getSize() const noexcept { return data.size(); } - void getMinMax (int startSample, int endSample, MinMaxValue& result) throw() + void getMinMax (int startSample, int endSample, MinMaxValue& result) noexcept { if (startSample >= 0) { @@ -21910,7 +21907,7 @@ private: ensureSize (numSamples); - if (timePerPixel * sampleRate <= samplesPerThumbSample && levelData != 0) + if (timePerPixel * sampleRate <= samplesPerThumbSample && levelData != nullptr) { int sample = roundToInt (startTime * sampleRate); Array levels; @@ -21968,7 +21965,7 @@ private: } } - MinMaxValue* getData (const int channelNum, const int cacheIndex) throw() + MinMaxValue* getData (const int channelNum, const int cacheIndex) noexcept { jassert (isPositiveAndBelow (channelNum, numChannelsCached) && isPositiveAndBelow (cacheIndex, data.size())); @@ -22005,7 +22002,7 @@ AudioThumbnail::~AudioThumbnail() void AudioThumbnail::clear() { - source = 0; + source = nullptr; const ScopedLock sl (lock); window->invalidate(); @@ -22113,20 +22110,20 @@ bool AudioThumbnail::setSource (InputSource* const newSource) { clear(); - return newSource != 0 && setDataSource (new LevelDataSource (*this, newSource)); + return newSource != nullptr && setDataSource (new LevelDataSource (*this, newSource)); } void AudioThumbnail::setReader (AudioFormatReader* newReader, int64 hash) { clear(); - if (newReader != 0) + if (newReader != nullptr) setDataSource (new LevelDataSource (*this, newReader, hash)); } int64 AudioThumbnail::getHashCode() const { - return source == 0 ? 0 : source->hashCode; + return source == nullptr ? 0 : source->hashCode; } void AudioThumbnail::addBlock (const int64 startSample, const AudioSampleBuffer& incoming, @@ -22177,22 +22174,22 @@ void AudioThumbnail::setLevels (const MinMaxValue* const* values, int thumbIndex sendChangeMessage(); } -int AudioThumbnail::getNumChannels() const throw() +int AudioThumbnail::getNumChannels() const noexcept { return numChannels; } -double AudioThumbnail::getTotalLength() const throw() +double AudioThumbnail::getTotalLength() const noexcept { return sampleRate > 0 ? (totalSamples / sampleRate) : 0; } -bool AudioThumbnail::isFullyLoaded() const throw() +bool AudioThumbnail::isFullyLoaded() const noexcept { return numSamplesFinished >= totalSamples - samplesPerThumbSample; } -int64 AudioThumbnail::getNumSamplesFinished() const throw() +int64 AudioThumbnail::getNumSamplesFinished() const noexcept { return numSamplesFinished; } @@ -22269,7 +22266,7 @@ bool AudioThumbnailCache::loadThumb (AudioThumbnail& thumb, const int64 hashCode { ThumbnailCacheEntry* te = findThumbFor (hashCode); - if (te != 0) + if (te != nullptr) { te->lastUsed = Time::getMillisecondCounter(); @@ -22286,7 +22283,7 @@ void AudioThumbnailCache::storeThumb (const AudioThumbnail& thumb, { ThumbnailCacheEntry* te = findThumbFor (hashCode); - if (te == 0) + if (te == nullptr) { te = new ThumbnailCacheEntry(); te->hash = hashCode; @@ -22509,13 +22506,13 @@ public: JUCE_AUTORELEASEPOOL checkThreadIsAttached(); - if (dataHandle != 0) + if (dataHandle != nullptr) DisposeHandle (dataHandle); - if (extractor != 0) + if (extractor != nullptr) { MovieAudioExtractionEnd (extractor); - extractor = 0; + extractor = nullptr; } DisposeMovie (movie); @@ -22571,7 +22568,7 @@ public: for (int j = numDestChannels; --j >= 0;) { - if (destSamples[j] != 0) + if (destSamples[j] != nullptr) { const short* src = ((const short*) bufferList->mBuffers[0].mData) + j; @@ -22590,7 +22587,7 @@ public: if (((outFlags & kQTMovieAudioExtractionComplete) != 0 || samplesReceived == 0) && numSamples > 0) { for (int j = numDestChannels; --j >= 0;) - if (destSamples[j] != 0) + if (destSamples[j] != nullptr) zeromem (destSamples[j] + startOffsetInDestBuffer, sizeof (int) * numSamples); break; @@ -23069,13 +23066,13 @@ public: bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { - jassert (destSamples != 0); + jassert (destSamples != nullptr); const int64 samplesAvailable = lengthInSamples - startSampleInFile; if (samplesAvailable < numSamples) { for (int i = numDestChannels; --i >= 0;) - if (destSamples[i] != 0) + if (destSamples[i] != nullptr) zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples); numSamples = (int) samplesAvailable; @@ -23165,7 +23162,7 @@ public: bool write (const int** data, int numSamples) { - jassert (data != 0 && *data != 0); // the input must contain at least one channel! + jassert (data != nullptr && *data != nullptr); // the input must contain at least one channel! if (writeFailed) return false; @@ -23207,7 +23204,7 @@ private: int64 headerPosition; bool writeFailed; - static int getChannelMask (const int numChannels) throw() + static int getChannelMask (const int numChannels) noexcept { switch (numChannels) { @@ -23361,7 +23358,7 @@ AudioFormatReader* WavAudioFormat::createReaderFor (InputStream* sourceStream, return r.release(); if (! deleteStreamIfOpeningFails) - r->input = 0; + r->input = nullptr; return 0; } @@ -23385,23 +23382,23 @@ namespace WavFileHelpers WavAudioFormat wav; ScopedPointer reader (wav.createReaderFor (file.createInputStream(), true)); - if (reader != 0) + if (reader != nullptr) { ScopedPointer outStream (tempFile.getFile().createOutputStream()); - if (outStream != 0) + if (outStream != nullptr) { ScopedPointer writer (wav.createWriterFor (outStream, reader->sampleRate, reader->numChannels, reader->bitsPerSample, metadata, 0)); - if (writer != 0) + if (writer != nullptr) { outStream.release(); bool ok = writer->writeFromAudioReader (*reader, 0, -1); - writer = 0; - reader = 0; + writer = nullptr; + reader = nullptr; return ok && tempFile.overwriteTargetFileWithTemporary(); } @@ -23417,11 +23414,11 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai using namespace WavFileHelpers; ScopedPointer reader (static_cast (createReaderFor (wavFile.createInputStream(), true))); - if (reader != 0) + if (reader != nullptr) { const int64 bwavPos = reader->bwavChunkStart; const int64 bwavSize = reader->bwavSize; - reader = 0; + reader = nullptr; if (bwavSize > 0) { @@ -23504,7 +23501,7 @@ AudioFormatReaderSource::AudioFormatReaderSource (AudioFormatReader* const reade nextPlayPos (0), looping (false) { - jassert (reader != 0); + jassert (reader != nullptr); } AudioFormatReaderSource::~AudioFormatReaderSource() @@ -23604,7 +23601,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE AudioSourcePlayer::AudioSourcePlayer() - : source (0), + : source (nullptr), sampleRate (0), bufferSize (0), tempBuffer (2, 8), @@ -23615,7 +23612,7 @@ AudioSourcePlayer::AudioSourcePlayer() AudioSourcePlayer::~AudioSourcePlayer() { - setSource (0); + setSource (nullptr); } void AudioSourcePlayer::setSource (AudioSource* newSource) @@ -23624,7 +23621,7 @@ void AudioSourcePlayer::setSource (AudioSource* newSource) { AudioSource* const oldSource = source; - if (newSource != 0 && bufferSize > 0 && sampleRate > 0) + if (newSource != nullptr && bufferSize > 0 && sampleRate > 0) newSource->prepareToPlay (bufferSize, sampleRate); { @@ -23632,12 +23629,12 @@ void AudioSourcePlayer::setSource (AudioSource* newSource) source = newSource; } - if (oldSource != 0) + if (oldSource != nullptr) oldSource->releaseResources(); } } -void AudioSourcePlayer::setGain (const float newGain) throw() +void AudioSourcePlayer::setGain (const float newGain) noexcept { gain = newGain; } @@ -23653,7 +23650,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, const ScopedLock sl (readLock); - if (source != 0) + if (source != nullptr) { AudioSourceChannelInfo info; int i, numActiveChans = 0, numInputs = 0, numOutputs = 0; @@ -23662,7 +23659,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, // of non-zero pointers.. for (i = 0; i < totalNumInputChannels; ++i) { - if (inputChannelData[i] != 0) + if (inputChannelData[i] != nullptr) { inputChans [numInputs++] = inputChannelData[i]; if (numInputs >= numElementsInArray (inputChans)) @@ -23672,7 +23669,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, for (i = 0; i < totalNumOutputChannels; ++i) { - if (outputChannelData[i] != 0) + if (outputChannelData[i] != nullptr) { outputChans [numOutputs++] = outputChannelData[i]; if (numOutputs >= numElementsInArray (outputChans)) @@ -23735,7 +23732,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, else { for (int i = 0; i < totalNumOutputChannels; ++i) - if (outputChannelData[i] != 0) + if (outputChannelData[i] != nullptr) zeromem (outputChannelData[i], sizeof (float) * numSamples); } } @@ -23746,13 +23743,13 @@ void AudioSourcePlayer::audioDeviceAboutToStart (AudioIODevice* device) bufferSize = device->getCurrentBufferSizeSamples(); zeromem (channels, sizeof (channels)); - if (source != 0) + if (source != nullptr) source->prepareToPlay (bufferSize, sampleRate); } void AudioSourcePlayer::audioDeviceStopped() { - if (source != 0) + if (source != nullptr) source->releaseResources(); sampleRate = 0.0; @@ -23769,11 +23766,11 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE AudioTransportSource::AudioTransportSource() - : source (0), - resamplerSource (0), - bufferingSource (0), - positionableSource (0), - masterSource (0), + : source (nullptr), + resamplerSource (nullptr), + bufferingSource (nullptr), + positionableSource (nullptr), + masterSource (nullptr), gain (1.0f), lastGain (1.0f), playing (false), @@ -23789,7 +23786,7 @@ AudioTransportSource::AudioTransportSource() AudioTransportSource::~AudioTransportSource() { - setSource (0); + setSource (nullptr); releaseResources(); } @@ -23801,7 +23798,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, { if (source == newSource) { - if (source == 0) + if (source == nullptr) return; setSource (0, 0, 0); // deselect and reselect to avoid releasing resources wrongly @@ -23810,16 +23807,16 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, readAheadBufferSize = readAheadBufferSize_; sourceSampleRate = sourceSampleRateToCorrectFor; - ResamplingAudioSource* newResamplerSource = 0; - BufferingAudioSource* newBufferingSource = 0; - PositionableAudioSource* newPositionableSource = 0; - AudioSource* newMasterSource = 0; + ResamplingAudioSource* newResamplerSource = nullptr; + BufferingAudioSource* newBufferingSource = nullptr; + PositionableAudioSource* newPositionableSource = nullptr; + AudioSource* newMasterSource = nullptr; ScopedPointer oldResamplerSource (resamplerSource); ScopedPointer oldBufferingSource (bufferingSource); AudioSource* oldMasterSource = masterSource; - if (newSource != 0) + if (newSource != nullptr) { newPositionableSource = newSource; @@ -23837,7 +23834,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, if (isPrepared) { - if (newResamplerSource != 0 && sourceSampleRate > 0 && sampleRate > 0) + if (newResamplerSource != nullptr && sourceSampleRate > 0 && sampleRate > 0) newResamplerSource->setResamplingRatio (sourceSampleRate / sampleRate); newMasterSource->prepareToPlay (blockSize, sampleRate); @@ -23856,13 +23853,13 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, playing = false; } - if (oldMasterSource != 0) + if (oldMasterSource != nullptr) oldMasterSource->releaseResources(); } void AudioTransportSource::start() { - if ((! playing) && masterSource != 0) + if ((! playing) && masterSource != nullptr) { { const ScopedLock sl (callbackLock); @@ -23913,7 +23910,7 @@ double AudioTransportSource::getLengthInSeconds() const void AudioTransportSource::setNextReadPosition (int64 newPosition) { - if (positionableSource != 0) + if (positionableSource != nullptr) { if (sampleRate > 0 && sourceSampleRate > 0) newPosition = (int64) (newPosition * sourceSampleRate / sampleRate); @@ -23924,7 +23921,7 @@ void AudioTransportSource::setNextReadPosition (int64 newPosition) int64 AudioTransportSource::getNextReadPosition() const { - if (positionableSource != 0) + if (positionableSource != nullptr) { const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0; @@ -23938,7 +23935,7 @@ int64 AudioTransportSource::getTotalLength() const { const ScopedLock sl (callbackLock); - if (positionableSource != 0) + if (positionableSource != nullptr) { const double ratio = (sampleRate > 0 && sourceSampleRate > 0) ? sampleRate / sourceSampleRate : 1.0; @@ -23952,11 +23949,11 @@ bool AudioTransportSource::isLooping() const { const ScopedLock sl (callbackLock); - return positionableSource != 0 + return positionableSource != nullptr && positionableSource->isLooping(); } -void AudioTransportSource::setGain (const float newGain) throw() +void AudioTransportSource::setGain (const float newGain) noexcept { gain = newGain; } @@ -23969,10 +23966,10 @@ void AudioTransportSource::prepareToPlay (int samplesPerBlockExpected, sampleRate = sampleRate_; blockSize = samplesPerBlockExpected; - if (masterSource != 0) + if (masterSource != nullptr) masterSource->prepareToPlay (samplesPerBlockExpected, sampleRate); - if (resamplerSource != 0 && sourceSampleRate > 0) + if (resamplerSource != nullptr && sourceSampleRate > 0) resamplerSource->setResamplingRatio (sourceSampleRate / sampleRate); isPrepared = true; @@ -23982,7 +23979,7 @@ void AudioTransportSource::releaseResources() { const ScopedLock sl (callbackLock); - if (masterSource != 0) + if (masterSource != nullptr) masterSource->releaseResources(); isPrepared = false; @@ -23994,7 +23991,7 @@ void AudioTransportSource::getNextAudioBlock (const AudioSourceChannelInfo& info inputStreamEOF = false; - if (masterSource != 0 && ! stopped) + if (masterSource != nullptr && ! stopped) { masterSource->getNextAudioBlock (info); @@ -24101,7 +24098,7 @@ private: BufferingAudioSource* const b = sources[i]; - if (b != 0 && b->readNextBufferChunk()) + if (b != nullptr && b->readNextBufferChunk()) busy = true; } @@ -24135,7 +24132,7 @@ BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* source_, nextPlayPos (0), wasSourceLooping (false) { - jassert (source_ != 0); + jassert (source_ != nullptr); jassert (numberOfSamplesToBuffer_ > 1024); // not much point using this class if you're // not using a larger buffer.. @@ -24145,7 +24142,7 @@ BufferingAudioSource::~BufferingAudioSource() { SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); - if (thread != 0) + if (thread != nullptr) thread->removeSource (this); if (deleteSourceWhenDeleted) @@ -24178,7 +24175,7 @@ void BufferingAudioSource::releaseResources() { SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); - if (thread != 0) + if (thread != nullptr) thread->removeSource (this); buffer.setSize (2, 0); @@ -24245,7 +24242,7 @@ void BufferingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); - if (thread != 0) + if (thread != nullptr) thread->notify(); } @@ -24264,7 +24261,7 @@ void BufferingAudioSource::setNextReadPosition (int64 newPosition) SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); - if (thread != 0) + if (thread != nullptr) thread->notify(); } @@ -24549,7 +24546,7 @@ IIRFilterAudioSource::IIRFilterAudioSource (AudioSource* const inputSource, : input (inputSource), deleteInputWhenDeleted (deleteInputWhenDeleted_) { - jassert (inputSource != 0); + jassert (inputSource != nullptr); for (int i = 2; --i >= 0;) iirFilters.add (new IIRFilter()); @@ -24616,7 +24613,7 @@ MixerAudioSource::~MixerAudioSource() void MixerAudioSource::addInputSource (AudioSource* input, const bool deleteWhenRemoved) { - if (input != 0 && ! inputs.contains (input)) + if (input != nullptr && ! inputs.contains (input)) { double localRate; int localBufferSize; @@ -24639,7 +24636,7 @@ void MixerAudioSource::addInputSource (AudioSource* input, const bool deleteWhen void MixerAudioSource::removeInputSource (AudioSource* input, const bool deleteInput) { - if (input != 0) + if (input != nullptr) { int index; @@ -24755,7 +24752,7 @@ ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource, sampsInBuffer (0), numChannels (numChannels_) { - jassert (input != 0); + jassert (input != nullptr); } ResamplingAudioSource::~ResamplingAudioSource() @@ -24969,10 +24966,10 @@ void ResamplingAudioSource::applyFilter (float* samples, int num, FilterState& f - coefficients[4] * fs.y1 - coefficients[5] * fs.y2; -#if JUCE_INTEL + #if JUCE_INTEL if (! (out < -1.0e-8 || out > 1.0e-8)) out = 0; -#endif + #endif fs.x2 = fs.x1; fs.x1 = in; @@ -25069,15 +25066,13 @@ bool AudioDeviceManager::AudioDeviceSetup::operator== (const AudioDeviceManager: } AudioDeviceManager::AudioDeviceManager() - : currentAudioDevice (0), - numInputChansNeeded (0), + : numInputChansNeeded (0), numOutputChansNeeded (2), listNeedsScanning (true), useInputNames (false), inputLevelMeasurementEnabledCount (0), inputLevel (0), tempBuffer (2, 2), - defaultMidiOutput (0), cpuUsageMs (0), timeToCpuScale (0) { @@ -25086,8 +25081,8 @@ AudioDeviceManager::AudioDeviceManager() AudioDeviceManager::~AudioDeviceManager() { - currentAudioDevice = 0; - defaultMidiOutput = 0; + currentAudioDevice = nullptr; + defaultMidiOutput = nullptr; } void AudioDeviceManager::createDeviceTypesIfNeeded() @@ -25112,7 +25107,7 @@ const OwnedArray & AudioDeviceManager::getAvailableDeviceType static void addIfNotNull (OwnedArray & list, AudioIODeviceType* const device) { - if (device != 0) + if (device != nullptr) list.add (device); } @@ -25140,14 +25135,14 @@ const String AudioDeviceManager::initialise (const int numInputChannelsNeeded, numInputChansNeeded = numInputChannelsNeeded; numOutputChansNeeded = numOutputChannelsNeeded; - if (e != 0 && e->hasTagName ("DEVICESETUP")) + if (e != nullptr && e->hasTagName ("DEVICESETUP")) { lastExplicitSettings = new XmlElement (*e); String error; AudioDeviceSetup setup; - if (preferredSetupOptions != 0) + if (preferredSetupOptions != nullptr) setup = *preferredSetupOptions; if (e->getStringAttribute ("audioDeviceName").isNotEmpty()) @@ -25166,7 +25161,7 @@ const String AudioDeviceManager::initialise (const int numInputChannelsNeeded, { AudioIODeviceType* const type = findType (setup.inputDeviceName, setup.outputDeviceName); - if (type != 0) + if (type != nullptr) currentDeviceType = type->getTypeName(); else if (availableDeviceTypes.size() > 0) currentDeviceType = availableDeviceTypes[0]->getTypeName(); @@ -25204,7 +25199,7 @@ const String AudioDeviceManager::initialise (const int numInputChannelsNeeded, { AudioDeviceSetup setup; - if (preferredSetupOptions != 0) + if (preferredSetupOptions != nullptr) { setup = *preferredSetupOptions; } @@ -25247,7 +25242,7 @@ const String AudioDeviceManager::initialise (const int numInputChannelsNeeded, void AudioDeviceManager::insertDefaultDeviceNames (AudioDeviceSetup& setup) const { AudioIODeviceType* type = getCurrentDeviceTypeObject(); - if (type != 0) + if (type != nullptr) { if (setup.outputDeviceName.isEmpty()) setup.outputDeviceName = type->getDeviceNames (false) [type->getDefaultDeviceIndex (false)]; @@ -25259,7 +25254,7 @@ void AudioDeviceManager::insertDefaultDeviceNames (AudioDeviceSetup& setup) cons XmlElement* AudioDeviceManager::createStateXml() const { - return lastExplicitSettings != 0 ? new XmlElement (*lastExplicitSettings) : 0; + return lastExplicitSettings != nullptr ? new XmlElement (*lastExplicitSettings) : 0; } void AudioDeviceManager::scanDevicesIfNeeded() @@ -25300,7 +25295,7 @@ void AudioDeviceManager::getAudioDeviceSetup (AudioDeviceSetup& setup) void AudioDeviceManager::deleteCurrentDevice() { - currentAudioDevice = 0; + currentAudioDevice = nullptr; currentSetup.inputDeviceName = String::empty; currentSetup.outputDeviceName = String::empty; } @@ -25340,7 +25335,7 @@ const String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& ne { jassert (&newSetup != ¤tSetup); // this will have no effect - if (newSetup == currentSetup && currentAudioDevice != 0) + if (newSetup == currentSetup && currentAudioDevice != nullptr) return String::empty; if (! (newSetup == currentSetup)) @@ -25354,7 +25349,7 @@ const String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& ne String error; AudioIODeviceType* type = getCurrentDeviceTypeObject(); - if (type == 0 || (newInputDeviceName.isEmpty() && newOutputDeviceName.isEmpty())) + if (type == nullptr || (newInputDeviceName.isEmpty() && newOutputDeviceName.isEmpty())) { deleteCurrentDevice(); @@ -25366,7 +25361,7 @@ const String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& ne if (currentSetup.inputDeviceName != newInputDeviceName || currentSetup.outputDeviceName != newOutputDeviceName - || currentAudioDevice == 0) + || currentAudioDevice == nullptr) { deleteCurrentDevice(); scanDevicesIfNeeded(); @@ -25385,7 +25380,7 @@ const String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& ne currentAudioDevice = type->createDevice (newOutputDeviceName, newInputDeviceName); - if (currentAudioDevice == 0) + if (currentAudioDevice == nullptr) error = "Can't open the audio device!\n\nThis may be because another application is currently using the same device - if so, you should close any other applications and try again!"; else error = currentAudioDevice->getLastError(); @@ -25459,7 +25454,7 @@ const String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& ne double AudioDeviceManager::chooseBestSampleRate (double rate) const { - jassert (currentAudioDevice != 0); + jassert (currentAudioDevice != nullptr); if (rate > 0) for (int i = currentAudioDevice->getNumSampleRates(); --i >= 0;) @@ -25484,7 +25479,7 @@ double AudioDeviceManager::chooseBestSampleRate (double rate) const int AudioDeviceManager::chooseBestBufferSize (int bufferSize) const { - jassert (currentAudioDevice != 0); + jassert (currentAudioDevice != nullptr); if (bufferSize > 0) for (int i = currentAudioDevice->getNumBufferSizesAvailable(); --i >= 0;) @@ -25496,21 +25491,21 @@ int AudioDeviceManager::chooseBestBufferSize (int bufferSize) const void AudioDeviceManager::stopDevice() { - if (currentAudioDevice != 0) + if (currentAudioDevice != nullptr) currentAudioDevice->stop(); - testSound = 0; + testSound = nullptr; } void AudioDeviceManager::closeAudioDevice() { stopDevice(); - currentAudioDevice = 0; + currentAudioDevice = nullptr; } void AudioDeviceManager::restartLastAudioDevice() { - if (currentAudioDevice == 0) + if (currentAudioDevice == nullptr) { if (currentSetup.inputDeviceName.isEmpty() && currentSetup.outputDeviceName.isEmpty()) @@ -25535,7 +25530,7 @@ void AudioDeviceManager::updateXml() lastExplicitSettings->setAttribute ("audioOutputDeviceName", currentSetup.outputDeviceName); lastExplicitSettings->setAttribute ("audioInputDeviceName", currentSetup.inputDeviceName); - if (currentAudioDevice != 0) + if (currentAudioDevice != nullptr) { lastExplicitSettings->setAttribute ("audioDeviceRate", currentAudioDevice->getCurrentSampleRate()); @@ -25583,7 +25578,7 @@ void AudioDeviceManager::addAudioCallback (AudioIODeviceCallback* newCallback) return; } - if (currentAudioDevice != 0 && newCallback != 0) + if (currentAudioDevice != nullptr && newCallback != nullptr) newCallback->audioDeviceAboutToStart (currentAudioDevice); const ScopedLock sl (audioCallbackLock); @@ -25592,9 +25587,9 @@ void AudioDeviceManager::addAudioCallback (AudioIODeviceCallback* newCallback) void AudioDeviceManager::removeAudioCallback (AudioIODeviceCallback* callbackToRemove) { - if (callbackToRemove != 0) + if (callbackToRemove != nullptr) { - bool needsDeinitialising = currentAudioDevice != 0; + bool needsDeinitialising = currentAudioDevice != nullptr; { const ScopedLock sl (audioCallbackLock); @@ -25663,7 +25658,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat const float* const src = tempChans [chan]; float* const dst = outputChannelData [chan]; - if (src != 0 && dst != 0) + if (src != nullptr && dst != nullptr) for (int j = 0; j < numSamples; ++j) dst[j] += src[j]; } @@ -25679,7 +25674,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat zeromem (outputChannelData[i], sizeof (float) * numSamples); } - if (testSound != 0) + if (testSound != nullptr) { const int numSamps = jmin (numSamples, testSound->getNumSamples() - testSoundPosition); const float* const src = testSound->getSampleData (0, testSoundPosition); @@ -25690,7 +25685,7 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat testSoundPosition += numSamps; if (testSoundPosition >= testSound->getNumSamples()) - testSound = 0; + testSound = nullptr; } } @@ -25743,12 +25738,12 @@ void AudioDeviceManager::setMidiInputEnabled (const String& name, if (index >= 0) { - MidiInput* const min = MidiInput::openDevice (index, &callbackHandler); + MidiInput* const midiIn = MidiInput::openDevice (index, &callbackHandler); - if (min != 0) + if (midiIn != nullptr) { - enabledMidiInputs.add (min); - min->start(); + enabledMidiInputs.add (midiIn); + midiIn->start(); } } } @@ -25804,7 +25799,7 @@ void AudioDeviceManager::handleIncomingMidiMessageInt (MidiInput* source, { if (! message.isActiveSense()) { - const bool isDefaultSource = (source == 0 || source == enabledMidiInputs.getFirst()); + const bool isDefaultSource = (source == nullptr || source == enabledMidiInputs.getFirst()); const ScopedLock sl (midiCallbackLock); @@ -25830,17 +25825,17 @@ void AudioDeviceManager::setDefaultMidiOutput (const String& deviceName) callbacks.clear(); } - if (currentAudioDevice != 0) + if (currentAudioDevice != nullptr) for (int i = oldCallbacks.size(); --i >= 0;) oldCallbacks.getUnchecked(i)->audioDeviceStopped(); - defaultMidiOutput = 0; + defaultMidiOutput = nullptr; defaultMidiOutputName = deviceName; if (deviceName.isNotEmpty()) defaultMidiOutput = MidiOutput::openDevice (MidiOutput::getDevices().indexOf (deviceName)); - if (currentAudioDevice != 0) + if (currentAudioDevice != nullptr) for (int i = oldCallbacks.size(); --i >= 0;) oldCallbacks.getUnchecked(i)->audioDeviceAboutToStart (currentAudioDevice); @@ -25891,7 +25886,7 @@ void AudioDeviceManager::playTestSound() testSoundPosition = 0; - if (currentAudioDevice != 0) + if (currentAudioDevice != nullptr) { const double sampleRate = currentAudioDevice->getCurrentSampleRate(); const int soundLength = (int) sampleRate; @@ -26647,7 +26642,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE AudioSampleBuffer::AudioSampleBuffer (const int numChannels_, - const int numSamples) throw() + const int numSamples) noexcept : numChannels (numChannels_), size (numSamples) { @@ -26657,7 +26652,7 @@ AudioSampleBuffer::AudioSampleBuffer (const int numChannels_, allocateData(); } -AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer& other) throw() +AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer& other) noexcept : numChannels (other.numChannels), size (other.size) { @@ -26687,7 +26682,7 @@ void AudioSampleBuffer::allocateData() AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo, const int numChannels_, - const int numSamples) throw() + const int numSamples) noexcept : numChannels (numChannels_), size (numSamples), allocatedBytes (0) @@ -26699,7 +26694,7 @@ AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo, AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo, const int numChannels_, const int startSample, - const int numSamples) throw() + const int numSamples) noexcept : numChannels (numChannels_), size (numSamples), allocatedBytes (0) @@ -26710,7 +26705,7 @@ AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo, void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo, const int newNumChannels, - const int newNumSamples) throw() + const int newNumSamples) noexcept { jassert (newNumChannels > 0); @@ -26739,7 +26734,7 @@ void AudioSampleBuffer::allocateChannels (float** const dataToReferTo, int offse for (int i = 0; i < numChannels; ++i) { // you have to pass in the same number of valid pointers as numChannels - jassert (dataToReferTo[i] != 0); + jassert (dataToReferTo[i] != nullptr); channels[i] = dataToReferTo[i] + offset; } @@ -26747,7 +26742,7 @@ void AudioSampleBuffer::allocateChannels (float** const dataToReferTo, int offse channels [numChannels] = 0; } -AudioSampleBuffer& AudioSampleBuffer::operator= (const AudioSampleBuffer& other) throw() +AudioSampleBuffer& AudioSampleBuffer::operator= (const AudioSampleBuffer& other) noexcept { if (this != &other) { @@ -26762,7 +26757,7 @@ AudioSampleBuffer& AudioSampleBuffer::operator= (const AudioSampleBuffer& other) return *this; } -AudioSampleBuffer::~AudioSampleBuffer() throw() +AudioSampleBuffer::~AudioSampleBuffer() noexcept { } @@ -26770,7 +26765,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels, const int newNumSamples, const bool keepExistingContent, const bool clearExtraSpace, - const bool avoidReallocating) throw() + const bool avoidReallocating) noexcept { jassert (newNumChannels > 0); @@ -26828,14 +26823,14 @@ void AudioSampleBuffer::setSize (const int newNumChannels, } } -void AudioSampleBuffer::clear() throw() +void AudioSampleBuffer::clear() noexcept { for (int i = 0; i < numChannels; ++i) zeromem (channels[i], size * sizeof (float)); } void AudioSampleBuffer::clear (const int startSample, - const int numSamples) throw() + const int numSamples) noexcept { jassert (startSample >= 0 && startSample + numSamples <= size); @@ -26845,7 +26840,7 @@ void AudioSampleBuffer::clear (const int startSample, void AudioSampleBuffer::clear (const int channel, const int startSample, - const int numSamples) throw() + const int numSamples) noexcept { jassert (isPositiveAndBelow (channel, numChannels)); jassert (startSample >= 0 && startSample + numSamples <= size); @@ -26856,7 +26851,7 @@ void AudioSampleBuffer::clear (const int channel, void AudioSampleBuffer::applyGain (const int channel, const int startSample, int numSamples, - const float gain) throw() + const float gain) noexcept { jassert (isPositiveAndBelow (channel, numChannels)); jassert (startSample >= 0 && startSample + numSamples <= size); @@ -26881,7 +26876,7 @@ void AudioSampleBuffer::applyGainRamp (const int channel, const int startSample, int numSamples, float startGain, - float endGain) throw() + float endGain) noexcept { if (startGain == endGain) { @@ -26905,7 +26900,7 @@ void AudioSampleBuffer::applyGainRamp (const int channel, void AudioSampleBuffer::applyGain (const int startSample, const int numSamples, - const float gain) throw() + const float gain) noexcept { for (int i = 0; i < numChannels; ++i) applyGain (i, startSample, numSamples, gain); @@ -26917,7 +26912,7 @@ void AudioSampleBuffer::addFrom (const int destChannel, const int sourceChannel, const int sourceStartSample, int numSamples, - const float gain) throw() + const float gain) noexcept { jassert (&source != this || sourceChannel != destChannel); jassert (isPositiveAndBelow (destChannel, numChannels)); @@ -26947,11 +26942,11 @@ void AudioSampleBuffer::addFrom (const int destChannel, const int destStartSample, const float* source, int numSamples, - const float gain) throw() + const float gain) noexcept { jassert (isPositiveAndBelow (destChannel, numChannels)); jassert (destStartSample >= 0 && destStartSample + numSamples <= size); - jassert (source != 0); + jassert (source != nullptr); if (gain != 0.0f && numSamples > 0) { @@ -26975,11 +26970,11 @@ void AudioSampleBuffer::addFromWithRamp (const int destChannel, const float* source, int numSamples, float startGain, - const float endGain) throw() + const float endGain) noexcept { jassert (isPositiveAndBelow (destChannel, numChannels)); jassert (destStartSample >= 0 && destStartSample + numSamples <= size); - jassert (source != 0); + jassert (source != nullptr); if (startGain == endGain) { @@ -27010,7 +27005,7 @@ void AudioSampleBuffer::copyFrom (const int destChannel, const AudioSampleBuffer& source, const int sourceChannel, const int sourceStartSample, - int numSamples) throw() + int numSamples) noexcept { jassert (&source != this || sourceChannel != destChannel); jassert (isPositiveAndBelow (destChannel, numChannels)); @@ -27029,11 +27024,11 @@ void AudioSampleBuffer::copyFrom (const int destChannel, void AudioSampleBuffer::copyFrom (const int destChannel, const int destStartSample, const float* source, - int numSamples) throw() + int numSamples) noexcept { jassert (isPositiveAndBelow (destChannel, numChannels)); jassert (destStartSample >= 0 && destStartSample + numSamples <= size); - jassert (source != 0); + jassert (source != nullptr); if (numSamples > 0) { @@ -27047,11 +27042,11 @@ void AudioSampleBuffer::copyFrom (const int destChannel, const int destStartSample, const float* source, int numSamples, - const float gain) throw() + const float gain) noexcept { jassert (isPositiveAndBelow (destChannel, numChannels)); jassert (destStartSample >= 0 && destStartSample + numSamples <= size); - jassert (source != 0); + jassert (source != nullptr); if (numSamples > 0) { @@ -27081,11 +27076,11 @@ void AudioSampleBuffer::copyFromWithRamp (const int destChannel, const float* source, int numSamples, float startGain, - float endGain) throw() + float endGain) noexcept { jassert (isPositiveAndBelow (destChannel, numChannels)); jassert (destStartSample >= 0 && destStartSample + numSamples <= size); - jassert (source != 0); + jassert (source != nullptr); if (startGain == endGain) { @@ -27115,7 +27110,7 @@ void AudioSampleBuffer::findMinMax (const int channel, const int startSample, int numSamples, float& minVal, - float& maxVal) const throw() + float& maxVal) const noexcept { jassert (isPositiveAndBelow (channel, numChannels)); jassert (startSample >= 0 && startSample + numSamples <= size); @@ -27125,7 +27120,7 @@ void AudioSampleBuffer::findMinMax (const int channel, float AudioSampleBuffer::getMagnitude (const int channel, const int startSample, - const int numSamples) const throw() + const int numSamples) const noexcept { jassert (isPositiveAndBelow (channel, numChannels)); jassert (startSample >= 0 && startSample + numSamples <= size); @@ -27137,7 +27132,7 @@ float AudioSampleBuffer::getMagnitude (const int channel, } float AudioSampleBuffer::getMagnitude (const int startSample, - const int numSamples) const throw() + const int numSamples) const noexcept { float mag = 0.0f; @@ -27149,7 +27144,7 @@ float AudioSampleBuffer::getMagnitude (const int startSample, float AudioSampleBuffer::getRMSLevel (const int channel, const int startSample, - const int numSamples) const throw() + const int numSamples) const noexcept { jassert (isPositiveAndBelow (channel, numChannels)); jassert (startSample >= 0 && startSample + numSamples <= size); @@ -27176,7 +27171,7 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader, const bool useLeftChan, const bool useRightChan) { - jassert (reader != 0); + jassert (reader != nullptr); jassert (startSample >= 0 && startSample + numSamples <= size); if (numSamples > 0) @@ -27191,15 +27186,15 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader, else if (useLeftChan || (reader->numChannels == 1)) { chans[0] = reinterpret_cast (getSampleData (0, startSample)); - chans[1] = 0; + chans[1] = nullptr; } else if (useRightChan) { - chans[0] = 0; + chans[0] = nullptr; chans[1] = reinterpret_cast (getSampleData (0, startSample)); } - chans[2] = 0; + chans[2] = nullptr; reader->read (chans, 2, readerStartSample, numSamples, true); @@ -27209,7 +27204,7 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader, { float* const d = reinterpret_cast (chans[j]); - if (d != 0) + if (d != nullptr) { const float multiplier = 1.0f / 0x7fffffff; @@ -27219,7 +27214,7 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader, } } - if (numChannels > 1 && (chans[0] == 0 || chans[1] == 0)) + if (numChannels > 1 && (chans[0] == nullptr || chans[1] == nullptr)) { // if this is a stereo buffer and the source was mono, dupe the first channel.. memcpy (getSampleData (1, startSample), @@ -27233,7 +27228,7 @@ void AudioSampleBuffer::writeToAudioWriter (AudioFormatWriter* writer, const int startSample, const int numSamples) const { - jassert (writer != 0); + jassert (writer != nullptr); writer->writeFromAudioSampleBuffer (*this, startSample, numSamples); } @@ -27262,7 +27257,7 @@ IIRFilter::~IIRFilter() { } -void IIRFilter::reset() throw() +void IIRFilter::reset() noexcept { const ScopedLock sl (processLock); @@ -27272,7 +27267,7 @@ void IIRFilter::reset() throw() y2 = 0; } -float IIRFilter::processSingleSampleRaw (const float in) throw() +float IIRFilter::processSingleSampleRaw (const float in) noexcept { float out = coefficients[0] * in + coefficients[1] * x1 @@ -27280,10 +27275,10 @@ float IIRFilter::processSingleSampleRaw (const float in) throw() - coefficients[4] * y1 - coefficients[5] * y2; -#if JUCE_INTEL + #if JUCE_INTEL if (! (out < -1.0e-8 || out > 1.0e-8)) out = 0; -#endif + #endif x2 = x1; x1 = in; @@ -27294,7 +27289,7 @@ float IIRFilter::processSingleSampleRaw (const float in) throw() } void IIRFilter::processSamples (float* const samples, - const int numSamples) throw() + const int numSamples) noexcept { const ScopedLock sl (processLock); @@ -27310,10 +27305,10 @@ void IIRFilter::processSamples (float* const samples, - coefficients[4] * y1 - coefficients[5] * y2; -#if JUCE_INTEL + #if JUCE_INTEL if (! (out < -1.0e-8 || out > 1.0e-8)) out = 0; -#endif + #endif x2 = x1; x1 = in; @@ -27326,7 +27321,7 @@ void IIRFilter::processSamples (float* const samples, } void IIRFilter::makeLowPass (const double sampleRate, - const double frequency) throw() + const double frequency) noexcept { jassert (sampleRate > 0); @@ -27343,7 +27338,7 @@ void IIRFilter::makeLowPass (const double sampleRate, } void IIRFilter::makeHighPass (const double sampleRate, - const double frequency) throw() + const double frequency) noexcept { const double n = tan (double_Pi * frequency / sampleRate); const double nSquared = n * n; @@ -27360,7 +27355,7 @@ void IIRFilter::makeHighPass (const double sampleRate, void IIRFilter::makeLowShelf (const double sampleRate, const double cutOffFrequency, const double Q, - const float gainFactor) throw() + const float gainFactor) noexcept { jassert (sampleRate > 0); jassert (Q > 0); @@ -27384,7 +27379,7 @@ void IIRFilter::makeLowShelf (const double sampleRate, void IIRFilter::makeHighShelf (const double sampleRate, const double cutOffFrequency, const double Q, - const float gainFactor) throw() + const float gainFactor) noexcept { jassert (sampleRate > 0); jassert (Q > 0); @@ -27408,7 +27403,7 @@ void IIRFilter::makeHighShelf (const double sampleRate, void IIRFilter::makeBandPass (const double sampleRate, const double centreFrequency, const double Q, - const float gainFactor) throw() + const float gainFactor) noexcept { jassert (sampleRate > 0); jassert (Q > 0); @@ -27428,13 +27423,13 @@ void IIRFilter::makeBandPass (const double sampleRate, 1.0 - alphaOverA); } -void IIRFilter::makeInactive() throw() +void IIRFilter::makeInactive() noexcept { const ScopedLock sl (processLock); active = false; } -void IIRFilter::copyCoefficientsFrom (const IIRFilter& other) throw() +void IIRFilter::copyCoefficientsFrom (const IIRFilter& other) noexcept { const ScopedLock sl (processLock); @@ -27443,7 +27438,7 @@ void IIRFilter::copyCoefficientsFrom (const IIRFilter& other) throw() } void IIRFilter::setCoefficients (double c1, double c2, double c3, - double c4, double c5, double c6) throw() + double c4, double c5, double c6) noexcept { const double a = 1.0 / c4; @@ -27474,8 +27469,8 @@ BEGIN_JUCE_NAMESPACE MidiOutput::MidiOutput() : Thread ("midi out"), - internal (0), - firstMessage (0) + internal (nullptr), + firstMessage (nullptr) { } @@ -27510,7 +27505,7 @@ void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer, const ScopedLock sl (lock); - if (firstMessage == 0 || firstMessage->message.getTimeStamp() > eventTime) + if (firstMessage == nullptr || firstMessage->message.getTimeStamp() > eventTime) { m->next = firstMessage; firstMessage = m; @@ -27519,7 +27514,7 @@ void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer, { PendingMessage* mm = firstMessage; - while (mm->next != 0 && mm->next->message.getTimeStamp() <= eventTime) + while (mm->next != nullptr && mm->next->message.getTimeStamp() <= eventTime) mm = mm->next; m->next = mm->next; @@ -27534,7 +27529,7 @@ void MidiOutput::clearAllPendingMessages() { const ScopedLock sl (lock); - while (firstMessage != 0) + while (firstMessage != nullptr) { PendingMessage* const m = firstMessage; firstMessage = firstMessage->next; @@ -27566,14 +27561,14 @@ void MidiOutput::run() const ScopedLock sl (lock); message = firstMessage; - if (message != 0) + if (message != nullptr) { eventTime = roundToInt (message->message.getTimeStamp()); if (eventTime > now + 20) { timeToWait = eventTime - (now + 20); - message = 0; + message = nullptr; } else { @@ -27582,7 +27577,7 @@ void MidiOutput::run() } } - if (message != 0) + if (message != nullptr) { if (eventTime > now) { @@ -27614,24 +27609,24 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_MidiBuffer.cpp ***/ BEGIN_JUCE_NAMESPACE -MidiBuffer::MidiBuffer() throw() +MidiBuffer::MidiBuffer() noexcept : bytesUsed (0) { } -MidiBuffer::MidiBuffer (const MidiMessage& message) throw() +MidiBuffer::MidiBuffer (const MidiMessage& message) noexcept : bytesUsed (0) { addEvent (message, 0); } -MidiBuffer::MidiBuffer (const MidiBuffer& other) throw() +MidiBuffer::MidiBuffer (const MidiBuffer& other) noexcept : data (other.data), bytesUsed (other.bytesUsed) { } -MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw() +MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) noexcept { bytesUsed = other.bytesUsed; data = other.data; @@ -27639,7 +27634,7 @@ MidiBuffer& MidiBuffer::operator= (const MidiBuffer& other) throw() return *this; } -void MidiBuffer::swapWith (MidiBuffer& other) throw() +void MidiBuffer::swapWith (MidiBuffer& other) noexcept { data.swapWith (other.data); std::swap (bytesUsed, other.bytesUsed); @@ -27649,27 +27644,27 @@ MidiBuffer::~MidiBuffer() { } -inline uint8* MidiBuffer::getData() const throw() +inline uint8* MidiBuffer::getData() const noexcept { return static_cast (data.getData()); } -inline int MidiBuffer::getEventTime (const void* const d) throw() +inline int MidiBuffer::getEventTime (const void* const d) noexcept { return *static_cast (d); } -inline uint16 MidiBuffer::getEventDataSize (const void* const d) throw() +inline uint16 MidiBuffer::getEventDataSize (const void* const d) noexcept { return *reinterpret_cast (static_cast (d) + sizeof (int)); } -inline uint16 MidiBuffer::getEventTotalSize (const void* const d) throw() +inline uint16 MidiBuffer::getEventTotalSize (const void* const d) noexcept { return getEventDataSize (d) + sizeof (int) + sizeof (uint16); } -void MidiBuffer::clear() throw() +void MidiBuffer::clear() noexcept { bytesUsed = 0; } @@ -27697,7 +27692,7 @@ void MidiBuffer::addEvent (const MidiMessage& m, const int sampleNumber) namespace MidiBufferHelpers { - int findActualEventLength (const uint8* const data, const int maxBytes) throw() + int findActualEventLength (const uint8* const data, const int maxBytes) noexcept { unsigned int byte = (unsigned int) *data; int size = 0; @@ -27776,12 +27771,12 @@ void MidiBuffer::ensureSize (size_t minimumNumBytes) data.ensureSize (minimumNumBytes); } -bool MidiBuffer::isEmpty() const throw() +bool MidiBuffer::isEmpty() const noexcept { return bytesUsed == 0; } -int MidiBuffer::getNumEvents() const throw() +int MidiBuffer::getNumEvents() const noexcept { int n = 0; const uint8* d = getData(); @@ -27796,12 +27791,12 @@ int MidiBuffer::getNumEvents() const throw() return n; } -int MidiBuffer::getFirstEventTime() const throw() +int MidiBuffer::getFirstEventTime() const noexcept { return bytesUsed > 0 ? getEventTime (data.getData()) : 0; } -int MidiBuffer::getLastEventTime() const throw() +int MidiBuffer::getLastEventTime() const noexcept { if (bytesUsed == 0) return 0; @@ -27820,7 +27815,7 @@ int MidiBuffer::getLastEventTime() const throw() } } -uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const throw() +uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const noexcept { const uint8* const endData = getData() + bytesUsed; @@ -27830,17 +27825,17 @@ uint8* MidiBuffer::findEventAfter (uint8* d, const int samplePosition) const thr return d; } -MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) throw() +MidiBuffer::Iterator::Iterator (const MidiBuffer& buffer_) noexcept : buffer (buffer_), data (buffer_.getData()) { } -MidiBuffer::Iterator::~Iterator() throw() +MidiBuffer::Iterator::~Iterator() noexcept { } -void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) throw() +void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) noexcept { data = buffer.getData(); const uint8* dataEnd = data + buffer.bytesUsed; @@ -27849,7 +27844,7 @@ void MidiBuffer::Iterator::setNextSamplePosition (const int samplePosition) thro data += getEventTotalSize (data); } -bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, int& samplePosition) throw() +bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, int& samplePosition) noexcept { if (data >= buffer.getData() + buffer.bytesUsed) return false; @@ -27863,7 +27858,7 @@ bool MidiBuffer::Iterator::getNextEvent (const uint8* &midiData, int& numBytes, return true; } -bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, int& samplePosition) throw() +bool MidiBuffer::Iterator::getNextEvent (MidiMessage& result, int& samplePosition) noexcept { if (data >= buffer.getData() + buffer.bytesUsed) return false; @@ -27907,7 +27902,7 @@ namespace MidiFileHelpers } } - bool parseMidiHeader (const uint8* &data, short& timeFormat, short& fileType, short& numberOfTracks) throw() + bool parseMidiHeader (const uint8* &data, short& timeFormat, short& fileType, short& numberOfTracks) noexcept { unsigned int ch = (int) ByteOrder::bigEndianInt (data); data += 4; @@ -28016,7 +28011,7 @@ namespace MidiFileHelpers struct Sorter { static int compareElements (const MidiMessageSequence::MidiEventHolder* const first, - const MidiMessageSequence::MidiEventHolder* const second) throw() + const MidiMessageSequence::MidiEventHolder* const second) noexcept { const double diff = (first->message.getTimeStamp() - second->message.getTimeStamp()); @@ -28049,12 +28044,12 @@ void MidiFile::clear() tracks.clear(); } -int MidiFile::getNumTracks() const throw() +int MidiFile::getNumTracks() const noexcept { return tracks.size(); } -const MidiMessageSequence* MidiFile::getTrack (const int index) const throw() +const MidiMessageSequence* MidiFile::getTrack (const int index) const noexcept { return tracks [index]; } @@ -28064,18 +28059,18 @@ void MidiFile::addTrack (const MidiMessageSequence& trackSequence) tracks.add (new MidiMessageSequence (trackSequence)); } -short MidiFile::getTimeFormat() const throw() +short MidiFile::getTimeFormat() const noexcept { return timeFormat; } -void MidiFile::setTicksPerQuarterNote (const int ticks) throw() +void MidiFile::setTicksPerQuarterNote (const int ticks) noexcept { timeFormat = (short) ticks; } void MidiFile::setSmpteTimeFormat (const int framesPerSecond, - const int subframeResolution) throw() + const int subframeResolution) noexcept { timeFormat = (short) (((-framesPerSecond) << 8) | subframeResolution); } @@ -28314,7 +28309,7 @@ void MidiKeyboardState::reset() eventsToAdd.clear(); } -bool MidiKeyboardState::isNoteOn (const int midiChannel, const int n) const throw() +bool MidiKeyboardState::isNoteOn (const int midiChannel, const int n) const noexcept { jassert (midiChannel >= 0 && midiChannel <= 16); @@ -28322,7 +28317,7 @@ bool MidiKeyboardState::isNoteOn (const int midiChannel, const int n) const thro && (noteStates[n] & (1 << (midiChannel - 1))) != 0; } -bool MidiKeyboardState::isNoteOnForChannels (const int midiChannelMask, const int n) const throw() +bool MidiKeyboardState::isNoteOnForChannels (const int midiChannelMask, const int n) const noexcept { return isPositiveAndBelow (n, (int) 128) && (noteStates[n] & midiChannelMask) != 0; @@ -28465,18 +28460,18 @@ BEGIN_JUCE_NAMESPACE namespace MidiHelpers { - inline uint8 initialByte (const int type, const int channel) throw() + inline uint8 initialByte (const int type, const int channel) noexcept { return (uint8) (type | jlimit (0, 15, channel - 1)); } - inline uint8 validVelocity (const int v) throw() + inline uint8 validVelocity (const int v) noexcept { return (uint8) jlimit (0, 127, v); } } -int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) throw() +int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) noexcept { numBytesUsed = 0; int v = 0; @@ -28496,7 +28491,7 @@ int MidiMessage::readVariableLengthVal (const uint8* data, int& numBytesUsed) th return v; } -int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) throw() +int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) noexcept { // this method only works for valid starting bytes of a short midi message jassert (firstByte >= 0x80 && firstByte != 0xf0 && firstByte != 0xf7); @@ -28516,7 +28511,7 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) throw() return messageLengths [firstByte & 0x7f]; } -MidiMessage::MidiMessage() throw() +MidiMessage::MidiMessage() noexcept : timeStamp (0), data (static_cast (preallocatedData.asBytes)), size (2) @@ -28542,7 +28537,7 @@ MidiMessage::MidiMessage (const void* const d, const int dataSize, const double jassert (size > 3 || data[0] >= 0xf0 || getMessageLengthFromFirstByte (data[0]) == size); } -MidiMessage::MidiMessage (const int byte1, const double t) throw() +MidiMessage::MidiMessage (const int byte1, const double t) noexcept : timeStamp (t), data (static_cast (preallocatedData.asBytes)), size (1) @@ -28553,7 +28548,7 @@ MidiMessage::MidiMessage (const int byte1, const double t) throw() jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 1); } -MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) throw() +MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) noexcept : timeStamp (t), data (static_cast (preallocatedData.asBytes)), size (2) @@ -28565,7 +28560,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) thro jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 2); } -MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, const double t) throw() +MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, const double t) noexcept : timeStamp (t), data (static_cast (preallocatedData.asBytes)), size (3) @@ -28728,7 +28723,7 @@ MidiMessage::~MidiMessage() delete[] data; } -int MidiMessage::getChannel() const throw() +int MidiMessage::getChannel() const noexcept { if ((data[0] & 0xf0) != 0xf0) return (data[0] & 0xf) + 1; @@ -28736,7 +28731,7 @@ int MidiMessage::getChannel() const throw() return 0; } -bool MidiMessage::isForChannel (const int channel) const throw() +bool MidiMessage::isForChannel (const int channel) const noexcept { jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 @@ -28744,7 +28739,7 @@ bool MidiMessage::isForChannel (const int channel) const throw() && ((data[0] & 0xf0) != 0xf0); } -void MidiMessage::setChannel (const int channel) throw() +void MidiMessage::setChannel (const int channel) noexcept { jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 @@ -28753,36 +28748,36 @@ void MidiMessage::setChannel (const int channel) throw() | (uint8)(channel - 1)); } -bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const throw() +bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const noexcept { return ((data[0] & 0xf0) == 0x90) && (returnTrueForVelocity0 || data[2] != 0); } -bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const throw() +bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const noexcept { return ((data[0] & 0xf0) == 0x80) || (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90)); } -bool MidiMessage::isNoteOnOrOff() const throw() +bool MidiMessage::isNoteOnOrOff() const noexcept { const int d = data[0] & 0xf0; return (d == 0x90) || (d == 0x80); } -int MidiMessage::getNoteNumber() const throw() +int MidiMessage::getNoteNumber() const noexcept { return data[1]; } -void MidiMessage::setNoteNumber (const int newNoteNumber) throw() +void MidiMessage::setNoteNumber (const int newNoteNumber) noexcept { if (isNoteOnOrOff()) data[1] = newNoteNumber & 127; } -uint8 MidiMessage::getVelocity() const throw() +uint8 MidiMessage::getVelocity() const noexcept { if (isNoteOnOrOff()) return data[2]; @@ -28790,36 +28785,36 @@ uint8 MidiMessage::getVelocity() const throw() return 0; } -float MidiMessage::getFloatVelocity() const throw() +float MidiMessage::getFloatVelocity() const noexcept { return getVelocity() * (1.0f / 127.0f); } -void MidiMessage::setVelocity (const float newVelocity) throw() +void MidiMessage::setVelocity (const float newVelocity) noexcept { if (isNoteOnOrOff()) data[2] = MidiHelpers::validVelocity (roundToInt (newVelocity * 127.0f)); } -void MidiMessage::multiplyVelocity (const float scaleFactor) throw() +void MidiMessage::multiplyVelocity (const float scaleFactor) noexcept { if (isNoteOnOrOff()) data[2] = MidiHelpers::validVelocity (roundToInt (scaleFactor * data[2])); } -bool MidiMessage::isAftertouch() const throw() +bool MidiMessage::isAftertouch() const noexcept { return (data[0] & 0xf0) == 0xa0; } -int MidiMessage::getAfterTouchValue() const throw() +int MidiMessage::getAfterTouchValue() const noexcept { return data[2]; } const MidiMessage MidiMessage::aftertouchChange (const int channel, const int noteNum, - const int aftertouchValue) throw() + const int aftertouchValue) noexcept { jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (isPositiveAndBelow (noteNum, (int) 128)); @@ -28830,12 +28825,12 @@ const MidiMessage MidiMessage::aftertouchChange (const int channel, aftertouchValue & 0x7f); } -bool MidiMessage::isChannelPressure() const throw() +bool MidiMessage::isChannelPressure() const noexcept { return (data[0] & 0xf0) == 0xd0; } -int MidiMessage::getChannelPressureValue() const throw() +int MidiMessage::getChannelPressureValue() const noexcept { jassert (isChannelPressure()); @@ -28843,7 +28838,7 @@ int MidiMessage::getChannelPressureValue() const throw() } const MidiMessage MidiMessage::channelPressureChange (const int channel, - const int pressure) throw() + const int pressure) noexcept { jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (isPositiveAndBelow (pressure, (int) 128)); @@ -28851,36 +28846,36 @@ const MidiMessage MidiMessage::channelPressureChange (const int channel, return MidiMessage (MidiHelpers::initialByte (0xd0, channel), pressure & 0x7f); } -bool MidiMessage::isProgramChange() const throw() +bool MidiMessage::isProgramChange() const noexcept { return (data[0] & 0xf0) == 0xc0; } -int MidiMessage::getProgramChangeNumber() const throw() +int MidiMessage::getProgramChangeNumber() const noexcept { return data[1]; } const MidiMessage MidiMessage::programChange (const int channel, - const int programNumber) throw() + const int programNumber) noexcept { jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 return MidiMessage (MidiHelpers::initialByte (0xc0, channel), programNumber & 0x7f); } -bool MidiMessage::isPitchWheel() const throw() +bool MidiMessage::isPitchWheel() const noexcept { return (data[0] & 0xf0) == 0xe0; } -int MidiMessage::getPitchWheelValue() const throw() +int MidiMessage::getPitchWheelValue() const noexcept { return data[1] | (data[2] << 7); } const MidiMessage MidiMessage::pitchWheel (const int channel, - const int position) throw() + const int position) noexcept { jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 jassert (isPositiveAndBelow (position, (int) 0x4000)); @@ -28888,26 +28883,26 @@ const MidiMessage MidiMessage::pitchWheel (const int channel, return MidiMessage (MidiHelpers::initialByte (0xe0, channel), position & 127, (position >> 7) & 127); } -bool MidiMessage::isController() const throw() +bool MidiMessage::isController() const noexcept { return (data[0] & 0xf0) == 0xb0; } -int MidiMessage::getControllerNumber() const throw() +int MidiMessage::getControllerNumber() const noexcept { jassert (isController()); return data[1]; } -int MidiMessage::getControllerValue() const throw() +int MidiMessage::getControllerValue() const noexcept { jassert (isController()); return data[2]; } -const MidiMessage MidiMessage::controllerEvent (const int channel, const int controllerType, const int value) throw() +const MidiMessage MidiMessage::controllerEvent (const int channel, const int controllerType, const int value) noexcept { // the channel must be between 1 and 16 inclusive jassert (channel > 0 && channel <= 16); @@ -28915,12 +28910,12 @@ const MidiMessage MidiMessage::controllerEvent (const int channel, const int con return MidiMessage (MidiHelpers::initialByte (0xb0, channel), controllerType & 127, value & 127); } -const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const float velocity) throw() +const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const float velocity) noexcept { return noteOn (channel, noteNumber, (uint8)(velocity * 127.0f)); } -const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) throw() +const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) noexcept { jassert (channel > 0 && channel <= 16); jassert (isPositiveAndBelow (noteNumber, (int) 128)); @@ -28928,7 +28923,7 @@ const MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, return MidiMessage (MidiHelpers::initialByte (0x90, channel), noteNumber & 127, MidiHelpers::validVelocity (velocity)); } -const MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) throw() +const MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) noexcept { jassert (channel > 0 && channel <= 16); jassert (isPositiveAndBelow (noteNumber, (int) 128)); @@ -28936,27 +28931,27 @@ const MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, return MidiMessage (MidiHelpers::initialByte (0x80, channel), noteNumber & 127, MidiHelpers::validVelocity (velocity)); } -const MidiMessage MidiMessage::allNotesOff (const int channel) throw() +const MidiMessage MidiMessage::allNotesOff (const int channel) noexcept { return controllerEvent (channel, 123, 0); } -bool MidiMessage::isAllNotesOff() const throw() +bool MidiMessage::isAllNotesOff() const noexcept { return (data[0] & 0xf0) == 0xb0 && data[1] == 123; } -const MidiMessage MidiMessage::allSoundOff (const int channel) throw() +const MidiMessage MidiMessage::allSoundOff (const int channel) noexcept { return controllerEvent (channel, 120, 0); } -bool MidiMessage::isAllSoundOff() const throw() +bool MidiMessage::isAllSoundOff() const noexcept { return (data[0] & 0xf0) == 0xb0 && data[1] == 120; } -const MidiMessage MidiMessage::allControllersOff (const int channel) throw() +const MidiMessage MidiMessage::allControllersOff (const int channel) noexcept { return controllerEvent (channel, 121, 0); } @@ -28978,7 +28973,7 @@ const MidiMessage MidiMessage::masterVolume (const float volume) return MidiMessage (buf, 8); } -bool MidiMessage::isSysEx() const throw() +bool MidiMessage::isSysEx() const noexcept { return *data == 0xf0; } @@ -28994,32 +28989,32 @@ const MidiMessage MidiMessage::createSysExMessage (const uint8* sysexData, const return MidiMessage (m, dataSize + 2); } -const uint8* MidiMessage::getSysExData() const throw() +const uint8* MidiMessage::getSysExData() const noexcept { return isSysEx() ? getRawData() + 1 : 0; } -int MidiMessage::getSysExDataSize() const throw() +int MidiMessage::getSysExDataSize() const noexcept { return isSysEx() ? size - 2 : 0; } -bool MidiMessage::isMetaEvent() const throw() +bool MidiMessage::isMetaEvent() const noexcept { return *data == 0xff; } -bool MidiMessage::isActiveSense() const throw() +bool MidiMessage::isActiveSense() const noexcept { return *data == 0xfe; } -int MidiMessage::getMetaEventType() const throw() +int MidiMessage::getMetaEventType() const noexcept { return *data != 0xff ? -1 : data[1]; } -int MidiMessage::getMetaEventLength() const throw() +int MidiMessage::getMetaEventLength() const noexcept { if (*data == 0xff) { @@ -29030,7 +29025,7 @@ int MidiMessage::getMetaEventLength() const throw() return 0; } -const uint8* MidiMessage::getMetaEventData() const throw() +const uint8* MidiMessage::getMetaEventData() const noexcept { int n; const uint8* d = data + 2; @@ -29038,17 +29033,17 @@ const uint8* MidiMessage::getMetaEventData() const throw() return d + n; } -bool MidiMessage::isTrackMetaEvent() const throw() +bool MidiMessage::isTrackMetaEvent() const noexcept { return getMetaEventType() == 0; } -bool MidiMessage::isEndOfTrackMetaEvent() const throw() +bool MidiMessage::isEndOfTrackMetaEvent() const noexcept { return getMetaEventType() == 47; } -bool MidiMessage::isTextMetaEvent() const throw() +bool MidiMessage::isTextMetaEvent() const noexcept { const int t = getMetaEventType(); @@ -29060,27 +29055,27 @@ const String MidiMessage::getTextFromTextMetaEvent() const return String (reinterpret_cast (getMetaEventData()), getMetaEventLength()); } -bool MidiMessage::isTrackNameEvent() const throw() +bool MidiMessage::isTrackNameEvent() const noexcept { return (data[1] == 3) && (*data == 0xff); } -bool MidiMessage::isTempoMetaEvent() const throw() +bool MidiMessage::isTempoMetaEvent() const noexcept { return (data[1] == 81) && (*data == 0xff); } -bool MidiMessage::isMidiChannelMetaEvent() const throw() +bool MidiMessage::isMidiChannelMetaEvent() const noexcept { return (data[1] == 0x20) && (*data == 0xff) && (data[2] == 1); } -int MidiMessage::getMidiChannelMetaEventChannel() const throw() +int MidiMessage::getMidiChannelMetaEventChannel() const noexcept { return data[3] + 1; } -double MidiMessage::getTempoSecondsPerQuarterNote() const throw() +double MidiMessage::getTempoSecondsPerQuarterNote() const noexcept { if (! isTempoMetaEvent()) return 0.0; @@ -29093,7 +29088,7 @@ double MidiMessage::getTempoSecondsPerQuarterNote() const throw() / 1000000.0; } -double MidiMessage::getTempoMetaEventTickLength (const short timeFormat) const throw() +double MidiMessage::getTempoMetaEventTickLength (const short timeFormat) const noexcept { if (timeFormat > 0) { @@ -29120,7 +29115,7 @@ double MidiMessage::getTempoMetaEventTickLength (const short timeFormat) const t } } -const MidiMessage MidiMessage::tempoMetaEvent (int microsecondsPerQuarterNote) throw() +const MidiMessage MidiMessage::tempoMetaEvent (int microsecondsPerQuarterNote) noexcept { uint8 d[8]; d[0] = 0xff; @@ -29133,12 +29128,12 @@ const MidiMessage MidiMessage::tempoMetaEvent (int microsecondsPerQuarterNote) t return MidiMessage (d, 6, 0.0); } -bool MidiMessage::isTimeSignatureMetaEvent() const throw() +bool MidiMessage::isTimeSignatureMetaEvent() const noexcept { return (data[1] == 0x58) && (*data == (uint8) 0xff); } -void MidiMessage::getTimeSignatureInfo (int& numerator, int& denominator) const throw() +void MidiMessage::getTimeSignatureInfo (int& numerator, int& denominator) const noexcept { if (isTimeSignatureMetaEvent()) { @@ -29177,7 +29172,7 @@ const MidiMessage MidiMessage::timeSignatureMetaEvent (const int numerator, cons return MidiMessage (d, 7, 0.0); } -const MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) throw() +const MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) noexcept { uint8 d[8]; d[0] = 0xff; @@ -29188,100 +29183,100 @@ const MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) throw() return MidiMessage (d, 4, 0.0); } -bool MidiMessage::isKeySignatureMetaEvent() const throw() +bool MidiMessage::isKeySignatureMetaEvent() const noexcept { return getMetaEventType() == 89; } -int MidiMessage::getKeySignatureNumberOfSharpsOrFlats() const throw() +int MidiMessage::getKeySignatureNumberOfSharpsOrFlats() const noexcept { return (int) *getMetaEventData(); } -const MidiMessage MidiMessage::endOfTrack() throw() +const MidiMessage MidiMessage::endOfTrack() noexcept { return MidiMessage (0xff, 0x2f, 0, 0.0); } -bool MidiMessage::isSongPositionPointer() const throw() +bool MidiMessage::isSongPositionPointer() const noexcept { return *data == 0xf2; } -int MidiMessage::getSongPositionPointerMidiBeat() const throw() +int MidiMessage::getSongPositionPointerMidiBeat() const noexcept { return data[1] | (data[2] << 7); } -const MidiMessage MidiMessage::songPositionPointer (const int positionInMidiBeats) throw() +const MidiMessage MidiMessage::songPositionPointer (const int positionInMidiBeats) noexcept { return MidiMessage (0xf2, positionInMidiBeats & 127, (positionInMidiBeats >> 7) & 127); } -bool MidiMessage::isMidiStart() const throw() +bool MidiMessage::isMidiStart() const noexcept { return *data == 0xfa; } -const MidiMessage MidiMessage::midiStart() throw() +const MidiMessage MidiMessage::midiStart() noexcept { return MidiMessage (0xfa); } -bool MidiMessage::isMidiContinue() const throw() +bool MidiMessage::isMidiContinue() const noexcept { return *data == 0xfb; } -const MidiMessage MidiMessage::midiContinue() throw() +const MidiMessage MidiMessage::midiContinue() noexcept { return MidiMessage (0xfb); } -bool MidiMessage::isMidiStop() const throw() +bool MidiMessage::isMidiStop() const noexcept { return *data == 0xfc; } -const MidiMessage MidiMessage::midiStop() throw() +const MidiMessage MidiMessage::midiStop() noexcept { return MidiMessage (0xfc); } -bool MidiMessage::isMidiClock() const throw() +bool MidiMessage::isMidiClock() const noexcept { return *data == 0xf8; } -const MidiMessage MidiMessage::midiClock() throw() +const MidiMessage MidiMessage::midiClock() noexcept { return MidiMessage (0xf8); } -bool MidiMessage::isQuarterFrame() const throw() +bool MidiMessage::isQuarterFrame() const noexcept { return *data == 0xf1; } -int MidiMessage::getQuarterFrameSequenceNumber() const throw() +int MidiMessage::getQuarterFrameSequenceNumber() const noexcept { return ((int) data[1]) >> 4; } -int MidiMessage::getQuarterFrameValue() const throw() +int MidiMessage::getQuarterFrameValue() const noexcept { return ((int) data[1]) & 0x0f; } const MidiMessage MidiMessage::quarterFrame (const int sequenceNumber, - const int value) throw() + const int value) noexcept { return MidiMessage (0xf1, (sequenceNumber << 4) | value); } -bool MidiMessage::isFullFrame() const throw() +bool MidiMessage::isFullFrame() const noexcept { return data[0] == 0xf0 && data[1] == 0x7f @@ -29294,7 +29289,7 @@ void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds, int& frames, - MidiMessage::SmpteTimecodeType& timecodeType) const throw() + MidiMessage::SmpteTimecodeType& timecodeType) const noexcept { jassert (isFullFrame()); @@ -29326,7 +29321,7 @@ const MidiMessage MidiMessage::fullFrame (const int hours, return MidiMessage (d, 10, 0.0); } -bool MidiMessage::isMidiMachineControlMessage() const throw() +bool MidiMessage::isMidiMachineControlMessage() const noexcept { return data[0] == 0xf0 && data[1] == 0x7f @@ -29334,7 +29329,7 @@ bool MidiMessage::isMidiMachineControlMessage() const throw() && size > 5; } -MidiMessage::MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand() const throw() +MidiMessage::MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand() const noexcept { jassert (isMidiMachineControlMessage()); @@ -29357,7 +29352,7 @@ const MidiMessage MidiMessage::midiMachineControlCommand (MidiMessage::MidiMachi bool MidiMessage::isMidiMachineControlGoto (int& hours, int& minutes, int& seconds, - int& frames) const throw() + int& frames) const noexcept { if (size >= 12 && data[0] == 0xf0 @@ -29419,7 +29414,7 @@ const String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includ return String::empty; } -const double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) throw() +const double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) noexcept { noteNumber -= 12 * 6 + 9; // now 0 = A return frequencyOfA * pow (2.0, noteNumber / 12.0); @@ -29679,7 +29674,7 @@ MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& return *this; } -void MidiMessageSequence::swapWith (MidiMessageSequence& other) throw() +void MidiMessageSequence::swapWith (MidiMessageSequence& other) noexcept { list.swapWithArray (other.list); } @@ -29707,7 +29702,7 @@ double MidiMessageSequence::getTimeOfMatchingKeyUp (const int index) const { const MidiEventHolder* const meh = list [index]; - if (meh != 0 && meh->noteOffObject != 0) + if (meh != nullptr && meh->noteOffObject != nullptr) return meh->noteOffObject->message.getTimeStamp(); else return 0.0; @@ -29717,7 +29712,7 @@ int MidiMessageSequence::getIndexOfMatchingKeyUp (const int index) const { const MidiEventHolder* const meh = list [index]; - return (meh != 0) ? list.indexOf (meh->noteOffObject) : -1; + return meh != nullptr ? list.indexOf (meh->noteOffObject) : -1; } int MidiMessageSequence::getIndexOf (MidiEventHolder* const event) const @@ -29815,7 +29810,7 @@ void MidiMessageSequence::addSequence (const MidiMessageSequence& other, } int MidiMessageSequence::compareElements (const MidiMessageSequence::MidiEventHolder* const first, - const MidiMessageSequence::MidiEventHolder* const second) throw() + const MidiMessageSequence::MidiEventHolder* const second) noexcept { const double diff = first->message.getTimeStamp() - second->message.getTimeStamp(); @@ -29836,7 +29831,7 @@ void MidiMessageSequence::updateMatchedPairs() if (m1.isNoteOn()) { - list.getUnchecked(i)->noteOffObject = 0; + list.getUnchecked(i)->noteOffObject = nullptr; const int note = m1.getNoteNumber(); const int chan = m1.getChannel(); const int len = list.size(); @@ -29959,7 +29954,7 @@ void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumbe MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& message_) : message (message_), - noteOffObject (0) + noteOffObject (nullptr) { } @@ -29974,7 +29969,7 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_AudioPluginFormat.cpp ***/ BEGIN_JUCE_NAMESPACE -AudioPluginFormat::AudioPluginFormat() throw() +AudioPluginFormat::AudioPluginFormat() noexcept { } @@ -30002,43 +29997,43 @@ juce_ImplementSingleton_SingleThreaded (AudioPluginFormatManager); void AudioPluginFormatManager::addDefaultFormats() { -#if JUCE_DEBUG + #if JUCE_DEBUG // you should only call this method once! for (int i = formats.size(); --i >= 0;) { - #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT) - jassert (dynamic_cast (formats[i]) == 0); - #endif + #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT) + jassert (dynamic_cast (formats[i]) == nullptr); + #endif - #if JUCE_PLUGINHOST_AU && JUCE_MAC - jassert (dynamic_cast (formats[i]) == 0); - #endif + #if JUCE_PLUGINHOST_AU && JUCE_MAC + jassert (dynamic_cast (formats[i]) == nullptr); + #endif - #if JUCE_PLUGINHOST_DX && JUCE_WINDOWS - jassert (dynamic_cast (formats[i]) == 0); - #endif + #if JUCE_PLUGINHOST_DX && JUCE_WINDOWS + jassert (dynamic_cast (formats[i]) == nullptr); + #endif - #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX - jassert (dynamic_cast (formats[i]) == 0); - #endif + #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX + jassert (dynamic_cast (formats[i]) == nullptr); + #endif } -#endif + #endif -#if JUCE_PLUGINHOST_AU && JUCE_MAC + #if JUCE_PLUGINHOST_AU && JUCE_MAC formats.add (new AudioUnitPluginFormat()); -#endif + #endif -#if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT) + #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT) formats.add (new VSTPluginFormat()); -#endif + #endif -#if JUCE_PLUGINHOST_DX && JUCE_WINDOWS + #if JUCE_PLUGINHOST_DX && JUCE_WINDOWS formats.add (new DirectXPluginFormat()); -#endif + #endif -#if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX + #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX formats.add (new LADSPAPluginFormat()); -#endif + #endif } int AudioPluginFormatManager::getNumFormats() @@ -30059,17 +30054,17 @@ void AudioPluginFormatManager::addFormat (AudioPluginFormat* const format) AudioPluginInstance* AudioPluginFormatManager::createPluginInstance (const PluginDescription& description, String& errorMessage) const { - AudioPluginInstance* result = 0; + AudioPluginInstance* result = nullptr; for (int i = 0; i < formats.size(); ++i) { result = formats.getUnchecked(i)->createInstanceFromDescription (description); - if (result != 0) + if (result != nullptr) break; } - if (result == 0) + if (result == nullptr) { if (! doesPluginStillExist (description)) errorMessage = TRANS ("This plug-in file no longer exists"); @@ -30189,7 +30184,7 @@ namespace return Time(); } - bool timesAreDifferent (const Time& t1, const Time& t2) throw() + bool timesAreDifferent (const Time& t1, const Time& t2) noexcept { return t1 != t2 || t1 == Time(); } @@ -30222,7 +30217,7 @@ bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier, bool addedOne = false; if (dontRescanIfAlreadyInList - && getTypeForFile (fileOrIdentifier) != 0) + && getTypeForFile (fileOrIdentifier) != nullptr) { bool needsRescanning = false; @@ -30249,7 +30244,7 @@ bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier, for (int i = 0; i < found.size(); ++i) { PluginDescription* const desc = found.getUnchecked(i); - jassert (desc != 0); + jassert (desc != nullptr); if (addType (*desc)) addedOne = true; @@ -30302,7 +30297,7 @@ class PluginSorter public: KnownPluginList::SortMethod method; - PluginSorter() throw() {} + PluginSorter() noexcept {} int compareElements (const PluginDescription* const first, const PluginDescription* const second) const @@ -30773,7 +30768,7 @@ PluginListComponent::PluginListComponent (KnownPluginList& listToEdit, setSize (400, 600); list.addChangeListener (this); - changeListenerCallback (0); + changeListenerCallback (nullptr); } PluginListComponent::~PluginListComponent() @@ -30809,7 +30804,7 @@ void PluginListComponent::paintListBoxItem (int row, const PluginDescription* const pd = list.getType (row); - if (pd != 0) + if (pd != nullptr) { GlyphArrangement ga; ga.addCurtailedLineOfText (Font (height * 0.7f, Font::bold), pd->name, 8.0f, height * 0.8f, width - 10.0f, true); @@ -30884,7 +30879,7 @@ void PluginListComponent::optionsMenuCallback (int result) { const PluginDescription* const desc = list.getType (listBox.getSelectedRow()); - if (desc != 0) + if (desc != nullptr) { if (File (desc->fileOrIdentifier).existsAsFile()) File (desc->fileOrIdentifier).getParentDirectory().startAsProcess(); @@ -30913,7 +30908,7 @@ void PluginListComponent::optionsMenuCallback (int result) void PluginListComponent::optionsMenuStaticCallback (int result, PluginListComponent* pluginList) { - if (pluginList != 0) + if (pluginList != nullptr) pluginList->optionsMenuCallback (result); } @@ -30965,12 +30960,12 @@ void PluginListComponent::filesDropped (const StringArray& files, int, int) void PluginListComponent::scanFor (AudioPluginFormat* format) { #if JUCE_MODAL_LOOPS_PERMITTED - if (format == 0) + if (format == nullptr) return; FileSearchPath path (format->getDefaultLocationsToSearch()); - if (propertiesToUse != 0) + if (propertiesToUse != nullptr) path = propertiesToUse->getValue ("lastPluginScanPath_" + format->getName(), path.toString()); { @@ -30989,7 +30984,7 @@ void PluginListComponent::scanFor (AudioPluginFormat* format) path = pathList.getPath(); } - if (propertiesToUse != 0) + if (propertiesToUse != nullptr) { propertiesToUse->setValue ("lastPluginScanPath_" + format->getName(), path.toString()); propertiesToUse->saveIfNeeded(); @@ -31410,7 +31405,7 @@ private: AudioUnitPluginInstance::AudioUnitPluginInstance (const String& fileOrIdentifier) : fileOrIdentifier (fileOrIdentifier), wantsMidiMessages (false), wasPlaying (false), prepared (false), - currentBuffer (0), + currentBuffer (nullptr), audioUnit (0) { using namespace AudioUnitFormatHelpers; @@ -31763,20 +31758,20 @@ OSStatus AudioUnitPluginInstance::getBeatAndTempo (Float64* outCurrentBeat, Floa AudioPlayHead* const ph = getPlayHead(); AudioPlayHead::CurrentPositionInfo result; - if (ph != 0 && ph->getCurrentPosition (result)) + if (ph != nullptr && ph->getCurrentPosition (result)) { - if (outCurrentBeat != 0) + if (outCurrentBeat != nullptr) *outCurrentBeat = result.ppqPosition; - if (outCurrentTempo != 0) + if (outCurrentTempo != nullptr) *outCurrentTempo = result.bpm; } else { - if (outCurrentBeat != 0) + if (outCurrentBeat != nullptr) *outCurrentBeat = 0; - if (outCurrentTempo != 0) + if (outCurrentTempo != nullptr) *outCurrentTempo = 120.0; } @@ -31791,32 +31786,32 @@ OSStatus AudioUnitPluginInstance::getMusicalTimeLocation (UInt32* outDeltaSample AudioPlayHead* const ph = getPlayHead(); AudioPlayHead::CurrentPositionInfo result; - if (ph != 0 && ph->getCurrentPosition (result)) + if (ph != nullptr && ph->getCurrentPosition (result)) { - if (outTimeSig_Numerator != 0) + if (outTimeSig_Numerator != nullptr) *outTimeSig_Numerator = result.timeSigNumerator; - if (outTimeSig_Denominator != 0) + if (outTimeSig_Denominator != nullptr) *outTimeSig_Denominator = result.timeSigDenominator; - if (outDeltaSampleOffsetToNextBeat != 0) + if (outDeltaSampleOffsetToNextBeat != nullptr) *outDeltaSampleOffsetToNextBeat = 0; //xxx - if (outCurrentMeasureDownBeat != 0) + if (outCurrentMeasureDownBeat != nullptr) *outCurrentMeasureDownBeat = result.ppqPositionOfLastBarStart; //xxx wrong } else { - if (outDeltaSampleOffsetToNextBeat != 0) + if (outDeltaSampleOffsetToNextBeat != nullptr) *outDeltaSampleOffsetToNextBeat = 0; - if (outTimeSig_Numerator != 0) + if (outTimeSig_Numerator != nullptr) *outTimeSig_Numerator = 4; - if (outTimeSig_Denominator != 0) + if (outTimeSig_Denominator != nullptr) *outTimeSig_Denominator = 4; - if (outCurrentMeasureDownBeat != 0) + if (outCurrentMeasureDownBeat != nullptr) *outCurrentMeasureDownBeat = 0; } @@ -31833,47 +31828,47 @@ OSStatus AudioUnitPluginInstance::getTransportState (Boolean* outIsPlaying, AudioPlayHead* const ph = getPlayHead(); AudioPlayHead::CurrentPositionInfo result; - if (ph != 0 && ph->getCurrentPosition (result)) + if (ph != nullptr && ph->getCurrentPosition (result)) { - if (outIsPlaying != 0) + if (outIsPlaying != nullptr) *outIsPlaying = result.isPlaying; - if (outTransportStateChanged != 0) + if (outTransportStateChanged != nullptr) { *outTransportStateChanged = result.isPlaying != wasPlaying; wasPlaying = result.isPlaying; } - if (outCurrentSampleInTimeLine != 0) + if (outCurrentSampleInTimeLine != nullptr) *outCurrentSampleInTimeLine = roundToInt (result.timeInSeconds * getSampleRate()); - if (outIsCycling != 0) + if (outIsCycling != nullptr) *outIsCycling = false; - if (outCycleStartBeat != 0) + if (outCycleStartBeat != nullptr) *outCycleStartBeat = 0; - if (outCycleEndBeat != 0) + if (outCycleEndBeat != nullptr) *outCycleEndBeat = 0; } else { - if (outIsPlaying != 0) + if (outIsPlaying != nullptr) *outIsPlaying = false; - if (outTransportStateChanged != 0) + if (outTransportStateChanged != nullptr) *outTransportStateChanged = false; - if (outCurrentSampleInTimeLine != 0) + if (outCurrentSampleInTimeLine != nullptr) *outCurrentSampleInTimeLine = 0; - if (outIsCycling != 0) + if (outIsCycling != nullptr) *outIsCycling = false; - if (outCycleStartBeat != 0) + if (outCycleStartBeat != nullptr) *outCycleStartBeat = 0; - if (outCycleEndBeat != 0) + if (outCycleEndBeat != nullptr) *outCycleEndBeat = 0; } @@ -31937,7 +31932,7 @@ private: bool createView (const bool createGenericViewIfNeeded) { - NSView* pluginView = 0; + NSView* pluginView = nil; UInt32 dataSize = 0; Boolean isWritable = false; @@ -31982,13 +31977,13 @@ private: wrapper.setView (pluginView); - if (pluginView != 0) + if (pluginView != nil) { timerCallback(); startTimer (70); } - return pluginView != 0; + return pluginView != nil; } }; @@ -32025,7 +32020,7 @@ public: plugin.editorBeingDeleted (this); } - bool isValid() const throw() { return componentRecord != 0; } + bool isValid() const noexcept { return componentRecord != 0; } void paint (Graphics& g) { @@ -32142,7 +32137,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor() w = 0; #if JUCE_SUPPORT_CARBON - if (w == 0) + if (w == nullptr) { w = new AudioUnitPluginWindowCarbon (*this); @@ -32151,7 +32146,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor() } #endif - if (w == 0) + if (w == nullptr) w = new AudioUnitPluginWindowCocoa (*this, true); // use AUGenericView as a fallback return w.release(); @@ -32159,7 +32154,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor() const String AudioUnitPluginInstance::getCategory() const { - const char* result = 0; + const char* result = nullptr; switch (componentDesc.componentType) { @@ -32310,7 +32305,7 @@ const String AudioUnitPluginInstance::getProgramName (int index) { const AUPreset* p = (const AUPreset*) CFArrayGetValueAtIndex (presets, i); - if (p != 0 && p->presetNumber == index) + if (p != nullptr && p->presetNumber == index) { s = PlatformUtilities::cfStringToJuceString (p->presetName); break; @@ -32444,7 +32439,7 @@ void AudioUnitPluginFormat::findAllTypesForFile (OwnedArray & ScopedPointer createdInstance (createInstanceFromDescription (desc)); AudioUnitPluginInstance* const auInstance = dynamic_cast ((AudioPluginInstance*) createdInstance); - if (auInstance != 0) + if (auInstance != nullptr) { auInstance->fillInPluginDescription (desc); results.add (new PluginDescription (desc)); @@ -32650,7 +32645,7 @@ public: { numEventsUsed = 0; - if (events != 0) + if (events != nullptr) events->numEvents = 0; } @@ -32705,7 +32700,7 @@ public: { const VstEvent* const e = events->events[i]; - if (e != 0) + if (e != nullptr) { if (e->type == kVstMidiType) { @@ -32730,7 +32725,7 @@ public: const int size = 20 + sizeof (VstEvent*) * numEventsNeeded; - if (events == 0) + if (events == nullptr) events.calloc (size, 1); else events.realloc (size, 1); @@ -32751,7 +32746,7 @@ public: void freeEvents() { - if (events != 0) + if (events != nullptr) { for (int i = numEventsAllocated; --i >= 0;) { @@ -32844,7 +32839,7 @@ struct fxProgramSet namespace { - long vst_swap (const long x) throw() + long vst_swap (const long x) noexcept { #ifdef JUCE_LITTLE_ENDIAN return (long) ByteOrder::swap ((uint32) x); @@ -32853,7 +32848,7 @@ namespace #endif } - float vst_swapFloat (const float x) throw() + float vst_swapFloat (const float x) noexcept { #ifdef JUCE_LITTLE_ENDIAN union { uint32 asInt; float asFloat; } n; @@ -32902,7 +32897,7 @@ class VSTPluginWindow; #endif #if JUCE_MAC && JUCE_PPC -static void* NewCFMFromMachO (void* const machofp) throw() +static void* NewCFMFromMachO (void* const machofp) noexcept { void* result = (void*) new char[8]; @@ -32968,7 +32963,7 @@ namespace return 0; } - void translateJuceToXButtonModifiers (const MouseEvent& e, XEvent& ev) throw() + void translateJuceToXButtonModifiers (const MouseEvent& e, XEvent& ev) noexcept { if (e.mods.isLeftButtonDown()) { @@ -32987,21 +32982,21 @@ namespace } } - void translateJuceToXMotionModifiers (const MouseEvent& e, XEvent& ev) throw() + void translateJuceToXMotionModifiers (const MouseEvent& e, XEvent& ev) noexcept { if (e.mods.isLeftButtonDown()) ev.xmotion.state |= Button1Mask; else if (e.mods.isRightButtonDown()) ev.xmotion.state |= Button3Mask; else if (e.mods.isMiddleButtonDown()) ev.xmotion.state |= Button2Mask; } - void translateJuceToXCrossingModifiers (const MouseEvent& e, XEvent& ev) throw() + void translateJuceToXCrossingModifiers (const MouseEvent& e, XEvent& ev) noexcept { if (e.mods.isLeftButtonDown()) ev.xcrossing.state |= Button1Mask; else if (e.mods.isRightButtonDown()) ev.xcrossing.state |= Button3Mask; else if (e.mods.isMiddleButtonDown()) ev.xcrossing.state |= Button2Mask; } - void translateJuceToXMouseWheelModifiers (const MouseEvent& e, const float increment, XEvent& ev) throw() + void translateJuceToXMouseWheelModifiers (const MouseEvent& e, const float increment, XEvent& ev) noexcept { if (increment < 0) { @@ -33051,7 +33046,7 @@ public: ScopedPointer m (new ModuleHandle (file)); if (! m->open()) - m = 0; + m = nullptr; --insideVSTCallback; _fpreset(); // (doesn't do any harm) @@ -33389,7 +33384,7 @@ public: desc.version = getVersion(); desc.numInputChannels = getNumInputChannels(); desc.numOutputChannels = getNumOutputChannels(); - desc.isInstrument = (effect != 0 && (effect->flags & effFlagsIsSynth) != 0); + desc.isInstrument = (effect != nullptr && (effect->flags & effFlagsIsSynth) != 0); } void* getPlatformSpecificData() { return effect; } @@ -33405,7 +33400,7 @@ public: void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages); - bool hasEditor() const { return effect != 0 && (effect->flags & effFlagsHasEditor) != 0; } + bool hasEditor() const { return effect != nullptr && (effect->flags & effFlagsHasEditor) != 0; } AudioProcessorEditor* createEditor(); const String getInputChannelName (int index) const; @@ -33414,14 +33409,14 @@ public: const String getOutputChannelName (int index) const; bool isOutputChannelStereoPair (int index) const; - int getNumParameters() { return effect != 0 ? effect->numParams : 0; } + int getNumParameters() { return effect != nullptr ? effect->numParams : 0; } float getParameter (int index); void setParameter (int index, float newValue); const String getParameterName (int index); const String getParameterText (int index); bool isParameterAutomatable (int index) const; - int getNumPrograms() { return effect != 0 ? effect->numPrograms : 0; } + int getNumPrograms() { return effect != nullptr ? effect->numPrograms : 0; } int getCurrentProgram() { return dispatch (effGetProgram, 0, 0, 0, 0); } void setCurrentProgram (int index); const String getProgramName (int index); @@ -33465,13 +33460,13 @@ private: void restoreFromTempParameterStore (const MemoryBlock& mb); const String getParameterLabel (int index) const; - bool usesChunks() const throw() { return effect != 0 && (effect->flags & effFlagsProgramChunks) != 0; } + bool usesChunks() const noexcept { return effect != nullptr && (effect->flags & effFlagsProgramChunks) != 0; } void getChunkData (MemoryBlock& mb, bool isPreset, int maxSizeMB) const; void setChunkData (const char* data, int size, bool isPreset); bool loadFromFXBFile (const void* data, int numBytes); bool saveToFXBFile (MemoryBlock& dest, bool isFXB, int maxSizeMB); - int getVersionNumber() const throw() { return effect != 0 ? effect->version : 0; } + int getVersionNumber() const noexcept { return effect != nullptr ? effect->version : 0; } const String getVersion() const; const String getCategory() const; @@ -33505,7 +33500,7 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr fragId != 0) { - static void* audioMasterCoerced = 0; + static void* audioMasterCoerced = nullptr; if (audioMasterCoerced == 0) audioMasterCoerced = NewCFMFromMachO ((void*) &audioMaster); @@ -33520,7 +33515,7 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr magic == kEffectMagic) + if (effect != nullptr && effect->magic == kEffectMagic) { #if JUCE_PPC module->coerceAEffectFunctionCalls (effect); @@ -33533,7 +33528,7 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr magic == kEffectMagic) + if (effect != nullptr && effect->magic == kEffectMagic) { try { @@ -33568,8 +33563,8 @@ VSTPluginInstance::~VSTPluginInstance() {} } - module = 0; - effect = 0; + module = nullptr; + effect = nullptr; } void VSTPluginInstance::initialise() @@ -33684,7 +33679,7 @@ void VSTPluginInstance::processBlock (AudioSampleBuffer& buffer, { AudioPlayHead* playHead = getPlayHead(); - if (playHead != 0) + if (playHead != nullptr) { AudioPlayHead::CurrentPositionInfo position; playHead->getCurrentPosition (position); @@ -33772,7 +33767,7 @@ void VSTPluginInstance::processBlock (AudioSampleBuffer& buffer, void VSTPluginInstance::handleMidiFromPlugin (const VstEvents* const events) { - if (events != 0) + if (events != nullptr) { const ScopedLock sl (midiInLock); VSTMidiEventList::addEventsToMidiBuffer (events, incomingMidi); @@ -33801,15 +33796,15 @@ public: pluginRefusesToResize (false), alreadyInside (false) { -#if JUCE_WINDOWS + #if JUCE_WINDOWS sizeCheckCount = 0; pluginHWND = 0; -#elif JUCE_LINUX + #elif JUCE_LINUX pluginWindow = None; pluginProc = None; -#else + #else addAndMakeVisible (innerWrapper = new InnerWrapperComponent (this)); -#endif + #endif activeVSTWindows.add (this); @@ -33820,11 +33815,12 @@ public: ~VSTPluginWindow() { -#if JUCE_MAC - innerWrapper = 0; -#else + #if JUCE_MAC + innerWrapper = nullptr; + #else closePluginWindow(); -#endif + #endif + activeVSTWindows.removeValue (this); plugin.editorBeingDeleted (this); } @@ -33837,7 +33833,7 @@ public: Component* const topComp = getTopLevelComponent(); - if (topComp->getPeer() != 0) + if (topComp->getPeer() != nullptr) { const Point pos (topComp->getLocalPoint (this, Point())); @@ -33898,7 +33894,7 @@ public: { ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) { const Point pos (getScreenPosition() - peer->getScreenPosition()); peer->addMaskedRegion (pos.getX(), pos.getY(), getWidth(), getHeight()); @@ -34017,7 +34013,7 @@ private: isOpen = true; - ERect* rect = 0; + ERect* rect = nullptr; dispatch (effEditGetRect, 0, 0, &rect, 0); dispatch (effEditOpen, 0, 0, parentWindow, 0); @@ -34031,7 +34027,7 @@ private: // double-check it's not too tiny int w = 250, h = 150; - if (rect != 0) + if (rect != nullptr) { w = rect->right - rect->left; h = rect->bottom - rect->top; @@ -34061,7 +34057,7 @@ private: log ("Opening VST UI: " + plugin.name); isOpen = true; - ERect* rect = 0; + ERect* rect = nullptr; dispatch (effEditGetRect, 0, 0, &rect, 0); dispatch (effEditOpen, 0, 0, getWindowHandle(), 0); @@ -34099,7 +34095,7 @@ private: w = r.right - r.left; h = r.bottom - r.top; - if (rect != 0) + if (rect != nullptr) { const int rw = rect->right - rect->left; const int rh = rect->bottom - rect->top; @@ -34136,7 +34132,7 @@ private: int w = 250, h = 150; - if (rect != 0) + if (rect != nullptr) { w = rect->right - rect->left; h = rect->bottom - rect->top; @@ -34444,7 +34440,7 @@ private: bool getEmbeddedViewSize (int& w, int& h) { - ERect* rect = 0; + ERect* rect = nullptr; owner->dispatch (effEditGetRect, 0, 0, &rect, 0); w = rect->right - rect->left; h = rect->bottom - rect->top; @@ -34470,7 +34466,7 @@ private: { ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) { const Point pos (getScreenPosition() - peer->getScreenPosition()); ERect r; @@ -34739,10 +34735,10 @@ void VSTPluginInstance::getChunkData (MemoryBlock& mb, bool isPreset, int maxSiz { if (usesChunks()) { - void* data = 0; + void* data = nullptr; const int bytes = dispatch (effGetChunk, isPreset ? 1 : 0, 0, &data, 0.0f); - if (data != 0 && bytes <= maxSizeMB * 1024 * 1024) + if (data != nullptr && bytes <= maxSizeMB * 1024 * 1024) { mb.setSize (bytes); mb.copyFrom (data, 0, bytes); @@ -34844,7 +34840,7 @@ namespace { String hostName ("Juce VST Host"); - if (JUCEApplication::getInstance() != 0) + if (JUCEApplication::getInstance() != nullptr) hostName = JUCEApplication::getInstance()->getApplicationName(); hostName.copyToUTF8 ((char*) ptr, jmin (kVstMaxVendorStrLen, kVstMaxProductStrLen) - 1); @@ -34895,7 +34891,7 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs { ++insideVSTCallback; #if JUCE_MAC - if (getActiveEditor() != 0) + if (getActiveEditor() != nullptr) dispatch (effEditIdle, 0, 0, 0, 0); #endif juce_callAnyTimersSynchronously(); @@ -34922,7 +34918,7 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs break; case audioMasterSizeWindow: - if (getActiveEditor() != 0) + if (getActiveEditor() != nullptr) getActiveEditor()->setSize (index, value); return 1; @@ -34985,7 +34981,7 @@ static VstIntPtr VSTCALLBACK audioMaster (AEffect* effect, VstInt32 opcode, VstI { try { - if (effect != 0 && effect->resvd2 != 0) + if (effect != nullptr && effect->resvd2 != 0) { return ((VSTPluginInstance*)(effect->resvd2)) ->handleCallback (opcode, index, value, ptr, opt); @@ -35035,7 +35031,7 @@ const String VSTPluginInstance::getVersion() const int VSTPluginInstance::getUID() const { - int uid = effect != 0 ? effect->uniqueID : 0; + int uid = effect != nullptr ? effect->uniqueID : 0; if (uid == 0) uid = module->file.hashCode(); @@ -35045,7 +35041,7 @@ int VSTPluginInstance::getUID() const const String VSTPluginInstance::getCategory() const { - const char* result = 0; + const char* result = nullptr; switch (dispatch (effGetPlugCategory, 0, 0, 0, 0)) { @@ -35066,7 +35062,7 @@ const String VSTPluginInstance::getCategory() const float VSTPluginInstance::getParameter (int index) { - if (effect != 0 && isPositiveAndBelow (index, (int) effect->numParams)) + if (effect != nullptr && isPositiveAndBelow (index, (int) effect->numParams)) { try { @@ -35083,7 +35079,7 @@ float VSTPluginInstance::getParameter (int index) void VSTPluginInstance::setParameter (int index, float newValue) { - if (effect != 0 && isPositiveAndBelow (index, (int) effect->numParams)) + if (effect != nullptr && isPositiveAndBelow (index, (int) effect->numParams)) { try { @@ -35100,7 +35096,7 @@ void VSTPluginInstance::setParameter (int index, float newValue) const String VSTPluginInstance::getParameterName (int index) { - if (effect != 0) + if (effect != nullptr) { jassert (index >= 0 && index < effect->numParams); @@ -35114,7 +35110,7 @@ const String VSTPluginInstance::getParameterName (int index) const String VSTPluginInstance::getParameterLabel (int index) const { - if (effect != 0) + if (effect != nullptr) { jassert (index >= 0 && index < effect->numParams); @@ -35128,7 +35124,7 @@ const String VSTPluginInstance::getParameterLabel (int index) const const String VSTPluginInstance::getParameterText (int index) { - if (effect != 0) + if (effect != nullptr) { jassert (index >= 0 && index < effect->numParams); @@ -35142,7 +35138,7 @@ const String VSTPluginInstance::getParameterText (int index) bool VSTPluginInstance::isParameterAutomatable (int index) const { - if (effect != 0) + if (effect != nullptr) { jassert (index >= 0 && index < effect->numParams); return dispatch (effCanBeAutomated, index, 0, 0, 0) != 0; @@ -35184,7 +35180,7 @@ const String VSTPluginInstance::getProgramName (int index) { return getCurrentProgramName(); } - else if (effect != 0) + else if (effect != nullptr) { char nm [256] = { 0 }; @@ -35214,7 +35210,7 @@ void VSTPluginInstance::changeProgramName (int index, const String& newName) void VSTPluginInstance::updateStoredProgramNames() { - if (effect != 0 && getNumPrograms() > 0) + if (effect != nullptr && getNumPrograms() > 0) { char nm [256] = { 0 }; @@ -35239,7 +35235,7 @@ void VSTPluginInstance::updateStoredProgramNames() const String VSTPluginInstance::getCurrentProgramName() { - if (effect != 0) + if (effect != nullptr) { char nm [256] = { 0 }; dispatch (effGetProgramName, 0, 0, nm, 0); @@ -35434,20 +35430,20 @@ AudioPluginInstance* VSTPluginFormat::createInstanceFromDescription (const Plugi const ReferenceCountedObjectPtr module (ModuleHandle::findOrCreateModule (file)); - if (module != 0) + if (module != nullptr) { shellUIDToCreate = desc.uid; result = new VSTPluginInstance (module); - if (result->effect != 0) + if (result->effect != nullptr) { result->effect->resvd2 = (VstIntPtr) (pointer_sized_int) (VSTPluginInstance*) result; result->initialise(); } else { - result = 0; + result = nullptr; } } @@ -35562,7 +35558,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE AudioProcessor::AudioProcessor() - : playHead (0), + : playHead (nullptr), sampleRate (0), blockSize (0), numInputChannels (0), @@ -35577,7 +35573,7 @@ AudioProcessor::~AudioProcessor() { // ooh, nasty - the editor should have been deleted before the filter // that it refers to is deleted.. - jassert (activeEditor == 0); + jassert (activeEditor == nullptr); #if JUCE_DEBUG // This will fail if you've called beginParameterChangeGesture() for one @@ -35586,7 +35582,7 @@ AudioProcessor::~AudioProcessor() #endif } -void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead) throw() +void AudioProcessor::setPlayHead (AudioPlayHead* const newPlayHead) noexcept { playHead = newPlayHead; } @@ -35606,7 +35602,7 @@ void AudioProcessor::removeListener (AudioProcessorListener* const listenerToRem void AudioProcessor::setPlayConfigDetails (const int numIns, const int numOuts, const double sampleRate_, - const int blockSize_) throw() + const int blockSize_) noexcept { numInputChannels = numIns; numOutputChannels = numOuts; @@ -35614,7 +35610,7 @@ void AudioProcessor::setPlayConfigDetails (const int numIns, blockSize = blockSize_; } -void AudioProcessor::setNonRealtime (const bool nonRealtime_) throw() +void AudioProcessor::setNonRealtime (const bool nonRealtime_) noexcept { nonRealtime = nonRealtime_; } @@ -35648,7 +35644,7 @@ void AudioProcessor::sendParamChangeMessageToListeners (const int parameterIndex l = listeners [i]; } - if (l != 0) + if (l != nullptr) l->audioProcessorParameterChanged (this, parameterIndex, newValue); } } @@ -35673,7 +35669,7 @@ void AudioProcessor::beginParameterChangeGesture (int parameterIndex) l = listeners [i]; } - if (l != 0) + if (l != nullptr) l->audioProcessorParameterChangeGestureBegin (this, parameterIndex); } } @@ -35699,7 +35695,7 @@ void AudioProcessor::endParameterChangeGesture (int parameterIndex) l = listeners [i]; } - if (l != 0) + if (l != nullptr) l->audioProcessorParameterChangeGestureEnd (this, parameterIndex); } } @@ -35715,7 +35711,7 @@ void AudioProcessor::updateHostDisplay() l = listeners [i]; } - if (l != 0) + if (l != nullptr) l->audioProcessorChanged (this); } } @@ -35740,25 +35736,25 @@ void AudioProcessor::reset() { } -void AudioProcessor::editorBeingDeleted (AudioProcessorEditor* const editor) throw() +void AudioProcessor::editorBeingDeleted (AudioProcessorEditor* const editor) noexcept { const ScopedLock sl (callbackLock); if (activeEditor == editor) - activeEditor = 0; + activeEditor = nullptr; } AudioProcessorEditor* AudioProcessor::createEditorIfNeeded() { - if (activeEditor != 0) + if (activeEditor != nullptr) return activeEditor; AudioProcessorEditor* const ed = createEditor(); // You must make your hasEditor() method return a consistent result! - jassert (hasEditor() == (ed != 0)); + jassert (hasEditor() == (ed != nullptr)); - if (ed != 0) + if (ed != nullptr) { // you must give your editor comp a size before returning it.. jassert (ed->getWidth() > 0 && ed->getHeight() > 0); @@ -35817,7 +35813,7 @@ XmlElement* AudioProcessor::getXmlFromBinary (const void* data, void AudioProcessorListener::audioProcessorParameterChangeGestureBegin (AudioProcessor*, int) {} void AudioProcessorListener::audioProcessorParameterChangeGestureEnd (AudioProcessor*, int) {} -bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const throw() +bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const noexcept { return timeInSeconds == other.timeInSeconds && ppqPosition == other.ppqPosition @@ -35831,7 +35827,7 @@ bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& && timeSigDenominator == other.timeSigDenominator; } -bool AudioPlayHead::CurrentPositionInfo::operator!= (const CurrentPositionInfo& other) const throw() +bool AudioPlayHead::CurrentPositionInfo::operator!= (const CurrentPositionInfo& other) const noexcept { return ! operator== (other); } @@ -35855,7 +35851,7 @@ AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* const owner_) : owner (owner_) { // the filter must be valid.. - jassert (owner != 0); + jassert (owner != nullptr); } AudioProcessorEditor::~AudioProcessorEditor() @@ -35879,7 +35875,7 @@ AudioProcessorGraph::Node::Node (const uint32 id_, AudioProcessor* const process processor (processor_), isPrepared (false) { - jassert (processor_ != 0); + jassert (processor_ != nullptr); } void AudioProcessorGraph::Node::prepare (const double sampleRate, const int blockSize, @@ -35892,7 +35888,7 @@ void AudioProcessorGraph::Node::prepare (const double sampleRate, const int bloc AudioProcessorGraph::AudioGraphIOProcessor* const ioProc = dynamic_cast (static_cast (processor)); - if (ioProc != 0) + if (ioProc != nullptr) ioProc->setParentGraph (graph); processor->setPlayConfigDetails (processor->getNumInputChannels(), @@ -35949,7 +35945,7 @@ AudioProcessorGraph::Node* AudioProcessorGraph::getNodeForId (const uint32 nodeI AudioProcessorGraph::Node* AudioProcessorGraph::addNode (AudioProcessor* const newProcessor, uint32 nodeId) { - if (newProcessor == 0) + if (newProcessor == nullptr) { jassertfalse; return 0; @@ -35962,7 +35958,7 @@ AudioProcessorGraph::Node* AudioProcessorGraph::addNode (AudioProcessor* const n else { // you can't add a node with an id that already exists in the graph.. - jassert (getNodeForId (nodeId) == 0); + jassert (getNodeForId (nodeId) == nullptr); removeNode (nodeId); } @@ -35975,7 +35971,7 @@ AudioProcessorGraph::Node* AudioProcessorGraph::addNode (AudioProcessor* const n AudioProcessorGraph::AudioGraphIOProcessor* const ioProc = dynamic_cast (static_cast (n->processor)); - if (ioProc != 0) + if (ioProc != nullptr) ioProc->setParentGraph (this); return n; @@ -35992,8 +35988,8 @@ bool AudioProcessorGraph::removeNode (const uint32 nodeId) AudioProcessorGraph::AudioGraphIOProcessor* const ioProc = dynamic_cast (static_cast (nodes.getUnchecked(i)->processor)); - if (ioProc != 0) - ioProc->setParentGraph (0); + if (ioProc != nullptr) + ioProc->setParentGraph (nullptr); nodes.remove (i); triggerAsyncUpdate(); @@ -36056,20 +36052,20 @@ bool AudioProcessorGraph::canConnect (const uint32 sourceNodeId, const Node* const source = getNodeForId (sourceNodeId); - if (source == 0 + if (source == nullptr || (sourceChannelIndex != midiChannelIndex && sourceChannelIndex >= source->processor->getNumOutputChannels()) || (sourceChannelIndex == midiChannelIndex && ! source->processor->producesMidi())) return false; const Node* const dest = getNodeForId (destNodeId); - if (dest == 0 + if (dest == nullptr || (destChannelIndex != midiChannelIndex && destChannelIndex >= dest->processor->getNumInputChannels()) || (destChannelIndex == midiChannelIndex && ! dest->processor->acceptsMidi())) return false; return getConnectionBetween (sourceNodeId, sourceChannelIndex, - destNodeId, destChannelIndex) == 0; + destNodeId, destChannelIndex) == nullptr; } bool AudioProcessorGraph::addConnection (const uint32 sourceNodeId, @@ -36151,7 +36147,7 @@ bool AudioProcessorGraph::removeIllegalConnections() const Node* const source = getNodeForId (c->sourceNodeId); const Node* const dest = getNodeForId (c->destNodeId); - if (source == 0 || dest == 0 + if (source == nullptr || dest == nullptr || (c->sourceChannelIndex != midiChannelIndex && ! isPositiveAndBelow (c->sourceChannelIndex, source->processor->getNumOutputChannels())) || (c->sourceChannelIndex == midiChannelIndex @@ -36395,7 +36391,7 @@ private: enum { freeNodeID = 0xffffffff, zeroNodeID = 0xfffffffe }; - static bool isNodeBusy (uint32 nodeID) throw() { return nodeID != freeNodeID && nodeID != zeroNodeID; } + static bool isNodeBusy (uint32 nodeID) noexcept { return nodeID != freeNodeID && nodeID != zeroNodeID; } void createRenderingOpsForNode (AudioProcessorGraph::Node* const node, Array& renderingOps, @@ -36734,7 +36730,7 @@ private: { if (inputChannelOfIndexToIgnore != AudioProcessorGraph::midiChannelIndex && graph.getConnectionBetween (nodeId, AudioProcessorGraph::midiChannelIndex, - node->id, AudioProcessorGraph::midiChannelIndex) != 0) + node->id, AudioProcessorGraph::midiChannelIndex) != nullptr) return true; } else @@ -36742,7 +36738,7 @@ private: for (int i = 0; i < node->getProcessor()->getNumInputChannels(); ++i) if (i != inputChannelOfIndexToIgnore && graph.getConnectionBetween (nodeId, outputChanIndex, - node->id, i) != 0) + node->id, i) != nullptr) return true; } @@ -36872,9 +36868,9 @@ void AudioProcessorGraph::handleAsyncUpdate() void AudioProcessorGraph::prepareToPlay (double /*sampleRate*/, int estimatedSamplesPerBlock) { - currentAudioInputBuffer = 0; + currentAudioInputBuffer = nullptr; currentAudioOutputBuffer.setSize (jmax (1, getNumOutputChannels()), estimatedSamplesPerBlock); - currentMidiInputBuffer = 0; + currentMidiInputBuffer = nullptr; currentMidiOutputBuffer.clear(); clearRenderingSequence(); @@ -36889,9 +36885,9 @@ void AudioProcessorGraph::releaseResources() renderingBuffers.setSize (1, 1); midiBuffers.clear(); - currentAudioInputBuffer = 0; + currentAudioInputBuffer = nullptr; currentAudioOutputBuffer.setSize (1, 1); - currentMidiInputBuffer = 0; + currentMidiInputBuffer = nullptr; currentMidiOutputBuffer.clear(); } @@ -36942,7 +36938,7 @@ void AudioProcessorGraph::setStateInformation (const void* /*data*/, int /*sizeI AudioProcessorGraph::AudioGraphIOProcessor::AudioGraphIOProcessor (const IODeviceType type_) : type (type_), - graph (0) + graph (nullptr) { } @@ -36975,17 +36971,17 @@ void AudioProcessorGraph::AudioGraphIOProcessor::fillInPluginDescription (Plugin d.isInstrument = false; d.numInputChannels = getNumInputChannels(); - if (type == audioOutputNode && graph != 0) + if (type == audioOutputNode && graph != nullptr) d.numInputChannels = graph->getNumInputChannels(); d.numOutputChannels = getNumOutputChannels(); - if (type == audioInputNode && graph != 0) + if (type == audioInputNode && graph != nullptr) d.numOutputChannels = graph->getNumOutputChannels(); } void AudioProcessorGraph::AudioGraphIOProcessor::prepareToPlay (double, int) { - jassert (graph != 0); + jassert (graph != nullptr); } void AudioProcessorGraph::AudioGraphIOProcessor::releaseResources() @@ -36995,7 +36991,7 @@ void AudioProcessorGraph::AudioGraphIOProcessor::releaseResources() void AudioProcessorGraph::AudioGraphIOProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) { - jassert (graph != 0); + jassert (graph != nullptr); switch (type) { @@ -37117,7 +37113,7 @@ void AudioProcessorGraph::AudioGraphIOProcessor::setParentGraph (AudioProcessorG { graph = newGraph; - if (graph != 0) + if (graph != nullptr) { setPlayConfigDetails (type == audioOutputNode ? graph->getNumOutputChannels() : 0, type == audioInputNode ? graph->getNumInputChannels() : 0, @@ -37136,7 +37132,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE AudioProcessorPlayer::AudioProcessorPlayer() - : processor (0), + : processor (nullptr), sampleRate (0), blockSize (0), isPrepared (false), @@ -37148,14 +37144,14 @@ AudioProcessorPlayer::AudioProcessorPlayer() AudioProcessorPlayer::~AudioProcessorPlayer() { - setProcessor (0); + setProcessor (nullptr); } void AudioProcessorPlayer::setProcessor (AudioProcessor* const processorToPlay) { if (processor != processorToPlay) { - if (processorToPlay != 0 && sampleRate > 0 && blockSize > 0) + if (processorToPlay != nullptr && sampleRate > 0 && blockSize > 0) { processorToPlay->setPlayConfigDetails (numInputChans, numOutputChans, sampleRate, blockSize); @@ -37172,7 +37168,7 @@ void AudioProcessorPlayer::setProcessor (AudioProcessor* const processorToPlay) isPrepared = true; } - if (oldOne != 0) + if (oldOne != nullptr) oldOne->releaseResources(); } } @@ -37233,7 +37229,7 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann const ScopedLock sl (lock); - if (processor != 0) + if (processor != nullptr) { const ScopedLock sl2 (processor->getCallbackLock()); @@ -37261,13 +37257,13 @@ void AudioProcessorPlayer::audioDeviceAboutToStart (AudioIODevice* device) messageCollector.reset (sampleRate); zeromem (channels, sizeof (channels)); - if (processor != 0) + if (processor != nullptr) { if (isPrepared) processor->releaseResources(); AudioProcessor* const oldProcessor = processor; - setProcessor (0); + setProcessor (nullptr); setProcessor (oldProcessor); } } @@ -37276,7 +37272,7 @@ void AudioProcessorPlayer::audioDeviceStopped() { const ScopedLock sl (lock); - if (processor != 0 && isPrepared) + if (processor != nullptr && isPrepared) processor->releaseResources(); sampleRate = 0.0; @@ -37393,7 +37389,7 @@ private: GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const owner_) : AudioProcessorEditor (owner_) { - jassert (owner_ != 0); + jassert (owner_ != nullptr); setOpaque (true); addAndMakeVisible (&panel); @@ -37503,7 +37499,7 @@ SamplerVoice::~SamplerVoice() bool SamplerVoice::canPlaySound (SynthesiserSound* sound) { - return dynamic_cast (sound) != 0; + return dynamic_cast (sound) != nullptr; } void SamplerVoice::startNote (const int midiNoteNumber, @@ -37512,9 +37508,9 @@ void SamplerVoice::startNote (const int midiNoteNumber, const int /*currentPitchWheelPosition*/) { const SamplerSound* const sound = dynamic_cast (s); - jassert (sound != 0); // this object can only play SamplerSounds! + jassert (sound != nullptr); // this object can only play SamplerSounds! - if (sound != 0) + if (sound != nullptr) { const double targetFreq = MidiMessage::getMidiNoteInHertz (midiNoteNumber); const double naturalFreq = MidiMessage::getMidiNoteInHertz (sound->midiRootNote); @@ -37576,7 +37572,7 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa { const SamplerSound* const playingSound = static_cast (getCurrentlyPlayingSound().getObject()); - if (playingSound != 0) + if (playingSound != nullptr) { const float* const inL = playingSound->data->getSampleData (0, 0); const float* const inR = playingSound->data->getNumChannels() > 1 @@ -37593,8 +37589,8 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa // just using a very simple linear interpolation here.. float l = (inL [pos] * invAlpha + inL [pos + 1] * alpha); - float r = (inR != 0) ? (inR [pos] * invAlpha + inR [pos + 1] * alpha) - : l; + float r = (inR != nullptr) ? (inR [pos] * invAlpha + inR [pos + 1] * alpha) + : l; l *= lgain; r *= rgain; @@ -37626,7 +37622,7 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa } } - if (outR != 0) + if (outR != nullptr) { *outL++ += l; *outR++ += r; @@ -37665,8 +37661,7 @@ SynthesiserSound::~SynthesiserSound() SynthesiserVoice::SynthesiserVoice() : currentSampleRate (44100.0), currentlyPlayingNote (-1), - noteOnTime (0), - currentlyPlayingSound (0) + noteOnTime (0) { } @@ -37676,7 +37671,7 @@ SynthesiserVoice::~SynthesiserVoice() bool SynthesiserVoice::isPlayingChannel (const int midiChannel) const { - return currentlyPlayingSound != 0 + return currentlyPlayingSound != nullptr && currentlyPlayingSound->appliesToChannel (midiChannel); } @@ -37688,7 +37683,7 @@ void SynthesiserVoice::setCurrentPlaybackSampleRate (const double newRate) void SynthesiserVoice::clearCurrentNote() { currentlyPlayingNote = -1; - currentlyPlayingSound = 0; + currentlyPlayingSound = nullptr; } Synthesiser::Synthesiser() @@ -37861,9 +37856,9 @@ void Synthesiser::startVoice (SynthesiserVoice* const voice, const int midiNoteNumber, const float velocity) { - if (voice != 0 && sound != 0) + if (voice != nullptr && sound != nullptr) { - if (voice->currentlyPlayingSound != 0) + if (voice->currentlyPlayingSound != nullptr) voice->stopNote (false); voice->startNote (midiNoteNumber, @@ -37891,7 +37886,7 @@ void Synthesiser::noteOff (const int midiChannel, { SynthesiserSound* const sound = voice->getCurrentlyPlayingSound(); - if (sound != 0 + if (sound != nullptr && sound->appliesToNote (midiNoteNumber) && sound->appliesToChannel (midiChannel)) { @@ -37962,18 +37957,18 @@ SynthesiserVoice* Synthesiser::findFreeVoice (SynthesiserSound* soundToPlay, if (stealIfNoneAvailable) { // currently this just steals the one that's been playing the longest, but could be made a bit smarter.. - SynthesiserVoice* oldest = 0; + SynthesiserVoice* oldest = nullptr; for (int i = voices.size(); --i >= 0;) { SynthesiserVoice* const voice = voices.getUnchecked (i); if (voice->canPlaySound (soundToPlay) - && (oldest == 0 || oldest->noteOnTime > voice->noteOnTime)) + && (oldest == nullptr || oldest->noteOnTime > voice->noteOnTime)) oldest = voice; } - jassert (oldest != 0); + jassert (oldest != nullptr); return oldest; } @@ -37991,7 +37986,7 @@ BEGIN_JUCE_NAMESPACE class ActionMessage : public Message { public: - ActionMessage (const String& messageText, ActionListener* const listener_) throw() + ActionMessage (const String& messageText, ActionListener* const listener_) noexcept : message (messageText) { pointerParameter = listener_; @@ -38017,7 +38012,7 @@ void ActionBroadcaster::CallbackReceiver::handleMessage (const Message& message) ActionBroadcaster::ActionBroadcaster() { // are you trying to create this object before or after juce has been intialised?? - jassert (MessageManager::instance != 0); + jassert (MessageManager::instance != nullptr); callback.owner = this; } @@ -38025,14 +38020,14 @@ ActionBroadcaster::ActionBroadcaster() ActionBroadcaster::~ActionBroadcaster() { // all event-based objects must be deleted BEFORE juce is shut down! - jassert (MessageManager::instance != 0); + jassert (MessageManager::instance != nullptr); } void ActionBroadcaster::addActionListener (ActionListener* const listener) { const ScopedLock sl (actionListenerLock); - if (listener != 0) + if (listener != nullptr) actionListeners.add (listener); } @@ -38088,7 +38083,7 @@ AsyncUpdater::AsyncUpdater() message = new AsyncUpdaterMessage (*this); } -inline Atomic& AsyncUpdater::getDeliveryFlag() const throw() +inline Atomic& AsyncUpdater::getDeliveryFlag() const noexcept { return static_cast (message.getObject())->shouldDeliver; } @@ -38110,7 +38105,7 @@ void AsyncUpdater::triggerAsyncUpdate() message->post(); } -void AsyncUpdater::cancelPendingUpdate() throw() +void AsyncUpdater::cancelPendingUpdate() noexcept { getDeliveryFlag().set (0); } @@ -38124,7 +38119,7 @@ void AsyncUpdater::handleUpdateNowIfNeeded() handleAsyncUpdate(); } -bool AsyncUpdater::isUpdatePending() const throw() +bool AsyncUpdater::isUpdatePending() const noexcept { return getDeliveryFlag().value != 0; } @@ -38136,10 +38131,10 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_ChangeBroadcaster.cpp ***/ BEGIN_JUCE_NAMESPACE -ChangeBroadcaster::ChangeBroadcaster() throw() +ChangeBroadcaster::ChangeBroadcaster() noexcept { // are you trying to create this object before or after juce has been intialised?? - jassert (MessageManager::instance != 0); + jassert (MessageManager::instance != nullptr); callback.owner = this; } @@ -38147,7 +38142,7 @@ ChangeBroadcaster::ChangeBroadcaster() throw() ChangeBroadcaster::~ChangeBroadcaster() { // all event-based objects must be deleted BEFORE juce is shut down! - jassert (MessageManager::instance != 0); + jassert (MessageManager::instance != nullptr); } void ChangeBroadcaster::addChangeListener (ChangeListener* const listener) @@ -38203,13 +38198,13 @@ void ChangeBroadcaster::callListeners() } ChangeBroadcaster::ChangeBroadcasterCallback::ChangeBroadcasterCallback() - : owner (0) + : owner (nullptr) { } void ChangeBroadcaster::ChangeBroadcasterCallback::handleAsyncUpdate() { - jassert (owner != 0); + jassert (owner != nullptr); owner->callListeners(); } @@ -38253,7 +38248,7 @@ bool InterprocessConnection::connectToSocket (const String& hostName, } else { - socket = 0; + socket = nullptr; return false; } } @@ -38296,10 +38291,10 @@ bool InterprocessConnection::createPipe (const String& pipeName, void InterprocessConnection::disconnect() { - if (socket != 0) + if (socket != nullptr) socket->close(); - if (pipe != 0) + if (pipe != nullptr) { pipe->cancelPendingReads(); pipe->close(); @@ -38309,8 +38304,8 @@ void InterprocessConnection::disconnect() { const ScopedLock sl (pipeAndSocketLock); - socket = 0; - pipe = 0; + socket = nullptr; + pipe = nullptr; } connectionLostInt(); @@ -38320,18 +38315,18 @@ bool InterprocessConnection::isConnected() const { const ScopedLock sl (pipeAndSocketLock); - return ((socket != 0 && socket->isConnected()) - || (pipe != 0 && pipe->isOpen())) + return ((socket != nullptr && socket->isConnected()) + || (pipe != nullptr && pipe->isOpen())) && isThreadRunning(); } const String InterprocessConnection::getConnectedHostName() const { - if (pipe != 0) + if (pipe != nullptr) { return "localhost"; } - else if (socket != 0) + else if (socket != nullptr) { if (! socket->isLocal()) return socket->getHostName(); @@ -38356,9 +38351,9 @@ bool InterprocessConnection::sendMessage (const MemoryBlock& message) const ScopedLock sl (pipeAndSocketLock); - if (socket != 0) + if (socket != nullptr) bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize()); - else if (pipe != 0) + else if (pipe != nullptr) bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize()); return bytesWritten == (int) messageData.getSize(); @@ -38447,8 +38442,8 @@ bool InterprocessConnection::readNextMessageInt() const int maximumMessageSize = 1024 * 1024 * 10; // sanity check uint32 messageHeader[2]; - const int bytes = (socket != 0) ? socket->read (messageHeader, sizeof (messageHeader), true) - : pipe->read (messageHeader, sizeof (messageHeader), pipeReceiveMessageTimeout); + const int bytes = socket != nullptr ? socket->read (messageHeader, sizeof (messageHeader), true) + : pipe ->read (messageHeader, sizeof (messageHeader), pipeReceiveMessageTimeout); if (bytes == sizeof (messageHeader) && ByteOrder::swapIfBigEndian (messageHeader[0]) == magicMessageHeader) @@ -38466,8 +38461,8 @@ bool InterprocessConnection::readNextMessageInt() return false; const int numThisTime = jmin (bytesInMessage, 65536); - const int bytesIn = (socket != 0) ? socket->read (static_cast (messageData.getData()) + bytesRead, numThisTime, true) - : pipe->read (static_cast (messageData.getData()) + bytesRead, numThisTime, pipeReceiveMessageTimeout); + const int bytesIn = socket != nullptr ? socket->read (static_cast (messageData.getData()) + bytesRead, numThisTime, true) + : pipe ->read (static_cast (messageData.getData()) + bytesRead, numThisTime, pipeReceiveMessageTimeout); if (bytesIn <= 0) break; @@ -38484,7 +38479,7 @@ bool InterprocessConnection::readNextMessageInt() { { const ScopedLock sl (pipeAndSocketLock); - socket = 0; + socket = nullptr; } connectionLostInt(); @@ -38498,7 +38493,7 @@ void InterprocessConnection::run() { while (! threadShouldExit()) { - if (socket != 0) + if (socket != nullptr) { const int ready = socket->waitUntilReady (true, 0); @@ -38506,7 +38501,7 @@ void InterprocessConnection::run() { { const ScopedLock sl (pipeAndSocketLock); - socket = 0; + socket = nullptr; } connectionLostInt(); @@ -38522,13 +38517,13 @@ void InterprocessConnection::run() Thread::sleep (2); } } - else if (pipe != 0) + else if (pipe != nullptr) { if (! pipe->isOpen()) { { const ScopedLock sl (pipeAndSocketLock); - pipe = 0; + pipe = nullptr; } connectionLostInt(); @@ -38576,7 +38571,7 @@ bool InterprocessConnectionServer::beginWaitingForSocket (const int portNumber) return true; } - socket = 0; + socket = nullptr; return false; } @@ -38584,24 +38579,24 @@ void InterprocessConnectionServer::stop() { signalThreadShouldExit(); - if (socket != 0) + if (socket != nullptr) socket->close(); stopThread (4000); - socket = 0; + socket = nullptr; } void InterprocessConnectionServer::run() { - while ((! threadShouldExit()) && socket != 0) + while ((! threadShouldExit()) && socket != nullptr) { ScopedPointer clientSocket (socket->waitForNextConnection()); - if (clientSocket != 0) + if (clientSocket != nullptr) { InterprocessConnection* newConnection = createConnectionObject(); - if (newConnection != 0) + if (newConnection != nullptr) newConnection->initialiseWithSocket (clientSocket.release()); } } @@ -38614,11 +38609,11 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_Message.cpp ***/ BEGIN_JUCE_NAMESPACE -Message::Message() throw() +Message::Message() noexcept : intParameter1 (0), intParameter2 (0), intParameter3 (0), - pointerParameter (0), + pointerParameter (nullptr), messageRecipient (0) { } @@ -38626,7 +38621,7 @@ Message::Message() throw() Message::Message (const int intParameter1_, const int intParameter2_, const int intParameter3_, - void* const pointerParameter_) throw() + void* const pointerParameter_) noexcept : intParameter1 (intParameter1_), intParameter2 (intParameter2_), intParameter3 (intParameter3_), @@ -38646,34 +38641,34 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_MessageListener.cpp ***/ BEGIN_JUCE_NAMESPACE -MessageListener::MessageListener() throw() +MessageListener::MessageListener() noexcept { // are you trying to create a messagelistener before or after juce has been intialised?? - jassert (MessageManager::instance != 0); + jassert (MessageManager::instance != nullptr); - if (MessageManager::instance != 0) + if (MessageManager::instance != nullptr) MessageManager::instance->messageListeners.add (this); } MessageListener::~MessageListener() { - if (MessageManager::instance != 0) + if (MessageManager::instance != nullptr) MessageManager::instance->messageListeners.removeValue (this); } -void MessageListener::postMessage (Message* const message) const throw() +void MessageListener::postMessage (Message* const message) const noexcept { message->messageRecipient = const_cast (this); - if (MessageManager::instance == 0) + if (MessageManager::instance == nullptr) MessageManager::getInstance(); MessageManager::instance->postMessageToQueue (message); } -bool MessageListener::isValidMessageListener() const throw() +bool MessageListener::isValidMessageListener() const noexcept { - return (MessageManager::instance != 0) + return (MessageManager::instance != nullptr) && MessageManager::instance->messageListeners.contains (this); } @@ -38684,11 +38679,11 @@ END_JUCE_NAMESPACE /*** Start of inlined file: juce_MessageManager.cpp ***/ BEGIN_JUCE_NAMESPACE -MessageManager* MessageManager::instance = 0; +MessageManager* MessageManager::instance = nullptr; static const int quitMessageId = 0xfffff321; -MessageManager::MessageManager() throw() +MessageManager::MessageManager() noexcept : quitMessagePosted (false), quitMessageReceived (false), threadWithLock (0) @@ -38699,9 +38694,9 @@ MessageManager::MessageManager() throw() Thread::setCurrentThreadName ("Juce Message Thread"); } -MessageManager::~MessageManager() throw() +MessageManager::~MessageManager() noexcept { - broadcaster = 0; + broadcaster = nullptr; doPlatformSpecificShutdown(); @@ -38709,12 +38704,12 @@ MessageManager::~MessageManager() throw() jassert (messageListeners.size() == 0); jassert (instance == this); - instance = 0; // do this last in case this instance is still needed by doPlatformSpecificShutdown() + instance = nullptr; // do this last in case this instance is still needed by doPlatformSpecificShutdown() } -MessageManager* MessageManager::getInstance() throw() +MessageManager* MessageManager::getInstance() noexcept { - if (instance == 0) + if (instance == nullptr) { instance = new MessageManager(); doPlatformSpecificInitialisation(); @@ -38729,12 +38724,12 @@ void MessageManager::postMessageToQueue (Message* const message) Message::Ptr deleter (message); // (this will delete messages that were just created with a 0 ref count) } -CallbackMessage::CallbackMessage() throw() {} +CallbackMessage::CallbackMessage() noexcept {} CallbackMessage::~CallbackMessage() {} void CallbackMessage::post() { - if (MessageManager::instance != 0) + if (MessageManager::instance != nullptr) MessageManager::instance->postMessageToQueue (this); } @@ -38745,11 +38740,11 @@ void MessageManager::deliverMessage (Message* const message) { MessageListener* const recipient = message->messageRecipient; - if (recipient == 0) + if (recipient == nullptr) { CallbackMessage* const callbackMessage = dynamic_cast (message); - if (callbackMessage != 0) + if (callbackMessage != nullptr) { callbackMessage->messageCallback(); } @@ -38809,13 +38804,13 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor) void MessageManager::deliverBroadcastMessage (const String& value) { - if (broadcaster != 0) + if (broadcaster != nullptr) broadcaster->sendActionMessage (value); } void MessageManager::registerBroadcastListener (ActionListener* const listener) { - if (broadcaster == 0) + if (broadcaster == nullptr) broadcaster = new ActionBroadcaster(); broadcaster->addActionListener (listener); @@ -38823,11 +38818,11 @@ void MessageManager::registerBroadcastListener (ActionListener* const listener) void MessageManager::deregisterBroadcastListener (ActionListener* const listener) { - if (broadcaster != 0) + if (broadcaster != nullptr) broadcaster->removeActionListener (listener); } -bool MessageManager::isThisTheMessageThread() const throw() +bool MessageManager::isThisTheMessageThread() const noexcept { return Thread::getCurrentThreadId() == messageThreadId; } @@ -38846,7 +38841,7 @@ void MessageManager::setCurrentThreadAsMessageThread() } } -bool MessageManager::currentThreadHasLockedMessageManager() const throw() +bool MessageManager::currentThreadHasLockedMessageManager() const noexcept { const Thread::ThreadID thisThread = Thread::getCurrentThreadId(); return thisThread == messageThreadId || thisThread == threadWithLock; @@ -38892,7 +38887,7 @@ MessageManagerLock::MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSi void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const job) { - if (MessageManager::instance != 0) + if (MessageManager::instance != nullptr) { if (MessageManager::instance->currentThreadHasLockedMessageManager()) { @@ -38900,7 +38895,7 @@ void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const } else { - if (threadToCheck == 0 && job == 0) + if (threadToCheck == nullptr && job == nullptr) { MessageManager::instance->lockingLock.enter(); } @@ -38908,8 +38903,8 @@ void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const { while (! MessageManager::instance->lockingLock.tryEnter()) { - if ((threadToCheck != 0 && threadToCheck->threadShouldExit()) - || (job != 0 && job->shouldExit())) + if ((threadToCheck != nullptr && threadToCheck->threadShouldExit()) + || (job != nullptr && job->shouldExit())) return; Thread::sleep (1); @@ -38921,11 +38916,11 @@ void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const while (! blockingMessage->lockedEvent.wait (20)) { - if ((threadToCheck != 0 && threadToCheck->threadShouldExit()) - || (job != 0 && job->shouldExit())) + if ((threadToCheck != nullptr && threadToCheck->threadShouldExit()) + || (job != nullptr && job->shouldExit())) { blockingMessage->releaseEvent.signal(); - blockingMessage = 0; + blockingMessage = nullptr; MessageManager::instance->lockingLock.exit(); return; } @@ -38939,16 +38934,16 @@ void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const } } -MessageManagerLock::~MessageManagerLock() throw() +MessageManagerLock::~MessageManagerLock() noexcept { - if (blockingMessage != 0) + if (blockingMessage != nullptr) { - jassert (MessageManager::instance == 0 || MessageManager::instance->currentThreadHasLockedMessageManager()); + jassert (MessageManager::instance == nullptr || MessageManager::instance->currentThreadHasLockedMessageManager()); blockingMessage->releaseEvent.signal(); - blockingMessage = 0; + blockingMessage = nullptr; - if (MessageManager::instance != 0) + if (MessageManager::instance != nullptr) { MessageManager::instance->threadWithLock = 0; MessageManager::instance->lockingLock.exit(); @@ -38983,11 +38978,11 @@ private: MultiTimer& owner; }; -MultiTimer::MultiTimer() throw() +MultiTimer::MultiTimer() noexcept { } -MultiTimer::MultiTimer (const MultiTimer&) throw() +MultiTimer::MultiTimer (const MultiTimer&) noexcept { } @@ -38997,7 +38992,7 @@ MultiTimer::~MultiTimer() timers.clear(); } -void MultiTimer::startTimer (const int timerId, const int intervalInMilliseconds) throw() +void MultiTimer::startTimer (const int timerId, const int intervalInMilliseconds) noexcept { const SpinLock::ScopedLockType sl (timerListLock); @@ -39017,7 +39012,7 @@ void MultiTimer::startTimer (const int timerId, const int intervalInMilliseconds newTimer->startTimer (intervalInMilliseconds); } -void MultiTimer::stopTimer (const int timerId) throw() +void MultiTimer::stopTimer (const int timerId) noexcept { const SpinLock::ScopedLockType sl (timerListLock); @@ -39030,7 +39025,7 @@ void MultiTimer::stopTimer (const int timerId) throw() } } -bool MultiTimer::isTimerRunning (const int timerId) const throw() +bool MultiTimer::isTimerRunning (const int timerId) const noexcept { const SpinLock::ScopedLockType sl (timerListLock); @@ -39044,7 +39039,7 @@ bool MultiTimer::isTimerRunning (const int timerId) const throw() return false; } -int MultiTimer::getTimerInterval (const int timerId) const throw() +int MultiTimer::getTimerInterval (const int timerId) const noexcept { const SpinLock::ScopedLockType sl (timerListLock); @@ -39073,19 +39068,19 @@ class InternalTimerThread : private Thread, public: InternalTimerThread() : Thread ("Juce Timer"), - firstTimer (0), + firstTimer (nullptr), callbackNeeded (0) { triggerAsyncUpdate(); } - ~InternalTimerThread() throw() + ~InternalTimerThread() noexcept { stopThread (4000); - jassert (instance == this || instance == 0); + jassert (instance == this || instance == nullptr); if (instance == this) - instance = 0; + instance = nullptr; } void run() @@ -39150,7 +39145,7 @@ public: { const SpinLock::ScopedLockType sl (lock); - while (firstTimer != 0 && firstTimer->countdownMs <= 0) + while (firstTimer != nullptr && firstTimer->countdownMs <= 0) { Timer* const t = firstTimer; t->countdownMs = t->periodMs; @@ -39196,33 +39191,33 @@ public: static void callAnyTimersSynchronously() { - if (InternalTimerThread::instance != 0) + if (InternalTimerThread::instance != nullptr) InternalTimerThread::instance->callTimersSynchronously(); } - static inline void add (Timer* const tim) throw() + static inline void add (Timer* const tim) noexcept { - if (instance == 0) + if (instance == nullptr) instance = new InternalTimerThread(); instance->addTimer (tim); } - static inline void remove (Timer* const tim) throw() + static inline void remove (Timer* const tim) noexcept { - if (instance != 0) + if (instance != nullptr) instance->removeTimer (tim); } - static inline void resetCounter (Timer* const tim, const int newCounter) throw() + static inline void resetCounter (Timer* const tim, const int newCounter) noexcept { - if (instance != 0) + if (instance != nullptr) { tim->countdownMs = newCounter; tim->periodMs = newCounter; - if ((tim->next != 0 && tim->next->countdownMs < tim->countdownMs) - || (tim->previous != 0 && tim->previous->countdownMs > tim->countdownMs)) + if ((tim->next != nullptr && tim->next->countdownMs < tim->countdownMs) + || (tim->previous != nullptr && tim->previous->countdownMs > tim->countdownMs)) { instance->removeTimer (tim); instance->addTimer (tim); @@ -39237,12 +39232,12 @@ private: Timer* volatile firstTimer; Atomic callbackNeeded; - void addTimer (Timer* const t) throw() + void addTimer (Timer* const t) noexcept { #if JUCE_DEBUG Timer* tt = firstTimer; - while (tt != 0) + while (tt != nullptr) { // trying to add a timer that's already here - shouldn't get to this point, // so if you get this assertion, let me know! @@ -39251,44 +39246,44 @@ private: tt = tt->next; } - jassert (t->previous == 0 && t->next == 0); + jassert (t->previous == nullptr && t->next == nullptr); #endif Timer* i = firstTimer; - if (i == 0 || i->countdownMs > t->countdownMs) + if (i == nullptr || i->countdownMs > t->countdownMs) { t->next = firstTimer; firstTimer = t; } else { - while (i->next != 0 && i->next->countdownMs <= t->countdownMs) + while (i->next != nullptr && i->next->countdownMs <= t->countdownMs) i = i->next; - jassert (i != 0); + jassert (i != nullptr); t->next = i->next; t->previous = i; i->next = t; } - if (t->next != 0) + if (t->next != nullptr) t->next->previous = t; - jassert ((t->next == 0 || t->next->countdownMs >= t->countdownMs) - && (t->previous == 0 || t->previous->countdownMs <= t->countdownMs)); + jassert ((t->next == nullptr || t->next->countdownMs >= t->countdownMs) + && (t->previous == nullptr || t->previous->countdownMs <= t->countdownMs)); notify(); } - void removeTimer (Timer* const t) throw() + void removeTimer (Timer* const t) noexcept { #if JUCE_DEBUG Timer* tt = firstTimer; bool found = false; - while (tt != 0) + while (tt != nullptr) { if (tt == t) { @@ -39304,7 +39299,7 @@ private: jassert (found); #endif - if (t->previous != 0) + if (t->previous != nullptr) { jassert (firstTimer != t); t->previous->next = t->next; @@ -39315,21 +39310,21 @@ private: firstTimer = t->next; } - if (t->next != 0) + if (t->next != nullptr) t->next->previous = t->previous; - t->next = 0; - t->previous = 0; + t->next = nullptr; + t->previous = nullptr; } int getTimeUntilFirstTimer (const int numMillisecsElapsed) const { const SpinLock::ScopedLockType sl (lock); - for (Timer* t = firstTimer; t != 0; t = t->next) + for (Timer* t = firstTimer; t != nullptr; t = t->next) t->countdownMs -= numMillisecsElapsed; - return firstTimer != 0 ? firstTimer->countdownMs : 1000; + return firstTimer != nullptr ? firstTimer->countdownMs : 1000; } void handleAsyncUpdate() @@ -39340,7 +39335,7 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InternalTimerThread); }; -InternalTimerThread* InternalTimerThread::instance = 0; +InternalTimerThread* InternalTimerThread::instance = nullptr; SpinLock InternalTimerThread::lock; void juce_callAnyTimersSynchronously() @@ -39352,11 +39347,11 @@ void juce_callAnyTimersSynchronously() static SortedSet activeTimers; #endif -Timer::Timer() throw() +Timer::Timer() noexcept : countdownMs (0), periodMs (0), - previous (0), - next (0) + previous (nullptr), + next (nullptr) { #if JUCE_DEBUG const SpinLock::ScopedLockType sl (InternalTimerThread::lock); @@ -39364,11 +39359,11 @@ Timer::Timer() throw() #endif } -Timer::Timer (const Timer&) throw() +Timer::Timer (const Timer&) noexcept : countdownMs (0), periodMs (0), - previous (0), - next (0) + previous (nullptr), + next (nullptr) { #if JUCE_DEBUG const SpinLock::ScopedLockType sl (InternalTimerThread::lock); @@ -39385,7 +39380,7 @@ Timer::~Timer() #endif } -void Timer::startTimer (const int interval) throw() +void Timer::startTimer (const int interval) noexcept { const SpinLock::ScopedLockType sl (InternalTimerThread::lock); @@ -39406,7 +39401,7 @@ void Timer::startTimer (const int interval) throw() } } -void Timer::stopTimer() throw() +void Timer::stopTimer() noexcept { const SpinLock::ScopedLockType sl (InternalTimerThread::lock); @@ -39434,7 +39429,7 @@ BEGIN_JUCE_NAMESPACE #define CHECK_MESSAGE_MANAGER_IS_LOCKED jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager()); -Component* Component::currentlyFocusedComponent = 0; +Component* Component::currentlyFocusedComponent = nullptr; class Component::MouseListenerList { @@ -39482,7 +39477,7 @@ public: { MouseListenerList* const list = comp.mouseListeners; - if (list != 0) + if (list != nullptr) { for (int i = list->listeners.size(); --i >= 0;) { @@ -39498,11 +39493,11 @@ public: Component* p = comp.parentComponent; - while (p != 0) + while (p != nullptr) { MouseListenerList* const list = p->mouseListeners; - if (list != 0 && list->numDeepMouseListeners > 0) + if (list != nullptr && list->numDeepMouseListeners > 0) { BailOutChecker2 checker2 (checker, p); @@ -39527,7 +39522,7 @@ public: { MouseListenerList* const list = comp.mouseListeners; - if (list != 0) + if (list != nullptr) { for (int i = list->listeners.size(); --i >= 0;) { @@ -39543,11 +39538,11 @@ public: Component* p = comp.parentComponent; - while (p != 0) + while (p != nullptr) { MouseListenerList* const list = p->mouseListeners; - if (list != 0 && list->numDeepMouseListeners > 0) + if (list != nullptr && list->numDeepMouseListeners > 0) { BailOutChecker2 checker2 (checker, p); @@ -39578,7 +39573,7 @@ private: { } - bool shouldBailOut() const throw() + bool shouldBailOut() const noexcept { return checker.shouldBailOut() || safePointer == 0; } @@ -39621,7 +39616,7 @@ public: static const Point convertFromParentSpace (const Component& comp, const Point& pointInParentSpace) { - if (comp.affineTransform == 0) + if (comp.affineTransform == nullptr) return pointInParentSpace - comp.getPosition(); return pointInParentSpace.toFloat().transformedBy (comp.affineTransform->inverted()).toInt() - comp.getPosition(); @@ -39629,7 +39624,7 @@ public: static const Rectangle convertFromParentSpace (const Component& comp, const Rectangle& areaInParentSpace) { - if (comp.affineTransform == 0) + if (comp.affineTransform == nullptr) return areaInParentSpace - comp.getPosition(); return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition(); @@ -39637,7 +39632,7 @@ public: static const Point convertToParentSpace (const Component& comp, const Point& pointInLocalSpace) { - if (comp.affineTransform == 0) + if (comp.affineTransform == nullptr) return pointInLocalSpace + comp.getPosition(); return (pointInLocalSpace + comp.getPosition()).toFloat().transformedBy (*comp.affineTransform).toInt(); @@ -39645,7 +39640,7 @@ public: static const Rectangle convertToParentSpace (const Component& comp, const Rectangle& areaInLocalSpace) { - if (comp.affineTransform == 0) + if (comp.affineTransform == nullptr) return areaInLocalSpace + comp.getPosition(); return (areaInLocalSpace + comp.getPosition()).toFloat().transformed (*comp.affineTransform).getSmallestIntegerContainer(); @@ -39655,7 +39650,7 @@ public: static const Type convertFromDistantParentSpace (const Component* parent, const Component& target, Type coordInParent) { const Component* const directParent = target.getParentComponent(); - jassert (directParent != 0); + jassert (directParent != nullptr); if (directParent == parent) return convertFromParentSpace (target, coordInParent); @@ -39666,7 +39661,7 @@ public: template static const Type convertCoordinate (const Component* target, const Component* source, Type p) { - while (source != 0) + while (source != nullptr) { if (source == target) return p; @@ -39677,7 +39672,7 @@ public: if (source->isOnDesktop()) { p = source->getPeer()->localToGlobal (p); - source = 0; + source = nullptr; } else { @@ -39686,8 +39681,8 @@ public: } } - jassert (source == 0); - if (target == 0) + jassert (source == nullptr); + if (target == nullptr) return p; const Component* const topLevelComp = target->getTopLevelComponent(); @@ -39709,7 +39704,7 @@ public: Component* const p = comp.getParentComponent(); - if (p != 0) + if (p != nullptr) r = r.getIntersection (convertFromParentSpace (comp, getUnclippedArea (*p))); return r; @@ -39773,15 +39768,15 @@ public: static const Rectangle getParentOrMainMonitorBounds (const Component& comp) { - return comp.getParentComponent() != 0 ? comp.getParentComponent()->getLocalBounds() - : Desktop::getInstance().getMainMonitorArea(); + return comp.getParentComponent() != nullptr ? comp.getParentComponent()->getLocalBounds() + : Desktop::getInstance().getMainMonitorArea(); } }; Component::Component() - : parentComponent (0), - lookAndFeel (0), - effect (0), + : parentComponent (nullptr), + lookAndFeel (nullptr), + effect (nullptr), componentFlags (0), componentTransparency (0) { @@ -39789,9 +39784,9 @@ Component::Component() Component::Component (const String& name) : componentName (name), - parentComponent (0), - lookAndFeel (0), - effect (0), + parentComponent (nullptr), + lookAndFeel (nullptr), + effect (nullptr), componentFlags (0), componentTransparency (0) { @@ -39810,7 +39805,7 @@ Component::~Component() while (childComponentList.size() > 0) removeChildComponent (childComponentList.size() - 1, false, true); - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->removeChildComponent (parentComponent->childComponentList.indexOf (this), true, false); else if (currentlyFocusedComponent == this || isParentOf (currentlyFocusedComponent)) giveAwayFocus (currentlyFocusedComponent != this); @@ -39841,8 +39836,8 @@ void Component::setName (const String& name) { ComponentPeer* const peer = getPeer(); - jassert (peer != 0); - if (peer != 0) + jassert (peer != nullptr); + if (peer != nullptr) peer->setTitle (name); } @@ -39876,23 +39871,23 @@ void Component::setVisible (bool shouldBeVisible) { if (currentlyFocusedComponent == this || isParentOf (currentlyFocusedComponent)) { - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->grabKeyboardFocus(); else giveAwayFocus (true); } } - if (safePointer != 0) + if (safePointer != nullptr) { sendVisibilityChangeMessage(); - if (safePointer != 0 && flags.hasHeavyweightPeerFlag) + if (safePointer != nullptr && flags.hasHeavyweightPeerFlag) { ComponentPeer* const peer = getPeer(); - jassert (peer != 0); - if (peer != 0) + jassert (peer != nullptr); + if (peer != nullptr) { peer->setVisible (shouldBeVisible); internalHierarchyChanged(); @@ -39920,7 +39915,7 @@ bool Component::isShowing() const { if (flags.visibleFlag) { - if (parentComponent != 0) + if (parentComponent != nullptr) { return parentComponent->isShowing(); } @@ -39928,7 +39923,7 @@ bool Component::isShowing() const { const ComponentPeer* const peer = getPeer(); - return peer != 0 && ! peer->isMinimised(); + return peer != nullptr && ! peer->isMinimised(); } } @@ -39939,7 +39934,7 @@ void* Component::getWindowHandle() const { const ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) return peer->getNativeHandle(); return 0; @@ -39962,7 +39957,7 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) // for this comp, and not for one of its parents. ComponentPeer* peer = ComponentPeer::getPeerFor (this); - if (peer != 0) + if (peer != nullptr) currentStyleFlags = peer->getStyleFlags(); if (styleWanted != currentStyleFlags || ! flags.hasHeavyweightPeerFlag) @@ -39981,10 +39976,10 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) bool wasFullscreen = false; bool wasMinimised = false; - ComponentBoundsConstrainer* currentConstainer = 0; + ComponentBoundsConstrainer* currentConstainer = nullptr; Rectangle oldNonFullScreenBounds; - if (peer != 0) + if (peer != nullptr) { wasFullscreen = peer->isFullScreen(); wasMinimised = peer->isMinimised(); @@ -39996,10 +39991,10 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) setTopLeftPosition (topLeft.getX(), topLeft.getY()); } - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->removeChildComponent (this); - if (safePointer != 0) + if (safePointer != nullptr) { flags.hasHeavyweightPeerFlag = true; @@ -40045,14 +40040,14 @@ void Component::removeFromDesktop() flags.hasHeavyweightPeerFlag = false; - jassert (peer != 0); + jassert (peer != nullptr); delete peer; Desktop::getInstance().removeDesktopComponent (this); } } -bool Component::isOnDesktop() const throw() +bool Component::isOnDesktop() const noexcept { return flags.hasHeavyweightPeerFlag; } @@ -40083,7 +40078,7 @@ void Component::setOpaque (const bool shouldBeOpaque) { const ComponentPeer* const peer = ComponentPeer::getPeerFor (this); - if (peer != 0) + if (peer != nullptr) { // to make it recreate the heavyweight window addToDesktop (peer->getStyleFlags()); @@ -40094,7 +40089,7 @@ void Component::setOpaque (const bool shouldBeOpaque) } } -bool Component::isOpaque() const throw() +bool Component::isOpaque() const noexcept { return flags.opaqueFlag; } @@ -40113,7 +40108,7 @@ void Component::moveChildInternal (const int sourceIndex, const int destIndex) if (sourceIndex != destIndex) { Component* const c = childComponentList.getUnchecked (sourceIndex); - jassert (c != 0); + jassert (c != nullptr); c->repaintParent(); childComponentList.move (sourceIndex, destIndex); @@ -40133,7 +40128,7 @@ void Component::toFront (const bool setAsForeground) { ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) { peer->toFront (setAsForeground); @@ -40141,7 +40136,7 @@ void Component::toFront (const bool setAsForeground) grabKeyboardFocus(); } } - else if (parentComponent != 0) + else if (parentComponent != nullptr) { const Array& childList = parentComponent->childComponentList; @@ -40175,12 +40170,12 @@ void Component::toFront (const bool setAsForeground) void Component::toBehind (Component* const other) { - if (other != 0 && other != this) + if (other != nullptr && other != this) { // the two components must belong to the same parent.. jassert (parentComponent == other->parentComponent); - if (parentComponent != 0) + if (parentComponent != nullptr) { const Array& childList = parentComponent->childComponentList; const int index = childList.indexOf (this); @@ -40207,8 +40202,8 @@ void Component::toBehind (Component* const other) ComponentPeer* const us = getPeer(); ComponentPeer* const them = other->getPeer(); - jassert (us != 0 && them != 0); - if (us != 0 && them != 0) + jassert (us != nullptr && them != nullptr); + if (us != nullptr && them != nullptr) us->toBehind (them); } } @@ -40221,7 +40216,7 @@ void Component::toBack() { jassertfalse; //xxx need to add this to native window } - else if (parentComponent != 0) + else if (parentComponent != nullptr) { const Array& childList = parentComponent->childComponentList; @@ -40253,8 +40248,8 @@ void Component::setAlwaysOnTop (const bool shouldStayOnTop) { ComponentPeer* const peer = getPeer(); - jassert (peer != 0); - if (peer != 0) + jassert (peer != nullptr); + if (peer != nullptr) { if (! peer->setAlwaysOnTop (shouldStayOnTop)) { @@ -40274,31 +40269,31 @@ void Component::setAlwaysOnTop (const bool shouldStayOnTop) } } -bool Component::isAlwaysOnTop() const throw() +bool Component::isAlwaysOnTop() const noexcept { return flags.alwaysOnTopFlag; } -int Component::proportionOfWidth (const float proportion) const throw() +int Component::proportionOfWidth (const float proportion) const noexcept { return roundToInt (proportion * bounds.getWidth()); } -int Component::proportionOfHeight (const float proportion) const throw() +int Component::proportionOfHeight (const float proportion) const noexcept { return roundToInt (proportion * bounds.getHeight()); } -int Component::getParentWidth() const throw() +int Component::getParentWidth() const noexcept { - return (parentComponent != 0) ? parentComponent->getWidth() - : getParentMonitorArea().getWidth(); + return parentComponent != nullptr ? parentComponent->getWidth() + : getParentMonitorArea().getWidth(); } -int Component::getParentHeight() const throw() +int Component::getParentHeight() const noexcept { - return (parentComponent != 0) ? parentComponent->getHeight() - : getParentMonitorArea().getHeight(); + return parentComponent != nullptr ? parentComponent->getHeight() + : getParentMonitorArea().getHeight(); } int Component::getScreenX() const { return getScreenPosition().getX(); } @@ -40340,8 +40335,8 @@ const Point Component::globalPositionToRelative (const Point& screenPo const Point Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point& positionRelativeToThis) const { - return targetComponent == 0 ? localPointToGlobal (positionRelativeToThis) - : targetComponent->getLocalPoint (this, positionRelativeToThis); + return targetComponent == nullptr ? localPointToGlobal (positionRelativeToThis) + : targetComponent->getLocalPoint (this, positionRelativeToThis); } void Component::setBounds (const int x, const int y, int w, int h) @@ -40391,7 +40386,7 @@ void Component::setBounds (const int x, const int y, int w, int h) { ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) { if (wasMoved && wasResized) peer->setBounds (getX(), getY(), getWidth(), getHeight(), false); @@ -40436,7 +40431,7 @@ void Component::sendMovedResizedMessages (const bool wasMoved, const bool wasRes } } - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->childBoundsChanged (this); if (! checker.shouldBailOut()) @@ -40553,9 +40548,9 @@ void Component::setBoundsToFit (int x, int y, int width, int height, } } -bool Component::isTransformed() const throw() +bool Component::isTransformed() const noexcept { - return affineTransform != 0; + return affineTransform != nullptr; } void Component::setTransform (const AffineTransform& newTransform) @@ -40566,16 +40561,16 @@ void Component::setTransform (const AffineTransform& newTransform) if (newTransform.isIdentity()) { - if (affineTransform != 0) + if (affineTransform != nullptr) { repaint(); - affineTransform = 0; + affineTransform = nullptr; repaint(); sendMovedResizedMessages (false, false); } } - else if (affineTransform == 0) + else if (affineTransform == nullptr) { repaint(); affineTransform = new AffineTransform (newTransform); @@ -40593,7 +40588,7 @@ void Component::setTransform (const AffineTransform& newTransform) const AffineTransform Component::getTransform() const { - return affineTransform != 0 ? *affineTransform : AffineTransform::identity; + return affineTransform != nullptr ? *affineTransform : AffineTransform::identity; } bool Component::hitTest (int x, int y) @@ -40617,14 +40612,14 @@ bool Component::hitTest (int x, int y) } void Component::setInterceptsMouseClicks (const bool allowClicks, - const bool allowClicksOnChildComponents) throw() + const bool allowClicksOnChildComponents) noexcept { flags.ignoresMouseClicksFlag = ! allowClicks; flags.allowChildMouseClicksFlag = allowClicksOnChildComponents; } void Component::getInterceptsMouseClicks (bool& allowsClicksOnThisComponent, - bool& allowsClicksOnChildComponents) const throw() + bool& allowsClicksOnChildComponents) const noexcept { allowsClicksOnThisComponent = ! flags.ignoresMouseClicksFlag; allowsClicksOnChildComponents = flags.allowChildMouseClicksFlag; @@ -40634,7 +40629,7 @@ bool Component::contains (const Point& point) { if (ComponentHelpers::hitTest (*this, point)) { - if (parentComponent != 0) + if (parentComponent != nullptr) { return parentComponent->contains (ComponentHelpers::convertToParentSpace (*this, point)); } @@ -40642,7 +40637,7 @@ bool Component::contains (const Point& point) { const ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) return peer->contains (point, true); } } @@ -40670,7 +40665,7 @@ Component* Component::getComponentAt (const Point& position) Component* child = childComponentList.getUnchecked(i); child = child->getComponentAt (ComponentHelpers::convertFromParentSpace (*child, position)); - if (child != 0) + if (child != nullptr) return child; } @@ -40691,9 +40686,9 @@ void Component::addChildComponent (Component* const child, int zOrder) // thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe. CHECK_MESSAGE_MANAGER_IS_LOCKED - if (child != 0 && child->parentComponent != this) + if (child != nullptr && child->parentComponent != this) { - if (child->parentComponent != 0) + if (child->parentComponent != nullptr) child->parentComponent->removeChildComponent (child); else child->removeFromDesktop(); @@ -40726,7 +40721,7 @@ void Component::addChildComponent (Component* const child, int zOrder) void Component::addAndMakeVisible (Component* const child, int zOrder) { - if (child != 0) + if (child != nullptr) { child->setVisible (true); addChildComponent (child, zOrder); @@ -40751,7 +40746,7 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven Component* const child = childComponentList [index]; - if (child != 0) + if (child != nullptr) { sendParentEvents = sendParentEvents && child->isShowing(); @@ -40762,7 +40757,7 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven } childComponentList.remove (index); - child->parentComponent = 0; + child->parentComponent = nullptr; // (NB: there are obscure situations where child->isShowing() = false, but it still has the focus) if (currentlyFocusedComponent == child || child->isParentOf (currentlyFocusedComponent)) @@ -40773,7 +40768,7 @@ Component* Component::removeChildComponent (const int index, bool sendParentEven giveAwayFocus (sendChildEvents || currentlyFocusedComponent != child); - if (thisPointer == 0) + if (thisPointer == nullptr) return child; grabKeyboardFocus(); @@ -40806,34 +40801,34 @@ void Component::deleteAllChildren() delete (removeChildComponent (childComponentList.size() - 1)); } -int Component::getNumChildComponents() const throw() +int Component::getNumChildComponents() const noexcept { return childComponentList.size(); } -Component* Component::getChildComponent (const int index) const throw() +Component* Component::getChildComponent (const int index) const noexcept { return childComponentList [index]; } -int Component::getIndexOfChildComponent (const Component* const child) const throw() +int Component::getIndexOfChildComponent (const Component* const child) const noexcept { return childComponentList.indexOf (const_cast (child)); } -Component* Component::getTopLevelComponent() const throw() +Component* Component::getTopLevelComponent() const noexcept { const Component* comp = this; - while (comp->parentComponent != 0) + while (comp->parentComponent != nullptr) comp = comp->parentComponent; return const_cast (comp); } -bool Component::isParentOf (const Component* possibleChild) const throw() +bool Component::isParentOf (const Component* possibleChild) const noexcept { - while (possibleChild != 0) + while (possibleChild != nullptr) { possibleChild = possibleChild->parentComponent; @@ -40984,7 +40979,7 @@ void Component::exitModalState (const int returnValue) void messageCallback() { - if (target.get() != 0) // (get() required for VS2003 bug) + if (target.get() != nullptr) // (get() required for VS2003 bug) target->exitModalState (result); } @@ -40998,7 +40993,7 @@ void Component::exitModalState (const int returnValue) } } -bool Component::isCurrentlyModal() const throw() +bool Component::isCurrentlyModal() const noexcept { return flags.currentlyModalFlag && getCurrentlyModalComponent() == this; @@ -41008,26 +41003,26 @@ bool Component::isCurrentlyBlockedByAnotherModalComponent() const { Component* const mc = getCurrentlyModalComponent(); - return ! (mc == 0 || mc == this || mc->isParentOf (this) + return ! (mc == nullptr || mc == this || mc->isParentOf (this) || mc->canModalEventBeSentToComponent (this)); } -int JUCE_CALLTYPE Component::getNumCurrentlyModalComponents() throw() +int JUCE_CALLTYPE Component::getNumCurrentlyModalComponents() noexcept { return ModalComponentManager::getInstance()->getNumModalComponents(); } -Component* JUCE_CALLTYPE Component::getCurrentlyModalComponent (int index) throw() +Component* JUCE_CALLTYPE Component::getCurrentlyModalComponent (int index) noexcept { return ModalComponentManager::getInstance()->getModalComponent (index); } -void Component::setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) throw() +void Component::setBroughtToFrontOnMouseClick (const bool shouldBeBroughtToFront) noexcept { flags.bringToFrontOnClickFlag = shouldBeBroughtToFront; } -bool Component::isBroughtToFrontOnMouseClick() const throw() +bool Component::isBroughtToFrontOnMouseClick() const noexcept { return flags.bringToFrontOnClickFlag; } @@ -41053,7 +41048,7 @@ void Component::updateMouseCursor() const sendFakeMouseMove(); } -void Component::setRepaintsOnMouseActivity (const bool shouldRepaint) throw() +void Component::setRepaintsOnMouseActivity (const bool shouldRepaint) noexcept { flags.repaintOnMouseActivityFlag = shouldRepaint; } @@ -41070,7 +41065,7 @@ void Component::setAlpha (const float newAlpha) { ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) peer->setAlpha (newAlpha); } else @@ -41138,11 +41133,11 @@ void Component::internalRepaint (int x, int y, int w, int h) if (h > 0) { - if (parentComponent != 0) + if (parentComponent != nullptr) { if (parentComponent->flags.visibleFlag) { - if (affineTransform == 0) + if (affineTransform == nullptr) { parentComponent->internalRepaint (x + getX(), y + getY(), w, h); } @@ -41157,7 +41152,7 @@ void Component::internalRepaint (int x, int y, int w, int h) { ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) peer->repaint (Rectangle (x, y, w, h)); } } @@ -41217,7 +41212,7 @@ void Component::paintComponentAndChildren (Graphics& g) if (child.isVisible()) { - if (child.affineTransform != 0) + if (child.affineTransform != nullptr) { g.saveState(); g.addTransform (*child.affineTransform); @@ -41243,7 +41238,7 @@ void Component::paintComponentAndChildren (Graphics& g) { const Component& sibling = *childComponentList.getUnchecked (j); - if (sibling.flags.opaqueFlag && sibling.isVisible() && sibling.affineTransform == 0) + if (sibling.flags.opaqueFlag && sibling.isVisible() && sibling.affineTransform == nullptr) { nothingClipped = false; g.excludeClipRegion (sibling.getBounds()); @@ -41272,7 +41267,7 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel) flags.isInsidePaintCall = true; #endif - if (effect != 0) + if (effect != nullptr) { Image effectImage (flags.opaqueFlag ? Image::RGB : Image::ARGB, getWidth(), getHeight(), ! flags.opaqueFlag, Image::NativeImage); @@ -41302,7 +41297,7 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel) #endif } -void Component::setPaintingIsUnclipped (const bool shouldPaintWithoutClipping) throw() +void Component::setPaintingIsUnclipped (const bool shouldPaintWithoutClipping) noexcept { flags.dontClipGraphicsFlag = shouldPaintWithoutClipping; } @@ -41336,18 +41331,18 @@ void Component::setComponentEffect (ImageEffectFilter* const newEffect) } } -LookAndFeel& Component::getLookAndFeel() const throw() +LookAndFeel& Component::getLookAndFeel() const noexcept { const Component* c = this; do { - if (c->lookAndFeel != 0) + if (c->lookAndFeel != nullptr) return *(c->lookAndFeel); c = c->parentComponent; } - while (c != 0); + while (c != nullptr); return LookAndFeel::getDefaultLookAndFeel(); } @@ -41374,13 +41369,13 @@ void Component::sendLookAndFeelChange() lookAndFeelChanged(); - if (safePointer != 0) + if (safePointer != nullptr) { for (int i = childComponentList.size(); --i >= 0;) { childComponentList.getUnchecked (i)->sendLookAndFeelChange(); - if (safePointer == 0) + if (safePointer == nullptr) return; i = jmin (i, childComponentList.size()); @@ -41392,10 +41387,10 @@ const Colour Component::findColour (const int colourId, const bool inheritFromPa { var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId)); - if (v != 0) + if (v != nullptr) return Colour ((int) *v); - if (inheritFromParent && parentComponent != 0) + if (inheritFromParent && parentComponent != nullptr) return parentComponent->findColour (colourId, true); return getLookAndFeel().findColour (colourId); @@ -41444,12 +41439,12 @@ MarkerList* Component::getMarkers (bool /*xAxis*/) return 0; } -Component::Positioner::Positioner (Component& component_) throw() +Component::Positioner::Positioner (Component& component_) noexcept : component (component_) { } -Component::Positioner* Component::getPositioner() const throw() +Component::Positioner* Component::getPositioner() const noexcept { return positioner; } @@ -41457,19 +41452,19 @@ Component::Positioner* Component::getPositioner() const throw() void Component::setPositioner (Positioner* newPositioner) { // You can only assign a positioner to the component that it was created for! - jassert (newPositioner == 0 || this == &(newPositioner->getComponent())); + jassert (newPositioner == nullptr || this == &(newPositioner->getComponent())); positioner = newPositioner; } -const Rectangle Component::getLocalBounds() const throw() +const Rectangle Component::getLocalBounds() const noexcept { return Rectangle (getWidth(), getHeight()); } -const Rectangle Component::getBoundsInParent() const throw() +const Rectangle Component::getBoundsInParent() const noexcept { - return affineTransform == 0 ? bounds - : bounds.toFloat().transformed (*affineTransform).getSmallestIntegerContainer(); + return affineTransform == nullptr ? bounds + : bounds.toFloat().transformed (*affineTransform).getSmallestIntegerContainer(); } void Component::getVisibleArea (RectangleList& result, const bool includeSiblings) const @@ -41533,7 +41528,7 @@ void Component::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, floa { // the base class just passes this event up to its parent.. - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->mouseWheelMove (e.getEventRelativeTo (parentComponent), wheelIncrementX, wheelIncrementY); } @@ -41587,7 +41582,7 @@ void Component::internalModalInputAttempt() { Component* const current = getCurrentlyModalComponent(); - if (current != 0) + if (current != nullptr) current->inputAttemptWhenModal(); } @@ -41613,7 +41608,7 @@ void Component::postCommandMessage (const int commandId) void messageCallback() { - if (target.get() != 0) // (get() required for VS2003 bug) + if (target.get() != nullptr) // (get() required for VS2003 bug) target->handleCommandMessage (commandId); } @@ -41641,7 +41636,7 @@ void Component::addMouseListener (MouseListener* const newListener, // twice - once via the direct callback that all components get anyway, and then again as a listener! jassert ((newListener != this) || wantsEventsForAllNestedChildComponents); - if (mouseListeners == 0) + if (mouseListeners == nullptr) mouseListeners = new MouseListenerList(); mouseListeners->addListener (newListener, wantsEventsForAllNestedChildComponents); @@ -41653,7 +41648,7 @@ void Component::removeMouseListener (MouseListener* const listenerToRemove) // thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe. CHECK_MESSAGE_MANAGER_IS_LOCKED - if (mouseListeners != 0) + if (mouseListeners != nullptr) mouseListeners->removeListener (listenerToRemove); } @@ -41759,7 +41754,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point& r { Component* c = this; - while (c != 0) + while (c != nullptr) { if (c->isBroughtToFrontOnMouseClick()) { @@ -41972,7 +41967,7 @@ void Component::internalBroughtToFront() // we need to bring the modal one to the front instead.. Component* const cm = getCurrentlyModalComponent(); - if (cm != 0 && cm->getTopLevelComponent() != getTopLevelComponent()) + if (cm != nullptr && cm->getTopLevelComponent() != getTopLevelComponent()) ModalComponentManager::getInstance()->bringModalComponentsToFront (false); // very important that this is false, otherwise in win32, // non-front components can't get focus when another modal comp is // active, and therefore can't receive mouse-clicks @@ -41992,7 +41987,7 @@ void Component::internalFocusGain (const FocusChangeType cause, const WeakRefere { focusGained (cause); - if (safePointer != 0) + if (safePointer != nullptr) internalChildFocusChange (cause, safePointer); } @@ -42007,7 +42002,7 @@ void Component::internalFocusLoss (const FocusChangeType cause) focusLost (focusChangedDirectly); - if (safePointer != 0) + if (safePointer != nullptr) internalChildFocusChange (cause, safePointer); } @@ -42026,18 +42021,18 @@ void Component::internalChildFocusChange (FocusChangeType cause, const WeakRefer focusOfChildComponentChanged (cause); - if (safePointer == 0) + if (safePointer == nullptr) return; } - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->internalChildFocusChange (cause, WeakReference (parentComponent)); } -bool Component::isEnabled() const throw() +bool Component::isEnabled() const noexcept { return (! flags.isDisabledFlag) - && (parentComponent == 0 || parentComponent->isEnabled()); + && (parentComponent == nullptr || parentComponent->isEnabled()); } void Component::setEnabled (const bool shouldBeEnabled) @@ -42048,7 +42043,7 @@ void Component::setEnabled (const bool shouldBeEnabled) // if any parent components are disabled, setting our flag won't make a difference, // so no need to send a change message - if (parentComponent == 0 || parentComponent->isEnabled()) + if (parentComponent == nullptr || parentComponent->isEnabled()) sendEnablementChangeMessage(); } } @@ -42059,18 +42054,18 @@ void Component::sendEnablementChangeMessage() enablementChanged(); - if (safePointer == 0) + if (safePointer == nullptr) return; for (int i = getNumChildComponents(); --i >= 0;) { Component* const c = getChildComponent (i); - if (c != 0) + if (c != nullptr) { c->sendEnablementChangeMessage(); - if (safePointer == 0) + if (safePointer == nullptr) return; } } @@ -42080,7 +42075,7 @@ void Component::enablementChanged() { } -void Component::setWantsKeyboardFocus (const bool wantsFocus) throw() +void Component::setWantsKeyboardFocus (const bool wantsFocus) noexcept { flags.wantsFocusFlag = wantsFocus; } @@ -42090,22 +42085,22 @@ void Component::setMouseClickGrabsKeyboardFocus (const bool shouldGrabFocus) flags.dontFocusOnMouseClickFlag = ! shouldGrabFocus; } -bool Component::getMouseClickGrabsKeyboardFocus() const throw() +bool Component::getMouseClickGrabsKeyboardFocus() const noexcept { return ! flags.dontFocusOnMouseClickFlag; } -bool Component::getWantsKeyboardFocus() const throw() +bool Component::getWantsKeyboardFocus() const noexcept { return flags.wantsFocusFlag && ! flags.isDisabledFlag; } -void Component::setFocusContainer (const bool shouldBeFocusContainer) throw() +void Component::setFocusContainer (const bool shouldBeFocusContainer) noexcept { flags.isFocusContainerFlag = shouldBeFocusContainer; } -bool Component::isFocusContainer() const throw() +bool Component::isFocusContainer() const noexcept { return flags.isFocusContainerFlag; } @@ -42124,7 +42119,7 @@ void Component::setExplicitFocusOrder (const int newFocusOrderIndex) KeyboardFocusTraverser* Component::createFocusTraverser() { - if (flags.isFocusContainerFlag || parentComponent == 0) + if (flags.isFocusContainerFlag || parentComponent == nullptr) return new KeyboardFocusTraverser(); return parentComponent->createFocusTraverser(); @@ -42138,7 +42133,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause) // get the focus onto our desktop window ComponentPeer* const peer = getPeer(); - if (peer != 0) + if (peer != nullptr) { WeakReference safePointer (this); @@ -42154,7 +42149,7 @@ void Component::takeKeyboardFocus (const FocusChangeType cause) // call this after setting currentlyFocusedComponent so that the one that's // losing it has a chance to see where focus is going - if (componentLosingFocus != 0) + if (componentLosingFocus != nullptr) componentLosingFocus->internalFocusLoss (cause); if (currentlyFocusedComponent == this) @@ -42168,7 +42163,7 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr { if (isShowing()) { - if (flags.wantsFocusFlag && (isEnabled() || parentComponent == 0)) + if (flags.wantsFocusFlag && (isEnabled() || parentComponent == nullptr)) { takeKeyboardFocus (cause); } @@ -42184,19 +42179,19 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr // find the default child component.. ScopedPointer traverser (createFocusTraverser()); - if (traverser != 0) + if (traverser != nullptr) { Component* const defaultComp = traverser->getDefaultComponent (this); - traverser = 0; + traverser = nullptr; - if (defaultComp != 0) + if (defaultComp != nullptr) { defaultComp->grabFocusInternal (cause, false); return; } } - if (canTryParent && parentComponent != 0) + if (canTryParent && parentComponent != nullptr) { // if no children want it and we're allowed to try our parent comp, // then pass up to parent, which will try our siblings. @@ -42222,24 +42217,24 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext) // thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe. CHECK_MESSAGE_MANAGER_IS_LOCKED - if (parentComponent != 0) + if (parentComponent != nullptr) { ScopedPointer traverser (createFocusTraverser()); - if (traverser != 0) + if (traverser != nullptr) { Component* const nextComp = moveToNext ? traverser->getNextComponent (this) : traverser->getPreviousComponent (this); - traverser = 0; + traverser = nullptr; - if (nextComp != 0) + if (nextComp != nullptr) { if (nextComp->isCurrentlyBlockedByAnotherModalComponent()) { WeakReference nextCompPointer (nextComp); internalModalInputAttempt(); - if (nextCompPointer == 0 || nextComp->isCurrentlyBlockedByAnotherModalComponent()) + if (nextCompPointer == nullptr || nextComp->isCurrentlyBlockedByAnotherModalComponent()) return; } @@ -42258,7 +42253,7 @@ bool Component::hasKeyboardFocus (const bool trueIfChildIsFocused) const || (trueIfChildIsFocused && isParentOf (currentlyFocusedComponent)); } -Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() throw() +Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() noexcept { return currentlyFocusedComponent; } @@ -42266,9 +42261,9 @@ Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() throw() void Component::giveAwayFocus (const bool sendFocusLossEvent) { Component* const componentLosingFocus = currentlyFocusedComponent; - currentlyFocusedComponent = 0; + currentlyFocusedComponent = nullptr; - if (sendFocusLossEvent && componentLosingFocus != 0) + if (sendFocusLossEvent && componentLosingFocus != nullptr) componentLosingFocus->internalFocusLoss (focusChangedDirectly); Desktop::getInstance().triggerFocusCallback(); @@ -42295,10 +42290,10 @@ bool Component::isMouseOver (const bool includeChildren) const return false; } -bool Component::isMouseButtonDown() const throw() { return flags.mouseDownFlag; } -bool Component::isMouseOverOrDragging() const throw() { return flags.mouseOverFlag || flags.mouseDownFlag; } +bool Component::isMouseButtonDown() const noexcept { return flags.mouseDownFlag; } +bool Component::isMouseOverOrDragging() const noexcept { return flags.mouseOverFlag || flags.mouseDownFlag; } -bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw() +bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() noexcept { return ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown(); } @@ -42315,7 +42310,7 @@ const Rectangle Component::getParentMonitorArea() const void Component::addKeyListener (KeyListener* const newListener) { - if (keyListeners == 0) + if (keyListeners == nullptr) keyListeners = new Array (); keyListeners->addIfNotAlreadyThere (newListener); @@ -42323,7 +42318,7 @@ void Component::addKeyListener (KeyListener* const newListener) void Component::removeKeyListener (KeyListener* const listenerToRemove) { - if (keyListeners != 0) + if (keyListeners != nullptr) keyListeners->removeValue (listenerToRemove); } @@ -42339,7 +42334,7 @@ bool Component::keyStateChanged (const bool /*isKeyDown*/) void Component::modifierKeysChanged (const ModifierKeys& modifiers) { - if (parentComponent != 0) + if (parentComponent != nullptr) parentComponent->modifierKeysChanged (modifiers); } @@ -42354,7 +42349,7 @@ ComponentPeer* Component::getPeer() const { if (flags.hasHeavyweightPeerFlag) return ComponentPeer::getPeerFor (this); - else if (parentComponent == 0) + else if (parentComponent == nullptr) return 0; return parentComponent->getPeer(); @@ -42363,12 +42358,12 @@ ComponentPeer* Component::getPeer() const Component::BailOutChecker::BailOutChecker (Component* const component) : safePointer (component) { - jassert (component != 0); + jassert (component != nullptr); } -bool Component::BailOutChecker::shouldBailOut() const throw() +bool Component::BailOutChecker::shouldBailOut() const noexcept { - return safePointer == 0; + return safePointer == nullptr; } END_JUCE_NAMESPACE @@ -42396,7 +42391,7 @@ BEGIN_JUCE_NAMESPACE Desktop::Desktop() : mouseClickCounter (0), - kioskModeComponent (0), + kioskModeComponent (nullptr), allowedOrientations (allOrientations) { createMouseInputSources(); @@ -42406,7 +42401,7 @@ Desktop::Desktop() Desktop::~Desktop() { jassert (instance == this); - instance = 0; + instance = nullptr; // doh! If you don't delete all your windows before exiting, you're going to // be leaking memory! @@ -42415,13 +42410,13 @@ Desktop::~Desktop() Desktop& JUCE_CALLTYPE Desktop::getInstance() { - if (instance == 0) + if (instance == nullptr) instance = new Desktop(); return *instance; } -Desktop* Desktop::instance = 0; +Desktop* Desktop::instance = nullptr; void Desktop::refreshMonitorSizes() { @@ -42439,24 +42434,24 @@ void Desktop::refreshMonitorSizes() for (int i = ComponentPeer::getNumPeers(); --i >= 0;) { ComponentPeer* const p = ComponentPeer::getPeer (i); - if (p != 0) + if (p != nullptr) p->handleScreenSizeChange(); } } } -int Desktop::getNumDisplayMonitors() const throw() +int Desktop::getNumDisplayMonitors() const noexcept { return monitorCoordsClipped.size(); } -const Rectangle Desktop::getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const throw() +const Rectangle Desktop::getDisplayMonitorCoordinates (const int index, const bool clippedToWorkArea) const noexcept { return clippedToWorkArea ? monitorCoordsClipped [index] : monitorCoordsUnclipped [index]; } -const RectangleList Desktop::getAllMonitorDisplayAreas (const bool clippedToWorkArea) const throw() +const RectangleList Desktop::getAllMonitorDisplayAreas (const bool clippedToWorkArea) const { RectangleList rl; @@ -42466,7 +42461,7 @@ const RectangleList Desktop::getAllMonitorDisplayAreas (const bool clippedToWork return rl; } -const Rectangle Desktop::getMainMonitorArea (const bool clippedToWorkArea) const throw() +const Rectangle Desktop::getMainMonitorArea (const bool clippedToWorkArea) const noexcept { return getDisplayMonitorCoordinates (0, clippedToWorkArea); } @@ -42495,12 +42490,12 @@ const Rectangle Desktop::getMonitorAreaContaining (const Point& positi return best; } -int Desktop::getNumComponents() const throw() +int Desktop::getNumComponents() const noexcept { return desktopComponents.size(); } -Component* Desktop::getComponent (const int index) const throw() +Component* Desktop::getComponent (const int index) const noexcept { return desktopComponents [index]; } @@ -42525,7 +42520,7 @@ Component* Desktop::findComponentAt (const Point& screenPosition) const void Desktop::addDesktopComponent (Component* const c) { - jassert (c != 0); + jassert (c != nullptr); jassert (! desktopComponents.contains (c)); desktopComponents.addIfNotAlreadyThere (c); } @@ -42573,12 +42568,12 @@ int Desktop::getMouseButtonClickCounter() return getInstance().mouseClickCounter; } -void Desktop::incrementMouseClickCounter() throw() +void Desktop::incrementMouseClickCounter() noexcept { ++mouseClickCounter; } -int Desktop::getNumDraggingMouseSources() const throw() +int Desktop::getNumDraggingMouseSources() const noexcept { int num = 0; for (int i = mouseSources.size(); --i >= 0;) @@ -42588,7 +42583,7 @@ int Desktop::getNumDraggingMouseSources() const throw() return num; } -MouseInputSource* Desktop::getDraggingMouseSource (int index) const throw() +MouseInputSource* Desktop::getDraggingMouseSource (int index) const noexcept { int num = 0; for (int i = mouseSources.size(); --i >= 0;) @@ -42639,7 +42634,7 @@ void Desktop::beginDragAutoRepeat (const int interval) { if (interval > 0) { - if (dragRepeater == 0) + if (dragRepeater == nullptr) dragRepeater = new MouseDragAutoRepeater(); if (dragRepeater->getTimerInterval() != interval) @@ -42647,7 +42642,7 @@ void Desktop::beginDragAutoRepeat (const int interval) } else { - dragRepeater = 0; + dragRepeater = nullptr; } } @@ -42702,7 +42697,7 @@ void Desktop::sendMouseMove() Component* const target = findComponentAt (lastFakeMouseMove); - if (target != 0) + if (target != nullptr) { Component::BailOutChecker checker (target); const Point pos (target->getLocalPoint (0, lastFakeMouseMove)); @@ -42734,9 +42729,9 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow if (kioskModeComponent != componentToUse) { // agh! Don't delete or remove a component from the desktop while it's still the kiosk component! - jassert (kioskModeComponent == 0 || ComponentPeer::getPeerFor (kioskModeComponent) != 0); + jassert (kioskModeComponent == nullptr || ComponentPeer::getPeerFor (kioskModeComponent) != nullptr); - if (kioskModeComponent != 0) + if (kioskModeComponent != nullptr) { setKioskComponent (kioskModeComponent, false, allowMenusAndBars); @@ -42745,10 +42740,10 @@ void Desktop::setKioskModeComponent (Component* componentToUse, const bool allow kioskModeComponent = componentToUse; - if (kioskModeComponent != 0) + if (kioskModeComponent != nullptr) { // Only components that are already on the desktop can be put into kiosk mode! - jassert (ComponentPeer::getPeerFor (kioskModeComponent) != 0); + jassert (ComponentPeer::getPeerFor (kioskModeComponent) != nullptr); kioskComponentOriginalBounds = kioskModeComponent->getBounds(); @@ -42765,7 +42760,7 @@ void Desktop::setOrientationsEnabled (const int newOrientations) allowedOrientations = newOrientations; } -bool Desktop::isOrientationEnabled (const DisplayOrientation orientation) const throw() +bool Desktop::isOrientationEnabled (const DisplayOrientation orientation) const noexcept { // Make sure you only pass one valid flag in here... jassert (orientation == upright || orientation == upsideDown || orientation == rotatedClockwise || orientation == rotatedAntiClockwise); @@ -42787,7 +42782,7 @@ public: : ComponentMovementWatcher (comp), component (comp), returnValue (0), isActive (true) { - jassert (comp != 0); + jassert (comp != nullptr); } void componentMovedOrResized (bool, bool) {} @@ -42843,13 +42838,13 @@ juce_ImplementSingleton_SingleThreaded (ModalComponentManager); void ModalComponentManager::startModal (Component* component) { - if (component != 0) + if (component != nullptr) stack.add (new ModalItem (component)); } void ModalComponentManager::attachCallback (Component* component, Callback* callback) { - if (callback != 0) + if (callback != nullptr) { ScopedPointer callbackDeleter (callback); @@ -42951,20 +42946,20 @@ void ModalComponentManager::handleAsyncUpdate() void ModalComponentManager::bringModalComponentsToFront (bool topOneShouldGrabFocus) { - ComponentPeer* lastOne = 0; + ComponentPeer* lastOne = nullptr; for (int i = 0; i < getNumModalComponents(); ++i) { Component* const c = getModalComponent (i); - if (c == 0) + if (c == nullptr) break; ComponentPeer* peer = c->getPeer(); - if (peer != 0 && peer != lastOne) + if (peer != nullptr && peer != lastOne) { - if (lastOne == 0) + if (lastOne == nullptr) { peer->toFront (topOneShouldGrabFocus); @@ -43005,7 +43000,7 @@ int ModalComponentManager::runEventLoopForCurrentComponent() Component* currentlyModal = getModalComponent (0); - if (currentlyModal == 0) + if (currentlyModal == nullptr) return 0; WeakReference prevFocused (Component::getCurrentlyFocusedComponent()); @@ -43024,7 +43019,7 @@ int ModalComponentManager::runEventLoopForCurrentComponent() } JUCE_CATCH_EXCEPTION - if (prevFocused != 0) + if (prevFocused != nullptr) prevFocused->grabKeyboardFocus(); return returnValue; @@ -43104,7 +43099,7 @@ Button::Button (const String& name) text (name), buttonPressTime (0), lastRepeatTime (0), - commandManagerToUse (0), + commandManagerToUse (nullptr), autoRepeatDelay (-1), autoRepeatSpeed (0), autoRepeatMinimumDelay (-1), @@ -43128,10 +43123,10 @@ Button::~Button() { isOn.removeListener (this); - if (commandManagerToUse != 0) + if (commandManagerToUse != nullptr) commandManagerToUse->removeListener (this); - repeatTimer = 0; + repeatTimer = nullptr; clearShortcuts(); } @@ -43152,7 +43147,7 @@ void Button::setTooltip (const String& newTooltip) const String Button::getTooltip() { - if (generateTooltip && commandManagerToUse != 0 && commandID != 0) + if (generateTooltip && commandManagerToUse != nullptr && commandID != 0) { String tt (commandManagerToUse->getDescriptionOfCommand (commandID)); @@ -43202,7 +43197,7 @@ void Button::setToggleState (const bool shouldBeOn, { sendClickMessage (ModifierKeys()); - if (deletionWatcher == 0) + if (deletionWatcher == nullptr) return; } @@ -43210,7 +43205,7 @@ void Button::setToggleState (const bool shouldBeOn, { turnOffOtherButtonsInGroup (sendChangeNotification); - if (deletionWatcher == 0) + if (deletionWatcher == nullptr) return; } @@ -43218,7 +43213,7 @@ void Button::setToggleState (const bool shouldBeOn, } } -void Button::setClickingTogglesState (const bool shouldToggle) throw() +void Button::setClickingTogglesState (const bool shouldToggle) noexcept { clickTogglesState = shouldToggle; @@ -43226,10 +43221,10 @@ void Button::setClickingTogglesState (const bool shouldToggle) throw() // up to be a command invoker. Instead, your command handler must flip the state of whatever // it is that this button represents, and the button will update its state to reflect this // in the applicationCommandListChanged() method. - jassert (commandManagerToUse == 0 || ! clickTogglesState); + jassert (commandManagerToUse == nullptr || ! clickTogglesState); } -bool Button::getClickingTogglesState() const throw() +bool Button::getClickingTogglesState() const noexcept { return clickTogglesState; } @@ -43255,7 +43250,7 @@ void Button::turnOffOtherButtonsInGroup (const bool sendChangeNotification) { Component* const p = getParentComponent(); - if (p != 0 && radioGroupId != 0) + if (p != nullptr && radioGroupId != 0) { WeakReference deletionWatcher (this); @@ -43267,11 +43262,11 @@ void Button::turnOffOtherButtonsInGroup (const bool sendChangeNotification) { Button* const b = dynamic_cast (c); - if (b != 0 && b->getRadioGroupId() == radioGroupId) + if (b != nullptr && b->getRadioGroupId() == radioGroupId) { b->setToggleState (false, sendChangeNotification); - if (deletionWatcher == 0) + if (deletionWatcher == nullptr) return; } } @@ -43323,12 +43318,12 @@ void Button::setState (const ButtonState newState) } } -bool Button::isDown() const throw() +bool Button::isDown() const noexcept { return buttonState == buttonDown; } -bool Button::isOver() const throw() +bool Button::isOver() const noexcept { return buttonState != buttonNormal; } @@ -43337,13 +43332,13 @@ void Button::buttonStateChanged() { } -uint32 Button::getMillisecondsSinceButtonDown() const throw() +uint32 Button::getMillisecondsSinceButtonDown() const noexcept { const uint32 now = Time::getApproximateMillisecondCounter(); return now > buttonPressTime ? now - buttonPressTime : 0; } -void Button::setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) throw() +void Button::setTriggeredOnMouseDown (const bool isTriggeredOnMouseDown) noexcept { triggerOnMouseDown = isTriggeredOnMouseDown; } @@ -43415,7 +43410,7 @@ void Button::sendClickMessage (const ModifierKeys& modifiers) { Component::BailOutChecker checker (this); - if (commandManagerToUse != 0 && commandID != 0) + if (commandManagerToUse != nullptr && commandID != 0) { ApplicationCommandTarget::InvocationInfo info (commandID); info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromButton; @@ -43517,12 +43512,12 @@ void Button::parentHierarchyChanged() if (newKeySource != keySource.get()) { - if (keySource != 0) + if (keySource != nullptr) keySource->removeKeyListener (this); keySource = newKeySource; - if (keySource != 0) + if (keySource != nullptr) keySource->addKeyListener (this); } } @@ -43536,22 +43531,22 @@ void Button::setCommandToTrigger (ApplicationCommandManager* const commandManage if (commandManagerToUse != commandManagerToUse_) { - if (commandManagerToUse != 0) + if (commandManagerToUse != nullptr) commandManagerToUse->removeListener (this); commandManagerToUse = commandManagerToUse_; - if (commandManagerToUse != 0) + if (commandManagerToUse != nullptr) commandManagerToUse->addListener (this); // if you've got clickTogglesState turned on, you shouldn't also connect the button // up to be a command invoker. Instead, your command handler must flip the state of whatever // it is that this button represents, and the button will update its state to reflect this // in the applicationCommandListChanged() method. - jassert (commandManagerToUse == 0 || ! clickTogglesState); + jassert (commandManagerToUse == nullptr || ! clickTogglesState); } - if (commandManagerToUse != 0) + if (commandManagerToUse != nullptr) applicationCommandListChanged(); else setEnabled (true); @@ -43568,15 +43563,15 @@ void Button::applicationCommandInvoked (const ApplicationCommandTarget::Invocati void Button::applicationCommandListChanged() { - if (commandManagerToUse != 0) + if (commandManagerToUse != nullptr) { ApplicationCommandInfo info (0); ApplicationCommandTarget* const target = commandManagerToUse->getTargetForCommand (commandID, info); - setEnabled (target != 0 && (info.flags & ApplicationCommandInfo::isDisabled) == 0); + setEnabled (target != nullptr && (info.flags & ApplicationCommandInfo::isDisabled) == 0); - if (target != 0) + if (target != nullptr) setToggleState ((info.flags & ApplicationCommandInfo::isTicked) != 0, false); } } @@ -43663,7 +43658,7 @@ bool Button::keyPressed (const KeyPress& key) void Button::setRepeatSpeed (const int initialDelayMillisecs, const int repeatMillisecs, - const int minimumDelayInMillisecs) throw() + const int minimumDelayInMillisecs) noexcept { autoRepeatDelay = initialDelayMillisecs; autoRepeatSpeed = repeatMillisecs; @@ -43711,7 +43706,7 @@ void Button::repeatTimerCallback() Button::RepeatTimer& Button::getRepeatTimer() { - if (repeatTimer == 0) + if (repeatTimer == nullptr) repeatTimer = new RepeatTimer (*this); return *repeatTimer; @@ -43728,7 +43723,7 @@ DrawableButton::DrawableButton (const String& name, const DrawableButton::ButtonStyle buttonStyle) : Button (name), style (buttonStyle), - currentImage (0), + currentImage (nullptr), edgeIndent (3) { if (buttonStyle == ImageOnButtonBackground) @@ -43756,16 +43751,16 @@ void DrawableButton::setImages (const Drawable* normal, const Drawable* downOn, const Drawable* disabledOn) { - jassert (normal != 0); // you really need to give it at least a normal image.. + jassert (normal != nullptr); // you really need to give it at least a normal image.. - if (normal != 0) normalImage = normal->createCopy(); - if (over != 0) overImage = over->createCopy(); - if (down != 0) downImage = down->createCopy(); - if (disabled != 0) disabledImage = disabled->createCopy(); - if (normalOn != 0) normalImageOn = normalOn->createCopy(); - if (overOn != 0) overImageOn = overOn->createCopy(); - if (downOn != 0) downImageOn = downOn->createCopy(); - if (disabledOn != 0) disabledImageOn = disabledOn->createCopy(); + if (normal != nullptr) normalImage = normal->createCopy(); + if (over != nullptr) overImage = over->createCopy(); + if (down != nullptr) downImage = down->createCopy(); + if (disabled != nullptr) disabledImage = disabled->createCopy(); + if (normalOn != nullptr) normalImageOn = normalOn->createCopy(); + if (overOn != nullptr) overImageOn = overOn->createCopy(); + if (downOn != nullptr) downImageOn = downOn->createCopy(); + if (disabledOn != nullptr) disabledImageOn = disabledOn->createCopy(); buttonStateChanged(); } @@ -43792,7 +43787,7 @@ void DrawableButton::setBackgroundColours (const Colour& toggledOffColour, } } -const Colour& DrawableButton::getBackgroundColour() const throw() +const Colour& DrawableButton::getBackgroundColour() const noexcept { return getToggleState() ? backgroundOn : backgroundOff; @@ -43809,7 +43804,7 @@ void DrawableButton::resized() { Button::resized(); - if (currentImage != 0) + if (currentImage != nullptr) { if (style == ImageRaw) { @@ -43844,7 +43839,7 @@ void DrawableButton::buttonStateChanged() { repaint(); - Drawable* imageToDraw = 0; + Drawable* imageToDraw = nullptr; float opacity = 1.0f; if (isEnabled()) @@ -43856,7 +43851,7 @@ void DrawableButton::buttonStateChanged() imageToDraw = getToggleState() ? disabledImageOn : disabledImage; - if (imageToDraw == 0) + if (imageToDraw == nullptr) { opacity = 0.4f; imageToDraw = getNormalImage(); @@ -43868,7 +43863,7 @@ void DrawableButton::buttonStateChanged() removeChildComponent (currentImage); currentImage = imageToDraw; - if (currentImage != 0) + if (currentImage != nullptr) { currentImage->setInterceptsMouseClicks (false, false); addAndMakeVisible (currentImage); @@ -43876,7 +43871,7 @@ void DrawableButton::buttonStateChanged() } } - if (currentImage != 0) + if (currentImage != nullptr) currentImage->setAlpha (opacity); } @@ -43914,7 +43909,7 @@ void DrawableButton::paintButton (Graphics& g, } } -Drawable* DrawableButton::getCurrentImage() const throw() +Drawable* DrawableButton::getCurrentImage() const noexcept { if (isDown()) return getDownImage(); @@ -43925,54 +43920,54 @@ Drawable* DrawableButton::getCurrentImage() const throw() return getNormalImage(); } -Drawable* DrawableButton::getNormalImage() const throw() +Drawable* DrawableButton::getNormalImage() const noexcept { - return (getToggleState() && normalImageOn != 0) ? normalImageOn - : normalImage; + return (getToggleState() && normalImageOn != nullptr) ? normalImageOn + : normalImage; } -Drawable* DrawableButton::getOverImage() const throw() +Drawable* DrawableButton::getOverImage() const noexcept { Drawable* d = normalImage; if (getToggleState()) { - if (overImageOn != 0) + if (overImageOn != nullptr) d = overImageOn; - else if (normalImageOn != 0) + else if (normalImageOn != nullptr) d = normalImageOn; - else if (overImage != 0) + else if (overImage != nullptr) d = overImage; } else { - if (overImage != 0) + if (overImage != nullptr) d = overImage; } return d; } -Drawable* DrawableButton::getDownImage() const throw() +Drawable* DrawableButton::getDownImage() const noexcept { Drawable* d = normalImage; if (getToggleState()) { - if (downImageOn != 0) + if (downImageOn != nullptr) d = downImageOn; - else if (overImageOn != 0) + else if (overImageOn != nullptr) d = overImageOn; - else if (normalImageOn != 0) + else if (normalImageOn != nullptr) d = normalImageOn; - else if (downImage != 0) + else if (downImage != nullptr) d = downImage; else d = getOverImage(); } else { - if (downImage != 0) + if (downImage != nullptr) d = downImage; else d = getOverImage(); @@ -44014,7 +44009,7 @@ void HyperlinkButton::setFont (const Font& newFont, repaint(); } -void HyperlinkButton::setURL (const URL& newURL) throw() +void HyperlinkButton::setURL (const URL& newURL) noexcept { url = newURL; setTooltip (newURL.toString (false)); @@ -44081,10 +44076,7 @@ ImageButton::ImageButton (const String& text_) imageX (0), imageY (0), imageW (0), - imageH (0), - normalImage (0), - overImage (0), - downImage (0) + imageH (0) { } @@ -44322,7 +44314,7 @@ void ShapeButton::paintButton (Graphics& g, bool isMouseOverButton, bool isButto int w = getWidth(); int h = getHeight(); - if (getComponentEffect() != 0) + if (getComponentEffect() != nullptr) { w -= 4; h -= 4; @@ -44443,9 +44435,9 @@ ToolbarButton::ToolbarButton (const int itemId_, const String& buttonText, : ToolbarItemComponent (itemId_, buttonText, true), normalImage (normalImage_), toggledOnImage (toggledOnImage_), - currentImage (0) + currentImage (nullptr) { - jassert (normalImage_ != 0); + jassert (normalImage_ != nullptr); } ToolbarButton::~ToolbarButton() @@ -44469,7 +44461,7 @@ void ToolbarButton::contentAreaChanged (const Rectangle&) void ToolbarButton::updateDrawable() { - if (currentImage != 0) + if (currentImage != nullptr) { currentImage->setTransformToFit (getContentArea().toFloat(), RectanglePlacement::centred); currentImage->setAlpha (isEnabled() ? 1.0f : 0.5f); @@ -44492,7 +44484,7 @@ void ToolbarButton::buttonStateChanged() { Drawable* d = normalImage; - if (getToggleState() && toggledOnImage != 0) + if (getToggleState() && toggledOnImage != nullptr) d = toggledOnImage; if (d != currentImage) @@ -44500,7 +44492,7 @@ void ToolbarButton::buttonStateChanged() removeChildComponent (currentImage); currentImage = d; - if (d != 0) + if (d != nullptr) { enablementChanged(); addAndMakeVisible (d); @@ -44585,12 +44577,12 @@ public: jassert (charNumInFile == text.length()); } - bool endsWithLineBreak() const throw() + bool endsWithLineBreak() const noexcept { return lineLengthWithoutNewLines != lineLength; } - void updateLength() throw() + void updateLength() noexcept { lineLength = 0; lineLengthWithoutNewLines = 0; @@ -44617,7 +44609,7 @@ public: CodeDocument::Iterator::Iterator (CodeDocument* const document_) : document (document_), - charPointer (0), + charPointer (nullptr), line (0), position (0) { @@ -44631,7 +44623,7 @@ CodeDocument::Iterator::Iterator (const CodeDocument::Iterator& other) { } -CodeDocument::Iterator& CodeDocument::Iterator::operator= (const CodeDocument::Iterator& other) throw() +CodeDocument::Iterator& CodeDocument::Iterator::operator= (const CodeDocument::Iterator& other) noexcept { document = other.document; charPointer = other.charPointer; @@ -44641,7 +44633,7 @@ CodeDocument::Iterator& CodeDocument::Iterator::operator= (const CodeDocument::I return *this; } -CodeDocument::Iterator::~Iterator() throw() +CodeDocument::Iterator::~Iterator() noexcept { } @@ -44649,11 +44641,11 @@ juce_wchar CodeDocument::Iterator::nextChar() { for (;;) { - if (charPointer.getAddress() == 0) + if (charPointer.getAddress() == nullptr) { CodeDocumentLine* const l = document->lines[line]; - if (l == 0) + if (l == nullptr) return 0; charPointer = l->line.getCharPointer(); @@ -44664,7 +44656,7 @@ juce_wchar CodeDocument::Iterator::nextChar() if (result == 0) { ++line; - charPointer = 0; + charPointer = nullptr; } else { @@ -44681,11 +44673,11 @@ void CodeDocument::Iterator::skip() void CodeDocument::Iterator::skipToEndOfLine() { - if (charPointer.getAddress() == 0) + if (charPointer.getAddress() == nullptr) { CodeDocumentLine* const l = document->lines[line]; - if (l == 0) + if (l == nullptr) return; charPointer = l->line.getCharPointer(); @@ -44693,16 +44685,16 @@ void CodeDocument::Iterator::skipToEndOfLine() position += charPointer.length(); ++line; - charPointer = 0; + charPointer = nullptr; } juce_wchar CodeDocument::Iterator::peekNextChar() const { - if (charPointer.getAddress() == 0) + if (charPointer.getAddress() == nullptr) { CodeDocumentLine* const l = document->lines[line]; - if (l == 0) + if (l == nullptr) return 0; charPointer = l->line.getCharPointer(); @@ -44714,7 +44706,7 @@ juce_wchar CodeDocument::Iterator::peekNextChar() const return c; CodeDocumentLine* const l = document->lines [line + 1]; - return l == 0 ? 0 : l->line[0]; + return l == nullptr ? 0 : l->line[0]; } void CodeDocument::Iterator::skipWhitespace() @@ -44723,19 +44715,19 @@ void CodeDocument::Iterator::skipWhitespace() skip(); } -bool CodeDocument::Iterator::isEOF() const throw() +bool CodeDocument::Iterator::isEOF() const noexcept { - return charPointer.getAddress() == 0 && line >= document->lines.size(); + return charPointer.getAddress() == nullptr && line >= document->lines.size(); } -CodeDocument::Position::Position() throw() +CodeDocument::Position::Position() noexcept : owner (0), characterPos (0), line (0), indexInLine (0), positionMaintained (false) { } CodeDocument::Position::Position (const CodeDocument* const ownerDocument, - const int line_, const int indexInLine_) throw() + const int line_, const int indexInLine_) noexcept : owner (const_cast (ownerDocument)), characterPos (0), line (line_), indexInLine (indexInLine_), positionMaintained (false) @@ -44744,14 +44736,14 @@ CodeDocument::Position::Position (const CodeDocument* const ownerDocument, } CodeDocument::Position::Position (const CodeDocument* const ownerDocument, - const int characterPos_) throw() + const int characterPos_) noexcept : owner (const_cast (ownerDocument)), positionMaintained (false) { setPosition (characterPos_); } -CodeDocument::Position::Position (const Position& other) throw() +CodeDocument::Position::Position (const Position& other) noexcept : owner (other.owner), characterPos (other.characterPos), line (other.line), indexInLine (other.indexInLine), positionMaintained (false) { @@ -44783,7 +44775,7 @@ CodeDocument::Position& CodeDocument::Position::operator= (const Position& other return *this; } -bool CodeDocument::Position::operator== (const Position& other) const throw() +bool CodeDocument::Position::operator== (const Position& other) const noexcept { jassert ((characterPos == other.characterPos) == (line == other.line && indexInLine == other.indexInLine)); @@ -44794,14 +44786,14 @@ bool CodeDocument::Position::operator== (const Position& other) const throw() && owner == other.owner; } -bool CodeDocument::Position::operator!= (const Position& other) const throw() +bool CodeDocument::Position::operator!= (const Position& other) const noexcept { return ! operator== (other); } void CodeDocument::Position::setLineAndIndex (const int newLineNum, const int newIndexInLine) { - jassert (owner != 0); + jassert (owner != nullptr); if (owner->lines.size() == 0) { @@ -44816,7 +44808,7 @@ void CodeDocument::Position::setLineAndIndex (const int newLineNum, const int ne line = owner->lines.size() - 1; CodeDocumentLine* const l = owner->lines.getUnchecked (line); - jassert (l != 0); + jassert (l != nullptr); indexInLine = l->lineLengthWithoutNewLines; characterPos = l->lineStartInFile + indexInLine; @@ -44826,7 +44818,7 @@ void CodeDocument::Position::setLineAndIndex (const int newLineNum, const int ne line = jmax (0, newLineNum); CodeDocumentLine* const l = owner->lines.getUnchecked (line); - jassert (l != 0); + jassert (l != nullptr); if (l->lineLengthWithoutNewLines > 0) indexInLine = jlimit (0, l->lineLengthWithoutNewLines, newIndexInLine); @@ -44840,7 +44832,7 @@ void CodeDocument::Position::setLineAndIndex (const int newLineNum, const int ne void CodeDocument::Position::setPosition (const int newPosition) { - jassert (owner != 0); + jassert (owner != nullptr); line = 0; indexInLine = 0; @@ -44887,7 +44879,7 @@ void CodeDocument::Position::setPosition (const int newPosition) void CodeDocument::Position::moveBy (int characterDelta) { - jassert (owner != 0); + jassert (owner != nullptr); if (characterDelta == 1) { @@ -44923,13 +44915,13 @@ const CodeDocument::Position CodeDocument::Position::movedByLines (const int del const juce_wchar CodeDocument::Position::getCharacter() const { const CodeDocumentLine* const l = owner->lines [line]; - return l == 0 ? 0 : l->line [getIndexInLine()]; + return l == nullptr ? 0 : l->line [getIndexInLine()]; } const String CodeDocument::Position::getLineText() const { const CodeDocumentLine* const l = owner->lines [line]; - return l == 0 ? String::empty : l->line; + return l == nullptr ? String::empty : l->line; } void CodeDocument::Position::setPositionMaintained (const bool isMaintained) @@ -44938,7 +44930,7 @@ void CodeDocument::Position::setPositionMaintained (const bool isMaintained) { positionMaintained = isMaintained; - if (owner != 0) + if (owner != nullptr) { if (isMaintained) { @@ -44985,7 +44977,7 @@ const String CodeDocument::getTextBetween (const Position& start, const Position if (startLine == endLine) { CodeDocumentLine* const line = lines [startLine]; - return (line == 0) ? String::empty : line->line.substring (start.getIndexInLine(), end.getIndexInLine()); + return (line == nullptr) ? String::empty : line->line.substring (start.getIndexInLine(), end.getIndexInLine()); } MemoryOutputStream mo; @@ -45017,19 +45009,19 @@ const String CodeDocument::getTextBetween (const Position& start, const Position return mo.toString(); } -int CodeDocument::getNumCharacters() const throw() +int CodeDocument::getNumCharacters() const noexcept { const CodeDocumentLine* const lastLine = lines.getLast(); - return (lastLine == 0) ? 0 : lastLine->lineStartInFile + lastLine->lineLength; + return (lastLine == nullptr) ? 0 : lastLine->lineStartInFile + lastLine->lineLength; } -const String CodeDocument::getLine (const int lineIndex) const throw() +const String CodeDocument::getLine (const int lineIndex) const noexcept { const CodeDocumentLine* const line = lines [lineIndex]; - return (line == 0) ? String::empty : line->line; + return (line == nullptr) ? String::empty : line->line; } -int CodeDocument::getMaximumLineLength() throw() +int CodeDocument::getMaximumLineLength() noexcept { if (maximumLineLength < 0) { @@ -45081,7 +45073,7 @@ bool CodeDocument::writeToStream (OutputStream& stream) return true; } -void CodeDocument::setNewLineCharacters (const String& newLineChars_) throw() +void CodeDocument::setNewLineCharacters (const String& newLineChars_) noexcept { jassert (newLineChars_ == "\r\n" || newLineChars_ == "\n" || newLineChars_ == "\r"); newLineChars = newLineChars_; @@ -45108,26 +45100,26 @@ void CodeDocument::clearUndoHistory() undoManager.clearUndoHistory(); } -void CodeDocument::setSavePoint() throw() +void CodeDocument::setSavePoint() noexcept { indexOfSavedState = currentActionIndex; } -bool CodeDocument::hasChangedSinceSavePoint() const throw() +bool CodeDocument::hasChangedSinceSavePoint() const noexcept { return currentActionIndex != indexOfSavedState; } namespace CodeDocumentHelpers { - int getCharacterType (const juce_wchar character) throw() + int getCharacterType (const juce_wchar character) noexcept { return (CharacterFunctions::isLetterOrDigit (character) || character == '_') ? 2 : (CharacterFunctions::isWhitespace (character) ? 0 : 1); } } -const CodeDocument::Position CodeDocument::findWordBreakAfter (const Position& position) const throw() +const CodeDocument::Position CodeDocument::findWordBreakAfter (const Position& position) const noexcept { Position p (position); const int maxDistance = 256; @@ -45165,7 +45157,7 @@ const CodeDocument::Position CodeDocument::findWordBreakAfter (const Position& p return p; } -const CodeDocument::Position CodeDocument::findWordBreakBefore (const Position& position) const throw() +const CodeDocument::Position CodeDocument::findWordBreakBefore (const Position& position) const noexcept { Position p (position); const int maxDistance = 256; @@ -45217,19 +45209,19 @@ void CodeDocument::checkLastLineStatus() const CodeDocumentLine* const lastLine = lines.getLast(); - if (lastLine != 0 && lastLine->endsWithLineBreak()) + if (lastLine != nullptr && lastLine->endsWithLineBreak()) { // check that there's an empty line at the end if the preceding one ends in a newline.. lines.add (new CodeDocumentLine (String::empty.getCharPointer(), 0, 0, lastLine->lineStartInFile + lastLine->lineLength)); } } -void CodeDocument::addListener (CodeDocument::Listener* const listener) throw() +void CodeDocument::addListener (CodeDocument::Listener* const listener) noexcept { listeners.add (listener); } -void CodeDocument::removeListener (CodeDocument::Listener* const listener) throw() +void CodeDocument::removeListener (CodeDocument::Listener* const listener) noexcept { listeners.remove (listener); } @@ -45245,7 +45237,7 @@ void CodeDocument::sendListenerChangeMessage (const int startLine, const int end class CodeDocumentInsertAction : public UndoableAction { public: - CodeDocumentInsertAction (CodeDocument& owner_, const String& text_, const int insertPos_) throw() + CodeDocumentInsertAction (CodeDocument& owner_, const String& text_, const int insertPos_) noexcept : owner (owner_), text (text_), insertPos (insertPos_) @@ -45294,7 +45286,7 @@ void CodeDocument::insert (const String& text, const int insertPos, const bool u CodeDocumentLine* const firstLine = lines [firstAffectedLine]; String textInsideOriginalLine (text); - if (firstLine != 0) + if (firstLine != nullptr) { const int index = pos.getIndexInLine(); textInsideOriginalLine = firstLine->line.substring (0, index) @@ -45308,7 +45300,7 @@ void CodeDocument::insert (const String& text, const int insertPos, const bool u jassert (newLines.size() > 0); CodeDocumentLine* const newFirstLine = newLines.getUnchecked (0); - newFirstLine->lineStartInFile = firstLine != 0 ? firstLine->lineStartInFile : 0; + newFirstLine->lineStartInFile = firstLine != nullptr ? firstLine->lineStartInFile : 0; lines.set (firstAffectedLine, newFirstLine); if (newLines.size() > 1) @@ -45348,7 +45340,7 @@ void CodeDocument::insert (const String& text, const int insertPos, const bool u class CodeDocumentDeleteAction : public UndoableAction { public: - CodeDocumentDeleteAction (CodeDocument& owner_, const int startPos_, const int endPos_) throw() + CodeDocumentDeleteAction (CodeDocument& owner_, const int startPos_, const int endPos_) noexcept : owner (owner_), startPos (startPos_), endPos (endPos_) @@ -45412,7 +45404,7 @@ void CodeDocument::remove (const int startPos, const int endPos, const bool undo lastAffectedLine = lines.size(); CodeDocumentLine* const lastLine = lines.getUnchecked (endLine); - jassert (lastLine != 0); + jassert (lastLine != nullptr); firstLine->line = firstLine->line.substring (0, startPosition.getIndexInLine()) + lastLine->line.substring (endPosition.getIndexInLine()); @@ -45459,7 +45451,7 @@ BEGIN_JUCE_NAMESPACE class CodeEditorComponent::CodeEditorLine { public: - CodeEditorLine() throw() + CodeEditorLine() noexcept : highlightColumnStart (0), highlightColumnEnd (0) { } @@ -45473,7 +45465,7 @@ public: Array newTokens; newTokens.ensureStorageAllocated (8); - if (analyser == 0) + if (analyser == nullptr) { newTokens.add (SyntaxToken (document.getLine (lineNum), -1)); } @@ -45567,12 +45559,12 @@ public: private: struct SyntaxToken { - SyntaxToken (const String& text_, const int type) throw() + SyntaxToken (const String& text_, const int type) noexcept : text (text_), tokenType (type), width (-1.0f) { } - bool operator!= (const SyntaxToken& other) const throw() + bool operator!= (const SyntaxToken& other) const noexcept { return text != other.text || tokenType != other.tokenType; } @@ -45641,7 +45633,7 @@ private: } } - int indexToColumn (int index, const String& line, int spacesPerTab) const throw() + int indexToColumn (int index, const String& line, int spacesPerTab) const noexcept { jassert (index <= line.length()); @@ -46172,7 +46164,7 @@ void CodeEditorComponent::goToStartOfDocument (const bool selecting) namespace CodeEditorHelpers { - int findFirstNonWhitespaceChar (const String& line) throw() + int findFirstNonWhitespaceChar (const String& line) noexcept { String::CharPointerType t (line.getCharPointer()); int i = 0; @@ -46515,7 +46507,7 @@ void CodeEditorComponent::setTabSize (const int numSpaces, const bool insertSpac } } -int CodeEditorComponent::indexToColumn (int lineNum, int index) const throw() +int CodeEditorComponent::indexToColumn (int lineNum, int index) const noexcept { String::CharPointerType t (document.getLine (lineNum).getCharPointer()); @@ -46537,7 +46529,7 @@ int CodeEditorComponent::indexToColumn (int lineNum, int index) const throw() return col; } -int CodeEditorComponent::columnToIndex (int lineNum, int column) const throw() +int CodeEditorComponent::columnToIndex (int lineNum, int column) const noexcept { String::CharPointerType t (document.getLine (lineNum).getCharPointer()); @@ -46571,7 +46563,7 @@ void CodeEditorComponent::resetToDefaultColours() { coloursForTokenCategories.clear(); - if (codeTokeniser != 0) + if (codeTokeniser != nullptr) { for (int i = codeTokeniser->getTokenTypes().size(); --i >= 0;) setColourForTokenType (i, codeTokeniser->getDefaultColour (i)); @@ -46615,7 +46607,7 @@ void CodeEditorComponent::updateCachedIterators (int maxLineNum) if (cachedIterators.size() == 0) cachedIterators.add (new CodeDocument::Iterator (&document)); - if (codeTokeniser == 0) + if (codeTokeniser == nullptr) return; for (;;) @@ -46644,7 +46636,7 @@ void CodeEditorComponent::updateCachedIterators (int maxLineNum) void CodeEditorComponent::getIteratorForPosition (int position, CodeDocument::Iterator& source) { - if (codeTokeniser == 0) + if (codeTokeniser == nullptr) return; for (int i = cachedIterators.size(); --i >= 0;) @@ -46687,19 +46679,19 @@ CPlusPlusCodeTokeniser::~CPlusPlusCodeTokeniser() namespace CppTokeniser { - bool isIdentifierStart (const juce_wchar c) throw() + bool isIdentifierStart (const juce_wchar c) noexcept { return CharacterFunctions::isLetter (c) || c == '_' || c == '@'; } - bool isIdentifierBody (const juce_wchar c) throw() + bool isIdentifierBody (const juce_wchar c) noexcept { return CharacterFunctions::isLetterOrDigit (c) || c == '_' || c == '@'; } - bool isReservedKeyword (String::CharPointerType token, const int tokenLength) throw() + bool isReservedKeyword (String::CharPointerType token, const int tokenLength) noexcept { static const char* const keywords2Char[] = { "if", "do", "or", "id", 0 }; @@ -46757,7 +46749,7 @@ namespace CppTokeniser return false; } - int parseIdentifier (CodeDocument::Iterator& source) throw() + int parseIdentifier (CodeDocument::Iterator& source) noexcept { int tokenLength = 0; String::CharPointerType::CharType possibleIdentifier [100]; @@ -46796,14 +46788,14 @@ namespace CppTokeniser return true; } - bool isHexDigit (const juce_wchar c) throw() + bool isHexDigit (const juce_wchar c) noexcept { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } - bool parseHexLiteral (CodeDocument::Iterator& source) throw() + bool parseHexLiteral (CodeDocument::Iterator& source) noexcept { if (source.nextChar() != '0') return false; @@ -46825,12 +46817,12 @@ namespace CppTokeniser return skipNumberSuffix (source); } - bool isOctalDigit (const juce_wchar c) throw() + bool isOctalDigit (const juce_wchar c) noexcept { return c >= '0' && c <= '7'; } - bool parseOctalLiteral (CodeDocument::Iterator& source) throw() + bool parseOctalLiteral (CodeDocument::Iterator& source) noexcept { if (source.nextChar() != '0') return false; @@ -46844,12 +46836,12 @@ namespace CppTokeniser return skipNumberSuffix (source); } - bool isDecimalDigit (const juce_wchar c) throw() + bool isDecimalDigit (const juce_wchar c) noexcept { return c >= '0' && c <= '9'; } - bool parseDecimalLiteral (CodeDocument::Iterator& source) throw() + bool parseDecimalLiteral (CodeDocument::Iterator& source) noexcept { int numChars = 0; while (isDecimalDigit (source.peekNextChar())) @@ -46864,7 +46856,7 @@ namespace CppTokeniser return skipNumberSuffix (source); } - bool parseFloatLiteral (CodeDocument::Iterator& source) throw() + bool parseFloatLiteral (CodeDocument::Iterator& source) noexcept { int numDigits = 0; @@ -46949,7 +46941,7 @@ namespace CppTokeniser return CPlusPlusCodeTokeniser::tokenType_error; } - void skipQuotedString (CodeDocument::Iterator& source) throw() + void skipQuotedString (CodeDocument::Iterator& source) noexcept { const juce_wchar quote = source.nextChar(); @@ -46965,7 +46957,7 @@ namespace CppTokeniser } } - void skipComment (CodeDocument::Iterator& source) throw() + void skipComment (CodeDocument::Iterator& source) noexcept { bool lastWasStar = false; @@ -47255,7 +47247,7 @@ const Colour CPlusPlusCodeTokeniser::getDefaultColour (const int tokenType) return Colours::black; } -bool CPlusPlusCodeTokeniser::isReservedKeyword (const String& token) throw() +bool CPlusPlusCodeTokeniser::isReservedKeyword (const String& token) noexcept { return CppTokeniser::isReservedKeyword (token.getCharPointer(), token.length()); } @@ -47272,12 +47264,12 @@ ComboBox::ItemInfo::ItemInfo (const String& name_, int itemId_, bool isEnabled_, { } -bool ComboBox::ItemInfo::isSeparator() const throw() +bool ComboBox::ItemInfo::isSeparator() const noexcept { return name.isEmpty(); } -bool ComboBox::ItemInfo::isRealItem() const throw() +bool ComboBox::ItemInfo::isRealItem() const noexcept { return ! (isHeading || name.isEmpty()); } @@ -47302,7 +47294,7 @@ ComboBox::~ComboBox() if (menuActive) PopupMenu::dismissAllActiveMenus(); - label = 0; + label = nullptr; } void ComboBox::setEditableText (const bool isEditable) @@ -47315,7 +47307,7 @@ void ComboBox::setEditableText (const bool isEditable) } } -bool ComboBox::isTextEditable() const throw() +bool ComboBox::isTextEditable() const noexcept { return label->isEditable(); } @@ -47325,7 +47317,7 @@ void ComboBox::setJustificationType (const Justification& justification) label->setJustificationType (justification); } -const Justification ComboBox::getJustificationType() const throw() +const Justification ComboBox::getJustificationType() const noexcept { return label->getJustificationType(); } @@ -47345,7 +47337,7 @@ void ComboBox::addItem (const String& newItemText, const int newItemId) jassert (newItemId != 0); // you shouldn't use duplicate item IDs! - jassert (getItemForId (newItemId) == 0); + jassert (getItemForId (newItemId) == nullptr); if (newItemText.isNotEmpty() && newItemId != 0) { @@ -47385,23 +47377,23 @@ void ComboBox::setItemEnabled (const int itemId, const bool shouldBeEnabled) { ItemInfo* const item = getItemForId (itemId); - if (item != 0) + if (item != nullptr) item->isEnabled = shouldBeEnabled; } -bool ComboBox::isItemEnabled (int itemId) const throw() +bool ComboBox::isItemEnabled (int itemId) const noexcept { const ItemInfo* const item = getItemForId (itemId); - return item != 0 && item->isEnabled; + return item != nullptr && item->isEnabled; } void ComboBox::changeItemText (const int itemId, const String& newText) { ItemInfo* const item = getItemForId (itemId); - jassert (item != 0); + jassert (item != nullptr); - if (item != 0) + if (item != nullptr) item->name = newText; } @@ -47414,7 +47406,7 @@ void ComboBox::clear (const bool dontSendChangeMessage) setSelectedItemIndex (-1, dontSendChangeMessage); } -ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() +ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const noexcept { if (itemId != 0) { @@ -47426,7 +47418,7 @@ ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() return 0; } -ComboBox::ItemInfo* ComboBox::getItemForIndex (const int index) const throw() +ComboBox::ItemInfo* ComboBox::getItemForIndex (const int index) const noexcept { for (int n = 0, i = 0; i < items.size(); ++i) { @@ -47440,7 +47432,7 @@ ComboBox::ItemInfo* ComboBox::getItemForIndex (const int index) const throw() return 0; } -int ComboBox::getNumItems() const throw() +int ComboBox::getNumItems() const noexcept { int n = 0; @@ -47455,17 +47447,17 @@ const String ComboBox::getItemText (const int index) const { const ItemInfo* const item = getItemForIndex (index); - return item != 0 ? item->name : String::empty; + return item != nullptr ? item->name : String::empty; } -int ComboBox::getItemId (const int index) const throw() +int ComboBox::getItemId (const int index) const noexcept { const ItemInfo* const item = getItemForIndex (index); - return item != 0 ? item->itemId : 0; + return item != nullptr ? item->itemId : 0; } -int ComboBox::indexOfItemId (const int itemId) const throw() +int ComboBox::indexOfItemId (const int itemId) const noexcept { for (int n = 0, i = 0; i < items.size(); ++i) { @@ -47498,17 +47490,17 @@ void ComboBox::setSelectedItemIndex (const int index, const bool dontSendChangeM setSelectedId (getItemId (index), dontSendChangeMessage); } -int ComboBox::getSelectedId() const throw() +int ComboBox::getSelectedId() const noexcept { const ItemInfo* const item = getItemForId (currentId.getValue()); - return (item != 0 && getText() == item->name) ? item->itemId : 0; + return (item != nullptr && getText() == item->name) ? item->itemId : 0; } void ComboBox::setSelectedId (const int newItemId, const bool dontSendChangeMessage) { const ItemInfo* const item = getItemForId (newItemId); - const String newItemText (item != 0 ? item->name : String::empty); + const String newItemText (item != nullptr ? item->name : String::empty); if (lastCurrentId != newItemId || label->getText() != newItemText) { @@ -47527,7 +47519,7 @@ bool ComboBox::selectIfEnabled (const int index) { const ItemInfo* const item = getItemForIndex (index); - if (item != 0 && item->isEnabled) + if (item != nullptr && item->isEnabled) { setSelectedItemIndex (index); return true; @@ -47643,9 +47635,9 @@ void ComboBox::lookAndFeelChanged() { ScopedPointer