Return a default-constructed QString instead of implicitly converting an empty string literal.

This commit is contained in:
Mat Sutcliffe
2018-12-20 21:47:58 +00:00
parent 6c05c5249d
commit d6b5dca6b2
49 changed files with 128 additions and 127 deletions

View File

@@ -84,7 +84,7 @@ namespace BlackMisc
QString CVoiceRoom::getVoiceRoomUrl(bool noProtocol) const
{
if (!this->isValid()) return "";
if (!this->isValid()) return {};
QString url(noProtocol ? "" : CVoiceRoom::protocolComplete());
url.append(this->m_hostname);
url.append("/");

View File

@@ -298,7 +298,7 @@ namespace BlackMisc
QString CAircraftIcaoCode::getEngineType() const
{
if (m_combinedType.length() != 3) return "";
if (m_combinedType.length() != 3) return {};
return m_combinedType.right(1);
}
@@ -322,15 +322,15 @@ namespace BlackMisc
QString CAircraftIcaoCode::getEngineCountString() const
{
if (m_combinedType.length() < 2) { return ""; }
if (m_combinedType.length() < 2) { return {}; }
return m_combinedType.mid(1, 1);
}
QString CAircraftIcaoCode::getAircraftType() const
{
if (m_combinedType.length() < 1) { return ""; }
if (m_combinedType.length() < 1) { return {}; }
QString c(m_combinedType.at(0));
if (c == "-") { return ""; }
if (c == "-") { return {}; }
return c;
}
@@ -477,7 +477,7 @@ namespace BlackMisc
QString CAircraftIcaoCode::getCombinedIataStringWithKey() const
{
if (!this->hasIataCode()) { return ""; }
if (!this->hasIataCode()) { return {}; }
return this->getIataCode() % u" [IATA" %
(this->hasDesignator() ? (u' ' % this->getDesignator()) : QString()) %
(this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
@@ -487,7 +487,7 @@ namespace BlackMisc
QString CAircraftIcaoCode::getCombinedFamilyStringWithKey() const
{
if (!this->hasFamily()) { return ""; }
if (!this->hasFamily()) { return {}; }
return this->getFamily() % u" [family" %
(this->hasDesignator() ? (u' ' % this->getDesignator()) : QString()) %
(this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %

View File

@@ -29,8 +29,8 @@ namespace BlackMisc
QString CAirportIcaoCode::unifyAirportCode(const QString &icaoCode)
{
const QString code = icaoCode.trimmed().toUpper();
if (code.length() != 4) return "";
if (containsChar(code, [](QChar c) { return !c.isLetterOrNumber(); })) { return ""; }
if (code.length() != 4) return {};
if (containsChar(code, [](QChar c) { return !c.isLetterOrNumber(); })) { return {}; }
return code;
}

View File

@@ -149,7 +149,7 @@ namespace BlackMisc
QString CCallsign::getAsObserverCallsignString() const
{
if (this->isEmpty()) { return ""; }
if (this->isEmpty()) { return {}; }
QString obs = this->getStringAsSet();
if (obs.endsWith("_OBS", Qt::CaseInsensitive)) { return obs; } // already OBS
if (obs.contains('_')) { obs = obs.left(obs.lastIndexOf('_')); }
@@ -168,8 +168,8 @@ namespace BlackMisc
QString CCallsign::getAirlineSuffix() const
{
if (m_callsign.length() < 3) { return ""; }
if (this->isAtcCallsign()) { return ""; }
if (m_callsign.length() < 3) { return {}; }
if (this->isAtcCallsign()) { return {}; }
thread_local const QRegularExpression regExp("^[A-Z]{3,}");
QRegularExpressionMatch match = regExp.match(m_callsign);
@@ -184,7 +184,7 @@ namespace BlackMisc
const QString number = match.captured(1);
if (number.length() >= 3 && airline.length() == 4) { return airline.left(3); }
return ""; // invalid
return {}; // invalid
}
bool CCallsign::hasSuffix() const

View File

@@ -130,9 +130,9 @@ namespace BlackMisc
{
const int maxIndex = remarks.size() - 1;
int f = remarks.indexOf(marker);
if (f < 0) { return ""; }
if (f < 0) { return {}; }
f += marker.length();
if (maxIndex <= f) { return ""; }
if (maxIndex <= f) { return {}; }
// the remarks are poorly formatted:
// 1) sometimes the values are enclosed in "/", like "/REG/D-AMBZ/"

View File

@@ -33,7 +33,7 @@ namespace BlackMisc
{
if (CSelcal::isValidCharacter(c)) { s += c;}
}
return CSelcal::isValidCode(s) ? s : QString("");
return CSelcal::isValidCode(s) ? s : QString();
}
bool CSelcal::equalsString(const QString &code) const

View File

@@ -79,19 +79,19 @@ namespace BlackMisc
QString CCacheSettingsUtils::otherVersionFileName(const CApplicationInfo &info, const QString &relativeFileName)
{
thread_local const QRegularExpression re("bin$");
if (relativeFileName.isEmpty()) { return ""; }
if (relativeFileName.isEmpty()) { return {}; }
QString otherFile = info.getApplicationDataDirectory();
otherFile.replace(re, relativeFileName);
const QFileInfo fi(otherFile);
if (!fi.isFile()) { return ""; }
if (!fi.isFile()) { return {}; }
if (fi.exists()) { return fi.absoluteFilePath(); }
return "";
return {};
}
QString CCacheSettingsUtils::otherVersionSettingsFileContent(const CApplicationInfo &info, const QString &mySettingFile)
{
const QString file = otherVersionSettingsFileName(info, mySettingFile);
if (file.isEmpty()) { return ""; }
if (file.isEmpty()) { return {}; }
const QString jsonStr = CFileUtils::readFileToString(file);
return jsonStr;
}
@@ -99,7 +99,7 @@ namespace BlackMisc
QString CCacheSettingsUtils::otherVersionCacheFileContent(const CApplicationInfo &info, const QString &myCacheFile)
{
const QString file = otherVersionCacheFileName(info, myCacheFile);
if (file.isEmpty()) { return ""; }
if (file.isEmpty()) { return {}; }
const QString jsonStr = CFileUtils::readFileToString(file);
return jsonStr;
}

View File

@@ -150,7 +150,7 @@ namespace BlackMisc
QString IDatastoreObjectWithStringKey::getDbKeyAsStringInParentheses(const QString &prefix) const
{
if (m_dbKey.isEmpty()) { return ""; }
if (m_dbKey.isEmpty()) { return {}; }
return prefix % '(' % m_dbKey % ')';
}

View File

@@ -171,7 +171,7 @@ namespace BlackMisc
const CIcon &toDatabaseIcon() const;
//! Invalid key
static QString invalidDbKey() { return ""; }
static QString invalidDbKey() { return {}; }
protected:
//! Constructor

View File

@@ -134,7 +134,7 @@ namespace BlackMisc
template<class OBJ, class CONTAINER, typename KEYTYPE>
QString IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::dbKeysAsString(const QString &separator) const
{
if (ITimestampObjectList<OBJ, CONTAINER>::container().isEmpty()) { return ""; }
if (ITimestampObjectList<OBJ, CONTAINER>::container().isEmpty()) { return {}; }
const QSet<QString> keys = IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::toDbKeyStringSet();
QString s;
for (const QString &k : keys)

View File

@@ -171,7 +171,7 @@ namespace BlackMisc
QString CDBusServer::getDBusInterfaceFromClassInfo(QObject *object)
{
if (! object) { return ""; }
if (! object) { return {}; }
const QMetaObject *mo = object->metaObject();
for (int i = 0; i < mo->classInfoCount(); i++)
{
@@ -179,7 +179,7 @@ namespace BlackMisc
const QString name = QString(ci.name()).toLower();
if (name == "d-bus interface") { return QString(ci.value()); }
}
return "";
return {};
}
QDBusConnection::RegisterOptions CDBusServer::registerOptions()

View File

@@ -209,7 +209,7 @@ namespace BlackMisc
return dir.absolutePath();
}
Q_ASSERT_X(false, Q_FUNC_INFO, "missing dir");
return "";
return {};
}
const QString &CDirectoryUtils::shareDirectory()
@@ -239,7 +239,7 @@ namespace BlackMisc
const QString getBootstrapResourceFileImpl()
{
const QString d(CDirectoryUtils::shareDirectory());
if (d.isEmpty()) { return ""; }
if (d.isEmpty()) { return {}; }
const QFile file(QDir::cleanPath(d + QDir::separator() + "shared/bootstrap/" + CDirectoryUtils::bootstrapFileName()));
Q_ASSERT_X(file.exists(), Q_FUNC_INFO, "missing bootstrap file");
return QFileInfo(file).absoluteFilePath();
@@ -254,7 +254,7 @@ namespace BlackMisc
QString getSwiftStaticDbFilesDirImpl()
{
const QString d(CDirectoryUtils::shareDirectory());
if (d.isEmpty()) { return ""; }
if (d.isEmpty()) { return {}; }
const QDir dir(QDir::cleanPath(d + QDir::separator() + "shared/dbdata"));
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
return dir.absolutePath();
@@ -269,7 +269,7 @@ namespace BlackMisc
QString getSoundFilesDirImpl()
{
const QString d(CDirectoryUtils::shareDirectory());
if (d.isEmpty()) { return ""; }
if (d.isEmpty()) { return {}; }
const QDir dir(QDir::cleanPath(d + QDir::separator() + "sounds"));
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
return dir.absolutePath();
@@ -284,7 +284,7 @@ namespace BlackMisc
QString getStylesheetsDirImpl()
{
const QString d(CDirectoryUtils::shareDirectory());
if (d.isEmpty()) { return ""; }
if (d.isEmpty()) { return {}; }
const QDir dir(QDir::cleanPath(d + QDir::separator() + "qss"));
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
return dir.absolutePath();
@@ -359,7 +359,7 @@ namespace BlackMisc
QString testFilesDirImpl()
{
const QString d(CDirectoryUtils::shareDirectory());
if (d.isEmpty()) { return ""; }
if (d.isEmpty()) { return {}; }
const QDir dir(QDir::cleanPath(d + QDir::separator() + "test"));
Q_ASSERT_X(dir.exists(), Q_FUNC_INFO, "missing dir");
return dir.absolutePath();

View File

@@ -75,7 +75,7 @@ namespace BlackMisc
QString CFileUtils::readFileToString(const QString &fileNameAndPath)
{
QFile file(fileNameAndPath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return ""; }
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return {}; }
QTextStream stream(&file);
QString content(stream.readAll());
file.close();
@@ -196,7 +196,7 @@ namespace BlackMisc
QString CFileUtils::normalizeFilePathToQtStandard(const QString &filePath)
{
if (filePath.isEmpty()) { return ""; }
if (filePath.isEmpty()) { return {}; }
QString n(filePath);
n = n.replace('\\', '/').replace("//", "/");
return n;
@@ -303,7 +303,7 @@ namespace BlackMisc
QString CFileUtils::findFirstExisting(const QStringList &filesOrDirectory)
{
if (filesOrDirectory.isEmpty()) { return ""; }
if (filesOrDirectory.isEmpty()) { return {}; }
for (const QString &f : filesOrDirectory)
{
if (f.isEmpty()) { continue; }
@@ -311,7 +311,7 @@ namespace BlackMisc
const QFileInfo fi(fn);
if (fi.exists()) { return fi.absoluteFilePath(); }
}
return "";
return {};
}
QString CFileUtils::findFirstFile(const QDir &dir, bool recursive, const QStringList &nameFilters, const QStringList &excludeDirectories, std::function<bool(const QFileInfo &)> predicate)

View File

@@ -22,7 +22,7 @@ namespace BlackMisc
//! Container to standard HTML table
template <class Obj, class Container> QString toHtmlTable(const CPropertyIndexList &indexes, const Container &container)
{
if (indexes.isEmpty() || container.isEmpty()) { return ""; }
if (indexes.isEmpty() || container.isEmpty()) { return {}; }
QString html;
for (const Obj &obj : container)
{

View File

@@ -72,7 +72,7 @@ namespace BlackMisc
QString CRemoteFile::getFormattedCreatedYmdhms() const
{
if (m_created < 1) { return ""; }
if (m_created < 1) { return {}; }
const QDateTime dt = QDateTime::fromMSecsSinceEpoch(m_created);
return dt.toString("yyyy-MM-dd HH:mm:ss");
}

View File

@@ -94,7 +94,7 @@ namespace BlackMisc
QString CTextMessage::getRecipientCallsignOrFrequency() const
{
if (!m_recipientCallsign.isEmpty()) { return m_recipientCallsign.asString(); }
if (m_frequency.isNull()) { return ""; }
if (m_frequency.isNull()) { return {}; }
return m_frequency.valueRoundedWithUnit(CFrequencyUnit::MHz(), 3);
}

View File

@@ -109,7 +109,7 @@ namespace BlackMisc
QString CUrl::getFullUrl(bool withQuery) const
{
if (m_host.isEmpty()) { return ""; }
if (m_host.isEmpty()) { return {}; }
QString qn(m_host);
if (!hasDefaultPort() && hasPort()) { qn = qn.append(":").append(QString::number(m_port)); }
@@ -198,8 +198,8 @@ namespace BlackMisc
{
const QString f(this->getFileName());
const int i = f.lastIndexOf('.');
if (i < 0) return "";
if (f.length() <= i + 1) return ""; // ends with "."
if (i < 0) return {};
if (f.length() <= i + 1) return {}; // ends with "."
return f.mid(i + 1); // suffix without dot
}
@@ -207,8 +207,8 @@ namespace BlackMisc
{
const QString f(this->getFileName());
const int i = f.lastIndexOf('.');
if (i < 0) return "";
if (f.length() <= i + 1) return ""; // ends with "."
if (i < 0) return {};
if (f.length() <= i + 1) return {}; // ends with "."
return f.mid(i); // suffix with dot
}

View File

@@ -47,18 +47,18 @@ namespace BlackMisc
QString CProcessInfo::processNameFromId(qint64 pid)
{
HANDLE proc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, static_cast<DWORD>(pid));
if (! proc) { return ""; }
if (! proc) { return {}; }
wchar_t path[1024];
auto len = GetModuleFileNameEx(proc, nullptr, path, std::extent<decltype(path)>::value);
CloseHandle(proc);
if (len <= 0) { return ""; }
if (len <= 0) { return {}; }
return QFileInfo(QString::fromWCharArray(path)).completeBaseName();
}
#else
QString CProcessInfo::processNameFromId(qint64)
{
qFatal("Not implemented");
return "";
return {};
}
#endif

View File

@@ -17,6 +17,7 @@
#include <QPainter>
#include <QPixmap>
#include <QSize>
#include <QStringBuilder>
#include <Qt>
#include <QtGlobal>
@@ -127,9 +128,9 @@ namespace BlackMisc
QString CRgbColor::hex(bool withHash) const
{
if (!isValid()) { return ""; }
if (!isValid()) { return {}; }
const QString h(redHex() + greenHex() + blueHex());
return withHash ? "#" + h : h;
return withHash ? u'#' % h : h;
}
void CRgbColor::setByString(const QString &color, bool isName)

View File

@@ -17,7 +17,7 @@ namespace BlackMisc
QString CSampleUtils::selectDirectory(const QStringList &directoryOptions, QTextStream &streamOut, QTextStream &streamIn)
{
Q_ASSERT(!directoryOptions.isEmpty());
if (directoryOptions.isEmpty()) { return ""; }
if (directoryOptions.isEmpty()) { return {}; }
if (directoryOptions.size() < 2) { return directoryOptions.first(); }
QString selectedDir;

View File

@@ -62,7 +62,7 @@ namespace BlackMisc
const QString p = this->part(index);
const int from = index < 1 ? 0 : nthIndexOf(m_cleanedLine, ' ', index, Qt::CaseInsensitive);
const int fi = m_cleanedLine.indexOf(p, from, Qt::CaseInsensitive);
if (fi < 0) { return ""; }
if (fi < 0) { return {}; }
return m_originalLine.mid(fi).trimmed();
}
@@ -154,7 +154,7 @@ namespace BlackMisc
QString CSimpleCommandParser::commandsHtmlHelp()
{
if (s_commands.isEmpty()) { return ""; }
if (s_commands.isEmpty()) { return {}; }
static const QString html("<table style=\"font-size: 8pt; white-space: nowrap;\">\n%1\n</table>");
static const QString row("<td>%1</td><td>%2</td>");

View File

@@ -381,14 +381,14 @@ namespace BlackMisc
QString CAircraftModelList::findModelIconPathByModelString(const QString &modelString) const
{
if (modelString.isEmpty()) { return ""; }
if (modelString.isEmpty()) { return {}; }
const CAircraftModel m(findFirstByModelStringOrDefault(modelString, Qt::CaseInsensitive));
return m.getIconPath();
}
QString CAircraftModelList::findModelIconPathByCallsign(const CCallsign &callsign) const
{
if (callsign.isEmpty()) { return ""; }
if (callsign.isEmpty()) { return {}; }
const CAircraftModel m(findFirstByCallsignOrDefault(callsign));
return m.getIconPath();
}
@@ -1175,7 +1175,7 @@ namespace BlackMisc
QString CAircraftModelList::asHtmlSummary() const
{
if (this->isEmpty()) { return ""; }
if (this->isEmpty()) { return {}; }
QString html;
for (const CAircraftModel &model : *this)
{

View File

@@ -34,7 +34,7 @@ namespace BlackMisc
QString CAircraftModelUtilities::createIcaoAirlineAircraftHtmlMatrix(const CAircraftModelList &models)
{
if (models.isEmpty()) { return ""; }
if (models.isEmpty()) { return {}; }
static const QString emptyDesignator = "----";
static const QString colorLiveryDesignator = "-C-";
@@ -124,13 +124,13 @@ namespace BlackMisc
QString CAircraftModelUtilities::createIcaoAirlineAircraftHtmlMatrixFile(const CAircraftModelList &models, const QString &tempDir)
{
Q_ASSERT_X(!tempDir.isEmpty(), Q_FUNC_INFO, "Need directory");
if (models.isEmpty()) { return ""; }
if (models.isEmpty()) { return {}; }
const QString html = createIcaoAirlineAircraftHtmlMatrix(models);
if (html.isEmpty()) { return ""; }
if (html.isEmpty()) { return {}; }
QDir dir(tempDir);
BLACK_VERIFY_X(dir.exists(), Q_FUNC_INFO, "Directory does not exist");
if (!dir.exists()) { return ""; }
if (!dir.exists()) { return {}; }
const QString htmlTemplate = CFileUtils::readFileToString(CDirectoryUtils::htmlTemplateFilePath());
const QString fn("airlineAircraftMatrix.html");

View File

@@ -38,10 +38,10 @@ namespace BlackMisc
{
if (!this->getDbKey().isEmpty() && !this->getDescription().isEmpty())
{
return this->getDbKey() + " " + this->getDescription();
return this->getDbKey() % u' ' % this->getDescription();
}
if (!this->getDbKey().isEmpty()) { return this->getDbKey(); }
return "";
return {};
}
bool CDistributor::matchesKeyOrAlias(const QString &keyOrAlias) const

View File

@@ -48,7 +48,7 @@ namespace BlackMisc
QString CAircraftCfgEntries::getFileDirectory() const
{
if (m_fileName.isEmpty()) { return ""; }
if (m_fileName.isEmpty()) { return {}; }
const QFileInfo fileInfo(m_fileName);
return fileInfo.absolutePath();
}
@@ -166,8 +166,8 @@ namespace BlackMisc
QString CAircraftCfgEntries::getThumbnailFileNameGuess() const
{
if (m_texture.isEmpty()) { return ""; }
if (m_fileName.isEmpty()) { return ""; }
if (m_texture.isEmpty()) { return {}; }
if (m_fileName.isEmpty()) { return {}; }
QString fn = QDir::cleanPath(this->getFileDirectory() + QDir::separator() + "texture." + m_texture + QDir::separator() + "thumbnail.jpg");
return fn;
}
@@ -175,9 +175,9 @@ namespace BlackMisc
QString CAircraftCfgEntries::getThumbnailFileNameChecked() const
{
const QString f(getThumbnailFileNameGuess());
if (f.isEmpty()) { return ""; }
if (f.isEmpty()) { return {}; }
if (QFile(f).exists()) { return f; }
return "";
return {};
}
CVariant CAircraftCfgEntries::propertyByIndex(const BlackMisc::CPropertyIndex &index) const

View File

@@ -389,7 +389,7 @@ namespace BlackMisc
{
if (qv.isNull() || !qv.isValid())
{
return ""; // normal when there is no settings value
return {}; // normal when there is no settings value
}
else if (static_cast<QMetaType::Type>(qv.type()) == QMetaType::QStringList)
{
@@ -401,15 +401,15 @@ namespace BlackMisc
return qv.toString().trimmed();
}
Q_ASSERT(false);
return "";
return {};
}
QString CAircraftCfgParser::getFixedIniLineContent(const QString &line)
{
if (line.isEmpty()) { return ""; }
if (line.isEmpty()) { return {}; }
int index = line.indexOf('=');
if (index < 0) { return ""; }
if (line.length() < index + 1) { return ""; }
if (index < 0) { return {}; }
if (line.length() < index + 1) { return {}; }
QString content(line.midRef(index + 1).trimmed().toString());

View File

@@ -93,7 +93,7 @@ namespace BlackMisc
QString fsxSimObjectsDirFromRegistryImpl()
{
const QString fsxPath = CFsCommonUtil::fsxDirFromRegistry();
if (fsxPath.isEmpty()) { return ""; }
if (fsxPath.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(fsxPath);
}
@@ -106,7 +106,7 @@ namespace BlackMisc
QString fsxSimObjectsDirImpl()
{
QString dir(CFsCommonUtil::fsxDir());
if (dir.isEmpty()) { return ""; }
if (dir.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(dir);
}
@@ -186,7 +186,7 @@ namespace BlackMisc
QString p3dSimObjectsDirFromRegistryImpl()
{
const QString p3dPath = CFsCommonUtil::p3dDirFromRegistry();
if (p3dPath.isEmpty()) { return ""; }
if (p3dPath.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(p3dPath);
}
@@ -199,7 +199,7 @@ namespace BlackMisc
QString p3dSimObjectsDirImpl()
{
QString dir(CFsCommonUtil::p3dDir());
if (dir.isEmpty()) { return ""; }
if (dir.isEmpty()) { return {}; }
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(dir);
}

View File

@@ -73,7 +73,7 @@ namespace BlackMisc
QString CSimConnectUtilities::ipAddress(const QSettings *simConnectSettings)
{
if (!simConnectSettings) { return QString(""); }
if (!simConnectSettings) { return {}; }
return simConnectSettings->value("SimConnect/Address").toString();
}
@@ -167,8 +167,8 @@ namespace BlackMisc
QString CSimConnectUtilities::getSimConnectIniFileDirectory(CSimulatorInfo &simulator)
{
static const QString docDir = QStandardPaths::locate(QStandardPaths::DocumentsLocation, "", QStandardPaths::LocateDirectory);
if (docDir.isEmpty()) { return ""; }
if (!simulator.isSingleSimulator() || !simulator.isFsxP3DFamily()) return "";
if (docDir.isEmpty()) { return {}; }
if (!simulator.isSingleSimulator() || !simulator.isFsxP3DFamily()) return {};
const QString iniDir = CFileUtils::appendFilePaths(docDir, simulator.isP3D() ? "Prepar3D v4 Files" : "Flight Simulator X Files");
if (getSimConnectIniFileDirectories().isEmpty()) { return iniDir; }

View File

@@ -67,9 +67,9 @@ namespace BlackMisc
{
static const BlackMisc::CSettingReadOnly<TModelConverterXBinary> setting(new QObject());
const QString mcx = setting.get();
if (mcx.isEmpty()) return "";
if (mcx.isEmpty()) return {};
const QFile f(mcx);
return (f.exists()) ? mcx : "";
return (f.exists()) ? mcx : QString();
}
} // ns
} // ns

View File

@@ -198,7 +198,7 @@ namespace BlackMisc
QString CStatusMessage::getHumanOrTechnicalCategoriesAsString() const
{
if (m_categories.isEmpty()) { return ""; }
if (m_categories.isEmpty()) { return {}; }
const QString c(getHumanReadablePattern());
return c.isEmpty() ? this->getCategoriesAsString() : c;
}

View File

@@ -221,7 +221,7 @@ namespace BlackMisc
QString CStatusMessageList::toHtml(const CPropertyIndexList &indexes) const
{
if (indexes.isEmpty() || this->isEmpty()) { return ""; }
if (indexes.isEmpty() || this->isEmpty()) { return {}; }
QString html;
int line = 1;
const bool withLineNumbers = indexes.contains(CPropertyIndex::GlobalIndexLineNumber);