aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/api
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-10-24 10:50:33 -0700
committerJake Petroules <jake.petroules@qt.io>2017-11-16 15:11:15 +0000
commit4432ba4949647917d0fc3fb2ef73f9737a7c2431 (patch)
treee36f48e90f7019ad0ecfb7046638cebf3410930e /src/lib/corelib/api
parenta0c61e70eeefbf9d6c632a94d29bcc2a7e97b7d7 (diff)
STL compatibility: use empty() instead of isEmpty()
This is a simple find and replace with manual sanity check. Change-Id: Iab6d46dcc3be246d1650aae2b1730f933b717be8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/api')
-rw-r--r--src/lib/corelib/api/changeset.cpp8
-rw-r--r--src/lib/corelib/api/changeset.h2
-rw-r--r--src/lib/corelib/api/project.cpp12
-rw-r--r--src/lib/corelib/api/projectfileupdater.cpp12
-rw-r--r--src/lib/corelib/api/runenvironment.cpp4
5 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/corelib/api/changeset.cpp b/src/lib/corelib/api/changeset.cpp
index bd04fe006..4f0727a44 100644
--- a/src/lib/corelib/api/changeset.cpp
+++ b/src/lib/corelib/api/changeset.cpp
@@ -118,9 +118,9 @@ bool ChangeSet::hasOverlap(int pos, int length)
return false;
}
-bool ChangeSet::isEmpty() const
+bool ChangeSet::empty() const
{
- return m_operationList.isEmpty();
+ return m_operationList.empty();
}
QList<ChangeSet::EditOp> ChangeSet::operationList() const
@@ -372,7 +372,7 @@ void ChangeSet::apply_helper()
// convert all ops to replace
QList<EditOp> replaceList;
{
- while (!m_operationList.isEmpty()) {
+ while (!m_operationList.empty()) {
const EditOp cmd(m_operationList.front());
m_operationList.removeFirst();
convertToReplace(cmd, &replaceList);
@@ -383,7 +383,7 @@ void ChangeSet::apply_helper()
if (m_cursor)
m_cursor->beginEditBlock();
- while (!replaceList.isEmpty()) {
+ while (!replaceList.empty()) {
const EditOp cmd(replaceList.front());
replaceList.removeFirst();
doReplace(cmd, &replaceList);
diff --git a/src/lib/corelib/api/changeset.h b/src/lib/corelib/api/changeset.h
index 4991da7d5..13d3908d4 100644
--- a/src/lib/corelib/api/changeset.h
+++ b/src/lib/corelib/api/changeset.h
@@ -88,7 +88,7 @@ public:
ChangeSet();
ChangeSet(const QList<EditOp> &operations);
- bool isEmpty() const;
+ bool empty() const;
QList<EditOp> operationList() const;
diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp
index 90e3a1a81..9b13f0609 100644
--- a/src/lib/corelib/api/project.cpp
+++ b/src/lib/corelib/api/project.cpp
@@ -332,7 +332,7 @@ void ProjectPrivate::addGroup(const ProductData &product, const QString &groupNa
if (!product.isValid())
throw ErrorInfo(Tr::tr("Product is invalid."));
QList<ProductData> products = findProductsByName(product.name());
- if (products.isEmpty())
+ if (products.empty())
throw ErrorInfo(Tr::tr("Product '%1' does not exist.").arg(product.name()));
const QList<ResolvedProductPtr> resolvedProducts = internalProducts(products);
QBS_CHECK(products.size() == resolvedProducts.size());
@@ -376,7 +376,7 @@ ProjectPrivate::GroupUpdateContext ProjectPrivate::getGroupContext(const Product
if (!product.isValid())
throw ErrorInfo(Tr::tr("Product is invalid."));
context.products = findProductsByName(product.name());
- if (context.products.isEmpty())
+ if (context.products.empty())
throw ErrorInfo(Tr::tr("Product '%1' does not exist.").arg(product.name()));
context.resolvedProducts = internalProducts(context.products);
@@ -389,7 +389,7 @@ ProjectPrivate::GroupUpdateContext ProjectPrivate::getGroupContext(const Product
}
}
}
- if (context.resolvedGroups.isEmpty())
+ if (context.resolvedGroups.empty())
throw ErrorInfo(Tr::tr("Group '%1' does not exist.").arg(groupName));
for (const ProductData &p : qAsConst(context.products)) {
const GroupData &g = findGroupData(p, groupName);
@@ -429,7 +429,7 @@ ProjectPrivate::FileListUpdateContext ProjectPrivate::getFileListContext(const P
GroupUpdateContext &groupContext = filesContext.groupContext;
groupContext = getGroupContext(product, group);
- if (filePaths.isEmpty())
+ if (filePaths.empty())
throw ErrorInfo(Tr::tr("No files supplied."));
QString prefix;
@@ -552,7 +552,7 @@ void ProjectPrivate::removeFiles(const ProductData &product, const GroupData &gr
FileListUpdateContext filesContext = getFileListContext(product, group, filePaths, false);
GroupUpdateContext &groupContext = filesContext.groupContext;
- if (!filesContext.absoluteFilePathsFromWildcards.isEmpty()) {
+ if (!filesContext.absoluteFilePathsFromWildcards.empty()) {
throw ErrorInfo(Tr::tr("The following files cannot be removed from the project file, "
"because they match wildcard patterns: %1")
.arg(filesContext.absoluteFilePathsFromWildcards.join(QLatin1String(", "))));
@@ -563,7 +563,7 @@ void ProjectPrivate::removeFiles(const ProductData &product, const GroupData &gr
if (filesNotFound.removeOne(sa->absoluteFilePath))
sourceArtifacts << sa;
}
- if (!filesNotFound.isEmpty()) {
+ if (!filesNotFound.empty()) {
throw ErrorInfo(Tr::tr("The following files are not known to qbs: %1")
.arg(filesNotFound.join(QLatin1String(", "))));
}
diff --git a/src/lib/corelib/api/projectfileupdater.cpp b/src/lib/corelib/api/projectfileupdater.cpp
index b665e5520..37dfb7688 100644
--- a/src/lib/corelib/api/projectfileupdater.cpp
+++ b/src/lib/corelib/api/projectfileupdater.cpp
@@ -176,7 +176,7 @@ void ProjectFileUpdater::apply()
Parser parser(&engine);
if (!parser.parse()) {
QList<DiagnosticMessage> parserMessages = parser.diagnosticMessages();
- if (!parserMessages.isEmpty()) {
+ if (!parserMessages.empty()) {
ErrorInfo errorInfo;
errorInfo.append(Tr::tr("Failure parsing project file."));
for (const DiagnosticMessage &msg : qAsConst(parserMessages))
@@ -302,7 +302,7 @@ static QString &completeFilesRepr(QString &filesRepr, int indentation)
void ProjectFileFilesAdder::doApply(QString &fileContent, UiProgram *ast)
{
- if (m_files.isEmpty())
+ if (m_files.empty())
return;
QStringList sortedFiles = m_files;
sortedFiles.sort();
@@ -346,13 +346,13 @@ void ProjectFileFilesAdder::doApply(QString &fileContent, UiProgram *ast)
// Insert new files "sorted", but do not change the order of existing files.
const QString firstNewFileRepr = toJSLiteral(sortedFiles.front());
- while (!oldFileReprs.isEmpty()) {
+ while (!oldFileReprs.empty()) {
if (oldFileReprs.front() > firstNewFileRepr)
break;
addToFilesRepr(filesRepresentation, oldFileReprs.takeFirst(), arrayElemIndentation);
}
addToFilesRepr(filesRepresentation, sortedFiles, arrayElemIndentation);
- while (!oldFileReprs.isEmpty())
+ while (!oldFileReprs.empty())
addToFilesRepr(filesRepresentation, oldFileReprs.takeFirst(), arrayElemIndentation);
completeFilesRepr(filesRepresentation, bindingIndentation);
break;
@@ -414,7 +414,7 @@ ProjectFileFilesRemover::ProjectFileFilesRemover(const ProductData &product, con
void ProjectFileFilesRemover::doApply(QString &fileContent, UiProgram *ast)
{
- if (m_files.isEmpty())
+ if (m_files.empty())
return;
// Find the item containing the "files" binding.
@@ -464,7 +464,7 @@ void ProjectFileFilesRemover::doApply(QString &fileContent, UiProgram *ast)
newFilesList << existingFile;
elem = elem->next;
}
- if (!filesToRemove.isEmpty()) {
+ if (!filesToRemove.empty()) {
throw ErrorInfo(Tr::tr("The following files were not found in the 'files' list: %1")
.arg(filesToRemove.join(QLatin1String(", "))), bindingLocation);
}
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp
index 0470bfb9a..0a2c1f0e5 100644
--- a/src/lib/corelib/api/runenvironment.cpp
+++ b/src/lib/corelib/api/runenvironment.cpp
@@ -339,7 +339,7 @@ int RunEnvironment::doRunTarget(const QString &targetBin, const QStringList &arg
<< QStringLiteral("-run")
<< QStringLiteral("-bundle")
<< QDir::cleanPath(bundlePath);
- if (!arguments.isEmpty())
+ if (!arguments.empty())
targetArguments << QStringLiteral("-extra-args") << arguments;
} else if (QFileInfo(targetExecutable = findExecutable(QStringList()
<< QStringLiteral("ios-deploy"))).isExecutable()) {
@@ -348,7 +348,7 @@ int RunEnvironment::doRunTarget(const QString &targetBin, const QStringList &arg
<< QStringLiteral("--noninteractive")
<< QStringLiteral("--bundle")
<< QDir::cleanPath(bundlePath);
- if (!arguments.isEmpty())
+ if (!arguments.empty())
targetArguments << QStringLiteral("--args") << arguments;
} else {
d->logger.qbsLog(LoggerError)