| @@ -260,7 +260,7 @@ public: | |||
| audioSourcePlayer.setSource (&synthAudioSource); | |||
| deviceManager.addAudioCallback (&audioSourcePlayer); | |||
| deviceManager.addMidiInputCallback (String::empty, &(synthAudioSource.midiCollector)); | |||
| deviceManager.addMidiInputCallback (String(), &(synthAudioSource.midiCollector)); | |||
| setOpaque (true); | |||
| setSize (640, 480); | |||
| @@ -269,7 +269,7 @@ public: | |||
| ~AudioSynthesiserDemo() | |||
| { | |||
| audioSourcePlayer.setSource (nullptr); | |||
| deviceManager.removeMidiInputCallback (String::empty, &(synthAudioSource.midiCollector)); | |||
| deviceManager.removeMidiInputCallback (String(), &(synthAudioSource.midiCollector)); | |||
| deviceManager.removeAudioCallback (&audioSourcePlayer); | |||
| deviceManager.removeAudioCallback (&liveAudioDisplayComp); | |||
| } | |||
| @@ -31,7 +31,7 @@ class CodeEditorDemo : public Component, | |||
| { | |||
| public: | |||
| CodeEditorDemo() | |||
| : fileChooser ("File", File::nonexistent, true, false, false, | |||
| : fileChooser ("File", File(), true, false, false, | |||
| "*.cpp;*.h;*.hpp;*.c;*.mm;*.m", String(), | |||
| "Choose a C++ file to open it in the editor") | |||
| { | |||
| @@ -34,9 +34,9 @@ class FontsDemo : public Component, | |||
| { | |||
| public: | |||
| FontsDemo() | |||
| : heightLabel (String::empty, "Height:"), | |||
| kerningLabel (String::empty, "Kerning:"), | |||
| scaleLabel (String::empty, "Scale:"), | |||
| : heightLabel (String(), "Height:"), | |||
| kerningLabel (String(), "Kerning:"), | |||
| scaleLabel (String(), "Scale:"), | |||
| styleLabel ("Style"), | |||
| boldToggle ("Bold"), | |||
| italicToggle ("Italic") | |||
| @@ -395,7 +395,7 @@ class ImagesRenderingDemo : public GraphicsDemoBase | |||
| { | |||
| public: | |||
| ImagesRenderingDemo (ControllersComponent& cc, bool argb_, bool tiled_) | |||
| : GraphicsDemoBase (cc, String ("Images") + (argb_ ? ": ARGB" : ": RGB") + (tiled_ ? " Tiled" : String::empty )), | |||
| : GraphicsDemoBase (cc, String ("Images") + (argb_ ? ": ARGB" : ": RGB") + (tiled_ ? " Tiled" : String() )), | |||
| isArgb (argb_), isTiled (tiled_) | |||
| { | |||
| argbImage = ImageFileFormat::loadFrom (BinaryData::juce_icon_png, (size_t) BinaryData::juce_icon_pngSize); | |||
| @@ -86,7 +86,7 @@ public: | |||
| File getLastDocumentOpened() override | |||
| { | |||
| // not interested in this for now | |||
| return File::nonexistent; | |||
| return File(); | |||
| } | |||
| void setLastDocumentOpened (const File& /*file*/) override | |||
| @@ -836,8 +836,8 @@ struct OpenGLDemoClasses | |||
| controlsOverlay->statusLabel.setText (statusText, dontSendNotification); | |||
| newVertexShader = String::empty; | |||
| newFragmentShader = String::empty; | |||
| newVertexShader = String(); | |||
| newFragmentShader = String(); | |||
| } | |||
| } | |||
| @@ -97,7 +97,7 @@ public: | |||
| if (shader != nullptr) | |||
| { | |||
| statusLabel.setText (String::empty, dontSendNotification); | |||
| statusLabel.setText (String(), dontSendNotification); | |||
| shader->fillRect (g.getInternalContext(), getLocalBounds()); | |||
| } | |||
| @@ -35,8 +35,8 @@ class MovieComponentWithFileBrowser : public Component, | |||
| public: | |||
| MovieComponentWithFileBrowser() | |||
| : isDragOver (false), | |||
| fileChooser ("movie", File::nonexistent, true, false, false, | |||
| "*", String::empty, "(choose a video file to play)") | |||
| fileChooser ("movie", File(), true, false, false, | |||
| "*", String(), "(choose a video file to play)") | |||
| { | |||
| addAndMakeVisible (videoComp); | |||
| @@ -242,7 +242,7 @@ private: | |||
| static String::CharPointerType findEndOfFaceToken (String::CharPointerType t) noexcept | |||
| { | |||
| return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String::empty.getCharPointer()); | |||
| return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String().getCharPointer()); | |||
| } | |||
| }; | |||
| @@ -453,11 +453,11 @@ class ToolbarDemoComp : public Component, | |||
| { | |||
| public: | |||
| ToolbarDemoComp() | |||
| : depthLabel (String::empty, "Toolbar depth:"), | |||
| infoLabel (String::empty, "As well as showing off toolbars, this demo illustrates how to store " | |||
| "a set of SVG files in a Zip file, embed that in your application, and read " | |||
| "them back in at runtime.\n\nThe icon images here are taken from the open-source " | |||
| "Tango icon project."), | |||
| : depthLabel (String(), "Toolbar depth:"), | |||
| infoLabel (String(), "As well as showing off toolbars, this demo illustrates how to store " | |||
| "a set of SVG files in a Zip file, embed that in your application, and read " | |||
| "them back in at runtime.\n\nThe icon images here are taken from the open-source " | |||
| "Tango icon project."), | |||
| orientationButton ("Vertical/Horizontal"), | |||
| customiseButton ("Customise...") | |||
| { | |||
| @@ -356,9 +356,9 @@ private: | |||
| { | |||
| switch (type) | |||
| { | |||
| case xml: codeDocument.replaceAllContent (BinaryData::treedemo_xml); break; | |||
| case json: codeDocument.replaceAllContent (BinaryData::juce_module_info); break; | |||
| default: codeDocument.replaceAllContent (String::empty); break; | |||
| case xml: codeDocument.replaceAllContent (BinaryData::treedemo_xml); break; | |||
| case json: codeDocument.replaceAllContent (BinaryData::juce_module_info); break; | |||
| default: codeDocument.replaceAllContent (String()); break; | |||
| } | |||
| } | |||
| @@ -367,32 +367,32 @@ private: | |||
| } | |||
| case MainAppWindow::useLookAndFeelV1: | |||
| result.setInfo ("Use LookAndFeel_V1", String::empty, generalCategory, 0); | |||
| result.setInfo ("Use LookAndFeel_V1", String(), generalCategory, 0); | |||
| result.addDefaultKeypress ('i', ModifierKeys::commandModifier); | |||
| result.setTicked (isLookAndFeelSelected<LookAndFeel_V1>()); | |||
| break; | |||
| case MainAppWindow::useLookAndFeelV2: | |||
| result.setInfo ("Use LookAndFeel_V2", String::empty, generalCategory, 0); | |||
| result.setInfo ("Use LookAndFeel_V2", String(), generalCategory, 0); | |||
| result.addDefaultKeypress ('o', ModifierKeys::commandModifier); | |||
| result.setTicked (isLookAndFeelSelected<LookAndFeel_V2>()); | |||
| break; | |||
| case MainAppWindow::useLookAndFeelV3: | |||
| result.setInfo ("Use LookAndFeel_V3", String::empty, generalCategory, 0); | |||
| result.setInfo ("Use LookAndFeel_V3", String(), generalCategory, 0); | |||
| result.addDefaultKeypress ('p', ModifierKeys::commandModifier); | |||
| result.setTicked (isLookAndFeelSelected<LookAndFeel_V3>()); | |||
| break; | |||
| case MainAppWindow::toggleRepaintDebugging: | |||
| result.setInfo ("Toggle repaint display", String::empty, generalCategory, 0); | |||
| result.setInfo ("Toggle repaint display", String(), generalCategory, 0); | |||
| result.addDefaultKeypress ('r', ModifierKeys()); | |||
| result.setTicked (juceDemoRepaintDebuggingActive); | |||
| break; | |||
| case MainAppWindow::useNativeTitleBar: | |||
| { | |||
| result.setInfo ("Use native window title bar", String::empty, generalCategory, 0); | |||
| result.setInfo ("Use native window title bar", String(), generalCategory, 0); | |||
| result.addDefaultKeypress ('n', ModifierKeys::commandModifier); | |||
| bool nativeTitlebar = false; | |||
| @@ -405,7 +405,7 @@ private: | |||
| #if ! JUCE_LINUX | |||
| case MainAppWindow::goToKioskMode: | |||
| result.setInfo ("Show full-screen kiosk mode", String::empty, generalCategory, 0); | |||
| result.setInfo ("Show full-screen kiosk mode", String(), generalCategory, 0); | |||
| result.addDefaultKeypress ('f', ModifierKeys::commandModifier); | |||
| result.setTicked (Desktop::getInstance().getKioskModeComponent() != 0); | |||
| break; | |||
| @@ -50,18 +50,18 @@ public: | |||
| //============================================================================== | |||
| MPESetupComponent() | |||
| : masterChannelLabel (String::empty, "Master channel:"), | |||
| noteChannelsLabel (String::empty, "Nr. of note channels:"), | |||
| masterPitchbendRangeLabel (String::empty, "Master pitchbend range (semitones):"), | |||
| notePitchbendRangeLabel (String::empty, "Note pitchbend range (semitones):"), | |||
| : masterChannelLabel (String(), "Master channel:"), | |||
| noteChannelsLabel (String(), "Nr. of note channels:"), | |||
| masterPitchbendRangeLabel (String(), "Master pitchbend range (semitones):"), | |||
| notePitchbendRangeLabel (String(), "Note pitchbend range (semitones):"), | |||
| addZoneButton ("Add this zone"), | |||
| clearAllZonesButton ("Clear all zones"), | |||
| legacyStartChannelLabel (String::empty, "First channel:"), | |||
| legacyEndChannelLabel (String::empty, "Last channel:"), | |||
| legacyPitchbendRangeLabel (String::empty, "Pitchbend range (semitones):"), | |||
| legacyStartChannelLabel (String(), "First channel:"), | |||
| legacyEndChannelLabel (String(), "Last channel:"), | |||
| legacyPitchbendRangeLabel (String(), "Pitchbend range (semitones):"), | |||
| legacyModeEnabledToggle ("Enable Legacy Mode"), | |||
| voiceStealingEnabledToggle ("Enable synth voice stealing"), | |||
| numberOfVoicesLabel (String::empty, "Number of synth voices") | |||
| numberOfVoicesLabel (String(), "Number of synth voices") | |||
| { | |||
| initialiseComboBoxWithConsecutiveIntegers (masterChannel, masterChannelLabel, 1, 15, defaultMasterChannel); | |||
| @@ -41,8 +41,8 @@ public: | |||
| { | |||
| setLookAndFeel (&lookAndFeel); | |||
| setSize (880, 720); | |||
| audioDeviceManager.initialise (0, 2, 0, true, String::empty, 0); | |||
| audioDeviceManager.addMidiInputCallback(String::empty, this); | |||
| audioDeviceManager.initialise (0, 2, 0, true, String(), 0); | |||
| audioDeviceManager.addMidiInputCallback (String(), this); | |||
| audioDeviceManager.addAudioCallback (this); | |||
| addAndMakeVisible (audioSetupComp); | |||
| @@ -65,7 +65,7 @@ public: | |||
| ~MainComponent() | |||
| { | |||
| audioDeviceManager.removeMidiInputCallback (String::empty, this); | |||
| audioDeviceManager.removeMidiInputCallback (String(), this); | |||
| } | |||
| //============================================================================== | |||
| @@ -167,7 +167,7 @@ MainContentComponent::MainContentComponent () | |||
| midiMonitor.setScrollbarsShown (true); | |||
| midiMonitor.setCaretVisible (false); | |||
| midiMonitor.setPopupMenuEnabled (false); | |||
| midiMonitor.setText (String::empty); | |||
| midiMonitor.setText (String()); | |||
| addAndMakeVisible (midiMonitor); | |||
| if (! BluetoothMidiDevicePairingDialogue::isAvailable()) | |||
| @@ -243,7 +243,7 @@ private: | |||
| static String::CharPointerType findEndOfFaceToken (String::CharPointerType t) noexcept | |||
| { | |||
| return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String::empty.getCharPointer()); | |||
| return CharacterFunctions::findEndOfToken (t, CharPointer_ASCII ("/ \t"), String().getCharPointer()); | |||
| } | |||
| }; | |||
| @@ -59,9 +59,9 @@ public: | |||
| JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemoPluginAudioProcessor& owner) | |||
| : AudioProcessorEditor (owner), | |||
| midiKeyboard (owner.keyboardState, MidiKeyboardComponent::horizontalKeyboard), | |||
| timecodeDisplayLabel (String::empty), | |||
| gainLabel (String::empty, "Throughput level:"), | |||
| delayLabel (String::empty, "Delay:") | |||
| timecodeDisplayLabel (String()), | |||
| gainLabel (String(), "Throughput level:"), | |||
| delayLabel (String(), "Delay:") | |||
| { | |||
| // add some sliders.. | |||
| addAndMakeVisible (gainSlider = new ParameterSlider (*owner.gainParam)); | |||
| @@ -256,7 +256,7 @@ Result FilterGraph::saveDocument (const File& file) | |||
| { | |||
| ScopedPointer<XmlElement> xml (createXml()); | |||
| if (! xml->writeToFile (file, String::empty)) | |||
| if (! xml->writeToFile (file, String())) | |||
| return Result::fail ("Couldn't write to the file"); | |||
| return Result::ok(); | |||
| @@ -969,7 +969,7 @@ void GraphEditorPanel::dragConnector (const MouseEvent& e) | |||
| if (draggingConnector != nullptr) | |||
| { | |||
| draggingConnector->setTooltip (String::empty); | |||
| draggingConnector->setTooltip (String()); | |||
| int x = e2.x; | |||
| int y = e2.y; | |||
| @@ -1013,7 +1013,7 @@ void GraphEditorPanel::endDraggingConnector (const MouseEvent& e) | |||
| if (draggingConnector == nullptr) | |||
| return; | |||
| draggingConnector->setTooltip (String::empty); | |||
| draggingConnector->setTooltip (String()); | |||
| const MouseEvent e2 (e.getEventRelativeTo (this)); | |||
| @@ -1108,7 +1108,7 @@ GraphDocumentComponent::GraphDocumentComponent (AudioPluginFormatManager& format | |||
| addAndMakeVisible (statusBar = new TooltipBar()); | |||
| deviceManager->addAudioCallback (&graphPlayer); | |||
| deviceManager->addMidiInputCallback (String::empty, &graphPlayer.getMidiMessageCollector()); | |||
| deviceManager->addMidiInputCallback (String(), &graphPlayer.getMidiMessageCollector()); | |||
| graphPanel->updateComponents(); | |||
| } | |||
| @@ -1143,7 +1143,7 @@ void GraphDocumentComponent::unfocusKeyboardComponent() | |||
| void GraphDocumentComponent::releaseGraph() | |||
| { | |||
| deviceManager->removeAudioCallback (&graphPlayer); | |||
| deviceManager->removeMidiInputCallback (String::empty, &graphPlayer.getMidiMessageCollector()); | |||
| deviceManager->removeMidiInputCallback (String(), &graphPlayer.getMidiMessageCollector()); | |||
| deviceManager->removeChangeListener (graphPanel); | |||
| deleteAllChildren(); | |||
| @@ -387,12 +387,12 @@ void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationComma | |||
| break; | |||
| case CommandIDs::showPluginListEditor: | |||
| result.setInfo ("Edit the list of available plug-Ins...", String::empty, category, 0); | |||
| result.setInfo ("Edit the list of available plug-Ins...", String(), category, 0); | |||
| result.addDefaultKeypress ('p', ModifierKeys::commandModifier); | |||
| break; | |||
| case CommandIDs::showAudioSettings: | |||
| result.setInfo ("Change the audio device settings", String::empty, category, 0); | |||
| result.setInfo ("Change the audio device settings", String(), category, 0); | |||
| result.addDefaultKeypress ('a', ModifierKeys::commandModifier); | |||
| break; | |||
| @@ -401,7 +401,7 @@ void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationComma | |||
| break; | |||
| case CommandIDs::aboutBox: | |||
| result.setInfo ("About...", String::empty, category, 0); | |||
| result.setInfo ("About...", String(), category, 0); | |||
| break; | |||
| case CommandIDs::allWindowsForward: | |||
| @@ -437,7 +437,7 @@ bool MainHostWindow::perform (const InvocationInfo& info) | |||
| case CommandIDs::saveAs: | |||
| if (graphEditor != nullptr && graphEditor->graph != nullptr) | |||
| graphEditor->graph->saveAs (File::nonexistent, true, true, true); | |||
| graphEditor->graph->saveAs (File(), true, true, true); | |||
| break; | |||
| case CommandIDs::showPluginListEditor: | |||
| @@ -577,6 +577,6 @@ bool MainHostWindow::isDoublePrecisionProcessing() | |||
| void MainHostWindow::updatePrecisionMenuItem (ApplicationCommandInfo& info) | |||
| { | |||
| info.setInfo ("Double floating point precision rendering", String::empty, "General", 0); | |||
| info.setInfo ("Double floating point precision rendering", String(), "General", 0); | |||
| info.setTicked (isDoublePrecisionProcessing()); | |||
| } | |||
| @@ -170,7 +170,7 @@ bool AppearanceSettings::readFromFile (const File& file) | |||
| bool AppearanceSettings::writeToFile (const File& file) const | |||
| { | |||
| const ScopedPointer<XmlElement> xml (settings.createXml()); | |||
| return xml != nullptr && xml->writeToFile (file, String::empty); | |||
| return xml != nullptr && xml->writeToFile (file, String()); | |||
| } | |||
| Font AppearanceSettings::getDefaultCodeFont() | |||
| @@ -77,7 +77,7 @@ Identifier PathSettingsTab::getKeyForPropertyComponent (TextPropertyComponent* c | |||
| // this property component does not have a key associated to it! | |||
| jassertfalse; | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| Component* PathSettingsTab::getContent() | |||
| @@ -286,7 +286,7 @@ struct AppearanceEditor | |||
| StringArray names; | |||
| names.add ("<Default Monospaced>"); | |||
| names.add (String::empty); | |||
| names.add (String()); | |||
| names.addArray (getAppSettings().monospacedFontNames); | |||
| return new ChoicePropertyComponent (Value (new FontNameValueSource (value)), | |||
| @@ -62,7 +62,7 @@ public: | |||
| Component* createEditor() override { return new ItemPreviewComponent (file); } | |||
| Component* createViewer() override { return createEditor(); } | |||
| void fileHasBeenRenamed (const File& newFile) override { file = newFile; } | |||
| String getState() const override { return String::empty; } | |||
| String getState() const override { return String(); } | |||
| void restoreState (const String&) override {} | |||
| String getType() const override | |||
| @@ -62,7 +62,7 @@ public: | |||
| virtual void fileHasBeenRenamed (const File& newFile) = 0; | |||
| virtual String getState() const = 0; | |||
| virtual void restoreState (const String& state) = 0; | |||
| virtual File getCounterpartFile() const { return File::nonexistent; } | |||
| virtual File getCounterpartFile() const { return File(); } | |||
| }; | |||
| //============================================================================== | |||
| @@ -639,7 +639,7 @@ void CppCodeEditorComponent::insertComponentClass() | |||
| const char* classNameField = "Class Name"; | |||
| aw.addTextEditor (classNameField, String::empty, String::empty, false); | |||
| aw.addTextEditor (classNameField, String(), String(), false); | |||
| aw.addButton (TRANS ("Insert Code"), 1, KeyPress (KeyPress::returnKey)); | |||
| aw.addButton (TRANS ("Cancel"), 0, KeyPress (KeyPress::escapeKey)); | |||
| @@ -46,7 +46,7 @@ public: | |||
| bool needsSaving() const override { return codeDoc != nullptr && codeDoc->hasChangedSinceSavePoint(); } | |||
| bool hasFileBeenModifiedExternally() override { return modDetector.hasBeenModified(); } | |||
| void fileHasBeenRenamed (const File& newFile) override { modDetector.fileHasBeenRenamed (newFile); } | |||
| String getState() const override { return lastState != nullptr ? lastState->toString() : String::empty; } | |||
| String getState() const override { return lastState != nullptr ? lastState->toString() : String(); } | |||
| void restoreState (const String& state) override { lastState = new CodeEditorComponent::State (state); } | |||
| File getCounterpartFile() const override | |||
| @@ -55,14 +55,14 @@ public: | |||
| if (! ComponentTypeHandler::restoreFromXml (xml, comp, layout)) | |||
| return false; | |||
| ComboBox defaultBox (String::empty); | |||
| ComboBox defaultBox; | |||
| ComboBox* const c = dynamic_cast<ComboBox*> (comp); | |||
| jassert (c != nullptr); | |||
| c->setEditableText (xml.getBoolAttribute ("editable", defaultBox.isTextEditable())); | |||
| c->setJustificationType (Justification (xml.getIntAttribute ("layout", defaultBox.getJustificationType().getFlags()))); | |||
| c->getProperties().set ("items", xml.getStringAttribute ("items", String::empty)); | |||
| c->getProperties().set ("items", xml.getStringAttribute ("items", String())); | |||
| c->setTextWhenNothingSelected (xml.getStringAttribute ("textWhenNonSelected", defaultBox.getTextWhenNothingSelected())); | |||
| c->setTextWhenNoChoicesAvailable (xml.getStringAttribute ("textWhenNoItems", defaultBox.getTextWhenNoChoicesAvailable())); | |||
| @@ -196,7 +196,7 @@ bool ComponentTypeHandler::restoreFromXml (const XmlElement& xml, | |||
| for (int i = 0; i < colours.size(); ++i) | |||
| { | |||
| const String col (xml.getStringAttribute (colours[i]->xmlTagName, String::empty)); | |||
| const String col (xml.getStringAttribute (colours[i]->xmlTagName, String())); | |||
| if (col.isNotEmpty()) | |||
| comp->setColour (colours[i]->colourId, Colour::fromString (col)); | |||
| @@ -518,12 +518,12 @@ void ComponentTypeHandler::fillInResizeCode (GeneratedCode& code, Component* com | |||
| if (pos.rect.isPositionAbsolute()) | |||
| code.constructorCode += r + "\n"; | |||
| else | |||
| code.getCallbackCode (String::empty, "void", "resized()", false) += r; | |||
| code.getCallbackCode (String(), "void", "resized()", false) += r; | |||
| } | |||
| String ComponentTypeHandler::getCreationParameters (GeneratedCode&, Component*) | |||
| { | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) | |||
| @@ -93,7 +93,7 @@ public: | |||
| return false; | |||
| ((GenericComponent*) comp)->actualClassName = xml.getStringAttribute ("class", "Component"); | |||
| ((GenericComponent*) comp)->constructorParams = xml.getStringAttribute ("params", String::empty); | |||
| ((GenericComponent*) comp)->constructorParams = xml.getStringAttribute ("params", String()); | |||
| return true; | |||
| } | |||
| @@ -44,7 +44,7 @@ public: | |||
| XmlElement* e = ComponentTypeHandler::createXmlFor (comp, layout); | |||
| e->setAttribute ("title", g->getText()); | |||
| GroupComponent defaultComp (String::empty, String::empty); | |||
| GroupComponent defaultComp; | |||
| if (g->getTextLabelPosition().getFlags() != defaultComp.getTextLabelPosition().getFlags()) | |||
| e->setAttribute ("textpos", g->getTextLabelPosition().getFlags()); | |||
| @@ -82,7 +82,7 @@ public: | |||
| String s; | |||
| GroupComponent defaultComp (String::empty, String::empty); | |||
| GroupComponent defaultComp; | |||
| if (g->getTextLabelPosition().getFlags() != defaultComp.getTextLabelPosition().getFlags()) | |||
| { | |||
| @@ -101,15 +101,15 @@ public: | |||
| setImageKeepProportions (l, ib, xml.getBoolAttribute ("keepProportions", true), false); | |||
| setImageResource (l, ib, normalImage, xml.getStringAttribute ("resourceNormal", String::empty), false); | |||
| setImageResource (l, ib, normalImage, xml.getStringAttribute ("resourceNormal", String()), false); | |||
| setImageOpacity (l, ib, normalImage, (float) xml.getDoubleAttribute ("opacityNormal", 1.0f), false); | |||
| setImageColour (l, ib, normalImage, Colour::fromString (xml.getStringAttribute ("colourNormal", "0")), false); | |||
| setImageResource (l, ib, overImage, xml.getStringAttribute ("resourceOver", String::empty), false); | |||
| setImageResource (l, ib, overImage, xml.getStringAttribute ("resourceOver", String()), false); | |||
| setImageOpacity (l, ib, overImage, (float) xml.getDoubleAttribute ("opacityOver", 1.0f), false); | |||
| setImageColour (l, ib, overImage, Colour::fromString (xml.getStringAttribute ("colourOver", "0")), false); | |||
| setImageResource (l, ib, downImage, xml.getStringAttribute ("resourceDown", String::empty), false); | |||
| setImageResource (l, ib, downImage, xml.getStringAttribute ("resourceDown", String()), false); | |||
| setImageOpacity (l, ib, downImage, (float) xml.getDoubleAttribute ("opacityDown", 1.0f), false); | |||
| setImageColour (l, ib, downImage, Colour::fromString (xml.getStringAttribute ("colourDown", "0")), false); | |||
| @@ -68,7 +68,7 @@ public: | |||
| if (! ComponentTypeHandler::restoreFromXml (xml, comp, layout)) | |||
| return false; | |||
| Label defaultLabel (String::empty, String::empty); | |||
| Label defaultLabel; | |||
| Font font; | |||
| font.setHeight ((float) xml.getDoubleAttribute ("fontsize", 15.0)); | |||
| @@ -147,7 +147,7 @@ public: | |||
| default: jassertfalse; break; | |||
| } | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) | |||
| @@ -275,7 +275,7 @@ public: | |||
| TabDemoContentComp* const tdc = dynamic_cast<TabDemoContentComp*> (tc->getTabContentComponent (tabIndex)); | |||
| jassert (tdc != nullptr); | |||
| return tdc != 0 ? tdc->contentClassName : String::empty; | |||
| return tdc != 0 ? tdc->contentClassName : String(); | |||
| } | |||
| static void setTabClassName (TabbedComponent* tc, int tabIndex, const String& newName) | |||
| @@ -295,7 +295,7 @@ public: | |||
| TabDemoContentComp* const tdc = dynamic_cast<TabDemoContentComp*> (tc->getTabContentComponent (tabIndex)); | |||
| jassert (tdc != nullptr); | |||
| return tdc != 0 ? tdc->constructorParams : String::empty; | |||
| return tdc != 0 ? tdc->constructorParams : String(); | |||
| } | |||
| static void setTabConstructorParams (TabbedComponent* tc, int tabIndex, const String& newParams) | |||
| @@ -315,7 +315,7 @@ public: | |||
| TabDemoContentComp* const tdc = dynamic_cast<TabDemoContentComp*> (tc->getTabContentComponent (tabIndex)); | |||
| jassert (tdc != nullptr); | |||
| return tdc != 0 ? tdc->jucerComponentFile : String::empty; | |||
| return tdc != 0 ? tdc->jucerComponentFile : String(); | |||
| } | |||
| static void setTabJucerFile (TabbedComponent* tc, int tabIndex, const String& newFile) | |||
| @@ -66,7 +66,7 @@ public: | |||
| v->setScrollBarThickness (xml.getIntAttribute ("scrollbarThickness", defaultViewport.getScrollBarThickness())); | |||
| setViewportJucerComponentFile (v, xml.getStringAttribute ("jucerFile", String::empty)); | |||
| setViewportJucerComponentFile (v, xml.getStringAttribute ("jucerFile", String())); | |||
| setViewportGenericComponentClass (v, xml.getStringAttribute ("contentClass")); | |||
| setViewportContentType (v, xml.getIntAttribute ("contentType", 0)); | |||
| setViewportConstructorParams (v, xml.getStringAttribute ("constructorParams")); | |||
| @@ -150,7 +150,7 @@ public: | |||
| } | |||
| else | |||
| { | |||
| classNm = String::empty; | |||
| classNm = String(); | |||
| } | |||
| } | |||
| @@ -505,7 +505,7 @@ private: | |||
| const String filename (getViewportJucerComponentFile (component)); | |||
| if (filename.isEmpty()) | |||
| return File::nonexistent; | |||
| return File(); | |||
| return document.getCppFile().getSiblingFile (filename); | |||
| } | |||
| @@ -275,7 +275,7 @@ class ButtonTestComponent : public Button | |||
| { | |||
| public: | |||
| ButtonTestComponent (ButtonDocument* const doc, const bool fillBackground) | |||
| : Button (String::empty), | |||
| : Button (String()), | |||
| document (doc), | |||
| alwaysFillBackground (fillBackground) | |||
| { | |||
| @@ -158,7 +158,7 @@ String BinaryResources::browseForResource (const String& title, | |||
| return name; | |||
| } | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| String BinaryResources::findUniqueName (const String& rootName) const | |||
| @@ -715,7 +715,7 @@ void ComponentLayout::fillInGeneratedCode (GeneratedCode& code) const | |||
| String ComponentLayout::getComponentMemberVariableName (Component* comp) const | |||
| { | |||
| if (comp == nullptr) | |||
| return String::empty; | |||
| return String(); | |||
| String name (comp->getProperties() ["memberName"].toString()); | |||
| @@ -730,7 +730,7 @@ void ComponentLayout::setComponentMemberVariableName (Component* comp, const Str | |||
| jassert (comp != nullptr); | |||
| const String oldName (getComponentMemberVariableName (comp)); | |||
| comp->getProperties().set ("memberName", String::empty); | |||
| comp->getProperties().set ("memberName", String()); | |||
| const String n (getUnusedMemberName (CodeHelpers::makeValidIdentifier (newName, false, true, false), comp)); | |||
| comp->getProperties().set ("memberName", n); | |||
| @@ -775,7 +775,7 @@ String ComponentLayout::getUnusedMemberName (String nameRoot, Component* comp) c | |||
| String ComponentLayout::getComponentVirtualClassName (Component* comp) const | |||
| { | |||
| if (comp == nullptr) | |||
| return String::empty; | |||
| return String(); | |||
| return comp->getProperties() ["virtualName"]; | |||
| } | |||
| @@ -173,7 +173,7 @@ void JucerDocument::setParentClasses (const String& classes) | |||
| s = s.fromFirstOccurrenceOf (" ", false, false); | |||
| if (s.trim().isEmpty()) | |||
| type = s = String::empty; | |||
| type = s = String(); | |||
| } | |||
| s = type + CodeHelpers::makeValidIdentifier (s.trim(), false, false, true); | |||
| @@ -378,11 +378,11 @@ bool JucerDocument::loadFromXml (const XmlElement& xml) | |||
| && getTypeName().equalsIgnoreCase (xml.getStringAttribute ("documentType"))) | |||
| { | |||
| className = xml.getStringAttribute ("className", defaultClassName); | |||
| templateFile = xml.getStringAttribute ("template", String::empty); | |||
| componentName = xml.getStringAttribute ("componentName", String::empty); | |||
| templateFile = xml.getStringAttribute ("template", String()); | |||
| componentName = xml.getStringAttribute ("componentName", String()); | |||
| parentClasses = xml.getStringAttribute ("parentClasses", defaultParentClasses); | |||
| constructorParams = xml.getStringAttribute ("constructorParams", String::empty); | |||
| variableInitialisers = xml.getStringAttribute ("variableInitialisers", String::empty); | |||
| constructorParams = xml.getStringAttribute ("constructorParams", String()); | |||
| variableInitialisers = xml.getStringAttribute ("variableInitialisers", String()); | |||
| fixedSize = xml.getBoolAttribute ("fixedSize", false); | |||
| initialWidth = xml.getIntAttribute ("initialWidth", 300); | |||
| @@ -425,10 +425,10 @@ void JucerDocument::fillInGeneratedCode (GeneratedCode& code) const | |||
| code.constructorCode << "setName (" + quotedString (componentName, false) + ");\n"; | |||
| // call these now, just to make sure they're the first two methods in the list. | |||
| code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false) | |||
| code.getCallbackCode (String(), "void", "paint (Graphics& g)", false) | |||
| << "//[UserPrePaint] Add your own custom painting code here..\n//[/UserPrePaint]\n\n"; | |||
| code.getCallbackCode (String::empty, "void", "resized()", false) | |||
| code.getCallbackCode (String(), "void", "resized()", false) | |||
| << "//[UserPreResize] Add your own custom resize code here..\n//[/UserPreResize]\n\n"; | |||
| if (ComponentLayout* l = getComponentLayout()) | |||
| @@ -449,10 +449,10 @@ void JucerDocument::fillInGeneratedCode (GeneratedCode& code) const | |||
| if (initialWidth > 0 || initialHeight > 0) | |||
| code.constructorCode << "\nsetSize (" << initialWidth << ", " << initialHeight << ");\n"; | |||
| code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false) | |||
| code.getCallbackCode (String(), "void", "paint (Graphics& g)", false) | |||
| << "//[UserPaint] Add your own custom painting code here..\n//[/UserPaint]"; | |||
| code.getCallbackCode (String::empty, "void", "resized()", false) | |||
| code.getCallbackCode (String(), "void", "resized()", false) | |||
| << "//[UserResized] Add your own custom resize handling here..\n//[/UserResized]"; | |||
| // add optional methods | |||
| @@ -491,7 +491,7 @@ void JucerDocument::fillInPaintCode (GeneratedCode& code) const | |||
| { | |||
| for (int i = 0; i < getNumPaintRoutines(); ++i) | |||
| getPaintRoutine (i) | |||
| ->fillInGeneratedCode (code, code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false)); | |||
| ->fillInGeneratedCode (code, code.getCallbackCode (String(), "void", "paint (Graphics& g)", false)); | |||
| } | |||
| void JucerDocument::setTemplateFile (const String& newFile) | |||
| @@ -377,7 +377,7 @@ public: | |||
| String getResource() const | |||
| { | |||
| if (element == nullptr) | |||
| return String::empty; | |||
| return String(); | |||
| if (isForStroke) | |||
| return element->getStrokeType().fill.imageResourceName; | |||
| @@ -893,12 +893,12 @@ void ColouredElement::addColourAttributes (XmlElement* const e) const | |||
| bool ColouredElement::loadColourAttributes (const XmlElement& xml) | |||
| { | |||
| fillType.restoreFromString (xml.getStringAttribute ("fill", String::empty)); | |||
| fillType.restoreFromString (xml.getStringAttribute ("fill", String())); | |||
| isStrokePresent = showOutline && xml.getBoolAttribute ("hasStroke", false); | |||
| strokeType.restoreFromString (xml.getStringAttribute ("stroke", String::empty)); | |||
| strokeType.fill.restoreFromString (xml.getStringAttribute ("strokeColour", String::empty)); | |||
| strokeType.restoreFromString (xml.getStringAttribute ("stroke", String())); | |||
| strokeType.fill.restoreFromString (xml.getStringAttribute ("strokeColour", String())); | |||
| return true; | |||
| } | |||
| @@ -202,7 +202,7 @@ public: | |||
| break; | |||
| } | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| void restoreFromString (const String& s) | |||
| @@ -77,8 +77,8 @@ public: | |||
| String resource (document.getResources() | |||
| .browseForResource ("Select an image file to add as a resource", | |||
| "*.jpg;*.jpeg;*.png;*.gif;*.svg", | |||
| File::nonexistent, | |||
| String::empty)); | |||
| File(), | |||
| String())); | |||
| if (resource.isNotEmpty()) | |||
| setResource (resource); | |||
| @@ -86,7 +86,7 @@ public: | |||
| else | |||
| { | |||
| if (choices[newIndex] == getNoneText() && allowChoiceOfNoResource) | |||
| setResource (String::empty); | |||
| setResource (String()); | |||
| else | |||
| setResource (choices [newIndex]); | |||
| } | |||
| @@ -110,7 +110,7 @@ public: | |||
| choices.clear(); | |||
| choices.add ("-- create a new image resource -- "); | |||
| choices.add (String::empty); | |||
| choices.add (String()); | |||
| if (allowChoiceOfNoResource) | |||
| choices.add (getNoneText()); | |||
| @@ -368,7 +368,7 @@ public: | |||
| if (xml.hasTagName (getTagName())) | |||
| { | |||
| position.restoreFromXml (xml, position); | |||
| resourceName = xml.getStringAttribute ("resource", String::empty); | |||
| resourceName = xml.getStringAttribute ("resource", String()); | |||
| opacity = xml.getDoubleAttribute ("opacity", 1.0); | |||
| mode = (StretchMode) xml.getIntAttribute ("mode", (int) stretched); | |||
| @@ -405,7 +405,7 @@ private: | |||
| if (element != nullptr) | |||
| return element->getResource(); | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| }; | |||
| @@ -425,7 +425,7 @@ void PaintElementPath::fillInGeneratedCode (GeneratedCode& code, String& paintMe | |||
| r << '\n'; | |||
| if (somePointsAreRelative) | |||
| code.getCallbackCode (String::empty, "void", "resized()", false) | |||
| code.getCallbackCode (String(), "void", "resized()", false) | |||
| << pathVariable << ".clear();\n" << r; | |||
| else | |||
| code.constructorCode << r; | |||
| @@ -35,9 +35,9 @@ public: | |||
| const bool allowEditingOfFilename, | |||
| const String& fileBrowserWildcard = "*") | |||
| : PropertyComponent (name), | |||
| filenameComp (name, File::nonexistent, allowEditingOfFilename, | |||
| filenameComp (name, File(), allowEditingOfFilename, | |||
| isDirectory, false, fileBrowserWildcard, | |||
| String::empty, String::empty) | |||
| String(), String()) | |||
| { | |||
| addAndMakeVisible (filenameComp); | |||
| filenameComp.addListener (this); | |||
| @@ -36,7 +36,7 @@ public: | |||
| choices.add (getDefaultSans()); | |||
| choices.add (getDefaultSerif()); | |||
| choices.add (getDefaultMono()); | |||
| choices.add (String::empty); | |||
| choices.add (String()); | |||
| static StringArray fontNames; | |||
| @@ -90,7 +90,7 @@ public: | |||
| static String getTypefaceNameCode (const String& typefaceName) | |||
| { | |||
| if (typefaceName == getDefaultFont()) return String::empty; | |||
| if (typefaceName == getDefaultFont()) return String(); | |||
| if (typefaceName == getDefaultSans()) return "Font::getDefaultSansSerifFontName(), "; | |||
| if (typefaceName == getDefaultSerif()) return "Font::getDefaultSerifFontName(), "; | |||
| if (typefaceName == getDefaultMono()) return "Font::getDefaultMonospacedFontName(), "; | |||
| @@ -414,7 +414,7 @@ protected: | |||
| public: | |||
| PositionPropLabel (PositionPropertyBase& owner_) | |||
| : Label (String::empty, String::empty), | |||
| : Label (String(), String()), | |||
| owner (owner_) | |||
| { | |||
| setEditable (true, true, false); | |||
| @@ -47,7 +47,7 @@ public: | |||
| : PropertyComponent ("extra callbacks", 250), | |||
| document (doc) | |||
| { | |||
| addAndMakeVisible (listBox = new ListBox (String::empty, this)); | |||
| addAndMakeVisible (listBox = new ListBox (String(), this)); | |||
| listBox->setRowHeight (22); | |||
| document.addChangeListener (this); | |||
| @@ -817,20 +817,20 @@ void JucerDocumentEditor::getCommandInfo (const CommandID commandID, Application | |||
| break; | |||
| case StandardApplicationCommandIDs::cut: | |||
| result.setInfo (TRANS ("Cut"), String::empty, "Editing", 0); | |||
| result.setInfo (TRANS ("Cut"), String(), "Editing", 0); | |||
| result.setActive (isSomethingSelected()); | |||
| result.defaultKeypresses.add (KeyPress ('x', cmd, 0)); | |||
| break; | |||
| case StandardApplicationCommandIDs::copy: | |||
| result.setInfo (TRANS ("Copy"), String::empty, "Editing", 0); | |||
| result.setInfo (TRANS ("Copy"), String(), "Editing", 0); | |||
| result.setActive (isSomethingSelected()); | |||
| result.defaultKeypresses.add (KeyPress ('c', cmd, 0)); | |||
| break; | |||
| case StandardApplicationCommandIDs::paste: | |||
| { | |||
| result.setInfo (TRANS ("Paste"), String::empty, "Editing", 0); | |||
| result.setInfo (TRANS ("Paste"), String(), "Editing", 0); | |||
| result.defaultKeypresses.add (KeyPress ('v', cmd, 0)); | |||
| bool canPaste = false; | |||
| @@ -851,18 +851,18 @@ void JucerDocumentEditor::getCommandInfo (const CommandID commandID, Application | |||
| break; | |||
| case StandardApplicationCommandIDs::del: | |||
| result.setInfo (TRANS ("Delete"), String::empty, "Editing", 0); | |||
| result.setInfo (TRANS ("Delete"), String(), "Editing", 0); | |||
| result.setActive (isSomethingSelected()); | |||
| break; | |||
| case StandardApplicationCommandIDs::selectAll: | |||
| result.setInfo (TRANS ("Select All"), String::empty, "Editing", 0); | |||
| result.setInfo (TRANS ("Select All"), String(), "Editing", 0); | |||
| result.setActive (currentPaintRoutine != nullptr || currentLayout != nullptr); | |||
| result.defaultKeypresses.add (KeyPress ('a', cmd, 0)); | |||
| break; | |||
| case StandardApplicationCommandIDs::deselectAll: | |||
| result.setInfo (TRANS ("Deselect All"), String::empty, "Editing", 0); | |||
| result.setInfo (TRANS ("Deselect All"), String(), "Editing", 0); | |||
| result.setActive (currentPaintRoutine != nullptr || currentLayout != nullptr); | |||
| result.defaultKeypresses.add (KeyPress ('d', cmd, 0)); | |||
| break; | |||
| @@ -84,7 +84,7 @@ ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc) | |||
| delButton.addListener (this); | |||
| delButton.setEnabled (false); | |||
| addAndMakeVisible (listBox = new TableListBox (String::empty, this)); | |||
| addAndMakeVisible (listBox = new TableListBox (String(), this)); | |||
| listBox->getHeader().addColumn ("name", 1, 150, 80, 400); | |||
| listBox->getHeader().addColumn ("original file", 2, 350, 80, 800); | |||
| listBox->getHeader().addColumn ("size", 3, 100, 40, 150); | |||
| @@ -247,8 +247,8 @@ void ResourceEditorPanel::buttonClicked (Button* b) | |||
| document.getResources() | |||
| .browseForResource ("Select a file to add as a resource", | |||
| "*", | |||
| File::nonexistent, | |||
| String::empty); | |||
| File(), | |||
| String()); | |||
| } | |||
| else if (b == &delButton) | |||
| { | |||
| @@ -219,7 +219,7 @@ struct ClassDatabase | |||
| if (isAbstract) return "This class is abstract"; | |||
| if (noDefaultConstructor) return "This class has no default constructor"; | |||
| if (inAnonymousNamespace) return "This class is declared inside an anonymous namespace"; | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| bool isDisallowed (const InstantiationFlags& disallowedFlags) const | |||
| @@ -82,7 +82,7 @@ private: | |||
| } | |||
| String getRenamingName() const override { return getDisplayName(); } | |||
| String getDisplayName() const override { return (namespaceToShow != nullptr ? namespaceToShow->name : String::empty) + "::"; } | |||
| String getDisplayName() const override { return (namespaceToShow != nullptr ? namespaceToShow->name : String()) + "::"; } | |||
| void setName (const String&) override {} | |||
| bool isMissing() override { return false; } | |||
| Icon getIcon() const override { return Icon (getIcons().graph, getContrastingColour (Colours::darkred, 0.5f)); } | |||
| @@ -190,7 +190,7 @@ struct CppParserHelpers | |||
| if (CPlusPlusCodeTokeniser::isReservedKeyword (ed.getText().replaceSection (ed.getHighlightedRegion().getStart(), | |||
| ed.getHighlightedRegion().getLength(), | |||
| s))) | |||
| return String::empty; | |||
| return String(); | |||
| return s; | |||
| } | |||
| @@ -27,7 +27,7 @@ class ErrorListComp : public TreePanelBase, | |||
| { | |||
| public: | |||
| ErrorListComp (ErrorList& el) | |||
| : TreePanelBase (nullptr, String::empty), | |||
| : TreePanelBase (nullptr, String()), | |||
| errorList (el) | |||
| { | |||
| setName ("Errors and Warnings"); | |||
| @@ -82,7 +82,7 @@ struct SourceCodeRange | |||
| String toString() const | |||
| { | |||
| if (file.isEmpty() && range.isEmpty()) | |||
| return String::empty; | |||
| return String(); | |||
| return file + ":" + String (range.getStart()) + ":" + String (range.getEnd()); | |||
| } | |||
| @@ -179,7 +179,7 @@ public: | |||
| return defaultInstallation; | |||
| #endif | |||
| return File::nonexistent; | |||
| return File(); | |||
| } | |||
| protected: | |||
| @@ -188,7 +188,7 @@ private: | |||
| if (isCodeBlocks() && isWindows()) | |||
| { | |||
| defines.set ("__MINGW__", "1"); | |||
| defines.set ("__MINGW_EXTENSION", String::empty); | |||
| defines.set ("__MINGW_EXTENSION", String()); | |||
| } | |||
| else | |||
| { | |||
| @@ -767,7 +767,7 @@ protected: | |||
| << newLine | |||
| << "#endif" << newLine; | |||
| if (iconFile != File::nonexistent) | |||
| if (iconFile != File()) | |||
| mo << newLine | |||
| << "IDI_ICON1 ICON DISCARDABLE " << iconFile.getFileName().quoted() | |||
| << newLine | |||
| @@ -862,7 +862,7 @@ public: | |||
| if (group.getID() == ProjectSaver::getGeneratedGroupID()) | |||
| { | |||
| if (iconFile != File::nonexistent) | |||
| if (iconFile != File()) | |||
| { | |||
| group.addFileAtIndex (iconFile, -1, true); | |||
| group.findItemForFile (iconFile).getShouldAddToBinaryResourcesValue() = false; | |||
| @@ -884,7 +884,7 @@ public: | |||
| { | |||
| MemoryOutputStream mo; | |||
| writeSolutionFile (mo, getSolutionVersionString(), String::empty, getVCProjFile()); | |||
| writeSolutionFile (mo, getSolutionVersionString(), String(), getVCProjFile()); | |||
| overwriteFileIfDifferentOrThrow (getSLNFile(), mo); | |||
| } | |||
| @@ -1493,7 +1493,7 @@ protected: | |||
| { | |||
| XmlElement* targetName = props->createNewChildElement ("TargetName"); | |||
| setConditionAttribute (*targetName, config); | |||
| targetName->addTextElement (config.getOutputFilename (String::empty, true)); | |||
| targetName->addTextElement (config.getOutputFilename (String(), true)); | |||
| } | |||
| { | |||
| @@ -1660,7 +1660,7 @@ protected: | |||
| } | |||
| } | |||
| if (iconFile != File::nonexistent) | |||
| if (iconFile != File()) | |||
| { | |||
| XmlElement* e = otherFilesGroup->createNewChildElement ("None"); | |||
| e->setAttribute ("Include", prependDot (iconFile.getFileName())); | |||
| @@ -1694,7 +1694,7 @@ protected: | |||
| if (projectType.isStaticLibrary()) return "StaticLibrary"; | |||
| jassertfalse; | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| static const char* getOptimisationLevelString (int level) | |||
| @@ -1777,7 +1777,7 @@ protected: | |||
| for (int i = 0; i < projectItem.getNumChildren(); ++i) | |||
| addFilesToFilter (projectItem.getChild(i), | |||
| (path.isEmpty() ? String::empty : (path + "\\")) + projectItem.getChild(i).getName(), | |||
| (path.isEmpty() ? String() : (path + "\\")) + projectItem.getChild(i).getName(), | |||
| cpps, headers, otherFiles, groups); | |||
| } | |||
| else if (projectItem.shouldBeAddedToTargetProject()) | |||
| @@ -550,7 +550,7 @@ public: | |||
| xcodeIsExecutable = true; | |||
| xcodeCreatePList = false; | |||
| xcodeFileType = "compiled.mach-o.executable"; | |||
| xcodeBundleExtension = String::empty; | |||
| xcodeBundleExtension = String(); | |||
| xcodeProductType = "com.apple.product-type.tool"; | |||
| xcodeCopyToProductInstallPathAfterBuild = false; | |||
| break; | |||
| @@ -833,5 +833,5 @@ String ProjectExporter::getExternalLibraryFlags (const BuildConfiguration& confi | |||
| if (libraries.size() != 0) | |||
| return replacePreprocessorTokens (config, "-l" + libraries.joinIntoString (" -l")).trim(); | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| @@ -384,7 +384,7 @@ protected: | |||
| static void writeXmlOrThrow (const XmlElement& xml, const File& file, const String& encoding, int maxCharsPerLine, bool useUnixNewLines = false) | |||
| { | |||
| MemoryOutputStream mo; | |||
| xml.writeToStream (mo, String::empty, false, true, encoding, maxCharsPerLine); | |||
| xml.writeToStream (mo, String(), false, true, encoding, maxCharsPerLine); | |||
| if (useUnixNewLines) | |||
| { | |||
| @@ -287,7 +287,7 @@ private: | |||
| if (xml != nullptr) | |||
| { | |||
| MemoryOutputStream mo; | |||
| xml->writeToStream (mo, String::empty); | |||
| xml->writeToStream (mo, String()); | |||
| replaceFileIfDifferent (projectFile, mo); | |||
| } | |||
| } | |||
| @@ -324,9 +324,9 @@ private: | |||
| if (! foundCodeSection) | |||
| { | |||
| userContent.add (String::empty); | |||
| userContent.add (String()); | |||
| userContent.add ("// (You can add your own code in this section, and the Projucer will not overwrite it)"); | |||
| userContent.add (String::empty); | |||
| userContent.add (String()); | |||
| } | |||
| return userContent.joinIntoString (newLine) + newLine; | |||
| @@ -36,7 +36,7 @@ class TextWithDefaultPropertyComponent : public PropertyComponent, | |||
| { | |||
| public: | |||
| LabelComp (TextWithDefaultPropertyComponent& tpc, const int charLimit) | |||
| : Label (String::empty, String::empty), | |||
| : Label (String(), String()), | |||
| owner (tpc), | |||
| maxChars (charLimit) | |||
| { | |||
| @@ -158,7 +158,7 @@ private: | |||
| void editorShown (Label*, TextEditor& editor) override | |||
| { | |||
| if (cachedValue.isUsingDefault()) | |||
| editor.setText (String::empty, dontSendNotification); | |||
| editor.setText (String(), dontSendNotification); | |||
| } | |||
| void editorHidden (Label*, TextEditor&) override {} | |||
| @@ -65,7 +65,7 @@ try : TextPropertyComponent (propertyName, 1024, false), | |||
| // which has set the project value to whatever is displayed in the label (this may be the | |||
| // global/fallback value). In this case we have to reset the project value to blank: | |||
| if (initialValueIsEmpty) | |||
| getValue().setValue (String::empty); | |||
| getValue().setValue (String()); | |||
| getValue().addListener (this); | |||
| setColour (textColourId, getTextColourToDisplay()); | |||
| @@ -114,7 +114,7 @@ void DependencyPathPropertyComponent::labelTextChanged (Label*) | |||
| void DependencyPathPropertyComponent::editorShown (Label* /*label*/, TextEditor& editor) | |||
| { | |||
| if (! pathValueSource.isUsingProjectSettings()) | |||
| editor.setText (String::empty, dontSendNotification); | |||
| editor.setText (String(), dontSendNotification); | |||
| } | |||
| void DependencyPathPropertyComponent::editorHidden (Label*, TextEditor&) | |||
| @@ -90,7 +90,7 @@ private: | |||
| if ((value.refersToSameSourceAs (globalSettingsValue) && isUsingGlobalSettings())) | |||
| { | |||
| sendChangeMessage (true); | |||
| setValue (String::empty); // make sure that the project-specific value is still blank | |||
| setValue (String()); // make sure that the project-specific value is still blank | |||
| } | |||
| } | |||
| @@ -761,7 +761,7 @@ void EnabledModuleList::addModuleFromUserSelectedFile() | |||
| { | |||
| static File lastLocation (findDefaultModulesFolder (project)); | |||
| FileChooser fc ("Select a module to add...", lastLocation, String::empty, false); | |||
| FileChooser fc ("Select a module to add...", lastLocation, String(), false); | |||
| if (fc.browseForDirectory()) | |||
| { | |||
| @@ -1231,15 +1231,13 @@ void Project::createExporterForCurrentPlatform() | |||
| String Project::getFileTemplate (const String& templateName) | |||
| { | |||
| int dataSize; | |||
| const char* data = BinaryData::getNamedResource (templateName.toUTF8(), dataSize); | |||
| if (data == nullptr) | |||
| { | |||
| jassertfalse; | |||
| return String::empty; | |||
| } | |||
| if (const char* data = BinaryData::getNamedResource (templateName.toUTF8(), dataSize)) | |||
| return String::fromUTF8 (data, dataSize); | |||
| jassertfalse; | |||
| return String(); | |||
| return String::fromUTF8 (data, dataSize); | |||
| } | |||
| //============================================================================== | |||
| @@ -637,7 +637,7 @@ bool ProjectContentComponent::hasFileInRecentList (const File& f) const | |||
| File ProjectContentComponent::getCurrentFile() const | |||
| { | |||
| return currentDocument != nullptr ? currentDocument->getFile() | |||
| : File::nonexistent; | |||
| : File(); | |||
| } | |||
| bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc, bool grabFocus) | |||
| @@ -1174,7 +1174,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica | |||
| break; | |||
| case CommandIDs::deleteSelectedItem: | |||
| result.setInfo ("Delete Selected File", String::empty, CommandCategories::general, 0); | |||
| result.setInfo ("Delete Selected File", String(), CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0)); | |||
| result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0)); | |||
| result.setActive (dynamic_cast<TreePanelBase*> (treeViewTabs.getCurrentContentComponent()) != nullptr); | |||
| @@ -140,7 +140,7 @@ public: | |||
| virtual void browseToAddExistingFiles() | |||
| { | |||
| const File location (item.isGroup() ? item.determineGroupFolder() : getFile()); | |||
| FileChooser fc ("Add Files to Jucer Project", location, String::empty, false); | |||
| FileChooser fc ("Add Files to Jucer Project", location, String(), false); | |||
| if (fc.browseForMultipleFilesOrDirectories()) | |||
| { | |||
| @@ -156,7 +156,7 @@ public: | |||
| virtual void checkFileStatus() // (recursive) | |||
| { | |||
| const File file (getFile()); | |||
| const bool nowMissing = file != File::nonexistent && ! file.exists(); | |||
| const bool nowMissing = file != File() && ! file.exists(); | |||
| if (nowMissing != isFileMissing) | |||
| { | |||
| @@ -235,7 +235,7 @@ public: | |||
| bool mightContainSubItems() override { return item.getNumChildren() > 0; } | |||
| String getUniqueName() const override { jassert (item.getID().isNotEmpty()); return item.getID(); } | |||
| bool canBeSelected() const override { return true; } | |||
| String getTooltip() override { return String::empty; } | |||
| String getTooltip() override { return String(); } | |||
| File getDraggableFile() const override { return getFile(); } | |||
| var getDragSourceDescription() override | |||
| @@ -39,7 +39,7 @@ public: | |||
| const String& propertyDescription, | |||
| bool isDirectory, | |||
| const String& wildcards = "*", | |||
| const File& rootToUseForRelativePaths = File::nonexistent) | |||
| const File& rootToUseForRelativePaths = File()) | |||
| : PropertyComponent (propertyDescription), | |||
| innerComp (valueToControl, isDirectory, wildcards, rootToUseForRelativePaths) | |||
| { | |||
| @@ -122,8 +122,8 @@ private: | |||
| void setTo (const File& f) | |||
| { | |||
| value = (root == File::nonexistent) ? f.getFullPathName() | |||
| : f.getRelativePathFrom (root); | |||
| value = (root == File()) ? f.getFullPathName() | |||
| : f.getRelativePathFrom (root); | |||
| } | |||
| Value value; | |||
| @@ -27,7 +27,7 @@ class SVGPathDataComponent : public Component, | |||
| { | |||
| public: | |||
| SVGPathDataComponent() | |||
| : desc (String::empty, | |||
| : desc (String(), | |||
| "Paste an SVG path string into the top box, and it'll be converted to some C++ " | |||
| "code that will load it as a Path object..") | |||
| { | |||
| @@ -201,7 +201,7 @@ struct TranslationHelpers | |||
| if (currentItem.isNotEmpty()) | |||
| result.add (currentItem); | |||
| currentItem = String::empty; | |||
| currentItem = String(); | |||
| } | |||
| else | |||
| { | |||
| @@ -273,7 +273,7 @@ struct TranslationHelpers | |||
| { | |||
| lines.add ("language: " + original.getLanguageName()); | |||
| lines.add ("countries: " + original.getCountryCodes().joinIntoString (" ")); | |||
| lines.add (String::empty); | |||
| lines.add (String()); | |||
| const StringArray& originalKeys (originalStrings.getAllKeys()); | |||
| const StringArray& originalValues (originalStrings.getAllValues()); | |||
| @@ -296,7 +296,7 @@ struct TranslationHelpers | |||
| { | |||
| lines.add ("language: [enter full name of the language here!]"); | |||
| lines.add ("countries: [enter list of 2-character country codes here!]"); | |||
| lines.add (String::empty); | |||
| lines.add (String()); | |||
| } | |||
| for (int i = 0; i < preStrings.size(); ++i) | |||
| @@ -429,8 +429,7 @@ private: | |||
| void loadFile() | |||
| { | |||
| FileChooser fc ("Choose a translation file to load", | |||
| File::nonexistent, | |||
| "*"); | |||
| File(), "*"); | |||
| if (fc.browseForFileToOpen()) | |||
| { | |||
| @@ -27,7 +27,7 @@ class UTF8Component : public Component, | |||
| { | |||
| public: | |||
| UTF8Component() | |||
| : desc (String::empty, | |||
| : desc (String(), | |||
| "Type any string into the box, and it'll be shown below as a portable UTF-8 literal, " | |||
| "ready to cut-and-paste into your source-code...") | |||
| { | |||
| @@ -142,7 +142,7 @@ public: | |||
| TRANS ("Please enter the name for the new class"), | |||
| AlertWindow::NoIcon, nullptr); | |||
| aw.addTextEditor (getClassNameFieldName(), String::empty, String::empty, false); | |||
| aw.addTextEditor (getClassNameFieldName(), String(), String(), false); | |||
| aw.addButton (TRANS ("Create Files"), 1, KeyPress (KeyPress::returnKey)); | |||
| aw.addButton (TRANS ("Cancel"), 0, KeyPress (KeyPress::escapeKey)); | |||
| @@ -38,7 +38,7 @@ static ComboBox& createFileCreationOptionComboBox (Component& setupComp, | |||
| c->addItemList (fileOptions, 1); | |||
| c->setSelectedId (1, dontSendNotification); | |||
| Label* l = new Label (String::empty, TRANS("Files to Auto-Generate") + ":"); | |||
| Label* l = new Label (String(), TRANS("Files to Auto-Generate") + ":"); | |||
| l->attachToComponent (c, true); | |||
| itemsCreated.add (l); | |||
| @@ -34,9 +34,9 @@ public: | |||
| ModulesFolderPathBox (File initialFileOrDirectory) | |||
| : currentPathBox ("currentPathBox"), | |||
| openFolderButton (TRANS("...")), | |||
| modulesLabel (String::empty, TRANS("Modules Folder") + ":") | |||
| modulesLabel (String(), TRANS("Modules Folder") + ":") | |||
| { | |||
| if (initialFileOrDirectory == File::nonexistent) | |||
| if (initialFileOrDirectory == File()) | |||
| initialFileOrDirectory = findDefaultModulesFolder(); | |||
| setModulesFolder (initialFileOrDirectory); | |||
| @@ -263,14 +263,14 @@ public: | |||
| WizardComp() | |||
| : platformTargets(), | |||
| projectName (TRANS("Project name")), | |||
| nameLabel (String::empty, TRANS("Project Name") + ":"), | |||
| typeLabel (String::empty, TRANS("Project Type") + ":"), | |||
| nameLabel (String(), TRANS("Project Name") + ":"), | |||
| typeLabel (String(), TRANS("Project Type") + ":"), | |||
| fileBrowser (FileBrowserComponent::saveMode | |||
| | FileBrowserComponent::canSelectDirectories | |||
| | FileBrowserComponent::doNotClearFileNameOnRootChange, | |||
| NewProjectWizardClasses::getLastWizardFolder(), nullptr, nullptr), | |||
| fileOutline (String::empty, TRANS("Project Folder") + ":"), | |||
| targetsOutline (String::empty, TRANS("Target Platforms") + ":"), | |||
| fileOutline (String(), TRANS("Project Folder") + ":"), | |||
| targetsOutline (String(), TRANS("Target Platforms") + ":"), | |||
| createButton (TRANS("Create") + "..."), | |||
| cancelButton (TRANS("Cancel")), | |||
| modulesPathBox (findDefaultModulesFolder()) | |||
| @@ -254,7 +254,7 @@ public: | |||
| appFolder = appFolder.getParentDirectory(); | |||
| } | |||
| return File::nonexistent; | |||
| return File(); | |||
| } | |||
| private: | |||
| @@ -254,7 +254,7 @@ struct OpenDiskDevice | |||
| [device releaseMediaReservation]; | |||
| [device releaseExclusiveAccess]; | |||
| return String::empty; | |||
| return String(); | |||
| } | |||
| DRDevice* device; | |||
| @@ -129,7 +129,7 @@ public: | |||
| if (settings != nullptr) | |||
| f = File (settings->getValue ("lastStateFile")); | |||
| if (f == File::nonexistent) | |||
| if (f == File()) | |||
| f = File::getSpecialLocation (File::userDocumentsDirectory); | |||
| return f; | |||
| @@ -44,12 +44,11 @@ public: | |||
| @param formatToLookFor this is the type of format that you want to look for | |||
| @param directoriesToSearch the path to search | |||
| @param searchRecursively true to search recursively | |||
| @param deadMansPedalFile if this isn't File::nonexistent, then it will | |||
| be used as a file to store the names of any plugins | |||
| that crash during initialisation. If there are | |||
| any plugins listed in it, then these will always | |||
| be scanned after all other possible files have | |||
| been tried - in this way, even if there's a few | |||
| @param deadMansPedalFile if this isn't File(), then it will be used as a file | |||
| to store the names of any plugins that crash during | |||
| initialisation. If there are any plugins listed in it, | |||
| then these will always be scanned after all other possible | |||
| files have been tried - in this way, even if there's a few | |||
| dodgy plugins in your path, then a couple of rescans | |||
| will still manage to find all the proper plugins. | |||
| It's probably best to choose a file in the user's | |||
| @@ -336,7 +336,7 @@ public: | |||
| bool allowPluginsWhichRequireAsynchronousInstantiation, int threads, | |||
| const String& title, const String& text) | |||
| : owner (plc), formatToScan (format), propertiesToUse (properties), | |||
| pathChooserWindow (TRANS("Select folders to scan..."), String::empty, AlertWindow::NoIcon), | |||
| pathChooserWindow (TRANS("Select folders to scan..."), String(), AlertWindow::NoIcon), | |||
| progressWindow (title, text, AlertWindow::NoIcon), | |||
| progress (0.0), numThreads (threads), allowAsync (allowPluginsWhichRequireAsynchronousInstantiation), | |||
| finished (false) | |||
| @@ -422,7 +422,7 @@ private: | |||
| + TRANS ("Are you sure you want to scan the folder \"XYZ\"?") | |||
| .replace ("XYZ", f.getFullPathName()), | |||
| TRANS ("Scan"), | |||
| String::empty, | |||
| String(), | |||
| nullptr, | |||
| ModalCallbackFunction::create (warnAboutStupidPathsCallback, this)); | |||
| return; | |||
| @@ -76,7 +76,7 @@ class AudioDeviceSelectorComponent::MidiInputSelectorComponentListBox : public | |||
| { | |||
| public: | |||
| MidiInputSelectorComponentListBox (AudioDeviceManager& dm, const String& noItems) | |||
| : ListBox (String::empty, nullptr), | |||
| : ListBox (String(), nullptr), | |||
| deviceManager (dm), | |||
| noItemsMessage (noItems) | |||
| { | |||
| @@ -340,11 +340,11 @@ public: | |||
| || comboBoxThatHasChanged == inputDeviceDropDown) | |||
| { | |||
| if (outputDeviceDropDown != nullptr) | |||
| config.outputDeviceName = outputDeviceDropDown->getSelectedId() < 0 ? String::empty | |||
| config.outputDeviceName = outputDeviceDropDown->getSelectedId() < 0 ? String() | |||
| : outputDeviceDropDown->getText(); | |||
| if (inputDeviceDropDown != nullptr) | |||
| config.inputDeviceName = inputDeviceDropDown->getSelectedId() < 0 ? String::empty | |||
| config.inputDeviceName = inputDeviceDropDown->getSelectedId() < 0 ? String() | |||
| : inputDeviceDropDown->getText(); | |||
| if (! type.hasSeparateInputsAndOutputs()) | |||
| @@ -390,7 +390,7 @@ public: | |||
| { | |||
| if (AudioIODevice* const device = setup.manager->getCurrentAudioDevice()) | |||
| { | |||
| Component modalWindow (String::empty); | |||
| Component modalWindow; | |||
| modalWindow.setOpaque (true); | |||
| modalWindow.addToDesktop (0); | |||
| modalWindow.enterModalState(); | |||
| @@ -445,7 +445,7 @@ public: | |||
| addAndMakeVisible (outputChanList | |||
| = new ChannelSelectorListBox (setup, ChannelSelectorListBox::audioOutputType, | |||
| TRANS ("(no audio output channels found)"))); | |||
| outputChanLabel = new Label (String::empty, TRANS("Active output channels:")); | |||
| outputChanLabel = new Label (String(), TRANS("Active output channels:")); | |||
| outputChanLabel->setJustificationType (Justification::centredRight); | |||
| outputChanLabel->attachToComponent (outputChanList, true); | |||
| } | |||
| @@ -466,7 +466,7 @@ public: | |||
| addAndMakeVisible (inputChanList | |||
| = new ChannelSelectorListBox (setup, ChannelSelectorListBox::audioInputType, | |||
| TRANS("(no audio input channels found)"))); | |||
| inputChanLabel = new Label (String::empty, TRANS("Active input channels:")); | |||
| inputChanLabel = new Label (String(), TRANS("Active input channels:")); | |||
| inputChanLabel->setJustificationType (Justification::centredRight); | |||
| inputChanLabel->attachToComponent (inputChanList, true); | |||
| } | |||
| @@ -605,11 +605,11 @@ private: | |||
| { | |||
| if (outputDeviceDropDown == nullptr) | |||
| { | |||
| outputDeviceDropDown = new ComboBox (String::empty); | |||
| outputDeviceDropDown = new ComboBox (String()); | |||
| outputDeviceDropDown->addListener (this); | |||
| addAndMakeVisible (outputDeviceDropDown); | |||
| outputDeviceLabel = new Label (String::empty, | |||
| outputDeviceLabel = new Label (String(), | |||
| type.hasSeparateInputsAndOutputs() ? TRANS("Output:") | |||
| : TRANS("Device:")); | |||
| outputDeviceLabel->attachToComponent (outputDeviceDropDown, true); | |||
| @@ -634,11 +634,11 @@ private: | |||
| { | |||
| if (inputDeviceDropDown == nullptr) | |||
| { | |||
| inputDeviceDropDown = new ComboBox (String::empty); | |||
| inputDeviceDropDown = new ComboBox (String()); | |||
| inputDeviceDropDown->addListener (this); | |||
| addAndMakeVisible (inputDeviceDropDown); | |||
| inputDeviceLabel = new Label (String::empty, TRANS("Input:")); | |||
| inputDeviceLabel = new Label (String(), TRANS("Input:")); | |||
| inputDeviceLabel->attachToComponent (inputDeviceDropDown, true); | |||
| addAndMakeVisible (inputLevelMeter | |||
| @@ -655,9 +655,9 @@ private: | |||
| { | |||
| if (sampleRateDropDown == nullptr) | |||
| { | |||
| addAndMakeVisible (sampleRateDropDown = new ComboBox (String::empty)); | |||
| addAndMakeVisible (sampleRateDropDown = new ComboBox (String())); | |||
| sampleRateLabel = new Label (String::empty, TRANS("Sample rate:")); | |||
| sampleRateLabel = new Label (String(), TRANS("Sample rate:")); | |||
| sampleRateLabel->attachToComponent (sampleRateDropDown, true); | |||
| } | |||
| else | |||
| @@ -682,9 +682,9 @@ private: | |||
| { | |||
| if (bufferSizeDropDown == nullptr) | |||
| { | |||
| addAndMakeVisible (bufferSizeDropDown = new ComboBox (String::empty)); | |||
| addAndMakeVisible (bufferSizeDropDown = new ComboBox (String())); | |||
| bufferSizeLabel = new Label (String::empty, TRANS("Audio buffer size:")); | |||
| bufferSizeLabel = new Label (String(), TRANS("Audio buffer size:")); | |||
| bufferSizeLabel->attachToComponent (bufferSizeDropDown, true); | |||
| } | |||
| else | |||
| @@ -724,7 +724,7 @@ public: | |||
| //============================================================================== | |||
| ChannelSelectorListBox (const AudioDeviceSetupDetails& setupDetails, | |||
| const BoxType boxType, const String& noItemsText) | |||
| : ListBox (String::empty, nullptr), | |||
| : ListBox (String(), nullptr), | |||
| setup (setupDetails), type (boxType), noItemsMessage (noItemsText) | |||
| { | |||
| refresh(); | |||
| @@ -993,7 +993,7 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||
| if (types.size() > 1) | |||
| { | |||
| deviceTypeDropDown = new ComboBox (String::empty); | |||
| deviceTypeDropDown = new ComboBox (String()); | |||
| for (int i = 0; i < types.size(); ++i) | |||
| deviceTypeDropDown->addItem (types.getUnchecked(i)->getTypeName(), i + 1); | |||
| @@ -1001,7 +1001,7 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||
| addAndMakeVisible (deviceTypeDropDown); | |||
| deviceTypeDropDown->addListener (this); | |||
| deviceTypeDropDownLabel = new Label (String::empty, TRANS("Audio device type:")); | |||
| deviceTypeDropDownLabel = new Label (String(), TRANS("Audio device type:")); | |||
| deviceTypeDropDownLabel->setJustificationType (Justification::centredRight); | |||
| deviceTypeDropDownLabel->attachToComponent (deviceTypeDropDown, true); | |||
| } | |||
| @@ -1012,7 +1012,7 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||
| = new MidiInputSelectorComponentListBox (deviceManager, | |||
| "(" + TRANS("No MIDI inputs available") + ")")); | |||
| midiInputsLabel = new Label (String::empty, TRANS ("Active MIDI inputs:")); | |||
| midiInputsLabel = new Label (String(), TRANS ("Active MIDI inputs:")); | |||
| midiInputsLabel->setJustificationType (Justification::topRight); | |||
| midiInputsLabel->attachToComponent (midiInputsList, true); | |||
| @@ -1032,7 +1032,7 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& | |||
| if (showMidiOutputSelector) | |||
| { | |||
| addAndMakeVisible (midiOutputSelector = new ComboBox (String::empty)); | |||
| addAndMakeVisible (midiOutputSelector = new ComboBox (String())); | |||
| midiOutputSelector->addListener (this); | |||
| midiOutputLabel = new Label ("lm", TRANS("MIDI Output:")); | |||
| @@ -26,7 +26,7 @@ class MidiKeyboardUpDownButton : public Button | |||
| { | |||
| public: | |||
| MidiKeyboardUpDownButton (MidiKeyboardComponent& comp, const int d) | |||
| : Button (String::empty), owner (comp), delta (d) | |||
| : Button (String()), owner (comp), delta (d) | |||
| { | |||
| } | |||
| @@ -85,12 +85,22 @@ bool NamedValueSet::isEmpty() const noexcept | |||
| return values.isEmpty(); | |||
| } | |||
| static const var& getNullVarRef() noexcept | |||
| { | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| return var::null; | |||
| #else | |||
| static var nullVar; | |||
| return nullVar; | |||
| #endif | |||
| } | |||
| const var& NamedValueSet::operator[] (const Identifier& name) const noexcept | |||
| { | |||
| if (const var* v = getVarPointer (name)) | |||
| return *v; | |||
| return var::null; | |||
| return getNullVarRef(); | |||
| } | |||
| var NamedValueSet::getWithDefault (const Identifier& name, const var& defaultReturnValue) const | |||
| @@ -189,7 +199,7 @@ const var& NamedValueSet::getValueAt (const int index) const noexcept | |||
| return values.getReference (index).value; | |||
| jassertfalse; | |||
| return var::null; | |||
| return getNullVarRef(); | |||
| } | |||
| var* NamedValueSet::getVarPointerAt (int index) const noexcept | |||
| @@ -434,7 +434,9 @@ var::var() noexcept : type (&VariantType_Void::instance) {} | |||
| var::var (const VariantType& t) noexcept : type (&t) {} | |||
| var::~var() noexcept { type->cleanUp (value); } | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| const var var::null; | |||
| #endif | |||
| //============================================================================== | |||
| var::var (const var& valueToCopy) : type (valueToCopy.type) | |||
| @@ -582,7 +584,7 @@ const var& var::operator[] (const Identifier& propertyName) const | |||
| if (DynamicObject* const o = getDynamicObject()) | |||
| return o->getProperty (propertyName); | |||
| return var::null; | |||
| return getNullVarRef(); | |||
| } | |||
| const var& var::operator[] (const char* const propertyName) const | |||
| @@ -70,8 +70,10 @@ public: | |||
| /** Destructor. */ | |||
| ~var() noexcept; | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| /** A static var object that can be used where you need an empty variant object. */ | |||
| static const var null; | |||
| #endif | |||
| var (const var& valueToCopy); | |||
| var (int value) noexcept; | |||
| @@ -68,7 +68,9 @@ File& File::operator= (File&& other) noexcept | |||
| } | |||
| #endif | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| const File File::nonexistent; | |||
| #endif | |||
| //============================================================================== | |||
| static String removeEllipsis (const String& path) | |||
| @@ -1009,9 +1011,9 @@ public: | |||
| const File home (File::getSpecialLocation (File::userHomeDirectory)); | |||
| const File temp (File::getSpecialLocation (File::tempDirectory)); | |||
| expect (! File::nonexistent.exists()); | |||
| expect (! File::nonexistent.existsAsFile()); | |||
| expect (! File::nonexistent.isDirectory()); | |||
| expect (! File().exists()); | |||
| expect (! File().existsAsFile()); | |||
| expect (! File().isDirectory()); | |||
| #if ! JUCE_WINDOWS | |||
| expect (File("/").isDirectory()); | |||
| #endif | |||
| @@ -49,8 +49,7 @@ public: | |||
| /** Creates an (invalid) file object. | |||
| The file is initially set to an empty path, so getFullPathName() will return | |||
| an empty string, and comparing the file to File::nonexistent will return | |||
| true. | |||
| an empty string. | |||
| You can use its operator= method to point it at a proper file. | |||
| */ | |||
| @@ -95,8 +94,13 @@ public: | |||
| #endif | |||
| //============================================================================== | |||
| /** This static constant is used for referring to an 'invalid' file. */ | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| /** This static constant is used for referring to an 'invalid' file. | |||
| Bear in mind that you should avoid this kind of static variable, and always prefer | |||
| to use File() or {} if you need a default-constructed File object. | |||
| */ | |||
| static const File nonexistent; | |||
| #endif | |||
| //============================================================================== | |||
| /** Checks whether the file actually exists. | |||
| @@ -625,7 +625,7 @@ public: | |||
| beginTest ("JSON"); | |||
| Random r = getRandom(); | |||
| expect (JSON::parse (String::empty) == var()); | |||
| expect (JSON::parse (String()) == var()); | |||
| expect (JSON::parse ("{}").isObject()); | |||
| expect (JSON::parse ("[]").isArray()); | |||
| expect (JSON::parse ("[ 1234 ]")[0].isInt()); | |||
| @@ -156,6 +156,16 @@ | |||
| //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1 | |||
| #endif | |||
| /* Config: JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| If disabled, this will turn off dangerous static globals like String::empty, var::null, etc | |||
| which can cause nasty order-of-initialisation problems if they are referenced during static | |||
| constructor code. | |||
| */ | |||
| #ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| #define JUCE_ALLOW_STATIC_NULL_VARIABLES 1 | |||
| #endif | |||
| #ifndef JUCE_STRING_UTF_TYPE | |||
| #define JUCE_STRING_UTF_TYPE 8 | |||
| #endif | |||
| @@ -237,7 +237,9 @@ private: | |||
| } | |||
| }; | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| const String String::empty; | |||
| #endif | |||
| //============================================================================== | |||
| String::String() noexcept : text (&(emptyString.text)) | |||
| @@ -2270,7 +2272,7 @@ public: | |||
| beginTest ("Basics"); | |||
| expect (String().length() == 0); | |||
| expect (String() == String::empty); | |||
| expect (String() == String()); | |||
| String s1, s2 ("abcd"); | |||
| expect (s1.isEmpty() && ! s1.isNotEmpty()); | |||
| expect (s2.isNotEmpty() && ! s2.isEmpty()); | |||
| @@ -2282,16 +2284,16 @@ public: | |||
| expect (String ("abcdefg", 4) == L"abcd"); | |||
| expect (String ("abcdefg", 4) == String (L"abcdefg", 4)); | |||
| expect (String::charToString ('x') == "x"); | |||
| expect (String::charToString (0) == String::empty); | |||
| expect (String::charToString (0) == String()); | |||
| expect (s2 + "e" == "abcde" && s2 + 'e' == "abcde"); | |||
| expect (s2 + L'e' == "abcde" && s2 + L"e" == "abcde"); | |||
| expect (s1.equalsIgnoreCase ("abcD") && s1 < "abce" && s1 > "abbb"); | |||
| expect (s1.startsWith ("ab") && s1.startsWith ("abcd") && ! s1.startsWith ("abcde")); | |||
| expect (s1.startsWithIgnoreCase ("aB") && s1.endsWithIgnoreCase ("CD")); | |||
| expect (s1.endsWith ("bcd") && ! s1.endsWith ("aabcd")); | |||
| expectEquals (s1.indexOf (String::empty), 0); | |||
| expectEquals (s1.indexOfIgnoreCase (String::empty), 0); | |||
| expect (s1.startsWith (String::empty) && s1.endsWith (String::empty) && s1.contains (String::empty)); | |||
| expectEquals (s1.indexOf (String()), 0); | |||
| expectEquals (s1.indexOfIgnoreCase (String()), 0); | |||
| expect (s1.startsWith (String()) && s1.endsWith (String()) && s1.contains (String())); | |||
| expect (s1.contains ("cd") && s1.contains ("ab") && s1.contains ("abcd")); | |||
| expect (s1.containsChar ('a')); | |||
| expect (! s1.containsChar ('x')); | |||
| @@ -2472,9 +2474,9 @@ public: | |||
| } | |||
| beginTest ("Numeric conversions"); | |||
| expect (String::empty.getIntValue() == 0); | |||
| expect (String::empty.getDoubleValue() == 0.0); | |||
| expect (String::empty.getFloatValue() == 0.0f); | |||
| expect (String().getIntValue() == 0); | |||
| expect (String().getDoubleValue() == 0.0); | |||
| expect (String().getFloatValue() == 0.0f); | |||
| expect (s.getIntValue() == 12345678); | |||
| expect (s.getLargeIntValue() == (int64) 12345678); | |||
| expect (s.getDoubleValue() == 12345678.0); | |||
| @@ -2511,11 +2513,11 @@ public: | |||
| expect (s3.containsAnyOf (String (L"zzzFs"))); | |||
| expect (s3.startsWith ("abcd")); | |||
| expect (s3.startsWithIgnoreCase (String (L"abCD"))); | |||
| expect (s3.startsWith (String::empty)); | |||
| expect (s3.startsWith (String())); | |||
| expect (s3.startsWithChar ('a')); | |||
| expect (s3.endsWith (String ("HIJ"))); | |||
| expect (s3.endsWithIgnoreCase (String (L"Hij"))); | |||
| expect (s3.endsWith (String::empty)); | |||
| expect (s3.endsWith (String())); | |||
| expect (s3.endsWithChar (L'J')); | |||
| expect (s3.indexOf ("HIJ") == 7); | |||
| expect (s3.indexOf (String (L"HIJK")) == -1); | |||
| @@ -2565,28 +2567,28 @@ public: | |||
| expect (! String ("xx?y").matchesWildcard ("xx?y?", true)); | |||
| expect (String ("xx?y").matchesWildcard ("xx??", true)); | |||
| expectEquals (s5.fromFirstOccurrenceOf (String::empty, true, false), s5); | |||
| expectEquals (s5.fromFirstOccurrenceOf (String(), true, false), s5); | |||
| expectEquals (s5.fromFirstOccurrenceOf ("xword2", true, false), s5.substring (100)); | |||
| expectEquals (s5.fromFirstOccurrenceOf (String (L"word2"), true, false), s5.substring (5)); | |||
| expectEquals (s5.fromFirstOccurrenceOf ("Word2", true, true), s5.substring (5)); | |||
| expectEquals (s5.fromFirstOccurrenceOf ("word2", false, false), s5.getLastCharacters (6)); | |||
| expectEquals (s5.fromFirstOccurrenceOf ("Word2", false, true), s5.getLastCharacters (6)); | |||
| expectEquals (s5.fromLastOccurrenceOf (String::empty, true, false), s5); | |||
| expectEquals (s5.fromLastOccurrenceOf (String(), true, false), s5); | |||
| expectEquals (s5.fromLastOccurrenceOf ("wordx", true, false), s5); | |||
| expectEquals (s5.fromLastOccurrenceOf ("word", true, false), s5.getLastCharacters (5)); | |||
| expectEquals (s5.fromLastOccurrenceOf ("worD", true, true), s5.getLastCharacters (5)); | |||
| expectEquals (s5.fromLastOccurrenceOf ("word", false, false), s5.getLastCharacters (1)); | |||
| expectEquals (s5.fromLastOccurrenceOf ("worD", false, true), s5.getLastCharacters (1)); | |||
| expect (s5.upToFirstOccurrenceOf (String::empty, true, false).isEmpty()); | |||
| expect (s5.upToFirstOccurrenceOf (String(), true, false).isEmpty()); | |||
| expectEquals (s5.upToFirstOccurrenceOf ("word4", true, false), s5); | |||
| expectEquals (s5.upToFirstOccurrenceOf ("word2", true, false), s5.substring (0, 10)); | |||
| expectEquals (s5.upToFirstOccurrenceOf ("Word2", true, true), s5.substring (0, 10)); | |||
| expectEquals (s5.upToFirstOccurrenceOf ("word2", false, false), s5.substring (0, 5)); | |||
| expectEquals (s5.upToFirstOccurrenceOf ("Word2", false, true), s5.substring (0, 5)); | |||
| expectEquals (s5.upToLastOccurrenceOf (String::empty, true, false), s5); | |||
| expectEquals (s5.upToLastOccurrenceOf (String(), true, false), s5); | |||
| expectEquals (s5.upToLastOccurrenceOf ("zword", true, false), s5); | |||
| expectEquals (s5.upToLastOccurrenceOf ("word", true, false), s5.dropLastCharacters (1)); | |||
| expectEquals (s5.dropLastCharacters(1).upToLastOccurrenceOf ("word", true, false), s5.dropLastCharacters (1)); | |||
| @@ -2604,9 +2606,9 @@ public: | |||
| expect (s5.replaceCharacters ("wo", "xy") != s5); | |||
| expectEquals (s5.replaceCharacters ("wo", "xy").replaceCharacters ("xy", "wo"), s5); | |||
| expectEquals (s5.retainCharacters ("1wordxya"), String ("wordwordword")); | |||
| expect (s5.retainCharacters (String::empty).isEmpty()); | |||
| expect (s5.retainCharacters (String()).isEmpty()); | |||
| expect (s5.removeCharacters ("1wordxya") == " 2 3"); | |||
| expectEquals (s5.removeCharacters (String::empty), s5); | |||
| expectEquals (s5.removeCharacters (String()), s5); | |||
| expect (s5.initialSectionContainingOnly ("word") == L"word"); | |||
| expect (String ("word").initialSectionContainingOnly ("word") == L"word"); | |||
| expectEquals (s5.initialSectionNotContaining (String ("xyz ")), String ("word")); | |||
| @@ -2647,9 +2649,9 @@ public: | |||
| expectEquals (s.joinIntoString ("-"), String ("4-3-2-1-0")); | |||
| s.remove (2); | |||
| expectEquals (s.joinIntoString ("--"), String ("4--3--1--0")); | |||
| expectEquals (s.joinIntoString (String::empty), String ("4310")); | |||
| expectEquals (s.joinIntoString (StringRef()), String ("4310")); | |||
| s.clear(); | |||
| expectEquals (s.joinIntoString ("x"), String::empty); | |||
| expectEquals (s.joinIntoString ("x"), String()); | |||
| StringArray toks; | |||
| toks.addTokens ("x,,", ";,", ""); | |||
| @@ -147,13 +147,15 @@ public: | |||
| ~String() noexcept; | |||
| //============================================================================== | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| /** This is a static empty string object that can be used if you need a reference to one. | |||
| The value of String::empty is exactly the same as String(), and in almost all cases | |||
| it's better to avoid String::empty and just use String() instead, so that the compiler | |||
| it's better to avoid String::empty and just use String() or {} instead, so that the compiler | |||
| only has to reason about locally-constructed objects, rather than taking into account | |||
| the fact that you're referencing a global shared static memory address. | |||
| */ | |||
| static const String empty; | |||
| #endif | |||
| /** This is the character encoding type used internally to store the string. | |||
| @@ -127,7 +127,12 @@ const String& StringArray::operator[] (const int index) const noexcept | |||
| if (isPositiveAndBelow (index, strings.size())) | |||
| return strings.getReference (index); | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| return String::empty; | |||
| #else | |||
| static String empty; | |||
| return empty; | |||
| #endif | |||
| } | |||
| String& StringArray::getReference (const int index) noexcept | |||
| @@ -262,9 +262,9 @@ public: | |||
| Random r = getRandom(); | |||
| testDiff (String::empty, String::empty); | |||
| testDiff ("x", String::empty); | |||
| testDiff (String::empty, "x"); | |||
| testDiff (String(), String()); | |||
| testDiff ("x", String()); | |||
| testDiff (String(), "x"); | |||
| testDiff ("x", "x"); | |||
| testDiff ("x", "y"); | |||
| testDiff ("xxx", "x"); | |||
| @@ -60,7 +60,7 @@ public: | |||
| @param counterName the name used when printing out the statistics | |||
| @param runsPerPrintout the number of start/stop iterations before calling | |||
| printStatistics() | |||
| @param loggingFile a file to dump the results to - if this is File::nonexistent, | |||
| @param loggingFile a file to dump the results to - if this is File(), | |||
| the results are just written to the debugger output | |||
| */ | |||
| PerformanceCounter (const String& counterName, | |||
| @@ -460,12 +460,22 @@ int XmlElement::getNumAttributes() const noexcept | |||
| return attributes.size(); | |||
| } | |||
| static const String& getEmptyStringRef() noexcept | |||
| { | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| return String::empty; | |||
| #else | |||
| static String empty; | |||
| return empty; | |||
| #endif | |||
| } | |||
| const String& XmlElement::getAttributeName (const int index) const noexcept | |||
| { | |||
| if (const XmlAttributeNode* const att = attributes [index]) | |||
| return att->name.toString(); | |||
| return String::empty; | |||
| return getEmptyStringRef(); | |||
| } | |||
| const String& XmlElement::getAttributeValue (const int index) const noexcept | |||
| @@ -473,7 +483,7 @@ const String& XmlElement::getAttributeValue (const int index) const noexcept | |||
| if (const XmlAttributeNode* const att = attributes [index]) | |||
| return att->value; | |||
| return String::empty; | |||
| return getEmptyStringRef(); | |||
| } | |||
| XmlElement::XmlAttributeNode* XmlElement::getAttribute (StringRef attributeName) const noexcept | |||
| @@ -496,7 +506,7 @@ const String& XmlElement::getStringAttribute (StringRef attributeName) const noe | |||
| if (const XmlAttributeNode* att = getAttribute (attributeName)) | |||
| return att->value; | |||
| return String::empty; | |||
| return getEmptyStringRef(); | |||
| } | |||
| String XmlElement::getStringAttribute (StringRef attributeName, const String& defaultReturnValue) const | |||
| @@ -627,7 +627,9 @@ ValueTree::ValueTree() noexcept | |||
| { | |||
| } | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| const ValueTree ValueTree::invalid; | |||
| #endif | |||
| ValueTree::ValueTree (const Identifier& type) : object (new ValueTree::SharedObject (type)) | |||
| { | |||
| @@ -721,20 +723,30 @@ ValueTree ValueTree::getParent() const noexcept | |||
| ValueTree ValueTree::getSibling (const int delta) const noexcept | |||
| { | |||
| if (object == nullptr || object->parent == nullptr) | |||
| return invalid; | |||
| return ValueTree(); | |||
| const int index = object->parent->indexOf (*this) + delta; | |||
| return ValueTree (object->parent->children.getObjectPointer (index)); | |||
| } | |||
| static const var& getNullVarRef() noexcept | |||
| { | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| return var::null; | |||
| #else | |||
| static var nullVar; | |||
| return nullVar; | |||
| #endif | |||
| } | |||
| const var& ValueTree::operator[] (const Identifier& name) const noexcept | |||
| { | |||
| return object == nullptr ? var::null : object->properties[name]; | |||
| return object == nullptr ? getNullVarRef() : object->properties[name]; | |||
| } | |||
| const var& ValueTree::getProperty (const Identifier& name) const noexcept | |||
| { | |||
| return object == nullptr ? var::null : object->properties[name]; | |||
| return object == nullptr ? getNullVarRef() : object->properties[name]; | |||
| } | |||
| var ValueTree::getProperty (const Identifier& name, const var& defaultReturnValue) const | |||
| @@ -523,10 +523,13 @@ public: | |||
| } | |||
| } | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| /** An invalid ValueTree that can be used if you need to return one as an error condition, etc. | |||
| This invalid object is equivalent to ValueTree created with its default constructor. | |||
| This invalid object is equivalent to ValueTree created with its default constructor, but | |||
| you should always prefer to avoid it and use ValueTree() or {} instead. | |||
| */ | |||
| static const ValueTree invalid; | |||
| #endif | |||
| /** Returns the total number of references to the shared underlying data structure that this | |||
| ValueTree is using. | |||
| @@ -79,7 +79,9 @@ bool AffineTransform::isIdentity() const noexcept | |||
| && (mat11 == 1.0f); | |||
| } | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| const AffineTransform AffineTransform::identity; | |||
| #endif | |||
| //============================================================================== | |||
| AffineTransform AffineTransform::followedBy (const AffineTransform& other) const noexcept | |||
| @@ -67,15 +67,13 @@ public: | |||
| /** Compares two transforms. */ | |||
| bool operator!= (const AffineTransform& other) const noexcept; | |||
| /** A ready-to-use identity transform, which you can use to append other | |||
| transformations to. | |||
| e.g. @code | |||
| AffineTransform myTransform = AffineTransform().rotated (.5f) | |||
| .scaled (2.0f); | |||
| @endcode | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| /** A ready-to-use identity transform. | |||
| Note that you should always avoid using a static variable like this, and | |||
| prefer AffineTransform() or {} if you need a default-constructed instance. | |||
| */ | |||
| static const AffineTransform identity; | |||
| #endif | |||
| //============================================================================== | |||
| /** Transforms a 2D coordinate using this matrix. */ | |||
| @@ -259,7 +259,9 @@ Image::~Image() | |||
| { | |||
| } | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| const Image Image::null; | |||
| #endif | |||
| int Image::getReferenceCount() const noexcept { return image == nullptr ? 0 : image->getSharedCount(); } | |||
| int Image::getWidth() const noexcept { return image == nullptr ? 0 : image->width; } | |||
| @@ -146,10 +146,13 @@ public: | |||
| */ | |||
| inline bool isNull() const noexcept { return image == nullptr; } | |||
| #if JUCE_ALLOW_STATIC_NULL_VARIABLES | |||
| /** A null Image object that can be used when you need to return an invalid image. | |||
| This object is the equivalient to an Image created with the default constructor. | |||
| This object is the equivalient to an Image created with the default constructor, and | |||
| you should always prefer to use Image() or {} when you need an empty image object. | |||
| */ | |||
| static const Image null; | |||
| #endif | |||
| //============================================================================== | |||
| /** Returns the image's width (in pixels). */ | |||