From 798128856c83f2542af166de0083ed46bcd70704 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 13 Oct 2015 09:00:55 +0200 Subject: [PATCH] qdoc: Fix single-character string literals. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use character literals where applicable. Change-Id: I7011ae6ee55107b4788cc434e0dc3618c4213799 Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/config.cpp | 6 +++--- src/tools/qdoc/cppcodemarker.cpp | 2 +- src/tools/qdoc/cppcodeparser.cpp | 2 +- src/tools/qdoc/generator.cpp | 6 +++--- src/tools/qdoc/htmlgenerator.cpp | 18 +++++++++--------- src/tools/qdoc/node.h | 2 +- src/tools/qdoc/puredocparser.cpp | 2 +- src/tools/qdoc/qdocdatabase.cpp | 8 ++++---- src/tools/qdoc/qdocindexfiles.cpp | 24 ++++++++++++------------ src/tools/qdoc/qmlvisitor.cpp | 2 +- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index ae6bbaf5da..6c47b86d22 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -493,7 +493,7 @@ QStringList Config::getCanonicalPathList(const QString& var, bool validate) cons QDir dir(sl[i].simplified()); QString path = dir.path(); if (dir.isRelative()) - dir.setPath(d + "/" + path); + dir.setPath(d + QLatin1Char('/') + path); if (validate && !QFileInfo::exists(dir.path())) lastLocation_.warning(tr("Cannot find file or directory: %1").arg(path)); else @@ -889,7 +889,7 @@ QStringList Config::loadMaster(const QString& fileName) if (!fin.open(QFile::ReadOnly | QFile::Text)) { if (!Config::installDir.isEmpty()) { int prefix = location.filePath().length() - location.fileName().length(); - fin.setFileName(Config::installDir + "/" + fileName.right(fileName.length() - prefix)); + fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix)); } if (!fin.open(QFile::ReadOnly | QFile::Text)) location.fatal(tr("Cannot open master qdocconf file '%1': %2").arg(fileName).arg(fin.errorString())); @@ -945,7 +945,7 @@ void Config::load(Location location, const QString& fileName) if (!fin.open(QFile::ReadOnly | QFile::Text)) { if (!Config::installDir.isEmpty()) { int prefix = location.filePath().length() - location.fileName().length(); - fin.setFileName(Config::installDir + "/" + fileName.right(fileName.length() - prefix)); + fin.setFileName(Config::installDir + QLatin1Char('/') + fileName.right(fileName.length() - prefix)); } if (!fin.open(QFile::ReadOnly | QFile::Text)) location.fatal(tr("Cannot open file '%1': %2").arg(fileName).arg(fin.errorString())); diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index 3b38745b70..e299eae434 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -154,7 +154,7 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, synopsis = typified(func->returnType()) + QLatin1Char(' '); synopsis += name; if (func->metaness() != FunctionNode::MacroWithoutParams) { - synopsis += "("; + synopsis += QLatin1Char('('); if (!func->parameters().isEmpty()) { QVector::ConstIterator p = func->parameters().constBegin(); while (p != func->parameters().constEnd()) { diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 5d2a2c90d0..f20b998cc4 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -2321,7 +2321,7 @@ bool CppCodeParser::matchDocsAndStuff() QString topics; QSet::ConstIterator t = topicCommandsUsed.constBegin(); while (t != topicCommandsUsed.constEnd()) { - topics += " \\" + *t + ","; + topics += " \\" + *t + QLatin1Char(','); ++t; } topics[topics.lastIndexOf(',')] = '.'; diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 5037d95640..3ce5bf99d0 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -1500,7 +1500,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) // We have an overloaded signal, show an example QString code = "connect(" + objectName + ", static_cast<" + func->returnType() - + "(" + func->parent()->name() + "::*)("; + + QLatin1Char('(') + func->parent()->name() + "::*)("; for (int i = 0; i < func->parameters().size(); ++i) { if (i != 0) code += ", "; @@ -1508,7 +1508,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) code += p.dataType() + p.rightType(); } - code += ")"; + code += QLatin1Char(')'); if (func->isConst()) code += " const"; code += ">(&" + func->parent()->name() + "::" + func->name() + "),\n [=]("; @@ -1519,7 +1519,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) const Parameter &p = func->parameters().at(i); code += p.dataType(); if (code[code.size()-1].isLetterOrNumber()) - code += " "; + code += QLatin1Char(' '); code += p.name() + p.rightType(); } diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 5b2039764a..90f8ab2046 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1191,7 +1191,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark if (unit < 3) { out() << "id=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) << "\""; } - out() << ">"; + out() << '>'; inSectionHeading_ = true; break; } @@ -1228,18 +1228,18 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark if (!p1.isEmpty()) { if (p1 == QLatin1String("borderless")) attr = p1; - else if (p1.contains("%")) + else if (p1.contains(QLatin1Char('%'))) width = p1; } if (!p2.isEmpty()) { if (p2 == QLatin1String("borderless")) attr = p2; - else if (p2.contains("%")) + else if (p2.contains(QLatin1Char('%'))) width = p2; } - out() << "
\n "; numTableRows_ = 0; } @@ -1288,7 +1288,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark out() << p; } else { - QStringList spans = p.split(","); + QStringList spans = p.split(QLatin1Char(',')); if (spans.size() == 2) { if (spans.at(0) != "1") out() << " colspan=\"" << spans.at(0) << '"'; @@ -2216,7 +2216,7 @@ void HtmlGenerator::generateRequisites(Aggregate *inner, CodeMarker *marker) out() << "" << "
" << *i << ":" - << " "; + " "; if (*i == headerText) out() << requisites.value(*i).toString(); @@ -2262,7 +2262,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker) else logicalModuleVersion = qcn->logicalModuleVersion(); text.clear(); - text << "import " + qcn->logicalModuleName() + " " + logicalModuleVersion; + text << "import " + qcn->logicalModuleName() + QLatin1Char(' ') + logicalModuleVersion; requisites.insert(importText, text); //add the since and project into the map @@ -3820,7 +3820,7 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const int hashtag = link.lastIndexOf(QChar('#')); if (hashtag != -1) link.truncate(hashtag); - link += "#" + ref; + link += QLatin1Char('#') + ref; } return link; } diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 6262cee0ab..6b1032805f 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -1134,7 +1134,7 @@ class CollectionNode : public Aggregate virtual QString logicalModuleName() const Q_DECL_OVERRIDE { return logicalModuleName_; } virtual QString logicalModuleVersion() const Q_DECL_OVERRIDE { - return logicalModuleVersionMajor_ + "." + logicalModuleVersionMinor_; + return logicalModuleVersionMajor_ + QLatin1Char('.') + logicalModuleVersionMinor_; } virtual QString logicalModuleIdentifier() const Q_DECL_OVERRIDE { return logicalModuleName_ + logicalModuleVersionMajor_; diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp index 80a7ec4bf5..b47f1fc453 100644 --- a/src/tools/qdoc/puredocparser.cpp +++ b/src/tools/qdoc/puredocparser.cpp @@ -173,7 +173,7 @@ bool PureDocParser::processQdocComments() QString topics; QSet::ConstIterator t = topicCommandsUsed.constBegin(); while (t != topicCommandsUsed.constEnd()) { - topics += " \\" + *t + ","; + topics += " \\" + *t + QLatin1Char(','); ++t; } topics[topics.lastIndexOf(',')] = '.'; diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index acd11ff20b..28373bd3b5 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -340,10 +340,10 @@ void QDocForest::printLinkCounts(const QString& project) while (i != m.end()) { QString line = " " + i.value(); if (i.value() != module) - depends += " " + i.value(); + depends += QLatin1Char(' ') + i.value(); int pad = 30 - line.length(); for (int k=0; k& counts) if (i.value() != module) { counts.append(-(i.key())); strings.append(i.value()); - depends += " " + i.value(); + depends += QLatin1Char(' ') + i.value(); } ++i; } @@ -1674,7 +1674,7 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q const Node* node = 0; Atom* atom = const_cast(a); - QStringList targetPath = atom->string().split("#"); + QStringList targetPath = atom->string().split(QLatin1Char('#')); QString first = targetPath.first().trimmed(); if (Generator::debugging()) qDebug() << " first:" << first; diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index fdc42316cb..292a4de021 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -660,7 +660,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, QString groupsAttr = attributes.value(QLatin1String("groups")).toString(); if (!groupsAttr.isEmpty()) { - QStringList groupNames = groupsAttr.split(","); + QStringList groupNames = groupsAttr.split(QLatin1Char(',')); foreach (const QString &name, groupNames) { qdb_->addToGroup(name, node); } @@ -1029,11 +1029,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, baseStrings.insert(n->fullName()); } if (!baseStrings.isEmpty()) - writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(",")); + writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(QLatin1Char(','))); if (!node->physicalModuleName().isEmpty()) writer.writeAttribute("module", node->physicalModuleName()); if (!classNode->groupNames().isEmpty()) - writer.writeAttribute("groups", classNode->groupNames().join(",")); + writer.writeAttribute("groups", classNode->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1044,7 +1044,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!namespaceNode->physicalModuleName().isEmpty()) writer.writeAttribute("module", namespaceNode->physicalModuleName()); if (!namespaceNode->groupNames().isEmpty()) - writer.writeAttribute("groups", namespaceNode->groupNames().join(",")); + writer.writeAttribute("groups", namespaceNode->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1056,7 +1056,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("fulltitle", qcn->fullTitle()); writer.writeAttribute("subtitle", qcn->subTitle()); if (!qcn->groupNames().isEmpty()) - writer.writeAttribute("groups", qcn->groupNames().join(",")); + writer.writeAttribute("groups", qcn->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1098,7 +1098,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("module", node->physicalModuleName()); } if (!docNode->groupNames().isEmpty()) - writer.writeAttribute("groups", docNode->groupNames().join(",")); + writer.writeAttribute("groups", docNode->groupNames().join(QLatin1Char(','))); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); } @@ -1113,7 +1113,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!cn->physicalModuleName().isEmpty()) writer.writeAttribute("module", cn->physicalModuleName()); if (!cn->groupNames().isEmpty()) - writer.writeAttribute("groups", cn->groupNames().join(",")); + writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(','))); /* This is not read back in, so it probably shouldn't be written out in the first place. @@ -1122,7 +1122,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QStringList names; foreach (const Node* member, cn->members()) names.append(member->name()); - writer.writeAttribute("members", names.join(",")); + writer.writeAttribute("members", names.join(QLatin1Char(','))); } if (!brief.isEmpty()) writer.writeAttribute("brief", brief); @@ -1138,7 +1138,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!cn->physicalModuleName().isEmpty()) writer.writeAttribute("module", cn->physicalModuleName()); if (!cn->groupNames().isEmpty()) - writer.writeAttribute("groups", cn->groupNames().join(",")); + writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(','))); /* This is not read back in, so it probably shouldn't be written out in the first place. @@ -1147,7 +1147,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QStringList names; foreach (const Node* member, cn->members()) names.append(member->name()); - writer.writeAttribute("members", names.join(",")); + writer.writeAttribute("members", names.join(QLatin1Char(','))); } if (!brief.isEmpty()) writer.writeAttribute("brief", brief); @@ -1163,7 +1163,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!cn->physicalModuleName().isEmpty()) writer.writeAttribute("module", cn->physicalModuleName()); if (!cn->groupNames().isEmpty()) - writer.writeAttribute("groups", cn->groupNames().join(",")); + writer.writeAttribute("groups", cn->groupNames().join(QLatin1Char(','))); /* This is not read back in, so it probably shouldn't be written out in the first place. @@ -1172,7 +1172,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QStringList names; foreach (const Node* member, cn->members()) names.append(member->name()); - writer.writeAttribute("members", names.join(",")); + writer.writeAttribute("members", names.join(QLatin1Char(','))); } if (!brief.isEmpty()) writer.writeAttribute("brief", brief); diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index 155e1de054..0cb4d84513 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -624,7 +624,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import) QString version = document.mid(import->versionToken.offset, import->versionToken.length); QString importId = document.mid(import->importIdToken.offset, import->importIdToken.length); QString importUri = getFullyQualifiedId(import->importUri); - QString reconstructed = importUri + QString(" ") + version; + QString reconstructed = importUri + QLatin1Char(' ') + version; importList.append(ImportRec(name, version, importId, importUri)); return true;