mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Removed a few more places where static objects could cause problems for people who do unwise amounts of work in their static constructors.
This commit is contained in:
parent
fb15840f61
commit
a316bd5f6f
21 changed files with 44 additions and 44 deletions
|
|
@ -231,7 +231,7 @@ public:
|
|||
if (getColour() != newColour)
|
||||
{
|
||||
if (newColour == defaultColour && defaultButton.isVisible())
|
||||
colourValue = var::null;
|
||||
colourValue = var();
|
||||
else
|
||||
colourValue = newColour.toDisplayString (true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ bool PluginDirectoryScanner::skipNextFile()
|
|||
|
||||
void PluginDirectoryScanner::setDeadMansPedalFile (const StringArray& newContents)
|
||||
{
|
||||
if (deadMansPedalFile != File::nonexistent)
|
||||
if (deadMansPedalFile.getFullPathName().isNotEmpty())
|
||||
deadMansPedalFile.replaceWithText (newContents.joinIntoString ("\n"), true, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
return var::null;
|
||||
return var();
|
||||
}
|
||||
|
||||
bool hasProperty (const Identifier& propertyName) const override
|
||||
|
|
@ -297,7 +297,7 @@ public:
|
|||
|
||||
void removeProperty (const Identifier& propertyName) override
|
||||
{
|
||||
setProperty (propertyName, var::null);
|
||||
setProperty (propertyName, var());
|
||||
}
|
||||
|
||||
bool hasMethod (const Identifier& methodName) const override
|
||||
|
|
@ -401,7 +401,7 @@ var variantTojuceVar (const VARIANT& v)
|
|||
switch (v.vt & ~VT_BYREF)
|
||||
{
|
||||
case VT_VOID:
|
||||
case VT_EMPTY: return var::null;
|
||||
case VT_EMPTY: return var();
|
||||
case VT_I1: return var ((int) v.cVal);
|
||||
case VT_I2: return var ((int) v.iVal);
|
||||
case VT_I4: return var ((int) v.lVal);
|
||||
|
|
@ -421,7 +421,7 @@ var variantTojuceVar (const VARIANT& v)
|
|||
}
|
||||
}
|
||||
|
||||
return var::null;
|
||||
return var();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -896,7 +896,7 @@ static var createValueFromNPVariant (NPP npp, const NPVariant& v)
|
|||
else if (NPVARIANT_IS_OBJECT (v) && npp != nullptr)
|
||||
return var (new DynamicObjectWrappingNPObject (npp, NPVARIANT_TO_OBJECT (v)));
|
||||
|
||||
return var::null;
|
||||
return var();
|
||||
}
|
||||
|
||||
static void createNPVariantFromValue (NPP npp, NPVariant& out, const var& v)
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void PropertySet::removeValue (StringRef keyName)
|
|||
|
||||
void PropertySet::setValue (const String& keyName, const XmlElement* const xml)
|
||||
{
|
||||
setValue (keyName, xml == nullptr ? var::null
|
||||
setValue (keyName, xml == nullptr ? var()
|
||||
: var (xml->createDocument ("", true)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ String File::getFileNameWithoutExtension() const
|
|||
|
||||
bool File::isAChildOf (const File& potentialParent) const
|
||||
{
|
||||
if (potentialParent == File::nonexistent)
|
||||
if (potentialParent.fullPath.isEmpty())
|
||||
return false;
|
||||
|
||||
const String ourPath (getPathUpToLastSlash());
|
||||
|
|
@ -629,7 +629,7 @@ bool File::hasFileExtension (StringRef possibleSuffix) const
|
|||
File File::withFileExtension (StringRef newExtension) const
|
||||
{
|
||||
if (fullPath.isEmpty())
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
|
||||
String filePart (getFileName());
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ TemporaryFile::TemporaryFile (const File& target, const int optionFlags)
|
|||
targetFile (target)
|
||||
{
|
||||
// If you use this constructor, you need to give it a valid target file!
|
||||
jassert (targetFile != File::nonexistent);
|
||||
jassert (targetFile != File());
|
||||
}
|
||||
|
||||
TemporaryFile::TemporaryFile (const File& target, const File& temporary)
|
||||
|
|
@ -79,7 +79,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
|
|||
{
|
||||
// This method only works if you created this object with the constructor
|
||||
// that takes a target file!
|
||||
jassert (targetFile != File::nonexistent);
|
||||
jassert (targetFile != File());
|
||||
|
||||
if (temporaryFile.exists())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
switch (t.getAndAdvance())
|
||||
{
|
||||
case 0: result = var::null; return Result::ok();
|
||||
case 0: result = var(); return Result::ok();
|
||||
case '{': return parseObject (t, result);
|
||||
case '[': return parseArray (t, result);
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ private:
|
|||
if (t2.getAndAdvance() == 'u' && t2.getAndAdvance() == 'l' && t2.getAndAdvance() == 'l')
|
||||
{
|
||||
t = t2;
|
||||
result = var::null;
|
||||
result = var();
|
||||
return Result::ok();
|
||||
}
|
||||
break;
|
||||
|
|
@ -254,7 +254,7 @@ private:
|
|||
if (c2 != ':')
|
||||
return createFail ("Expected ':', but found", &oldT);
|
||||
|
||||
resultProperties.set (propertyName, var::null);
|
||||
resultProperties.set (propertyName, var());
|
||||
var* propertyValue = resultProperties.getVarPointer (propertyName);
|
||||
|
||||
Result r2 (parseAny (t, *propertyValue));
|
||||
|
|
@ -300,7 +300,7 @@ private:
|
|||
return createFail ("Unexpected end-of-input in array declaration");
|
||||
|
||||
t = oldT;
|
||||
destArray->add (var::null);
|
||||
destArray->add (var());
|
||||
Result r (parseAny (t, destArray->getReference (destArray->size() - 1)));
|
||||
|
||||
if (r.failed())
|
||||
|
|
@ -514,7 +514,7 @@ var JSON::parse (const String& text)
|
|||
var result;
|
||||
|
||||
if (! JSONParser::parseObjectOrArray (text.getCharPointer(), result))
|
||||
result = var::null;
|
||||
result = var();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -610,7 +610,7 @@ public:
|
|||
{
|
||||
switch (r.nextInt (depth > 3 ? 6 : 8))
|
||||
{
|
||||
case 0: return var::null;
|
||||
case 0: return var();
|
||||
case 1: return r.nextInt();
|
||||
case 2: return r.nextInt64();
|
||||
case 3: return r.nextBool();
|
||||
|
|
@ -638,7 +638,7 @@ public:
|
|||
}
|
||||
|
||||
default:
|
||||
return var::null;
|
||||
return var();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1244,7 +1244,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
if (matchIf (TokenTypes::openParen)) return parseSuffixes (matchCloseParen (parseExpression()));
|
||||
if (matchIf (TokenTypes::true_)) return parseSuffixes (new LiteralValue (location, (int) 1));
|
||||
if (matchIf (TokenTypes::false_)) return parseSuffixes (new LiteralValue (location, (int) 0));
|
||||
if (matchIf (TokenTypes::null_)) return parseSuffixes (new LiteralValue (location, var::null));
|
||||
if (matchIf (TokenTypes::null_)) return parseSuffixes (new LiteralValue (location, var()));
|
||||
if (matchIf (TokenTypes::undefined)) return parseSuffixes (new Expression (location));
|
||||
|
||||
if (currentType == TokenTypes::literal)
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
|
|||
break;
|
||||
}
|
||||
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
bool File::moveToTrash() const
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
|
|||
if (struct passwd* const pw = getpwuid (getuid()))
|
||||
return File (CharPointer_UTF8 (pw->pw_dir));
|
||||
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
case userDocumentsDirectory: return resolveXDGFolder ("XDG_DOCUMENTS_DIR", "~");
|
||||
|
|
@ -163,7 +163,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
|
|||
break;
|
||||
}
|
||||
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ File File::getSpecialLocation (const SpecialLocationType type)
|
|||
return File (resultPath.convertToPrecomposedUnicode());
|
||||
}
|
||||
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ namespace WindowsFileHelpers
|
|||
if (SHGetSpecialFolderPath (0, path, type, FALSE))
|
||||
return File (String (path));
|
||||
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
File getModuleFileName (HINSTANCE moduleHandle)
|
||||
|
|
@ -542,7 +542,7 @@ File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type)
|
|||
|
||||
default:
|
||||
jassertfalse; // unknown type?
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
return WindowsFileHelpers::getSpecialFolderPath (csidlType);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
static void appendToFile (const File& f, const String& s)
|
||||
{
|
||||
if (f != File::nonexistent)
|
||||
if (f.getFullPathName().isNotEmpty())
|
||||
{
|
||||
FileOutputStream out (f);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
*/
|
||||
PerformanceCounter (const String& counterName,
|
||||
int runsPerPrintout = 100,
|
||||
const File& loggingFile = File::nonexistent);
|
||||
const File& loggingFile = File());
|
||||
|
||||
/** Destructor. */
|
||||
~PerformanceCounter();
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ File PropertiesFile::Options::getDefaultFile() const
|
|||
File dir (File::getSpecialLocation (commonToAllUsers ? File::commonApplicationDataDirectory
|
||||
: File::userApplicationDataDirectory));
|
||||
|
||||
if (dir == File::nonexistent)
|
||||
return File::nonexistent;
|
||||
if (dir == File())
|
||||
return File();
|
||||
|
||||
dir = dir.getChildFile (folderName.isNotEmpty() ? folderName
|
||||
: applicationName);
|
||||
|
|
@ -165,7 +165,7 @@ bool PropertiesFile::save()
|
|||
stopTimer();
|
||||
|
||||
if (options.doNotSave
|
||||
|| file == File::nonexistent
|
||||
|| file == File()
|
||||
|| file.isDirectory()
|
||||
|| ! file.getParentDirectory().createDirectory())
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
undoManager->perform (new SetPropertyAction (this, name, newValue, var::null, true, false));
|
||||
undoManager->perform (new SetPropertyAction (this, name, newValue, var(), true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
else
|
||||
{
|
||||
if (properties.contains (name))
|
||||
undoManager->perform (new SetPropertyAction (this, name, var::null, properties [name], false, true));
|
||||
undoManager->perform (new SetPropertyAction (this, name, var(), properties [name], false, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ public:
|
|||
else
|
||||
{
|
||||
for (int i = properties.size(); --i >= 0;)
|
||||
undoManager->perform (new SetPropertyAction (this, properties.getName(i), var::null,
|
||||
undoManager->perform (new SetPropertyAction (this, properties.getName(i), var(),
|
||||
properties.getValueAt(i), false, true));
|
||||
}
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ public:
|
|||
return ValueTree (s);
|
||||
}
|
||||
|
||||
return ValueTree::invalid;
|
||||
return ValueTree();
|
||||
}
|
||||
|
||||
ValueTree getOrCreateChildWithName (const Identifier typeToMatch, UndoManager* undoManager)
|
||||
|
|
@ -257,7 +257,7 @@ public:
|
|||
return ValueTree (s);
|
||||
}
|
||||
|
||||
return ValueTree::invalid;
|
||||
return ValueTree();
|
||||
}
|
||||
|
||||
bool isAChildOf (const SharedObject* const possibleParent) const noexcept
|
||||
|
|
@ -846,17 +846,17 @@ ValueTree ValueTree::getChild (int index) const
|
|||
|
||||
ValueTree ValueTree::getChildWithName (const Identifier type) const
|
||||
{
|
||||
return object != nullptr ? object->getChildWithName (type) : ValueTree::invalid;
|
||||
return object != nullptr ? object->getChildWithName (type) : ValueTree();
|
||||
}
|
||||
|
||||
ValueTree ValueTree::getOrCreateChildWithName (const Identifier type, UndoManager* undoManager)
|
||||
{
|
||||
return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree::invalid;
|
||||
return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree();
|
||||
}
|
||||
|
||||
ValueTree ValueTree::getChildWithProperty (const Identifier propertyName, const var& propertyValue) const
|
||||
{
|
||||
return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree::invalid;
|
||||
return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree();
|
||||
}
|
||||
|
||||
bool ValueTree::isAChildOf (const ValueTree& possibleParent) const
|
||||
|
|
@ -976,7 +976,7 @@ ValueTree ValueTree::readFromStream (InputStream& input)
|
|||
const String type (input.readString());
|
||||
|
||||
if (type.isEmpty())
|
||||
return ValueTree::invalid;
|
||||
return ValueTree();
|
||||
|
||||
ValueTree v (type);
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ File DirectoryContentsList::getFile (const int index) const
|
|||
if (const FileInfo* const info = files [index])
|
||||
return root.getChildFile (info->filename);
|
||||
|
||||
return File::nonexistent;
|
||||
return File();
|
||||
}
|
||||
|
||||
bool DirectoryContentsList::contains (const File& targetFile) const
|
||||
|
|
|
|||
|
|
@ -952,6 +952,6 @@ void ListBoxModel::selectedRowsChanged (int) {}
|
|||
void ListBoxModel::deleteKeyPressed (int) {}
|
||||
void ListBoxModel::returnKeyPressed (int) {}
|
||||
void ListBoxModel::listWasScrolled() {}
|
||||
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
|
||||
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
|
||||
String ListBoxModel::getTooltipForRow (int) { return String::empty; }
|
||||
MouseCursor ListBoxModel::getMouseCursorForRow (int) { return MouseCursor::NormalCursor; }
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ void TableListBoxModel::returnKeyPressed (int) {}
|
|||
void TableListBoxModel::listWasScrolled() {}
|
||||
|
||||
String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; }
|
||||
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
|
||||
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var(); }
|
||||
|
||||
Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1371,7 +1371,7 @@ String TreeViewItem::getTooltip()
|
|||
|
||||
var TreeViewItem::getDragSourceDescription()
|
||||
{
|
||||
return var::null;
|
||||
return var();
|
||||
}
|
||||
|
||||
bool TreeViewItem::isInterestedInFileDrag (const StringArray&)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue