qdoc: Fix single-character string literals.

Use character literals where applicable.

Change-Id: I7011ae6ee55107b4788cc434e0dc3618c4213799
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This commit is contained in:
Friedemann Kleint 2015-10-13 09:00:55 +02:00
parent 72d0c62d14
commit 798128856c
10 changed files with 36 additions and 36 deletions

View File

@ -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()));

View File

@ -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<Parameter>::ConstIterator p = func->parameters().constBegin();
while (p != func->parameters().constEnd()) {

View File

@ -2321,7 +2321,7 @@ bool CppCodeParser::matchDocsAndStuff()
QString topics;
QSet<QString>::ConstIterator t = topicCommandsUsed.constBegin();
while (t != topicCommandsUsed.constEnd()) {
topics += " \\" + *t + ",";
topics += " \\" + *t + QLatin1Char(',');
++t;
}
topics[topics.lastIndexOf(',')] = '.';

View File

@ -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();
}

View File

@ -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() << "<div class=\"table\"><table class=\"" << attr << "\"";
out() << "<div class=\"table\"><table class=\"" << attr << '"';
if (!width.isEmpty())
out() << " width=\"" << width << "\"";
out() << " width=\"" << width << '"';
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() << "<tr>"
<< "<td class=\"memItemLeft rightAlign topAlign\"> "
<< *i << ":"
<< "</td><td class=\"memItemRight bottomAlign\"> ";
"</td><td class=\"memItemRight bottomAlign\"> ";
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;
}

View File

@ -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_;

View File

@ -173,7 +173,7 @@ bool PureDocParser::processQdocComments()
QString topics;
QSet<QString>::ConstIterator t = topicCommandsUsed.constBegin();
while (t != topicCommandsUsed.constEnd()) {
topics += " \\" + *t + ",";
topics += " \\" + *t + QLatin1Char(',');
++t;
}
topics[topics.lastIndexOf(',')] = '.';

View File

@ -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<pad; ++k)
line += " ";
line += QLatin1Char(' ');
line += "%1";
Location::null.report(line.arg(-(i.key())));
++i;
@ -370,7 +370,7 @@ QString QDocForest::getLinkCounts(QStringList& strings, QVector<int>& 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<Atom*>(a);
QStringList targetPath = atom->string().split("#");
QStringList targetPath = atom->string().split(QLatin1Char('#'));
QString first = targetPath.first().trimmed();
if (Generator::debugging())
qDebug() << " first:" << first;

View File

@ -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);

View File

@ -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;