Browse Source

Cleaned up a few String::empty uses

tags/2021-05-28
jules 9 years ago
parent
commit
ae712c72d8
16 changed files with 40 additions and 40 deletions
  1. +1
    -1
      modules/juce_audio_basics/midi/juce_MidiMessage.cpp
  2. +1
    -1
      modules/juce_audio_devices/native/juce_android_OpenSL.cpp
  3. +2
    -2
      modules/juce_audio_devices/native/juce_win32_DirectSound.cpp
  4. +1
    -1
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  5. +3
    -3
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  6. +5
    -5
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  7. +2
    -2
      modules/juce_core/misc/juce_WindowsRegistry.h
  8. +1
    -1
      modules/juce_core/native/juce_android_Files.cpp
  9. +2
    -2
      modules/juce_core/unit_tests/juce_UnitTest.cpp
  10. +2
    -2
      modules/juce_core/unit_tests/juce_UnitTest.h
  11. +1
    -1
      modules/juce_core/xml/juce_XmlDocument.cpp
  12. +1
    -1
      modules/juce_core/xml/juce_XmlElement.h
  13. +3
    -3
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  14. +9
    -9
      modules/juce_gui_basics/windows/juce_AlertWindow.h
  15. +5
    -5
      modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp
  16. +1
    -1
      modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp

+ 1
- 1
modules/juce_audio_basics/midi/juce_MidiMessage.cpp View File

@@ -982,7 +982,7 @@ String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includeOctav
return s; return s;
} }
return String::empty;
return String();
} }
double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) noexcept double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) noexcept


+ 1
- 1
modules/juce_audio_devices/native/juce_android_OpenSL.cpp View File

@@ -45,7 +45,7 @@ public:
{ {
// OpenSL has piss-poor support for determining latency, so the only way I can find to // OpenSL has piss-poor support for determining latency, so the only way I can find to
// get a number for this is by asking the AudioTrack/AudioRecord classes.. // get a number for this is by asking the AudioTrack/AudioRecord classes..
AndroidAudioIODevice javaDevice (String::empty);
AndroidAudioIODevice javaDevice (String());
// this is a total guess about how to calculate the latency, but seems to vaguely agree // this is a total guess about how to calculate the latency, but seems to vaguely agree
// with the devices I've tested.. YMMV // with the devices I've tested.. YMMV


+ 2
- 2
modules/juce_audio_devices/native/juce_win32_DirectSound.cpp View File

@@ -354,7 +354,7 @@ public:
hr = pOutputBuffer->Play (0, 0, 1 /* DSBPLAY_LOOPING */); hr = pOutputBuffer->Play (0, 0, 1 /* DSBPLAY_LOOPING */);
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
return String::empty;
return String();
} }
} }
} }
@@ -597,7 +597,7 @@ public:
hr = pInputBuffer->Start (1 /* DSCBSTART_LOOPING */); hr = pInputBuffer->Start (1 /* DSCBSTART_LOOPING */);
if (SUCCEEDED (hr)) if (SUCCEEDED (hr))
return String::empty;
return String();
} }
} }


+ 1
- 1
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -845,7 +845,7 @@ namespace WavFileHelpers
static MemoryBlock createFrom (const StringPairArray& values) static MemoryBlock createFrom (const StringPairArray& values)
{ {
const String ISRC (values.getValue (WavAudioFormat::ISRC, String::empty));
const String ISRC (values.getValue (WavAudioFormat::ISRC, String()));
MemoryOutputStream xml; MemoryOutputStream xml;
if (ISRC.isNotEmpty()) if (ISRC.isNotEmpty())


+ 3
- 3
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -1675,7 +1675,7 @@ public:
//============================================================================== //==============================================================================
const String getName() const override const String getName() const override
{ {
return module != nullptr ? module->name : String::empty;
return module != nullptr ? module->name : String();
} }
void repopulateArrangements() void repopulateArrangements()
@@ -1837,7 +1837,7 @@ public:
return toString (busInfo.name); return toString (busInfo.name);
} }
return String::empty;
return String();
} }
const String getInputChannelName (int channelIndex) const override { return getChannelName (channelIndex, true, true); } const String getInputChannelName (int channelIndex) const override { return getChannelName (channelIndex, true, true); }
@@ -1941,7 +1941,7 @@ public:
return toString (result); return toString (result);
} }
return String::empty;
return String();
} }
void setParameter (int parameterIndex, float newValue) override void setParameter (int parameterIndex, float newValue) override


+ 5
- 5
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -469,7 +469,7 @@ public:
} }
} }
return String::empty;
return String();
} }
#endif #endif
#else #else
@@ -1024,7 +1024,7 @@ public:
return String (pinProps.label, sizeof (pinProps.label)); return String (pinProps.label, sizeof (pinProps.label));
} }
return String::empty;
return String();
} }
bool isInputChannelStereoPair (int index) const override bool isInputChannelStereoPair (int index) const override
@@ -1048,7 +1048,7 @@ public:
return String (pinProps.label, sizeof (pinProps.label)); return String (pinProps.label, sizeof (pinProps.label));
} }
return String::empty;
return String();
} }
bool isOutputChannelStereoPair (int index) const override bool isOutputChannelStereoPair (int index) const override
@@ -1750,7 +1750,7 @@ private:
String getTextForOpcode (const int index, const AEffectOpcodes opcode) const String getTextForOpcode (const int index, const AEffectOpcodes opcode) const
{ {
if (effect == nullptr) if (effect == nullptr)
return String::empty;
return String();
jassert (index >= 0 && index < effect->numParams); jassert (index >= 0 && index < effect->numParams);
char nm [256] = { 0 }; char nm [256] = { 0 };
@@ -1775,7 +1775,7 @@ private:
if (index >= 0 && programNames[index].isEmpty()) if (index >= 0 && programNames[index].isEmpty())
{ {
while (programNames.size() < index) while (programNames.size() < index)
programNames.add (String::empty);
programNames.add (String());
programNames.set (index, progName); programNames.set (index, progName);
} }


+ 2
- 2
modules/juce_core/misc/juce_WindowsRegistry.h View File

@@ -60,7 +60,7 @@ public:
e.g. "HKEY_CURRENT_USER\Software\foo\bar" e.g. "HKEY_CURRENT_USER\Software\foo\bar"
*/ */
static String JUCE_CALLTYPE getValue (const String& regValuePath, static String JUCE_CALLTYPE getValue (const String& regValuePath,
const String& defaultValue = String::empty,
const String& defaultValue = String(),
WoW64Mode mode = WoW64_Default); WoW64Mode mode = WoW64_Default);
/** Reads a binary block from the registry. /** Reads a binary block from the registry.
@@ -128,7 +128,7 @@ public:
WoW64Mode mode = WoW64_Default); WoW64Mode mode = WoW64_Default);
// DEPRECATED: use the other methods with a WoW64Mode parameter of WoW64_64bit instead. // DEPRECATED: use the other methods with a WoW64Mode parameter of WoW64_64bit instead.
JUCE_DEPRECATED (static String getValueWow64 (const String&, const String& defaultValue = String::empty));
JUCE_DEPRECATED (static String getValueWow64 (const String&, const String& defaultValue = String()));
JUCE_DEPRECATED (static bool valueExistsWow64 (const String&)); JUCE_DEPRECATED (static bool valueExistsWow64 (const String&));
JUCE_DEPRECATED (static bool keyExistsWow64 (const String&)); JUCE_DEPRECATED (static bool keyExistsWow64 (const String&));


+ 1
- 1
modules/juce_core/native/juce_android_Files.cpp View File

@@ -43,7 +43,7 @@ bool File::isOnRemovableDrive() const
String File::getVersion() const String File::getVersion() const
{ {
return String::empty;
return String();
} }
File File::getSpecialLocation (const SpecialLocationType type) File File::getSpecialLocation (const SpecialLocationType type)


+ 2
- 2
modules/juce_core/unit_tests/juce_UnitTest.cpp View File

@@ -205,9 +205,9 @@ void UnitTestRunner::endTest()
m << r->failures << (r->failures == 1 ? " test" : " tests") m << r->failures << (r->failures == 1 ? " test" : " tests")
<< " failed, out of a total of " << (r->passes + r->failures); << " failed, out of a total of " << (r->passes + r->failures);
logMessage (String::empty);
logMessage (String());
logMessage (m); logMessage (m);
logMessage (String::empty);
logMessage (String());
} }
else else
{ {


+ 2
- 2
modules/juce_core/unit_tests/juce_UnitTest.h View File

@@ -136,13 +136,13 @@ public:
If testResult is true, a pass is logged; if it's false, a failure is logged. If testResult is true, a pass is logged; if it's false, a failure is logged.
If the failure message is specified, it will be written to the log if the test fails. If the failure message is specified, it will be written to the log if the test fails.
*/ */
void expect (bool testResult, const String& failureMessage = String::empty);
void expect (bool testResult, const String& failureMessage = String());
/** Compares two values, and if they don't match, prints out a message containing the /** Compares two values, and if they don't match, prints out a message containing the
expected and actual result values. expected and actual result values.
*/ */
template <class ValueType> template <class ValueType>
void expectEquals (ValueType actual, ValueType expected, String failureMessage = String::empty)
void expectEquals (ValueType actual, ValueType expected, String failureMessage = String())
{ {
const bool result = (actual == expected); const bool result = (actual == expected);


+ 1
- 1
modules/juce_core/xml/juce_XmlDocument.cpp View File

@@ -172,7 +172,7 @@ String XmlDocument::getFileContents (const String& filename) const
return in->readEntireStreamAsString(); return in->readEntireStreamAsString();
} }
return String::empty;
return String();
} }
juce_wchar XmlDocument::readNextChar() noexcept juce_wchar XmlDocument::readNextChar() noexcept


+ 1
- 1
modules/juce_core/xml/juce_XmlElement.h View File

@@ -134,7 +134,7 @@
} }
// now we can turn the whole thing into a text document.. // now we can turn the whole thing into a text document..
String myXmlDoc = animalsList.createDocument (String::empty);
String myXmlDoc = animalsList.createDocument (String());
@endcode @endcode
@see XmlDocument @see XmlDocument


+ 3
- 3
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -2757,7 +2757,7 @@ private:
reset(); reset();
if (TextInputTarget* const target = owner.findCurrentTextInputTarget()) if (TextInputTarget* const target = owner.findCurrentTextInputTarget())
target->insertTextAtCaret (String::empty);
target->insertTextAtCaret (String());
} }
void handleEndComposition (ComponentPeer& owner, HWND hWnd) void handleEndComposition (ComponentPeer& owner, HWND hWnd)
@@ -2768,7 +2768,7 @@ private:
if (TextInputTarget* const target = owner.findCurrentTextInputTarget()) if (TextInputTarget* const target = owner.findCurrentTextInputTarget())
{ {
target->setHighlightedRegion (compositionRange); target->setHighlightedRegion (compositionRange);
target->insertTextAtCaret (String::empty);
target->insertTextAtCaret (String());
compositionRange.setLength (0); compositionRange.setLength (0);
target->setHighlightedRegion (Range<int>::emptyRange (compositionRange.getEnd())); target->setHighlightedRegion (Range<int>::emptyRange (compositionRange.getEnd()));
@@ -2843,7 +2843,7 @@ private:
return String (buffer); return String (buffer);
} }
return String::empty;
return String();
} }
int getCompositionCaretPos (HIMC hImc, LPARAM lParam, const String& currentIMEString) const int getCompositionCaretPos (HIMC hImc, LPARAM lParam, const String& currentIMEString) const


+ 9
- 9
modules/juce_gui_basics/windows/juce_AlertWindow.h View File

@@ -131,7 +131,7 @@ public:
*/ */
void addTextEditor (const String& name, void addTextEditor (const String& name,
const String& initialContents, const String& initialContents,
const String& onScreenLabel = String::empty,
const String& onScreenLabel = String(),
bool isPasswordBox = false); bool isPasswordBox = false);
/** Returns the contents of a named textbox. /** Returns the contents of a named textbox.
@@ -161,7 +161,7 @@ public:
*/ */
void addComboBox (const String& name, void addComboBox (const String& name,
const StringArray& items, const StringArray& items,
const String& onScreenLabel = String::empty);
const String& onScreenLabel = String());
/** Returns a drop-down list that was added to the AlertWindow. /** Returns a drop-down list that was added to the AlertWindow.
@@ -246,7 +246,7 @@ public:
static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType, static void JUCE_CALLTYPE showMessageBox (AlertIconType iconType,
const String& title, const String& title,
const String& message, const String& message,
const String& buttonText = String::empty,
const String& buttonText = String(),
Component* associatedComponent = nullptr); Component* associatedComponent = nullptr);
#endif #endif
@@ -274,7 +274,7 @@ public:
static void JUCE_CALLTYPE showMessageBoxAsync (AlertIconType iconType, static void JUCE_CALLTYPE showMessageBoxAsync (AlertIconType iconType,
const String& title, const String& title,
const String& message, const String& message,
const String& buttonText = String::empty,
const String& buttonText = String(),
Component* associatedComponent = nullptr, Component* associatedComponent = nullptr,
ModalComponentManager::Callback* callback = nullptr); ModalComponentManager::Callback* callback = nullptr);
@@ -317,8 +317,8 @@ public:
const String& title, const String& title,
const String& message, const String& message,
#if JUCE_MODAL_LOOPS_PERMITTED #if JUCE_MODAL_LOOPS_PERMITTED
const String& button1Text = String::empty,
const String& button2Text = String::empty,
const String& button1Text = String(),
const String& button2Text = String(),
Component* associatedComponent = nullptr, Component* associatedComponent = nullptr,
ModalComponentManager::Callback* callback = nullptr); ModalComponentManager::Callback* callback = nullptr);
#else #else
@@ -371,9 +371,9 @@ public:
const String& title, const String& title,
const String& message, const String& message,
#if JUCE_MODAL_LOOPS_PERMITTED #if JUCE_MODAL_LOOPS_PERMITTED
const String& button1Text = String::empty,
const String& button2Text = String::empty,
const String& button3Text = String::empty,
const String& button1Text = String(),
const String& button2Text = String(),
const String& button3Text = String(),
Component* associatedComponent = nullptr, Component* associatedComponent = nullptr,
ModalComponentManager::Callback* callback = nullptr); ModalComponentManager::Callback* callback = nullptr);
#else #else


+ 5
- 5
modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp View File

@@ -433,7 +433,7 @@ String CodeDocument::Position::getLineText() const
if (const CodeDocumentLine* const l = owner->lines [line]) if (const CodeDocumentLine* const l = owner->lines [line])
return l->line; return l->line;
return String::empty;
return String();
} }
void CodeDocument::Position::setPositionMaintained (const bool isMaintained) void CodeDocument::Position::setPositionMaintained (const bool isMaintained)
@@ -482,7 +482,7 @@ String CodeDocument::getAllContent() const
String CodeDocument::getTextBetween (const Position& start, const Position& end) const String CodeDocument::getTextBetween (const Position& start, const Position& end) const
{ {
if (end.getPosition() <= start.getPosition()) if (end.getPosition() <= start.getPosition())
return String::empty;
return String();
const int startLine = start.getLineNumber(); const int startLine = start.getLineNumber();
const int endLine = end.getLineNumber(); const int endLine = end.getLineNumber();
@@ -492,7 +492,7 @@ String CodeDocument::getTextBetween (const Position& start, const Position& end)
if (CodeDocumentLine* const line = lines [startLine]) if (CodeDocumentLine* const line = lines [startLine])
return line->line.substring (start.getIndexInLine(), end.getIndexInLine()); return line->line.substring (start.getIndexInLine(), end.getIndexInLine());
return String::empty;
return String();
} }
MemoryOutputStream mo; MemoryOutputStream mo;
@@ -537,7 +537,7 @@ String CodeDocument::getLine (const int lineIndex) const noexcept
if (const CodeDocumentLine* const line = lines [lineIndex]) if (const CodeDocumentLine* const line = lines [lineIndex])
return line->line; return line->line;
return String::empty;
return String();
} }
int CodeDocument::getMaximumLineLength() noexcept int CodeDocument::getMaximumLineLength() noexcept
@@ -634,7 +634,7 @@ void CodeDocument::setNewLineCharacters (const String& newChars) noexcept
void CodeDocument::newTransaction() void CodeDocument::newTransaction()
{ {
undoManager.beginNewTransaction (String::empty);
undoManager.beginNewTransaction (String());
} }
void CodeDocument::undo() void CodeDocument::undo()


+ 1
- 1
modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp View File

@@ -870,7 +870,7 @@ void CodeEditorComponent::indentSelectedLines (const int spacesToAdd)
void CodeEditorComponent::cut() void CodeEditorComponent::cut()
{ {
insertText (String::empty);
insertText (String());
} }
bool CodeEditorComponent::copyToClipboard() bool CodeEditorComponent::copyToClipboard()


Loading…
Cancel
Save