1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed some whitespace style and cleaned up some code using C++11

This commit is contained in:
jules 2017-03-27 13:06:24 +01:00
parent 405a6aeaed
commit 8ed41ed14b
95 changed files with 310 additions and 320 deletions

View file

@ -77,7 +77,7 @@ Identifier PathSettingsTab::getKeyForPropertyComponent (TextPropertyComponent* c
// this property component does not have a key associated to it!
jassertfalse;
return String();
return {};
}
Component* PathSettingsTab::getContent()

View file

@ -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(); }
String getState() const override { return {}; }
void restoreState (const String&) override {}
String getType() const override

View file

@ -87,7 +87,7 @@ struct ProjucerLicenses : private DeletedAtShutdown
return String::fromUTF8 (name);
}
return String();
return {};
}
bool isDLLPresent() const

View file

@ -76,7 +76,7 @@ void FILTERCLASSNAME::setCurrentProgram (int index)
const String FILTERCLASSNAME::getProgramName (int index)
{
return String();
return {};
}
void FILTERCLASSNAME::changeProgramName (int index, const String& newName)

View file

@ -523,7 +523,7 @@ void ComponentTypeHandler::fillInResizeCode (GeneratedCode& code, Component* com
String ComponentTypeHandler::getCreationParameters (GeneratedCode&, Component*)
{
return String();
return {};
}
void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName)

View file

@ -546,7 +546,7 @@ private:
default: jassertfalse; break;
}
return String();
return {};
}
private:
@ -660,7 +660,7 @@ private:
default: jassertfalse; break;
}
return String();
return {};
}
static Slider::SliderStyle sliderStringToStyle (const String& s)
@ -685,7 +685,7 @@ private:
default: jassertfalse; break;
}
return String();
return {};
}
static Slider::TextEntryBoxPosition stringToTextBoxPos (const String& s)

View file

@ -147,7 +147,7 @@ public:
default: jassertfalse; break;
}
return String();
return {};
}
void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName)

View file

@ -715,7 +715,7 @@ void ComponentLayout::fillInGeneratedCode (GeneratedCode& code) const
String ComponentLayout::getComponentMemberVariableName (Component* comp) const
{
if (comp == nullptr)
return String();
return {};
String name (comp->getProperties() ["memberName"].toString());
@ -775,7 +775,7 @@ String ComponentLayout::getUnusedMemberName (String nameRoot, Component* comp) c
String ComponentLayout::getComponentVirtualClassName (Component* comp) const
{
if (comp == nullptr)
return String();
return {};
return comp->getProperties() ["virtualName"];
}

View file

@ -377,7 +377,7 @@ public:
String getResource() const
{
if (element == nullptr)
return String();
return {};
if (isForStroke)
return element->getStrokeType().fill.imageResourceName;

View file

@ -201,7 +201,7 @@ public:
break;
}
return String();
return {};
}
void restoreFromString (const String& s)

View file

@ -404,7 +404,7 @@ private:
if (element != nullptr)
return element->getResource();
return String();
return {};
}
};

View file

@ -94,7 +94,7 @@ public:
static String getTypefaceNameCode (const String& typefaceName)
{
if (typefaceName == getDefaultFont()) return String();
if (typefaceName == getDefaultFont()) return {};
if (typefaceName == getDefaultSans()) return "Font::getDefaultSansSerifFontName(), ";
if (typefaceName == getDefaultSerif()) return "Font::getDefaultSerifFontName(), ";
if (typefaceName == getDefaultMono()) return "Font::getDefaultMonospacedFontName(), ";

View file

@ -488,7 +488,7 @@ private:
}
//==============================================================================
String getAppBuildGradleFileContent () const
String getAppBuildGradleFileContent() const
{
MemoryOutputStream mo;
mo << "apply plugin: 'com.android." << (isLibrary() ? "library" : "application") << "'" << newLine << newLine;

View file

@ -214,7 +214,7 @@ private:
Array<var> (archFlags, numElementsInArray (archFlags))));
}
String getLibrarySubdirPath () const override
String getLibrarySubdirPath() const override
{
const String archFlag = getArchitectureTypeVar();
@ -227,7 +227,7 @@ private:
return "/i386";
jassertfalse;
return String();
return {};
}
};
@ -254,38 +254,35 @@ private:
String getTargetSuffix() const
{
const ProjectType::Target::TargetFileType fileType = getTargetFileType();
auto fileType = getTargetFileType();
switch (fileType)
{
case executable:
return "";
case staticLibrary:
return ".a";
case sharedLibraryOrDLL:
return ".so";
case executable: return {};
case staticLibrary: return ".a";
case sharedLibraryOrDLL: return ".so";
case pluginBundle:
switch (type)
{
case VST3PlugIn:
return ".vst3";
case VSTPlugIn:
case VST3PlugIn: return ".vst3";
case VSTPlugIn: return ".so";
default: break;
}
return ".so";
default:
break;
}
return ".so";
default:
break;
}
return String();
return {};
}
bool isDynamicLibrary() const
{
return (type == DynamicLibrary || type == VST3PlugIn || type == VSTPlugIn || type == AAXPlugIn);
return (type == DynamicLibrary || type == VST3PlugIn
|| type == VSTPlugIn || type == AAXPlugIn);
}
};

View file

@ -163,10 +163,11 @@ public:
}
}
String getLibrarySubdirPath () const override
String getLibrarySubdirPath() const override
{
auto result = String ("$(Platform)\\");
String result ("$(Platform)\\");
result += isUsingRuntimeLibDLL() ? "MD" : "MT";
if (isDebug())
result += "d";
@ -246,31 +247,26 @@ public:
switch (fileType)
{
case executable:
return ".exe";
case staticLibrary:
return ".lib";
case sharedLibraryOrDLL:
return ".dll";
case executable: return ".exe";
case staticLibrary: return ".lib";
case sharedLibraryOrDLL: return ".dll";
case pluginBundle:
switch (type)
{
case VST3PlugIn:
return ".vst3";
case AAXPlugIn:
return ".aaxdll";
case RTASPlugIn:
return ".dpm";
default:
break;
case VST3PlugIn: return ".vst3";
case AAXPlugIn: return ".aaxdll";
case RTASPlugIn: return ".dpm";
default: break;
}
return ".dll";
default:
break;
}
return String();
return {};
}
XmlElement* createToolElement (XmlElement& parent, const String& toolName) const
@ -350,7 +346,7 @@ public:
createRebasedPath (bundleScript) + String (" \"") + macOSDir + String ("\" ") + createRebasedPath (iconFilePath);
}
return String();
return {};
}
String getExtraPreBuildSteps (const MSVCBuildConfiguration& config) const
@ -372,7 +368,7 @@ public:
return script;
}
return String();
return {};
}
String getPostBuildSteps (const MSVCBuildConfiguration& config) const
@ -418,9 +414,10 @@ public:
String getExtraLinkerFlags() const
{
if (type == RTASPlugIn) return "/FORCE:multiple";
if (type == RTASPlugIn)
return "/FORCE:multiple";
return String();
return {};
}
StringArray getExtraSearchPaths() const
@ -533,7 +530,7 @@ public:
RelativePath::buildTargetFolder).toWindowsStyle());
}
return String();
return {};
}
bool shouldUseRuntimeDLL (const MSVCBuildConfiguration& config) const
@ -748,7 +745,7 @@ protected:
if (target->type == ProjectType::Target::SharedCodeTarget)
return target->getProjectGuid();
return String();
return {};
}
//==============================================================================
@ -1067,9 +1064,10 @@ protected:
return path.getFileNameWithoutExtension().startsWithIgnoreCase ("juce_audio_plugin_client_RTAS_");
}
StringArray getModuleLibs () const
StringArray getModuleLibs() const
{
StringArray result;
for (auto& lib : windowsLibs)
result.add (lib + ".lib");
@ -1487,7 +1485,7 @@ public:
Value getPlatformToolsetValue() { return getSetting (Ids::toolset); }
Value getIPPLibraryValue() { return getSetting (Ids::IPPLibrary); }
String getIPPLibrary() const { return settings [Ids::IPPLibrary]; }
virtual String getCppLanguageStandard() const { return String(); }
virtual String getCppLanguageStandard() const { return {}; }
String getPlatformToolset() const
{

View file

@ -51,18 +51,20 @@ protected:
Array<var> (archFlags, numElementsInArray (archFlags))));
}
String getLibrarySubdirPath () const override
String getLibrarySubdirPath() const override
{
const String archFlag = getArchitectureTypeVar();
String archFlag = getArchitectureTypeVar();
String prefix ("-march=");
const auto prefix = String ("-march=");
if (archFlag.startsWith (prefix))
return archFlag.substring (prefix.length());
else if (archFlag == "-m64")
if (archFlag == "-m64")
return "x86_64";
else if (archFlag == "-m32")
if (archFlag == "-m32")
return "i386";
else
return "$(shell uname -m)";
}
};
@ -86,7 +88,7 @@ public:
if (type == AggregateTarget)
// the aggregate target should not specify any settings at all!
// it just defines dependencies on the other targets.
return StringArray();
return {};
StringPairArray commonOptions = owner.getAllPreprocessorDefs (config, ProjectType::Target::unspecified);
StringPairArray targetSpecific = owner.getAllPreprocessorDefs (config, type);
@ -140,17 +142,13 @@ public:
{
switch (type)
{
case VSTPlugIn:
return ".so";
case VST3PlugIn:
return ".vst3";
case SharedCodeTarget:
return ".a";
default:
break;
case VSTPlugIn: return ".so";
case VST3PlugIn: return ".vst3";
case SharedCodeTarget: return ".a";
default: break;
}
return String();
return {};
}
String getTargetVarName() const

View file

@ -445,7 +445,7 @@ protected:
"Enable this to strip any locally defined symbols resulting in a smaller binary size. Enabling this will also remove any function names from crash logs. Must be disabled for static library projects.");
}
String getLibrarySubdirPath () const override
String getLibrarySubdirPath() const override
{
return "${CURRENT_ARCH}";
}
@ -779,7 +779,7 @@ public:
if (type == AggregateTarget)
// the aggregate target should not specify any settings at all!
// it just defines dependencies on the other targets.
return StringArray();
return {};
StringArray s;
@ -979,7 +979,7 @@ public:
case RTASPlugIn: return config.rtasBinaryLocation.get();
case AAXPlugIn: return config.aaxBinaryLocation.get();
case SharedCodeTarget: return owner.isiOS() ? "@executable_path/Frameworks" : "@executable_path/../Frameworks";
default: return String();
default: return {};
}
}
@ -2240,7 +2240,7 @@ private:
}
}
return String();
return {};
}
String getEntitlementsFileName() const
@ -2328,7 +2328,7 @@ private:
xcodeTarget);
}
return String();
return {};
}
String addFramework (const String& frameworkName) const
@ -2475,7 +2475,7 @@ private:
}
}
return StringArray();
return {};
}
StringArray getNamesOfTargets() const

View file

@ -873,5 +873,5 @@ String ProjectExporter::getExternalLibraryFlags (const BuildConfiguration& confi
if (libraries.size() != 0)
return replacePreprocessorTokens (config, "-l" + libraries.joinIntoString (" -l")).trim();
return String();
return {};
}

View file

@ -218,7 +218,7 @@ public:
//==============================================================================
virtual void createConfigProperties (PropertyListBuilder&) = 0;
virtual var getDefaultOptimisationLevel() const = 0;
virtual String getLibrarySubdirPath() const { return String(); }
virtual String getLibrarySubdirPath() const { return {}; }
//==============================================================================

View file

@ -137,7 +137,7 @@ private:
c = c->getParentComponent();
}
return String();
return {};
}
};

View file

@ -81,7 +81,7 @@ static var parseModuleDesc (const File& header)
}
}
return var();
return {};
}
ModuleDescription::ModuleDescription (const File& folder)
@ -135,13 +135,9 @@ ModuleList& ModuleList::operator= (const ModuleList& other)
const ModuleDescription* ModuleList::getModuleWithID (const String& moduleID) const
{
for (int i = 0; i < modules.size(); ++i)
{
ModuleDescription* m = modules.getUnchecked(i);
for (auto* m : modules)
if (m->getID() == moduleID)
return m;
}
return nullptr;
}
@ -164,8 +160,8 @@ StringArray ModuleList::getIDs() const
{
StringArray results;
for (int i = 0; i < modules.size(); ++i)
results.add (modules.getUnchecked(i)->getID());
for (auto* m : modules)
results.add (m->getID());
results.sort (true);
return results;
@ -174,6 +170,7 @@ StringArray ModuleList::getIDs() const
Result ModuleList::tryToAddModuleFromFolder (const File& path)
{
ModuleDescription m (path);
if (m.isValid())
{
modules.add (new ModuleDescription (m));

View file

@ -855,7 +855,7 @@ String Project::Item::getFilePath() const
if (isFile())
return state [Ids::file].toString();
return String();
return {};
}
File Project::Item::getFile() const
@ -1363,7 +1363,7 @@ String Project::getFileTemplate (const String& templateName)
return String::fromUTF8 (data, dataSize);
jassertfalse;
return String();
return {};
}

View file

@ -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(); }
String getTooltip() override { return {}; }
File getDraggableFile() const override { return getFile(); }
var getDragSourceDescription() override

View file

@ -251,7 +251,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS
// no RTAS on this OS!
jassertfalse;
return String();
return {};
}
if (key == Ids::aaxPath)
@ -261,7 +261,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS
// no AAX on this OS!
jassertfalse;
return String();
return {};
}
if (key == Ids::androidSDKPath)
@ -272,7 +272,7 @@ String StoredSettings::getFallbackPath (const Identifier& key, DependencyPathOS
// didn't recognise the key provided!
jassertfalse;
return String();
return {};
}
bool StoredSettings::isGlobalPathValid (const File& relativeTo, const Identifier& key, const String& path)

View file

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

View file

@ -442,7 +442,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup
jassert (&newSetup != &currentSetup); // this will have no effect
if (newSetup == currentSetup && currentAudioDevice != nullptr)
return String();
return {};
if (! (newSetup == currentSetup))
sendChangeMessage();
@ -462,7 +462,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup
if (treatAsChosenDevice)
updateXml();
return String();
return {};
}
if (currentSetup.inputDeviceName != newInputDeviceName

View file

@ -172,7 +172,7 @@ public:
return juceString (string);
}
return String();
return {};
}
String getOutputPortNameForJuceIndex (int idx)
@ -183,7 +183,7 @@ public:
return juceString (string);
}
return String();
return {};
}
StringArray getDevices (bool input)
@ -200,7 +200,7 @@ public:
return javaStringArrayToJuce (devices);
}
return StringArray();
return {};
}
AndroidMidiInput* openMidiInputPortWithIndex (int idx, MidiInput* juceMidiInput, juce::MidiInputCallback* callback)

View file

@ -78,7 +78,7 @@ class SlObjectRef
{
public:
//==============================================================================
SlObjectRef () noexcept {}
SlObjectRef() noexcept {}
SlObjectRef (const SlObjectRef& obj) noexcept : cb (obj.cb) {}
SlObjectRef (SlObjectRef&& obj) noexcept : cb (static_cast<ReferenceCountedObjectPtr<ControlBlock>&&> (obj.cb)) { obj.cb = nullptr; }
explicit SlObjectRef (SLObjectItf o) : cb (new ControlBlock (o)) {}
@ -108,7 +108,7 @@ class SlRef : public SlObjectRef
{
public:
//==============================================================================
SlRef () noexcept : type (nullptr) {}
SlRef() noexcept : type (nullptr) {}
SlRef (SlRef& r) noexcept : SlObjectRef (r), type (r.type) {}
SlRef (SlRef&& r) noexcept : SlObjectRef (static_cast<SlRef&&> (r)), type (r.type) { r.type = nullptr; }
@ -315,7 +315,7 @@ public:
(*queue)->Clear (queue);
}
void enqueueBuffer ()
void enqueueBuffer()
{
(*queue)->Enqueue (queue, getCurrentBuffer(), static_cast<SLuint32> (getBufferSizeInSamples() * sizeof (T)));
++numBlocksOut;
@ -986,7 +986,7 @@ private:
if (text.get() != 0)
return juceString (text);
return String();
return {};
}
static bool androidHasSystemFeature (const String& property)

View file

@ -212,7 +212,7 @@ public:
return instance;
}
void registerCallback ()
void registerCallback()
{
if (inputThread == nullptr)
inputThread = new MidiInputThread (*this);
@ -221,7 +221,7 @@ public:
inputThread->startThread();
}
void unregisterCallback ()
void unregisterCallback()
{
jassert (activeCallbacks.get() > 0);
if (--activeCallbacks == 0 && inputThread->isThreadRunning())
@ -273,7 +273,7 @@ private:
friend class ReferenceCountedObjectPtr<AlsaClient>;
friend struct ContainerDeletePolicy<AlsaClient>;
AlsaClient ()
AlsaClient()
: handle (nullptr),
inputThread (nullptr)
{
@ -601,7 +601,7 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba
// (These are just stub functions if ALSA is unavailable...)
StringArray MidiOutput::getDevices() { return StringArray(); }
StringArray MidiOutput::getDevices() { return {}; }
int MidiOutput::getDefaultDeviceIndex() { return 0; }
MidiOutput* MidiOutput::openDevice (int) { return nullptr; }
MidiOutput* MidiOutput::createNewDevice (const String&) { return nullptr; }
@ -613,7 +613,7 @@ MidiInput::~MidiInput() {}
void MidiInput::start() {}
void MidiInput::stop() {}
int MidiInput::getDefaultDeviceIndex() { return 0; }
StringArray MidiInput::getDevices() { return StringArray(); }
StringArray MidiInput::getDevices() { return {}; }
MidiInput* MidiInput::openDevice (int, MidiInputCallback*) { return nullptr; }
MidiInput* MidiInput::createNewDevice (const String&, MidiInputCallback*) { return nullptr; }

View file

@ -1284,7 +1284,7 @@ public:
fifos.clear();
startThread (9);
return String();
return {};
}
void close() override

View file

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

View file

@ -42,7 +42,7 @@ struct MidiServiceType
struct OutputWrapper
{
virtual ~OutputWrapper () {}
virtual ~OutputWrapper() {}
virtual String getDeviceName() = 0;

View file

@ -3131,12 +3131,12 @@ private:
MP3AudioFormat::MP3AudioFormat() : AudioFormat (MP3Decoder::mp3FormatName, ".mp3") {}
MP3AudioFormat::~MP3AudioFormat() {}
Array<int> MP3AudioFormat::getPossibleSampleRates() { return Array<int>(); }
Array<int> MP3AudioFormat::getPossibleBitDepths() { return Array<int>(); }
Array<int> MP3AudioFormat::getPossibleSampleRates() { return {}; }
Array<int> MP3AudioFormat::getPossibleBitDepths() { return {}; }
bool MP3AudioFormat::canDoStereo() { return true; }
bool MP3AudioFormat::canDoMono() { return true; }
bool MP3AudioFormat::isCompressed() { return true; }
StringArray MP3AudioFormat::getQualityOptions() { return StringArray(); }
StringArray MP3AudioFormat::getQualityOptions() { return {}; }
AudioFormatReader* MP3AudioFormat::createReaderFor (InputStream* sourceStream, const bool deleteStreamIfOpeningFails)
{

View file

@ -48,7 +48,7 @@ bool AudioFormat::canHandleFile (const File& f)
const String& AudioFormat::getFormatName() const { return formatName; }
const StringArray& AudioFormat::getFileExtensions() const { return fileExtensions; }
bool AudioFormat::isCompressed() { return false; }
StringArray AudioFormat::getQualityOptions() { return StringArray(); }
StringArray AudioFormat::getQualityOptions() { return {}; }
MemoryMappedAudioFormatReader* AudioFormat::createMemoryMappedReader (const File&)
{

View file

@ -105,7 +105,7 @@ public:
static String getFilePatterns (const String& fileSuffix)
{
if (fileSuffix.isEmpty())
return String();
return {};
return (fileSuffix.startsWithChar ('.') ? "*" : "*.") + fileSuffix;
}

View file

@ -862,7 +862,7 @@ private:
private:
void timerCallback() override
{
stopTimer ();
stopTimer();
ViewRect viewRect;
getSize (&viewRect);

View file

@ -882,7 +882,7 @@ public:
if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return "Input " + String (index + 1);
return String();
return {};
}
const String getOutputChannelName (int index) const override
@ -890,7 +890,7 @@ public:
if (isPositiveAndBelow (index, getTotalNumOutputChannels()))
return "Output " + String (index + 1);
return String();
return {};
}
bool isInputChannelStereoPair (int index) const override { return isPositiveAndBelow (index, getTotalNumInputChannels()); }
@ -972,17 +972,17 @@ public:
const String getParameterName (int index) override
{
if (const ParamInfo* p = parameters[index])
if (auto* p = parameters[index])
return p->name;
return String();
return {};
}
const String getParameterText (int index) override { return String (getParameter (index)); }
bool isParameterAutomatable (int index) const override
{
if (const ParamInfo* p = parameters[index])
if (auto* p = parameters[index])
return p->automatable;
return false;

View file

@ -338,7 +338,7 @@ public:
if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return String (plugin->PortNames [inputs [index]]).trim();
return String();
return {};
}
const String getOutputChannelName (const int index) const
@ -346,7 +346,7 @@ public:
if (isPositiveAndBelow (index, getTotalNumInputChannels()))
return String (plugin->PortNames [outputs [index]]).trim();
return String();
return {};
}
//==============================================================================
@ -390,7 +390,7 @@ public:
return String (plugin->PortNames [parameters [index]]).trim();
}
return String();
return {};
}
const String getParameterText (int index)
@ -407,7 +407,7 @@ public:
return String (parameterValues[index].scaled, 4);
}
return String();
return {};
}
//==============================================================================
@ -424,7 +424,7 @@ public:
const String getProgramName (int index)
{
// XXX
return String();
return {};
}
void changeProgramName (int index, const String& newName)

View file

@ -2131,7 +2131,7 @@ public:
return toString (busInfo.name);
}
return String();
return {};
}
const String getInputChannelName (int channelIndex) const override { return getChannelName (channelIndex, true, true); }
@ -2223,7 +2223,7 @@ public:
return toString (result);
}
return String();
return {};
}
void setParameter (int parameterIndex, float newValue) override

View file

@ -470,7 +470,7 @@ public:
}
}
return String();
return {};
}
#endif
#else
@ -981,7 +981,7 @@ public:
return String (pinProps.text, sizeof (pinProps.text));
}
return String();
return {};
}
bool isInputChannelStereoPair (int index) const override
@ -1005,7 +1005,7 @@ public:
return String (pinProps.text, sizeof (pinProps.text));
}
return String();
return {};
}
bool isOutputChannelStereoPair (int index) const override
@ -1810,7 +1810,7 @@ private:
String getTextForOpcode (const int index, const VstHostToPlugInOpcodes opcode) const
{
if (vstEffect == nullptr)
return String();
return {};
jassert (index >= 0 && index < vstEffect->numParameters);
char nm[256] = { 0 };

View file

@ -471,7 +471,7 @@ void AudioProcessor::sendParamChangeMessageToListeners (const int parameterIndex
if (isPositiveAndBelow (parameterIndex, getNumParameters()))
{
for (int i = listeners.size(); --i >= 0;)
if (AudioProcessorListener* l = getListenerLocked (i))
if (auto* l = getListenerLocked (i))
l->audioProcessorParameterChanged (this, parameterIndex, newValue);
}
else
@ -492,7 +492,7 @@ void AudioProcessor::beginParameterChangeGesture (int parameterIndex)
#endif
for (int i = listeners.size(); --i >= 0;)
if (AudioProcessorListener* l = getListenerLocked (i))
if (auto* l = getListenerLocked (i))
l->audioProcessorParameterChangeGestureBegin (this, parameterIndex);
}
else
@ -542,7 +542,7 @@ int AudioProcessor::getNumParameters()
float AudioProcessor::getParameter (int index)
{
if (AudioProcessorParameter* p = getParamChecked (index))
if (auto* p = getParamChecked (index))
return p->getValue();
return 0;
@ -550,13 +550,13 @@ float AudioProcessor::getParameter (int index)
void AudioProcessor::setParameter (int index, float newValue)
{
if (AudioProcessorParameter* p = getParamChecked (index))
if (auto* p = getParamChecked (index))
p->setValue (newValue);
}
float AudioProcessor::getParameterDefaultValue (int index)
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->getDefaultValue();
return 0;
@ -564,16 +564,16 @@ float AudioProcessor::getParameterDefaultValue (int index)
const String AudioProcessor::getParameterName (int index)
{
if (AudioProcessorParameter* p = getParamChecked (index))
if (auto* p = getParamChecked (index))
return p->getName (512);
return String();
return {};
}
String AudioProcessor::getParameterID (int index)
{
// Don't use getParamChecked here, as this must also work for legacy plug-ins
if (AudioProcessorParameterWithID* p = dynamic_cast<AudioProcessorParameterWithID*> (managedParameters[index]))
if (auto* p = dynamic_cast<AudioProcessorParameterWithID*> (managedParameters[index]))
return p->paramID;
return String (index);
@ -581,7 +581,7 @@ String AudioProcessor::getParameterID (int index)
String AudioProcessor::getParameterName (int index, int maximumStringLength)
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->getName (maximumStringLength);
return getParameterName (index).substring (0, maximumStringLength);
@ -601,7 +601,7 @@ const String AudioProcessor::getParameterText (int index)
String AudioProcessor::getParameterText (int index, int maximumStringLength)
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->getText (p->getValue(), maximumStringLength);
return getParameterText (index).substring (0, maximumStringLength);
@ -609,7 +609,7 @@ String AudioProcessor::getParameterText (int index, int maximumStringLength)
int AudioProcessor::getParameterNumSteps (int index)
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->getNumSteps();
return AudioProcessor::getDefaultNumParameterSteps();
@ -622,15 +622,15 @@ int AudioProcessor::getDefaultNumParameterSteps() noexcept
String AudioProcessor::getParameterLabel (int index) const
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->getLabel();
return String();
return {};
}
bool AudioProcessor::isParameterAutomatable (int index) const
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->isAutomatable();
return true;
@ -638,7 +638,7 @@ bool AudioProcessor::isParameterAutomatable (int index) const
bool AudioProcessor::isParameterOrientationInverted (int index) const
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->isOrientationInverted();
return false;
@ -646,7 +646,7 @@ bool AudioProcessor::isParameterOrientationInverted (int index) const
bool AudioProcessor::isMetaParameter (int index) const
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->isMetaParameter();
return false;
@ -654,7 +654,7 @@ bool AudioProcessor::isMetaParameter (int index) const
AudioProcessorParameter::Category AudioProcessor::getParameterCategory (int index) const
{
if (AudioProcessorParameter* p = managedParameters[index])
if (auto* p = managedParameters[index])
return p->getCategory();
return AudioProcessorParameter::genericParameter;

View file

@ -1527,7 +1527,7 @@ const String AudioProcessorGraph::AudioGraphIOProcessor::getName() const
default: break;
}
return String();
return {};
}
void AudioProcessorGraph::AudioGraphIOProcessor::fillInPluginDescription (PluginDescription& d) const
@ -1649,7 +1649,7 @@ int AudioProcessorGraph::AudioGraphIOProcessor::getNumPrograms()
int AudioProcessorGraph::AudioGraphIOProcessor::getCurrentProgram() { return 0; }
void AudioProcessorGraph::AudioGraphIOProcessor::setCurrentProgram (int) { }
const String AudioProcessorGraph::AudioGraphIOProcessor::getProgramName (int) { return String(); }
const String AudioProcessorGraph::AudioGraphIOProcessor::getProgramName (int) { return {}; }
void AudioProcessorGraph::AudioGraphIOProcessor::changeProgramName (int, const String&) {}
void AudioProcessorGraph::AudioGraphIOProcessor::getStateInformation (juce::MemoryBlock&) {}

View file

@ -365,7 +365,7 @@ public:
int getNumPrograms() override { return 0; }
int getCurrentProgram() override { return 0; }
void setCurrentProgram (int) override { }
const String getProgramName (int) override { return String(); }
const String getProgramName (int) override { return {}; }
void changeProgramName (int, const String&) override { }
void getStateInformation (juce::MemoryBlock&) override;
void setStateInformation (const void* data, int sizeInBytes) override;

View file

@ -558,7 +558,7 @@ String MidiKeyboardComponent::getWhiteNoteText (const int midiNoteNumber)
if (midiNoteNumber % 12 == 0)
return MidiMessage::getMidiNoteName (midiNoteNumber, true, true, octaveNumForMiddleC);
return String();
return {};
}
void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,

View file

@ -56,7 +56,7 @@ struct AndroidBluetoothMidiInterface
// if this is null then bluetooth is not enabled
if (btManager.get() == nullptr)
return StringArray();
return {};
jobjectArray jDevices = (jobjectArray) env->CallObjectMethod (btManager.get(),
AndroidBluetoothManager.getMidiBluetoothAddresses);

View file

@ -254,7 +254,7 @@ struct OpenDiskDevice
[device releaseMediaReservation];
[device releaseExclusiveAccess];
return String();
return {};
}
DRDevice* device;

View file

@ -35,7 +35,7 @@ class JUCE_API SoundPlayer : public AudioIODeviceCallback
{
public:
//==============================================================================
SoundPlayer ();
SoundPlayer();
/** Destructor. */
virtual ~SoundPlayer();

View file

@ -69,10 +69,10 @@ bool DynamicObject::hasMethod (const Identifier& methodName) const
var DynamicObject::invokeMethod (Identifier method, const var::NativeFunctionArgs& args)
{
if (var::NativeFunction function = properties [method].getNativeFunction())
if (auto function = properties [method].getNativeFunction())
return function (args);
return var();
return {};
}
void DynamicObject::setMethod (Identifier name, var::NativeFunction function)
@ -88,7 +88,7 @@ void DynamicObject::clear()
void DynamicObject::cloneAllProperties()
{
for (int i = properties.size(); --i >= 0;)
if (var* v = properties.getVarPointerAt (i))
if (auto* v = properties.getVarPointerAt (i))
*v = v->clone();
}

View file

@ -33,7 +33,7 @@
struct ListenerBase
{
ListenerBase (int& counter) : c (counter) {}
virtual ~ListenerBase () {}
virtual ~ListenerBase() {}
virtual void f () = 0;
virtual void f (void*) = 0;

View file

@ -51,7 +51,7 @@ public:
virtual int toInt (const ValueUnion&) const noexcept { return 0; }
virtual int64 toInt64 (const ValueUnion&) const noexcept { return 0; }
virtual double toDouble (const ValueUnion&) const noexcept { return 0; }
virtual String toString (const ValueUnion&) const { return String(); }
virtual String toString (const ValueUnion&) const { return {}; }
virtual bool toBool (const ValueUnion&) const noexcept { return false; }
virtual ReferenceCountedObject* toObject (const ValueUnion&) const noexcept { return nullptr; }
virtual Array<var>* toArray (const ValueUnion&) const noexcept { return nullptr; }
@ -291,7 +291,7 @@ public:
return d->clone().get();
jassertfalse; // can only clone DynamicObjects!
return var();
return {};
}
void writeToStream (const ValueUnion&, OutputStream& output) const override
@ -314,7 +314,7 @@ public:
Array<var>* toArray (const ValueUnion& data) const noexcept override
{
if (RefCountedArray* a = dynamic_cast<RefCountedArray*> (data.objectValue))
if (auto* a = dynamic_cast<RefCountedArray*> (data.objectValue))
return &(a->array);
return nullptr;
@ -331,7 +331,7 @@ public:
{
Array<var> arrayCopy;
if (const Array<var>* array = toArray (original.value))
if (auto* array = toArray (original.value))
for (int i = 0; i < array->size(); ++i)
arrayCopy.add (array->getReference(i).clone());
@ -340,7 +340,7 @@ public:
void writeToStream (const ValueUnion& data, OutputStream& output) const override
{
if (const Array<var>* array = toArray (data))
if (auto* array = toArray (data))
{
MemoryOutputStream buffer (512);
const int numItems = array->size();
@ -593,7 +593,7 @@ var var::clone() const noexcept
//==============================================================================
const var& var::operator[] (const Identifier& propertyName) const
{
if (DynamicObject* const o = getDynamicObject())
if (auto* o = getDynamicObject())
return o->getProperty (propertyName);
return getNullVarRef();
@ -606,7 +606,7 @@ const var& var::operator[] (const char* const propertyName) const
var var::getProperty (const Identifier& propertyName, const var& defaultReturnValue) const
{
if (DynamicObject* const o = getDynamicObject())
if (auto* o = getDynamicObject())
return o->getProperties().getWithDefault (propertyName, defaultReturnValue);
return defaultReturnValue;
@ -619,10 +619,10 @@ var::NativeFunction var::getNativeFunction() const
var var::invoke (const Identifier& method, const var* arguments, int numArguments) const
{
if (DynamicObject* const o = getDynamicObject())
if (auto* o = getDynamicObject())
return o->invokeMethod (method, var::NativeFunctionArgs (*this, arguments, numArguments));
return var();
return {};
}
var var::call (const Identifier& method) const
@ -662,7 +662,7 @@ var var::call (const Identifier& method, const var& arg1, const var& arg2, const
//==============================================================================
int var::size() const
{
if (const Array<var>* const array = getArray())
if (auto* array = getArray())
return array->size();
return 0;
@ -670,7 +670,7 @@ int var::size() const
const var& var::operator[] (int arrayIndex) const
{
const Array<var>* const array = getArray();
auto* array = getArray();
// When using this method, the var must actually be an array, and the index
// must be in-range!
@ -681,7 +681,7 @@ const var& var::operator[] (int arrayIndex) const
var& var::operator[] (int arrayIndex)
{
const Array<var>* const array = getArray();
auto* array = getArray();
// When using this method, the var must actually be an array, and the index
// must be in-range!
@ -692,7 +692,7 @@ var& var::operator[] (int arrayIndex)
Array<var>* var::convertToArray()
{
if (Array<var>* array = getArray())
if (auto* array = getArray())
return array;
Array<var> tempVar;
@ -710,7 +710,7 @@ void var::append (const var& n)
void var::remove (const int index)
{
if (Array<var>* const array = getArray())
if (auto* const array = getArray())
array->remove (index);
}
@ -726,7 +726,7 @@ void var::resize (const int numArrayElementsWanted)
int var::indexOf (const var& n) const
{
if (const Array<var>* const array = getArray())
if (auto* const array = getArray())
return array->indexOf (n);
return -1;
@ -774,7 +774,7 @@ var var::readFromStream (InputStream& input)
case varMarker_Array:
{
var v;
Array<var>* const destArray = v.convertToArray();
auto* destArray = v.convertToArray();
for (int i = input.readCompressedInt(); --i >= 0;)
destArray->add (readFromStream (input));
@ -787,7 +787,7 @@ var var::readFromStream (InputStream& input)
}
}
return var();
return {};
}
var::NativeFunctionArgs::NativeFunctionArgs (const var& t, const var* args, int numArgs) noexcept

View file

@ -114,7 +114,7 @@ static String removeEllipsis (const String& path)
String File::parseAbsolutePath (const String& p)
{
if (p.isEmpty())
return String();
return {};
#if JUCE_WINDOWS
// Windows..
@ -548,7 +548,7 @@ bool File::loadFileAsData (MemoryBlock& destBlock) const
String File::loadFileAsString() const
{
if (! existsAsFile())
return String();
return {};
FileInputStream in (*this);
return in.openedOk() ? in.readEntireStreamAsString()
@ -667,7 +667,7 @@ String File::getFileExtension() const
if (indexOfDot > fullPath.lastIndexOfChar (separator))
return fullPath.substring (indexOfDot);
return String();
return {};
}
bool File::hasFileExtension (StringRef possibleSuffix) const

View file

@ -590,7 +590,7 @@ public:
{
switch (r.nextInt (depth > 3 ? 6 : 8))
{
case 0: return var();
case 0: return {};
case 1: return r.nextInt();
case 2: return r.nextInt64();
case 3: return r.nextBool();
@ -618,7 +618,7 @@ public:
}
default:
return var();
return {};
}
}

View file

@ -158,7 +158,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
// if there's a class with an overridden DynamicObject::hasMethod, this avoids an error
if (o->hasMethod (functionName))
return var();
return {};
}
if (targetObject.isString())
@ -517,7 +517,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
}
var throwError (const char* typeName) const
{ location.throwError (getTokenName (operation) + " is not allowed on the " + typeName + " type"); return var(); }
{ location.throwError (getTokenName (operation) + " is not allowed on the " + typeName + " type"); return {}; }
};
struct EqualsOp : public BinaryOperator
@ -757,7 +757,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
if (o->hasMethod (dot->child)) // allow an overridden DynamicObject::invokeMethod to accept a method call.
return o->invokeMethod (dot->child, args);
location.throwError ("This expression is not a function!"); return var();
location.throwError ("This expression is not a function!"); return {};
}
ExpPtr object;

View file

@ -1135,7 +1135,7 @@ String BigInteger::toString (const int base, const int minimumNumCharacters) con
else
{
jassertfalse; // can't do the specified base!
return String();
return {};
}
s = s.paddedLeft ('0', minimumNumCharacters);

View file

@ -55,7 +55,7 @@ public:
virtual String getName() const
{
jassertfalse; // You shouldn't call this for an expression that's not actually a function!
return String();
return {};
}
virtual void renameSymbol (const Symbol& oldSymbol, const String& newName, const Scope& scope, int recursionDepth)
@ -1173,5 +1173,5 @@ void Expression::Scope::visitRelativeScope (const String& scopeName, Visitor&) c
String Expression::Scope::getScopeUID() const
{
return String();
return {};
}

View file

@ -45,7 +45,7 @@ bool File::isOnRemovableDrive() const
String File::getVersion() const
{
return String();
return {};
}
static File getSpecialFile (jmethodID type)

View file

@ -257,7 +257,7 @@ String SystemStats::getLogonName()
if (struct passwd* const pw = getpwuid (getuid()))
return CharPointer_UTF8 (pw->pw_name);
return String();
return {};
}
String SystemStats::getFullUserName()
@ -271,7 +271,7 @@ String SystemStats::getComputerName()
if (gethostname (name, sizeof (name) - 1) == 0)
return name;
return String();
return {};
}

View file

@ -143,7 +143,7 @@ public:
}
//==============================================================================
bool setOptions ()
bool setOptions()
{
const String address = url.toString (! isPost);
@ -209,7 +209,7 @@ public:
bool connect (WebInputStream::Listener* webInputListener)
{
if (! setOptions ())
if (! setOptions())
{
cleanup();
return false;

View file

@ -74,7 +74,7 @@ bool File::isOnRemovableDrive() const
String File::getVersion() const
{
return String(); // xxx not yet implemented
return {}; // xxx not yet implemented
}
//==============================================================================

View file

@ -428,7 +428,7 @@ private:
{
char c = 0;
if (read (&c, 1) != 1)
return String();
return {};
buffer.writeByte (c);
@ -443,7 +443,7 @@ private:
if (header.startsWithIgnoreCase ("HTTP/"))
return header;
return String();
return {};
}
static void writeValueIfNotPresent (MemoryOutputStream& dest, const String& headers, const String& key, const String& value)
@ -561,7 +561,7 @@ private:
if (lines[i].startsWithIgnoreCase (itemName))
return lines[i].substring (itemName.length()).trim();
return String();
return {};
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pimpl)

View file

@ -109,7 +109,7 @@ String SystemStats::getLogonName()
if (struct passwd* const pw = getpwuid (getuid()))
return CharPointer_UTF8 (pw->pw_name);
return String();
return {};
}
String SystemStats::getFullUserName()
@ -123,7 +123,7 @@ String SystemStats::getComputerName()
if (gethostname (name, sizeof (name) - 1) == 0)
return name;
return String();
return {};
}
static String getLocaleValue (nl_item key)

View file

@ -273,7 +273,7 @@ String File::getVersion() const
return nsStringToJuce (name);
}
return String();
return {};
}
//==============================================================================

View file

@ -613,7 +613,7 @@ struct BackgroundDownloadTask : public URL::DownloadTask
static void didBecomeInvalidWithError (id self, SEL, NSURLSession*, NSURLSessionTask*, NSError*)
{
if (auto state = getState (self)) state->didBecomeInvalidWithError ();
if (auto state = getState (self)) state->didBecomeInvalidWithError();
}
};
};

View file

@ -31,7 +31,7 @@
String String::fromCFString (CFStringRef cfString)
{
if (cfString == 0)
return String();
return {};
CFRange range = { 0, CFStringGetLength (cfString) };
CFIndex bytesNeeded = 0;

View file

@ -715,7 +715,7 @@ String File::getVolumeLabel() const
}
#endif
return String();
return {};
}
int File::getVolumeSerialNumber() const

View file

@ -501,7 +501,7 @@ void MACAddress::findAllAddresses (Array<MACAddress>& result)
void IPAddress::findAllAddresses (Array<IPAddress>& result, bool includeIPv6)
{
result.addIfNotAlreadyThere (IPAddress::local ());
result.addIfNotAlreadyThere (IPAddress::local());
if (includeIPv6)
result.addIfNotAlreadyThere (IPAddress::local (true));

View file

@ -242,7 +242,7 @@ String SystemStats::getOperatingSystemName()
String SystemStats::getDeviceDescription()
{
return String();
return {};
}
bool SystemStats::isOperatingSystem64Bit()

View file

@ -526,7 +526,7 @@ String URL::readEntireTextStream (const bool usePostCommand) const
if (in != nullptr)
return in->readEntireStreamAsString();
return String();
return {};
}
XmlElement* URL::readEntireXmlStream (const bool usePostCommand) const

View file

@ -375,7 +375,7 @@ public:
bool finished, error;
int httpCode;
DownloadTask ();
DownloadTask();
private:
friend class URL;
@ -441,7 +441,7 @@ public:
/** Tries to download the entire contents of this URL and parse it as XML.
If it fails, or if the text that it reads can't be parsed as XML, this will
return 0.
return nullptr.
When it returns a valid XmlElement object, the caller is responsibile for deleting
this object when no longer needed.

View file

@ -1179,7 +1179,7 @@ bool String::matchesWildcard (StringRef wildcard, const bool ignoreCase) const n
String String::repeatedString (StringRef stringToRepeat, int numberOfTimesToRepeat)
{
if (numberOfTimesToRepeat <= 0)
return String();
return {};
String result (PreallocationBytes (findByteOffsetOfEnd (stringToRepeat) * (size_t) numberOfTimesToRepeat));
CharPointerType n (result.text);
@ -1291,7 +1291,7 @@ String String::replaceSection (int index, int numCharsToReplace, StringRef strin
const size_t newTotalBytes = initialBytes + newStringBytes + remainderBytes;
if (newTotalBytes <= 0)
return String();
return {};
String result (PreallocationBytes ((size_t) newTotalBytes));
@ -1537,7 +1537,7 @@ String String::substring (int start, const int end) const
start = 0;
if (end <= start)
return String();
return {};
int i = 0;
CharPointerType t1 (text);
@ -1545,7 +1545,7 @@ String String::substring (int start, const int end) const
while (i < start)
{
if (t1.isEmpty())
return String();
return {};
++i;
++t1;
@ -1579,7 +1579,7 @@ String String::substring (int start) const
while (--start >= 0)
{
if (t.isEmpty())
return String();
return {};
++t;
}
@ -1604,7 +1604,7 @@ String String::fromFirstOccurrenceOf (StringRef sub,
const int i = ignoreCase ? indexOfIgnoreCase (sub)
: indexOf (sub);
if (i < 0)
return String();
return {};
return substring (includeSubString ? i : i + sub.length());
}
@ -1658,7 +1658,7 @@ String String::unquoted() const
const int len = length();
if (len == 0)
return String();
return {};
const juce_wchar lastChar = text [len - 1];
const int dropAtStart = (*text == '"' || *text == '\'') ? 1 : 0;
@ -1709,7 +1709,7 @@ String String::trim() const
CharPointerType trimmedEnd (findTrimmedEnd (start, end));
if (trimmedEnd <= start)
return String();
return {};
if (text < start || trimmedEnd < end)
return String (start, trimmedEnd);
@ -1782,7 +1782,7 @@ String String::trimCharactersAtEnd (StringRef charactersToTrim) const
String String::retainCharacters (StringRef charactersToRetain) const
{
if (isEmpty())
return String();
return {};
StringCreationHelper builder (text);
@ -1804,7 +1804,7 @@ String String::retainCharacters (StringRef charactersToRetain) const
String String::removeCharacters (StringRef charactersToRemove) const
{
if (isEmpty())
return String();
return {};
StringCreationHelper builder (text);
@ -1903,7 +1903,7 @@ String String::formattedRaw (const char* pf, ...)
break; // returns -1 because of an error rather than because it needs more space.
}
return String();
return {};
}
//==============================================================================
@ -1963,7 +1963,7 @@ String String::toHexString (short number) { return toHexString ((int) (unsig
String String::toHexString (const void* const d, const int size, const int groupSize)
{
if (size <= 0)
return String();
return {};
int numChars = (size * 2) + 2;
if (groupSize > 0)
@ -2008,7 +2008,7 @@ String String::createStringFromData (const void* const unknownData, int size)
const uint8* const data = static_cast<const uint8*> (unknownData);
if (size <= 0 || data == nullptr)
return String();
return {};
if (size == 1)
return charToString ((juce_wchar) data[0]);
@ -2174,7 +2174,7 @@ String String::fromUTF8 (const char* const buffer, int bufferSizeBytes)
}
}
return String();
return {};
}
#if JUCE_MSVC

View file

@ -320,7 +320,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo
start = 0;
if (start >= last)
return String();
return {};
if (start == last - 1)
return strings.getReference (start);
@ -334,7 +334,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo
String result;
result.preallocateBytes (bytesNeeded);
String::CharPointerType dest (result.getCharPointer());
auto dest = result.getCharPointer();
while (start < last)
{

View file

@ -106,7 +106,7 @@ static String addPooledString (Array<String>& strings, const NewStringType& newS
String StringPool::getPooledString (const char* const newString)
{
if (newString == nullptr || *newString == 0)
return String();
return {};
const ScopedLock sl (lock);
garbageCollectIfNeeded();
@ -116,7 +116,7 @@ String StringPool::getPooledString (const char* const newString)
String StringPool::getPooledString (String::CharPointerType start, String::CharPointerType end)
{
if (start.isEmpty() || start == end)
return String();
return {};
const ScopedLock sl (lock);
garbageCollectIfNeeded();
@ -126,7 +126,7 @@ String StringPool::getPooledString (String::CharPointerType start, String::CharP
String StringPool::getPooledString (StringRef newString)
{
if (newString.isEmpty())
return String();
return {};
const ScopedLock sl (lock);
garbageCollectIfNeeded();
@ -136,7 +136,7 @@ String StringPool::getPooledString (StringRef newString)
String StringPool::getPooledString (const String& newString)
{
if (newString.isEmpty())
return String();
return {};
const ScopedLock sl (lock);
garbageCollectIfNeeded();

View file

@ -108,7 +108,7 @@ namespace TimeHelpers
#ifdef JUCE_MSVC
if (tm->tm_year < -1900 || tm->tm_year > 8099)
return String(); // Visual Studio's library can only handle 0 -> 9999 AD
return {}; // Visual Studio's library can only handle 0 -> 9999 AD
#endif
for (size_t bufferSize = 256; ; bufferSize += 256)
@ -491,15 +491,15 @@ Time Time::fromISO8601 (StringRef iso) noexcept
const int year = parseFixedSizeIntAndSkip (t, 4, '-');
if (year < 0)
return Time();
return {};
const int month = parseFixedSizeIntAndSkip (t, 2, '-');
if (month < 0)
return Time();
return {};
const int day = parseFixedSizeIntAndSkip (t, 2, 0);
if (day < 0)
return Time();
return {};
int hours = 0, minutes = 0, milliseconds = 0;
@ -508,11 +508,11 @@ Time Time::fromISO8601 (StringRef iso) noexcept
++t;
hours = parseFixedSizeIntAndSkip (t, 2, ':');
if (hours < 0)
return Time();
return {};
minutes = parseFixedSizeIntAndSkip (t, 2, ':');
if (minutes < 0)
return Time();
return {};
milliseconds = (int) (1000.0 * CharacterFunctions::readDoubleValue (t));
}
@ -523,18 +523,18 @@ Time Time::fromISO8601 (StringRef iso) noexcept
{
const int offsetHours = parseFixedSizeIntAndSkip (t, 2, ':');
if (offsetHours < 0)
return Time();
return {};
const int offsetMinutes = parseFixedSizeIntAndSkip (t, 2, 0);
if (offsetMinutes < 0)
return Time();
return {};
const int offsetMs = (offsetHours * 60 + offsetMinutes) * 60 * 1000;
milliseconds += nextChar == '-' ? offsetMs : -offsetMs; // NB: this seems backwards but is correct!
}
else if (nextChar != 0 && nextChar != 'Z')
{
return Time();
return {};
}
return Time (year, month - 1, day, hours, minutes, 0, milliseconds, false);

View file

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

View file

@ -286,31 +286,31 @@ bool UndoManager::redo()
String UndoManager::getUndoDescription() const
{
if (const ActionSet* const s = getCurrentSet())
if (auto* s = getCurrentSet())
return s->name;
return String();
return {};
}
String UndoManager::getRedoDescription() const
{
if (const ActionSet* const s = getNextSet())
if (auto* s = getNextSet())
return s->name;
return String();
return {};
}
Time UndoManager::getTimeOfUndoTransaction() const
{
if (const ActionSet* const s = getCurrentSet())
if (auto* s = getCurrentSet())
return s->time;
return Time();
return {};
}
Time UndoManager::getTimeOfRedoTransaction() const
{
if (const ActionSet* const s = getNextSet())
if (auto* s = getNextSet())
return s->time;
return Time::getCurrentTime();

View file

@ -151,7 +151,7 @@ String InterprocessConnection::getConnectedHostName() const
const ScopedLock sl (pipeAndSocketLock);
if (pipe == nullptr && socket == nullptr)
return String();
return {};
if (socket != nullptr && ! socket->isLocal())
return socket->getHostName();

View file

@ -139,8 +139,8 @@ struct JUCEApplicationBase::MultipleInstanceHandler {};
//==============================================================================
#if JUCE_ANDROID
StringArray JUCEApplicationBase::getCommandLineParameterArray() { return StringArray(); }
String JUCEApplicationBase::getCommandLineParameters() { return String(); }
StringArray JUCEApplicationBase::getCommandLineParameterArray() { return {}; }
String JUCEApplicationBase::getCommandLineParameters() { return {}; }
#else

View file

@ -107,7 +107,7 @@ public:
readCallback[WINDOW_SYSTEM_FD]->active = true;
}
void removeWindowSystemFd ()
void removeWindowSystemFd()
{
jassert (fdCount == FD_COUNT);

View file

@ -110,7 +110,7 @@ namespace TTFNameExtractor
}
}
return String();
return {};
}
static String getTypefaceNameFromFile (MemoryInputStream& input)
@ -128,7 +128,7 @@ namespace TTFNameExtractor
return parseNameTable (input, ByteOrder::swapIfLittleEndian (tableDirectory.offset));
}
return String();
return {};
}
}

View file

@ -51,7 +51,7 @@ void ApplicationCommandManager::registerCommand (const ApplicationCommandInfo& n
// the name isn't optional!
jassert (newCommand.shortName.isNotEmpty());
if (ApplicationCommandInfo* command = getMutableCommandForID (newCommand.commandID))
if (auto* command = getMutableCommandForID (newCommand.commandID))
{
// Trying to re-register the same command ID with different parameters can often indicate a typo.
// This assertion is here because I've found it useful catching some mistakes, but it may also cause
@ -132,19 +132,19 @@ const ApplicationCommandInfo* ApplicationCommandManager::getCommandForID (const
String ApplicationCommandManager::getNameOfCommand (const CommandID commandID) const noexcept
{
if (const ApplicationCommandInfo* const ci = getCommandForID (commandID))
if (auto* ci = getCommandForID (commandID))
return ci->shortName;
return String();
return {};
}
String ApplicationCommandManager::getDescriptionOfCommand (const CommandID commandID) const noexcept
{
if (const ApplicationCommandInfo* const ci = getCommandForID (commandID))
if (auto* ci = getCommandForID (commandID))
return ci->description.isNotEmpty() ? ci->description
: ci->shortName;
return String();
return {};
}
StringArray ApplicationCommandManager::getCommandCategories() const
@ -186,7 +186,7 @@ bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::Invocati
bool ok = false;
ApplicationCommandInfo commandInfo (0);
if (ApplicationCommandTarget* const target = getTargetForCommand (inf.commandID, commandInfo))
if (auto* target = getTargetForCommand (inf.commandID, commandInfo))
{
ApplicationCommandTarget::InvocationInfo info (inf);
info.commandFlags = commandInfo.flags;
@ -248,7 +248,7 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
if (c == nullptr)
{
if (TopLevelWindow* const activeWindow = TopLevelWindow::getActiveTopLevelWindow())
if (auto* activeWindow = TopLevelWindow::getActiveTopLevelWindow())
{
c = activeWindow->getPeer()->getLastFocusedSubcomponent();
@ -259,12 +259,12 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
if (c == nullptr && Process::isForegroundProcess())
{
Desktop& desktop = Desktop::getInstance();
auto& desktop = Desktop::getInstance();
// getting a bit desperate now: try all desktop comps..
for (int i = desktop.getNumComponents(); --i >= 0;)
if (ComponentPeer* const peer = desktop.getComponent(i)->getPeer())
if (ApplicationCommandTarget* const target = findTargetForComponent (peer->getLastFocusedSubcomponent()))
if (auto* peer = desktop.getComponent(i)->getPeer())
if (auto* target = findTargetForComponent (peer->getLastFocusedSubcomponent()))
return target;
}
@ -274,11 +274,11 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
// component that really should get the event. And if not, the event will
// still be passed up to the top level window anyway, so let's send it to the
// content comp.
if (ResizableWindow* const resizableWindow = dynamic_cast<ResizableWindow*> (c))
if (Component* const content = resizableWindow->getContentComponent())
if (auto* resizableWindow = dynamic_cast<ResizableWindow*> (c))
if (auto* content = resizableWindow->getContentComponent())
c = content;
if (ApplicationCommandTarget* const target = findTargetForComponent (c))
if (auto* target = findTargetForComponent (c))
return target;
}

View file

@ -606,7 +606,7 @@ private:
return str.fromFirstOccurrenceOf ("#", false, false)
.upToLastOccurrenceOf (")", false, false).trim();
return String();
return {};
}
//==============================================================================
@ -1160,7 +1160,7 @@ private:
if (xml.parent != nullptr)
return getInheritedAttribute (*xml.parent, attributeName);
return String();
return {};
}
static int parsePlacementFlags (const String& align) noexcept

View file

@ -3376,7 +3376,7 @@ private:
return String (buffer);
}
return String();
return {};
}
int getCompositionCaretPos (HIMC hImc, LPARAM lParam, const String& currentIMEString) const

View file

@ -200,15 +200,15 @@ int ComboBox::getNumItems() const noexcept
String ComboBox::getItemText (const int index) const
{
if (const PopupMenu::Item* const item = getItemForIndex (index))
if (auto* item = getItemForIndex (index))
return item->text;
return String();
return {};
}
int ComboBox::getItemId (const int index) const noexcept
{
if (const PopupMenu::Item* const item = getItemForIndex (index))
if (auto* item = getItemForIndex (index))
return item->itemID;
return 0;
@ -223,7 +223,7 @@ int ComboBox::indexOfItemId (const int itemId) const noexcept
while (iterator.next())
{
PopupMenu::Item &item = iterator.getItem();
auto& item = iterator.getItem();
if (item.itemID == itemId)
return n;

View file

@ -138,7 +138,7 @@ public:
if (ListBoxModel* m = owner.getModel())
return m->getTooltipForRow (row);
return String();
return {};
}
ScopedPointer<Component> customComponent;
@ -968,6 +968,6 @@ void ListBoxModel::selectedRowsChanged (int) {}
void ListBoxModel::deleteKeyPressed (int) {}
void ListBoxModel::returnKeyPressed (int) {}
void ListBoxModel::listWasScrolled() {}
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
String ListBoxModel::getTooltipForRow (int) { return String(); }
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return {}; }
String ListBoxModel::getTooltipForRow (int) { return {}; }
MouseCursor ListBoxModel::getMouseCursorForRow (int) { return MouseCursor::NormalCursor; }

View file

@ -92,15 +92,15 @@ int TableHeaderComponent::getNumColumns (const bool onlyCountVisibleColumns) con
String TableHeaderComponent::getColumnName (const int columnId) const
{
if (const ColumnInfo* const ci = getInfoForId (columnId))
if (auto* ci = getInfoForId (columnId))
return ci->name;
return String();
return {};
}
void TableHeaderComponent::setColumnName (const int columnId, const String& newName)
{
if (ColumnInfo* const ci = getInfoForId (columnId))
if (auto* ci = getInfoForId (columnId))
{
if (ci->name != newName)
{

View file

@ -206,10 +206,10 @@ public:
const int columnId = owner.getHeader().getColumnIdAtX (getMouseXYRelative().getX());
if (columnId != 0)
if (TableListBoxModel* m = owner.getModel())
if (auto* m = owner.getModel())
return m->getCellTooltip (row, columnId);
return String();
return {};
}
Component* findChildComponentForColumn (const int columnId) const
@ -477,8 +477,8 @@ void TableListBoxModel::deleteKeyPressed (int) {}
void TableListBoxModel::returnKeyPressed (int) {}
void TableListBoxModel::listWasScrolled() {}
String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String(); }
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return {}; }
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return {}; }
Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate)
{

View file

@ -49,7 +49,7 @@ struct TextAtom
return atomText.substring (0, numChars);
if (isNewLine())
return String();
return {};
return String::repeatedString (String::charToString (passwordCharacter), numChars);
}
@ -2344,7 +2344,7 @@ String TextEditor::getText() const
String TextEditor::getTextInRange (const Range<int>& range) const
{
if (range.isEmpty())
return String();
return {};
MemoryOutputStream mo;
mo.preallocate ((size_t) jmin (getTotalNumChars(), range.getLength()));
@ -2353,7 +2353,7 @@ String TextEditor::getTextInRange (const Range<int>& range) const
for (int i = 0; i < sections.size(); ++i)
{
const UniformTextSection* const s = sections.getUnchecked (i);
auto* s = sections.getUnchecked (i);
const int nextIndex = index + s->getTotalLength();
if (range.getStart() < nextIndex)

View file

@ -1156,7 +1156,7 @@ TreeViewItem::~TreeViewItem()
String TreeViewItem::getUniqueName() const
{
return String();
return {};
}
void TreeViewItem::itemOpennessChanged (bool)
@ -1378,7 +1378,7 @@ void TreeViewItem::itemSelectionChanged (bool)
String TreeViewItem::getTooltip()
{
return String();
return {};
}
void TreeViewItem::ownerViewChanged (TreeView*)
@ -1387,7 +1387,7 @@ void TreeViewItem::ownerViewChanged (TreeView*)
var TreeViewItem::getDragSourceDescription()
{
return var();
return {};
}
bool TreeViewItem::isInterestedInFileDrag (const StringArray&)

View file

@ -173,10 +173,10 @@ TextEditor* AlertWindow::getTextEditor (const String& nameOfTextEditor) const
String AlertWindow::getTextEditorContents (const String& nameOfTextEditor) const
{
if (TextEditor* const t = getTextEditor (nameOfTextEditor))
if (auto* t = getTextEditor (nameOfTextEditor))
return t->getText();
return String();
return {};
}

View file

@ -80,7 +80,7 @@ void TooltipWindow::displayTip (Point<int> screenPos, const String& tip)
repaint();
}
if (Component* const parent = getParentComponent())
if (auto* parent = getParentComponent())
{
updatePosition (tip, parent->getLocalPoint (nullptr, screenPos),
parent->getLocalBounds());
@ -111,7 +111,7 @@ String TooltipWindow::getTipFor (Component* const c)
return ttc->getTooltip();
}
return String();
return {};
}
void TooltipWindow::hideTip()

View file

@ -422,7 +422,7 @@ CodeDocument::Position CodeDocument::Position::movedByLines (const int deltaLine
juce_wchar CodeDocument::Position::getCharacter() const
{
if (const CodeDocumentLine* const l = owner->lines [line])
if (auto* l = owner->lines [line])
return l->line [getIndexInLine()];
return 0;
@ -430,10 +430,10 @@ juce_wchar CodeDocument::Position::getCharacter() const
String CodeDocument::Position::getLineText() const
{
if (const CodeDocumentLine* const l = owner->lines [line])
if (auto* l = owner->lines [line])
return l->line;
return String();
return {};
}
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
{
if (end.getPosition() <= start.getPosition())
return String();
return {};
const int startLine = start.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])
return line->line.substring (start.getIndexInLine(), end.getIndexInLine());
return String();
return {};
}
MemoryOutputStream mo;
@ -526,7 +526,7 @@ String CodeDocument::getTextBetween (const Position& start, const Position& end)
int CodeDocument::getNumCharacters() const noexcept
{
if (const CodeDocumentLine* const lastLine = lines.getLast())
if (auto* lastLine = lines.getLast())
return lastLine->lineStartInFile + lastLine->lineLength;
return 0;
@ -534,10 +534,10 @@ int CodeDocument::getNumCharacters() const noexcept
String CodeDocument::getLine (const int lineIndex) const noexcept
{
if (const CodeDocumentLine* const line = lines [lineIndex])
if (auto* line = lines [lineIndex])
return line->line;
return String();
return {};
}
int CodeDocument::getMaximumLineLength() noexcept

View file

@ -50,7 +50,7 @@ private:
if (NSURL* url = [actionInformation valueForKey: nsStringLiteral ("WebActionOriginalURLKey")])
return nsStringToJuce ([url absoluteString]);
return String();
return {};
}
static void decidePolicyForNavigationAction (id self, SEL, WebView*, NSDictionary* actionInformation,

View file

@ -547,7 +547,7 @@ public:
finishedSignal.signal();
}
void block() { finishedSignal.wait (); }
void block() { finishedSignal.wait(); }
OpenGLContext::AsyncWorker::Ptr originalWorker;
WaitableEvent finishedSignal;

View file

@ -49,7 +49,7 @@ String OSCArgument::getString() const noexcept
return stringValue;
jassertfalse; // you must check the type of an argument before attempting to get its value!
return String();
return {};
}
int32 OSCArgument::getInt32() const noexcept

View file

@ -42,7 +42,7 @@ struct CameraDevice::Pimpl
Time getTimeOfFirstRecordedFrame() const
{
return Time();
return {};
}
void addListener (CameraDevice::Listener* listenerToAdd)