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

Removed a few more uses of String::empty.

This commit is contained in:
jules 2013-12-01 23:28:31 +00:00
parent 2623f4d1e1
commit 2edec00b55
46 changed files with 91 additions and 91 deletions

View file

@ -156,7 +156,7 @@ void PropertySet::removeValue (StringRef keyName)
void PropertySet::setValue (const String& keyName, const XmlElement* const xml)
{
setValue (keyName, xml == nullptr ? var::null
: var (xml->createDocument (String::empty, true)));
: var (xml->createDocument ("", true)));
}
bool PropertySet::containsKey (StringRef keyName) const noexcept

View file

@ -69,7 +69,7 @@ public:
@param keyName the name of the property to retrieve
@param defaultReturnValue a value to return if the named property doesn't actually exist
*/
String getValue (StringRef keyName, const String& defaultReturnValue = String::empty) const noexcept;
String getValue (StringRef keyName, const String& defaultReturnValue = String()) const noexcept;
/** Returns one of the properties as an integer.

View file

@ -75,7 +75,7 @@ const File File::nonexistent;
String File::parseAbsolutePath (const String& p)
{
if (p.isEmpty())
return String::empty;
return String();
#if JUCE_WINDOWS
// Windows..
@ -482,11 +482,11 @@ bool File::loadFileAsData (MemoryBlock& destBlock) const
String File::loadFileAsString() const
{
if (! existsAsFile())
return String::empty;
return String();
FileInputStream in (*this);
return in.openedOk() ? in.readEntireStreamAsString()
: String::empty;
: String();
}
void File::readLines (StringArray& destLines) const
@ -598,7 +598,7 @@ String File::getFileExtension() const
if (indexOfDot > fullPath.lastIndexOfChar (separator))
return fullPath.substring (indexOfDot);
return String::empty;
return String();
}
bool File::hasFileExtension (StringRef possibleSuffix) const

View file

@ -89,7 +89,7 @@ public:
The file will not be created until you write to it. And remember that when
this object is deleted, the file will also be deleted!
*/
TemporaryFile (const String& suffix = String::empty,
TemporaryFile (const String& suffix = String(),
int optionFlags = 0);
/** Creates a temporary file in the same directory as a specified file.

View file

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

View file

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

View file

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

View file

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

View file

@ -44,7 +44,7 @@ String SystemStats::getOperatingSystemName()
String SystemStats::getDeviceDescription()
{
return String::empty;
return String();
}
bool SystemStats::isOperatingSystem64Bit()
@ -69,7 +69,7 @@ namespace LinuxStatsHelpers
if (lines[i].startsWithIgnoreCase (key))
return lines[i].fromFirstOccurrenceOf (":", false, false).trim();
return String::empty;
return String();
}
}
@ -107,7 +107,7 @@ String SystemStats::getLogonName()
if (struct passwd* const pw = getpwuid (getuid()))
return CharPointer_UTF8 (pw->pw_name);
return String::empty;
return String();
}
String SystemStats::getFullUserName()
@ -121,7 +121,7 @@ String SystemStats::getComputerName()
if (gethostname (name, sizeof (name) - 1) == 0)
return name;
return String::empty;
return String();
}
static String getLocaleValue (nl_item key)

View file

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

View file

@ -29,7 +29,7 @@
String String::fromCFString (CFStringRef cfString)
{
if (cfString == 0)
return String::empty;
return String();
CFRange range = { 0, CFStringGetLength (cfString) };
HeapBlock <UniChar> u ((size_t) range.length + 1);

View file

@ -124,7 +124,7 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
return iOS;
#else
StringArray parts;
parts.addTokens (getOSXVersion(), ".", String::empty);
parts.addTokens (getOSXVersion(), ".", String());
jassert (parts[0].getIntValue() == 10);
const int major = parts[1].getIntValue();
@ -148,7 +148,7 @@ String SystemStats::getDeviceDescription()
#if JUCE_IOS
return nsStringToJuce ([[UIDevice currentDevice] model]);
#else
return String::empty;
return String();
#endif
}
@ -182,7 +182,7 @@ String SystemStats::getCpuVendor()
return String (reinterpret_cast <const char*> (vendor), 12);
#else
return String::empty;
return String();
#endif
}
@ -218,7 +218,7 @@ String SystemStats::getComputerName()
if (gethostname (name, sizeof (name) - 1) == 0)
return String (name).upToLastOccurrenceOf (".local", false, true);
return String::empty;
return String();
}
static String getLocaleValue (CFStringRef key)

View file

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

View file

@ -55,7 +55,7 @@ IPAddress::IPAddress (uint32 n) noexcept
IPAddress::IPAddress (const String& adr)
{
StringArray tokens;
tokens.addTokens (adr, ".", String::empty);
tokens.addTokens (adr, ".", String());
for (int i = 0; i < 4; ++i)
address[i] = (uint8) tokens[i].getIntValue();

View file

@ -146,7 +146,7 @@ public:
@see waitForNextConnection
*/
bool createListener (int portNumber, const String& localHostName = String::empty);
bool createListener (int portNumber, const String& localHostName = String());
/** When in "listener" mode, this waits for a connection and spawns it as a new
socket.

View file

@ -181,7 +181,7 @@ namespace URLHelpers
<< "\"; filename=\"" << file.getFileName() << "\"\r\n";
const String mimeType (url.getMimeTypesOfUploadFiles()
.getValue (paramName, String::empty));
.getValue (paramName, String()));
if (mimeType.isNotEmpty())
data << "Content-Type: " << mimeType << "\r\n";
@ -253,7 +253,7 @@ String URL::getSubPath() const
{
const int startOfPath = URLHelpers::findStartOfPath (url);
return startOfPath <= 0 ? String::empty
return startOfPath <= 0 ? String()
: url.substring (startOfPath);
}
@ -363,7 +363,7 @@ String URL::readEntireTextStream (const bool usePostCommand) const
if (in != nullptr)
return in->readEntireStreamAsString();
return String::empty;
return String();
}
XmlElement* URL::readEntireXmlStream (const bool usePostCommand) const
@ -470,5 +470,5 @@ bool URL::launchInDefaultBrowser() const
if (u.containsChar ('@') && ! u.containsChar (':'))
u = "mailto:" + u;
return Process::openDocument (u, String::empty);
return Process::openDocument (u, String());
}

View file

@ -251,7 +251,7 @@ public:
InputStream* createInputStream (bool usePostCommand,
OpenStreamProgressCallback* progressCallback = nullptr,
void* progressCallbackContext = nullptr,
String extraHeaders = String::empty,
String extraHeaders = String(),
int connectionTimeOutMs = 0,
StringPairArray* responseHeaders = nullptr) const;

View file

@ -293,7 +293,7 @@ String StringArray::joinIntoString (StringRef separator, int start, int numberTo
start = 0;
if (start >= last)
return String::empty;
return String();
if (start == last - 1)
return strings.getReference (start);

View file

@ -81,7 +81,7 @@ namespace StringPoolHelpers
String::CharPointerType StringPool::getPooledString (const String& s)
{
if (s.isEmpty())
return String::empty.getCharPointer();
return String().getCharPointer();
return StringPoolHelpers::getPooledStringFromArray (strings, s, lock);
}
@ -89,7 +89,7 @@ String::CharPointerType StringPool::getPooledString (const String& s)
String::CharPointerType StringPool::getPooledString (const char* const s)
{
if (s == nullptr || *s == 0)
return String::empty.getCharPointer();
return String().getCharPointer();
return StringPoolHelpers::getPooledStringFromArray (strings, s, lock);
}
@ -97,7 +97,7 @@ String::CharPointerType StringPool::getPooledString (const char* const s)
String::CharPointerType StringPool::getPooledString (const wchar_t* const s)
{
if (s == nullptr || *s == 0)
return String::empty.getCharPointer();
return String().getCharPointer();
return StringPoolHelpers::getPooledStringFromArray (strings, s, lock);
}