qdoc: Fix some QString usage issues (Krazy warnings).

- Avoid single-character constants.
- Use QString() instead of "".

Change-Id: If04eff389e7b6d4a18201365b711708fdf545d00
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
This commit is contained in:
Friedemann Kleint 2012-05-16 11:26:11 +02:00 committed by Qt by Nokia
parent cd9be96b1e
commit 078ba2d0a2
17 changed files with 94 additions and 94 deletions

View File

@ -379,7 +379,7 @@ void Atom::dump() const
str.replace(QLatin1String("\n"), QLatin1String("\\n"));
str.replace(QRegExp(QLatin1String("[^\x20-\x7e]")), QLatin1String("?"));
if (!str.isEmpty())
str = QLatin1String(" \"") + str + QLatin1String("\"");
str = QLatin1String(" \"") + str + QLatin1Char('"');
fprintf(stderr,
" %-15s%s\n",
typeString().toLatin1().data(),

View File

@ -382,7 +382,7 @@ QString CodeMarker::sortName(const Node *node, const QString* name)
(node->type() == Node::QmlSignal) ||
(node->type() == Node::QmlSignalHandler)) {
const FunctionNode* func = static_cast<const FunctionNode *>(node);
return QLatin1String("E") + func->signature();
return QLatin1Char('E') + func->signature();
}
return QLatin1Char('B') + nodeName;

View File

@ -366,7 +366,7 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
synopsis = typified(func->returnType()) + QLatin1Char(' ') + name;
else
synopsis = name;
synopsis += "(";
synopsis += QLatin1Char('(');
if (!func->parameters().isEmpty()) {
QList<Parameter>::ConstIterator p = func->parameters().begin();
while (p != func->parameters().end()) {
@ -374,8 +374,8 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
synopsis += ", ";
synopsis += typified((*p).leftType());
if (!(*p).name().isEmpty()) {
if (!synopsis.endsWith("("))
synopsis += " ";
if (!synopsis.endsWith(QLatin1Char('(')))
synopsis += QLatin1Char(' ');
synopsis += "<@param>" + protect((*p).name()) + "</@param>";
}
synopsis += protect((*p).rightType());

View File

@ -927,7 +927,7 @@ bool CppCodeParser::splitQmlMethodArg(const QString& arg,
}
}
else {
type = QString("");
type.clear();
if (colonSplit.size() > 2) {
module = colonSplit[0];
element = colonSplit[1];
@ -1221,7 +1221,7 @@ void CppCodeParser::reset(Tree *tree)
access = Node::Public;
metaness = FunctionNode::Plain;
lastPath.clear();
moduleName = "";
moduleName.clear();
}
/*!
@ -2441,7 +2441,7 @@ void CppCodeParser::parseQiteratorDotH(const Location &location,
text.remove("\\\n");
QStringList lines = text.split(QLatin1Char('\n'));
lines = lines.filter("Q_DECLARE");
lines.replaceInStrings(QRegExp("#define Q[A-Z_]*\\(C\\)"), "");
lines.replaceInStrings(QRegExp("#define Q[A-Z_]*\\(C\\)"), QString());
if (lines.size() == 4) {
sequentialIteratorDefinition = lines[0];

View File

@ -555,7 +555,7 @@ void DitaXmlGenerator::initializeGenerator(const Config &config)
DITAXMLGENERATOR_CUSTOMHEADELEMENTS);
codeIndent = config.getInt(CONFIG_CODEINDENT);
version = config.getString(CONFIG_VERSION);
vrm = version.split(".");
vrm = version.split(QLatin1Char('.'));
}
/*!
@ -681,7 +681,7 @@ void DitaXmlGenerator::generateTree(Tree *tree)
Generator::generateTree(tree);
generateCollisionPages();
QString fileBase = project.toLower().simplified().replace(" ", "-");
QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-'));
generateIndex(fileBase, projectUrl, projectDescription);
writeDitaMap(tree);
@ -1843,7 +1843,7 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
generateThreadSafeness(nsn, marker);
generateSince(nsn, marker);
enterSection("","");
enterSection(QString(), QString());
generateBody(nsn, marker);
generateAlsoList(nsn, marker);
leaveSection();
@ -1980,7 +1980,7 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
generateInheritedBy(cn, marker);
generateThreadSafeness(cn, marker);
generateSince(cn, marker);
enterSection("","");
enterSection(QString(), QString());
generateBody(cn, marker);
generateAlsoList(cn, marker);
leaveSection();
@ -2105,7 +2105,7 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
generateThreadSafeness(fn, marker);
generateSince(fn, marker);
generateSince(fn, marker);
enterSection("","");
enterSection(QString(), QString());
generateBody(fn, marker);
generateAlsoList(fn, marker);
leaveSection();
@ -2228,7 +2228,7 @@ DitaXmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
writeEndTag(); // </p>
}
#endif
enterSection("","");
enterSection(QString(), QString());
generateBody(qcn, marker);
if (cn) {
generateQmlText(cn->doc().body(), cn, marker, qcn->name());
@ -2303,7 +2303,7 @@ void DitaXmlGenerator::generateFakeNode(FakeNode* fake, CodeMarker* marker)
writeProlog(fake);
writeStartTag(DT_body);
enterSection("","");
enterSection(QString(), QString());
if (fake->subType() == Node::Module) {
generateStatus(fake, marker);
if (moduleNamespaceMap.contains(fake->name())) {
@ -2336,7 +2336,7 @@ void DitaXmlGenerator::generateFakeNode(FakeNode* fake, CodeMarker* marker)
}
else {
if (fake->subType() == Node::Module) {
enterSection("","");
enterSection(QString(), QString());
generateBody(fake, marker);
leaveSection();
}
@ -2383,7 +2383,7 @@ void DitaXmlGenerator::writeLink(const Node* node,
{
if (node) {
QString link = fileName(node) + QLatin1Char('#') + node->guid();
if (link.endsWith("#"))
if (link.endsWith(QLatin1Char('#')))
qDebug() << "LINK ENDS WITH #:" << link << outFileName();
writeStartTag(DT_link);
writeHrefAttribute(link);
@ -2627,7 +2627,7 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node,
out() << "<li>";
out() << "<xref href=\""
<< nodeName
<< "#"
<< '#'
<< Doc::canonicalTitle(headingText.toString())
<< "\">";
generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
@ -2748,7 +2748,7 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node,
<< sectionNumber.size()
<< "\">";
out() << "<xref href=\""
<< "#"
<< '#'
<< Doc::canonicalTitle(s)
<< "\">";
generateAtomList(headingText.firstAtom(), node, marker, true, numAtoms);
@ -6417,10 +6417,10 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner)
QString text;
QStringList::ConstIterator i = inner->includes().begin();
while (i != inner->includes().end()) {
if ((*i).startsWith("<") && (*i).endsWith(">"))
if ((*i).startsWith(QLatin1Char('<')) && (*i).endsWith(QLatin1Char('>')))
text += *i;
else
text += "<" + *i + ">";
text += QLatin1Char('<') + *i + QLatin1Char('>');
++i;
if (i != inner->includes().end())
text += "\n";
@ -6530,14 +6530,14 @@ void DitaXmlGenerator::generateCollisionPages()
generateHeader(ncn, ditaTitle);
writeProlog(ncn);
writeStartTag(DT_body);
enterSection("","");
enterSection(QString(), QString());
NodeMap nm;
for (int i=0; i<collisions.size(); ++i) {
Node* n = collisions.at(i);
QString t;
if (!n->qmlModuleIdentifier().isEmpty())
t = n->qmlModuleIdentifier() + " ";
t = n->qmlModuleIdentifier() + QLatin1Char(' ');
t += protectEnc(fullTitle);
nm.insertMulti(t,n);
}

View File

@ -1051,7 +1051,7 @@ void DocParser::parse(const QString& source,
}
else if (openedCommands.top() == CMD_TABLE) {
p1 = "1,1";
p2 = "";
p2.clear();
if (isLeftBraceAhead()) {
p1 = getArgument();
if (isLeftBraceAhead()) {
@ -1307,7 +1307,7 @@ void DocParser::parse(const QString& source,
p1 = "1";
if (isLeftBraceAhead())
p1 = getArgument();
p1 += ",";
p1 += QLatin1Char(',');
p1 += QString::number((int)getSectioningUnit());
append(Atom::TableOfContents, p1);
break;
@ -2094,7 +2094,7 @@ void DocParser::leavePara()
paraState = OutsideParagraph;
indexStartedPara = false;
pendingParaRightType = Atom::Nop;
pendingParaString = "";
pendingParaString.clear();
}
}
@ -2177,7 +2177,7 @@ void DocParser::expandMacro(const QString &name,
(paramNo <= numParams)) {
if (!rawString.isEmpty()) {
append(Atom::RawString, rawString);
rawString = "";
rawString.clear();
}
append(Atom::String, args[paramNo - 1]);
j += 1;
@ -2402,7 +2402,7 @@ QString DocParser::getOptionalArgument()
skipSpacesOrOneEndl();
if (pos + 1 < (int) in.length() && in[pos] == '\\' &&
in[pos + 1].isLetterOrNumber()) {
return "";
return QString();
}
else {
return getArgument();
@ -2436,7 +2436,7 @@ QString DocParser::getRestOfLine()
}
if (!t.isEmpty())
t += " ";
t += QLatin1Char(' ');
t += in.mid(begin, pos - begin).simplified();
if (trailingSlash) {

View File

@ -82,7 +82,7 @@ int editDistance( const QString& s, const QString& t )
QString nearestName( const QString& actual, const QSet<QString>& candidates )
{
if (actual.isEmpty())
return "";
return QString();
int deltaBest = 10000;
int numBest = 0;
@ -107,7 +107,7 @@ QString nearestName( const QString& actual, const QSet<QString>& candidates )
actual.length() + best.length() >= 5 ) {
return best;
} else {
return "";
return QString();
}
}

View File

@ -454,13 +454,13 @@ QMap<QString, QString>& Generator::formattingRightMap()
QString Generator::fullDocumentLocation(const Node *node, bool subdir)
{
if (!node)
return "";
return QString();
if (!node->url().isEmpty())
return node->url();
QString parentName;
QString anchorRef;
QString fdl = "";
QString fdl;
/*
If the output is being sent to subdirectories of the
@ -478,31 +478,31 @@ QString Generator::fullDocumentLocation(const Node *node, bool subdir)
// an attribute containing the location of any documentation.
if (!node->fileBase().isEmpty())
parentName = node->fileBase() + "." + currentGenerator()->fileExtension();
parentName = node->fileBase() + QLatin1Char('.') + currentGenerator()->fileExtension();
else
return "";
return QString();
}
else if (node->type() == Node::Fake) {
if ((node->subType() == Node::QmlClass) ||
(node->subType() == Node::QmlBasicType)) {
QString fb = node->fileBase();
if (fb.startsWith(Generator::outputPrefix(QLatin1String("QML"))))
return fb + "." + currentGenerator()->fileExtension();
return fb + QLatin1Char('.') + currentGenerator()->fileExtension();
else {
QString mq = "";
QString mq;
if (!node->qmlModuleName().isEmpty()) {
mq = node->qmlModuleIdentifier().replace(QChar('.'),QChar('-'));
mq = mq.toLower() + "-";
mq = mq.toLower() + QLatin1Char('-');
}
return fdl+ Generator::outputPrefix(QLatin1String("QML")) + mq +
node->fileBase() + "." + currentGenerator()->fileExtension();
node->fileBase() + QLatin1Char('.') + currentGenerator()->fileExtension();
}
}
else
parentName = node->fileBase() + "." + currentGenerator()->fileExtension();
parentName = node->fileBase() + QLatin1Char('.') + currentGenerator()->fileExtension();
}
else if (node->fileBase().isEmpty())
return "";
return QString();
Node *parentNode = 0;
@ -522,11 +522,11 @@ QString Generator::fullDocumentLocation(const Node *node, bool subdir)
case Node::Class:
case Node::Namespace:
if (parentNode && !parentNode->name().isEmpty()) {
parentName.remove("." + currentGenerator()->fileExtension());
parentName.remove(QLatin1Char('.') + currentGenerator()->fileExtension());
parentName += QLatin1Char('-')
+ node->fileBase().toLower() + "." + currentGenerator()->fileExtension();
+ node->fileBase().toLower() + QLatin1Char('.') + currentGenerator()->fileExtension();
} else {
parentName = node->fileBase() + "." + currentGenerator()->fileExtension();
parentName = node->fileBase() + QLatin1Char('.') + currentGenerator()->fileExtension();
}
break;
case Node::Function:
@ -546,7 +546,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool subdir)
else if (functionNode->overloadNumber() > 1)
anchorRef = QLatin1Char('#') + functionNode->name()
+ "-" + QString::number(functionNode->overloadNumber());
+ QLatin1Char('-') + QString::number(functionNode->overloadNumber());
else
anchorRef = QLatin1Char('#') + functionNode->name();
}
@ -588,8 +588,8 @@ QString Generator::fullDocumentLocation(const Node *node, bool subdir)
by pages whose file names are lower-case.
*/
parentName = node->fileBase();
parentName.replace(QLatin1Char('/'), "-").replace(".", "-");
parentName += "." + currentGenerator()->fileExtension();
parentName.replace(QLatin1Char('/'), QLatin1Char('-')).replace(QLatin1Char('.'), QLatin1Char('-'));
parentName += QLatin1Char('.') + currentGenerator()->fileExtension();
}
break;
default:
@ -600,11 +600,11 @@ QString Generator::fullDocumentLocation(const Node *node, bool subdir)
if (node->type() != Node::Class && node->type() != Node::Namespace) {
switch (node->status()) {
case Node::Compat:
parentName.replace("." + currentGenerator()->fileExtension(),
parentName.replace(QLatin1Char('.') + currentGenerator()->fileExtension(),
"-compat." + currentGenerator()->fileExtension());
break;
case Node::Obsolete:
parentName.replace("." + currentGenerator()->fileExtension(),
parentName.replace(QLatin1Char('.') + currentGenerator()->fileExtension(),
"-obsolete." + currentGenerator()->fileExtension());
break;
default:
@ -864,7 +864,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
Text text;
Quoter quoter;
Doc::quoteFromFile(fake->doc().location(), quoter, fake->name());
QString code = quoter.quoteTo(fake->location(), "", "");
QString code = quoter.quoteTo(fake->location(), QString(), QString());
CodeMarker *codeMarker = CodeMarker::markerForFileName(fake->name());
text << Atom(codeMarker->atomType(), code);
generateText(text, fake, codeMarker);
@ -1965,7 +1965,7 @@ void Generator::terminate()
imgFileExts.clear();
imageFiles.clear();
imageDirs.clear();
outDir_ = "";
outDir_.clear();
QmlClassNode::terminate();
ExampleNode::terminate();
}

View File

@ -83,7 +83,7 @@ HelpProjectWriter::HelpProjectWriter(const Config &config, const QString &defaul
//customFilters = config.defs.
foreach (QString name, config.getStringSet(prefix + "excluded"))
project.excluded.insert(name.replace("\\", "/"));
project.excluded.insert(name.replace(QLatin1Char('\\'), QLatin1Char('/')));
foreach (const QString &name, config.getStringList(prefix + "subprojects")) {
SubProject subproject;
@ -99,7 +99,7 @@ HelpProjectWriter::HelpProjectWriter(const Config &config, const QString &defaul
if (project.subprojects.isEmpty()) {
SubProject subproject;
readSelectors(subproject, config.getStringList(prefix + "selectors"));
project.subprojects[""] = subproject;
project.subprojects.insert(QString(), subproject);
}
projects.append(project);

View File

@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
int HtmlGenerator::id = 0;
bool HtmlGenerator::debugging_on = false;
QString HtmlGenerator::divNavTop = "";
QString HtmlGenerator::divNavTop;
static bool showBrokenLinks = false;
@ -278,7 +278,7 @@ void HtmlGenerator::generateTree(Tree *tree)
//reportOrphans(tree->root());
generateCollisionPages();
QString fileBase = project.toLower().simplified().replace(" ", "-");
QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-'));
generateIndex(fileBase, projectUrl, projectDescription);
helpProjectWriter->generate(tree_);
@ -1492,7 +1492,7 @@ void HtmlGenerator::generateFakeNode(FakeNode* fake, CodeMarker* marker)
if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) {
subTitleSize = SmallSubTitle;
htmlTitle += " (" + fake->subTitle() + ")";
htmlTitle += " (" + fake->subTitle() + QLatin1Char(')');
}
else if (fake->subType() == Node::QmlBasicType) {
fullTitle = "QML Basic Type: " + fullTitle;
@ -1591,7 +1591,7 @@ void HtmlGenerator::generateFakeNode(FakeNode* fake, CodeMarker* marker)
s = sections.begin();
while (s != sections.end()) {
out() << "<a name=\"" << registerRef((*s).name.toLower())
<< "\"></a>" << divNavTop << "\n";
<< "\"></a>" << divNavTop << '\n';
out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
generateQmlSummary(*s,fake,marker);
++s;
@ -1833,7 +1833,7 @@ void HtmlGenerator::generateHeader(const QString& title,
if (shortVersion.count(QChar('.')) == 2)
shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
if (!project.isEmpty())
shortVersion = project + QLatin1String(" ") + shortVersion + QLatin1String(": ");
shortVersion = project + QLatin1Char(' ') + shortVersion + QLatin1String(": ");
else
shortVersion = QLatin1String("Qt ") + shortVersion + QLatin1String(": ");
@ -3201,7 +3201,7 @@ QString HtmlGenerator::cleanRef(const QString& ref)
} else if (u == '_') {
clean += "underscore.";
} else {
clean += "A";
clean += QLatin1Char('A');
}
for (int i = 1; i < (int) ref.length(); i++) {
@ -3213,7 +3213,7 @@ QString HtmlGenerator::cleanRef(const QString& ref)
u == '_' || u == ':' || u == '.') {
clean += c;
} else if (c.isSpace()) {
clean += "-";
clean += QLatin1Char('-');
} else if (u == '!') {
clean += "-not";
} else if (u == '&') {
@ -3227,7 +3227,7 @@ QString HtmlGenerator::cleanRef(const QString& ref)
} else if (u == '#') {
clean += QLatin1Char('#');
} else {
clean += "-";
clean += QLatin1Char('-');
clean += QString::number((int)u, 16);
}
}
@ -3246,7 +3246,7 @@ QString HtmlGenerator::registerRef(const QString& ref)
} else if (prevRef == ref) {
break;
}
clean += "x";
clean += QLatin1Char('x');
}
return clean;
}
@ -3362,7 +3362,7 @@ QString HtmlGenerator::refForNode(const Node *node)
else {
ref = func->name();
if (func->overloadNumber() != 1)
ref += "-" + QString::number(func->overloadNumber());
ref += QLatin1Char('-') + QString::number(func->overloadNumber());
}
break;
case Node::Fake:
@ -3382,7 +3382,7 @@ QString HtmlGenerator::refForNode(const Node *node)
func = static_cast<const FunctionNode *>(node);
ref = func->name() + "-method";
if (func->overloadNumber() != 1)
ref += "-" + QString::number(func->overloadNumber());
ref += QLatin1Char('-') + QString::number(func->overloadNumber());
break;
case Node::Variable:
ref = node->name() + "-var";
@ -3771,7 +3771,7 @@ QString HtmlGenerator::getLink(const Atom *atom,
*node = 0;
inObsoleteLink = false;
if (atom->string().contains(":") &&
if (atom->string().contains(QLatin1Char(':')) &&
(atom->string().startsWith("file:")
|| atom->string().startsWith("http:")
|| atom->string().startsWith("https:")

View File

@ -257,8 +257,8 @@ static void processQdocconfFile(const QString &fileName)
for (int i = 0; i < dependModules.size(); i++) {
QMultiMap<uint, QFileInfo> foundIndices;
for (int j = 0; j < indexDirs.size(); j++) {
QString fileToLookFor = indexDirs[j] + "/" + dependModules[i] +
"/" + dependModules[i] + ".index";
QString fileToLookFor = indexDirs[j] + QLatin1Char('/') + dependModules[i] +
QLatin1Char('/') + dependModules[i] + QLatin1String(".index");
if (QFile::exists(fileToLookFor)) {
QFileInfo tempFileInfo(fileToLookFor);
foundIndices.insert(tempFileInfo.lastModified().toTime_t(), tempFileInfo);
@ -390,7 +390,7 @@ static void processQdocconfFile(const QString &fileName)
tree->generateTagFile(tagFile);
}
tree->setVersion("");
tree->setVersion(QString());
Generator::terminate();
CodeParser::terminate();
CodeMarker::terminate();

View File

@ -261,7 +261,7 @@ QString Node::nodeTypeString(unsigned t)
default:
break;
}
return "";
return QString();
}
/*!
@ -314,7 +314,7 @@ QString Node::nodeSubtypeString(unsigned t)
default:
break;
}
return "";
return QString();
}
/*!
@ -1206,13 +1206,13 @@ QString Node::moduleName() const
int start = path.lastIndexOf(pattern);
if (start == -1)
return "";
return QString();
QString moduleDir = path.mid(start + pattern.size());
int finish = moduleDir.indexOf(QDir::separator());
if (finish == -1)
return "";
return QString();
QString moduleName = moduleDir.left(finish);
@ -1237,7 +1237,7 @@ QString Node::moduleName() const
else if (moduleName == "xml")
return "QtXml";
else
return "";
return QString();
}
/*!
@ -2563,7 +2563,7 @@ QString Node::cleanId(QString str)
return clean;
name = name.replace("::","-");
name = name.replace(" ","-");
name = name.replace(QLatin1Char(' '), QLatin1Char('-'));
name = name.replace("()","-call");
clean.reserve(name.size() + 20);
@ -2618,10 +2618,10 @@ QString Node::cleanId(QString str)
clean += "-hash";
}
else if (u == '(') {
clean += "-";
clean += QLatin1Char('-');
}
else if (u == ')') {
clean += "-";
clean += QLatin1Char('-');
}
else {
clean += QLatin1Char('-');
@ -2671,7 +2671,7 @@ QString Node::idForNode() const
}
else {
if (func->name().startsWith("operator")) {
str = "";
str.clear();
/*
The test below should probably apply to all
functions, but for now, overloaded operators
@ -2706,7 +2706,7 @@ QString Node::idForNode() const
if (operators_.contains(op)) {
str += operators_.value(op);
if (!tail.isEmpty())
str += "-" + tail;
str += QLatin1Char('-') + tail;
}
else
qDebug() << "qdoc internal error: Operator missing from operators_ map:" << op;
@ -2760,15 +2760,15 @@ QString Node::idForNode() const
if (str.endsWith(".html"))
str.remove(str.size()-5,5);
}
str.replace("/","-");
str.replace(QLatin1Char('/'), QLatin1Char('-'));
break;
case Node::File:
str = name();
str.replace("/","-");
str.replace(QLatin1Char('/'), QLatin1Char('-'));
break;
case Node::Example:
str = name();
str.replace("/","-");
str.replace(QLatin1Char('/'), QLatin1Char('-'));
break;
case Node::QmlBasicType:
str = "qml-basic-type-" + name();
@ -2803,7 +2803,7 @@ QString Node::idForNode() const
func = static_cast<const FunctionNode*>(this);
str = "qml-method-" + func->name();
if (func->overloadNumber() != 1)
str += "-" + QString::number(func->overloadNumber());
str += QLatin1Char('-') + QString::number(func->overloadNumber());
break;
case Node::Variable:
str = "var-" + name();

View File

@ -73,12 +73,12 @@ Atom::Type PlainCodeMarker::atomType() const
QString PlainCodeMarker::plainName( const Node * /* node */ )
{
return "";
return QString();
}
QString PlainCodeMarker::plainFullName(const Node * /* node */, const Node * /* relative */)
{
return "";
return QString();
}
QString PlainCodeMarker::markedUpCode( const QString& code,
@ -97,34 +97,34 @@ QString PlainCodeMarker::markedUpSynopsis( const Node * /* node */,
QString PlainCodeMarker::markedUpName( const Node * /* node */ )
{
return "";
return QString();
}
QString PlainCodeMarker::markedUpFullName( const Node * /* node */,
const Node * /* relative */ )
{
return "";
return QString();
}
QString PlainCodeMarker::markedUpEnumValue(const QString & /* enumValue */,
const Node * /* relative */)
{
return "";
return QString();
}
QString PlainCodeMarker::markedUpIncludes( const QStringList& /* includes */ )
{
return "";
return QString();
}
QString PlainCodeMarker::functionBeginRegExp( const QString& /* funcName */ )
{
return "";
return QString();
}
QString PlainCodeMarker::functionEndRegExp( const QString& /* funcName */ )
{
return "";
return QString();
}
QList<Section> PlainCodeMarker::sections(const InnerNode * /* innerNode */,

View File

@ -188,7 +188,7 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList& includes)
QString QmlCodeMarker::functionBeginRegExp(const QString& funcName)
{
return "^" + QRegExp::escape("function " + funcName) + "$";
return QLatin1Char('^') + QRegExp::escape("function " + funcName) + QLatin1Char('$');
}

View File

@ -128,7 +128,7 @@ QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) cons
else if (loc.begin() > lastEndOffset && loc.end() < offset) {
// Only examine multiline comments in order to avoid snippet markers.
if (document.mid(loc.offset - 1, 1) == "*") {
if (document.at(loc.offset - 1) == QLatin1Char('*')) {
QString comment = document.mid(loc.offset, loc.length);
if (comment.startsWith(QLatin1Char('!')) || comment.startsWith(QLatin1Char('*')))
return loc;

View File

@ -64,7 +64,7 @@ QString separator(int index, int count)
QString comma(int index, int count)
{
if (index == count - 1)
return QString("");
return QString();
if (count == 2)
return tr(" and ", "separator when N = 2");
if (index == 0)

View File

@ -229,7 +229,7 @@ void Text::dump() const
str.replace("\n", "\\n");
str.replace(QRegExp("[^\x20-\x7e]"), "?");
if (!str.isEmpty())
str = " \"" + str + "\"";
str = " \"" + str + QLatin1Char('"');
fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data());
atom = atom->next();
}