summaryrefslogtreecommitdiffstats
path: root/src/qdoc/cppcodeparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r--src/qdoc/cppcodeparser.cpp314
1 files changed, 126 insertions, 188 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index ce92448de..6a5087583 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -62,56 +62,26 @@ static QSet<QString> metaCommands_;
CppCodeParser::CppCodeParser()
{
if (topicCommands_.isEmpty()) {
- topicCommands_ << COMMAND_CLASS
- << COMMAND_DITAMAP
- << COMMAND_DONTDOCUMENT
- << COMMAND_ENUM
- << COMMAND_EXAMPLE
- << COMMAND_EXTERNALPAGE
- << COMMAND_FN
- << COMMAND_GROUP
- << COMMAND_HEADERFILE
- << COMMAND_MACRO
- << COMMAND_MODULE
- << COMMAND_NAMESPACE
- << COMMAND_PAGE
- << COMMAND_PROPERTY
- << COMMAND_TYPEALIAS
- << COMMAND_TYPEDEF
- << COMMAND_VARIABLE
- << COMMAND_QMLTYPE
- << COMMAND_QMLPROPERTY
- << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019
- << COMMAND_QMLATTACHEDPROPERTY
- << COMMAND_QMLSIGNAL
- << COMMAND_QMLATTACHEDSIGNAL
- << COMMAND_QMLMETHOD
- << COMMAND_QMLATTACHEDMETHOD
- << COMMAND_QMLBASICTYPE
- << COMMAND_QMLMODULE
- << COMMAND_JSTYPE
- << COMMAND_JSPROPERTY
- << COMMAND_JSPROPERTYGROUP // mws 13/03/2019
- << COMMAND_JSATTACHEDPROPERTY
- << COMMAND_JSSIGNAL
- << COMMAND_JSATTACHEDSIGNAL
- << COMMAND_JSMETHOD
- << COMMAND_JSATTACHEDMETHOD
- << COMMAND_JSBASICTYPE
- << COMMAND_JSMODULE
- << COMMAND_STRUCT
- << COMMAND_UNION;
+ topicCommands_ << COMMAND_CLASS << COMMAND_DITAMAP << COMMAND_DONTDOCUMENT << COMMAND_ENUM
+ << COMMAND_EXAMPLE << COMMAND_EXTERNALPAGE << COMMAND_FN << COMMAND_GROUP
+ << COMMAND_HEADERFILE << COMMAND_MACRO << COMMAND_MODULE << COMMAND_NAMESPACE
+ << COMMAND_PAGE << COMMAND_PROPERTY << COMMAND_TYPEALIAS << COMMAND_TYPEDEF
+ << COMMAND_VARIABLE << COMMAND_QMLTYPE << COMMAND_QMLPROPERTY
+ << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019
+ << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL
+ << COMMAND_QMLATTACHEDSIGNAL << COMMAND_QMLMETHOD
+ << COMMAND_QMLATTACHEDMETHOD << COMMAND_QMLBASICTYPE << COMMAND_QMLMODULE
+ << COMMAND_JSTYPE << COMMAND_JSPROPERTY
+ << COMMAND_JSPROPERTYGROUP // mws 13/03/2019
+ << COMMAND_JSATTACHEDPROPERTY << COMMAND_JSSIGNAL << COMMAND_JSATTACHEDSIGNAL
+ << COMMAND_JSMETHOD << COMMAND_JSATTACHEDMETHOD << COMMAND_JSBASICTYPE
+ << COMMAND_JSMODULE << COMMAND_STRUCT << COMMAND_UNION;
}
if (metaCommands_.isEmpty()) {
metaCommands_ = commonMetaCommands();
- metaCommands_ << COMMAND_CONTENTSPAGE
- << COMMAND_INHEADERFILE
- << COMMAND_NEXTPAGE
- << COMMAND_OVERLOAD
- << COMMAND_PREVIOUSPAGE
- << COMMAND_QMLINSTANTIATES
- << COMMAND_REIMP
- << COMMAND_RELATES;
+ metaCommands_ << COMMAND_CONTENTSPAGE << COMMAND_INHEADERFILE << COMMAND_NEXTPAGE
+ << COMMAND_OVERLOAD << COMMAND_PREVIOUSPAGE << COMMAND_QMLINSTANTIATES
+ << COMMAND_REIMP << COMMAND_RELATES;
}
}
@@ -148,11 +118,10 @@ void CppCodeParser::initializeParser(const Config &config)
nodeTypeTestFuncMap_.insert(COMMAND_PROPERTY, &Node::isProperty);
nodeTypeTestFuncMap_.insert(COMMAND_VARIABLE, &Node::isVariable);
-
exampleFiles = config.getCanonicalPathList(CONFIG_EXAMPLES);
exampleDirs = config.getCanonicalPathList(CONFIG_EXAMPLEDIRS);
- QStringList exampleFilePatterns = config.getStringList(
- CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS);
+ QStringList exampleFilePatterns =
+ config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS);
// Used for excluding dirs and files from the list of example files
const auto &excludeDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
@@ -165,8 +134,8 @@ void CppCodeParser::initializeParser(const Config &config)
else
exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.dita *.ui";
- QStringList exampleImagePatterns = config.getStringList(
- CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
+ QStringList exampleImagePatterns =
+ config.getStringList(CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
if (!exampleImagePatterns.isEmpty())
exampleImageFilter = exampleImagePatterns.join(' ');
@@ -215,15 +184,13 @@ const QSet<QString> &CppCodeParser::topicCommands()
/*!
Process the topic \a command found in the \a doc with argument \a arg.
*/
-Node *CppCodeParser::processTopicCommand(const Doc &doc,
- const QString &command,
+Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
const ArgLocPair &arg)
{
ExtraFuncData extra;
if (command == COMMAND_FN) {
Q_UNREACHABLE();
- }
- else if (nodeTypeMap_.contains(command)) {
+ } else if (nodeTypeMap_.contains(command)) {
/*
We should only get in here if the command refers to
something that can appear in a C++ namespace,
@@ -232,7 +199,7 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
this way to allow the writer to refer to the entity
without including the namespace qualifier.
*/
- Node::NodeType type = nodeTypeMap_[command];
+ Node::NodeType type = nodeTypeMap_[command];
QStringList words = arg.first.split(QLatin1Char(' '));
QStringList path;
int idx = 0;
@@ -247,11 +214,12 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
node = qdb_->findNodeByNameAndType(path, nodeTypeTestFuncMap_[command]);
if (node == nullptr) {
if (isWorthWarningAbout(doc)) {
- doc.location().warning(tr("Cannot find '%1' specified with '\\%2' in any header file")
- .arg(arg.first).arg(command));
+ doc.location().warning(
+ tr("Cannot find '%1' specified with '\\%2' in any header file")
+ .arg(arg.first)
+ .arg(command));
}
- }
- else if (node->isAggregate()) {
+ } else if (node->isAggregate()) {
if (type == Node::Namespace) {
NamespaceNode *ns = static_cast<NamespaceNode *>(node);
ns->markSeen();
@@ -260,10 +228,8 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
/*
This treats a class as a namespace.
*/
- if ((type == Node::Class) ||
- (type == Node::Namespace) ||
- (type == Node::Struct) ||
- (type == Node::Union)) {
+ if ((type == Node::Class) || (type == Node::Namespace) || (type == Node::Struct)
+ || (type == Node::Union)) {
if (path.size() > 1) {
path.pop_back();
QString ns = path.join(QLatin1String("::"));
@@ -272,54 +238,46 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
}
}
return node;
- }
- else if (command == COMMAND_EXAMPLE) {
+ } else if (command == COMMAND_EXAMPLE) {
if (Config::generateExamples) {
ExampleNode *en = new ExampleNode(qdb_->primaryTreeRoot(), arg.first);
en->setLocation(doc.startLocation());
setExampleFileLists(en);
return en;
}
- }
- else if (command == COMMAND_EXTERNALPAGE) {
+ } else if (command == COMMAND_EXTERNALPAGE) {
ExternalPageNode *epn = new ExternalPageNode(qdb_->primaryTreeRoot(), arg.first);
epn->setLocation(doc.startLocation());
return epn;
- }
- else if (command == COMMAND_HEADERFILE) {
+ } else if (command == COMMAND_HEADERFILE) {
HeaderNode *hn = new HeaderNode(qdb_->primaryTreeRoot(), arg.first);
hn->setLocation(doc.startLocation());
return hn;
- }
- else if (command == COMMAND_GROUP) {
+ } else if (command == COMMAND_GROUP) {
CollectionNode *cn = qdb_->addGroup(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_MODULE) {
+ } else if (command == COMMAND_MODULE) {
CollectionNode *cn = qdb_->addModule(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_QMLMODULE) {
+ } else if (command == COMMAND_QMLMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
CollectionNode *cn = qdb_->addQmlModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_JSMODULE) {
+ } else if (command == COMMAND_JSMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
CollectionNode *cn = qdb_->addJsModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
- }
- else if (command == COMMAND_PAGE) {
+ } else if (command == COMMAND_PAGE) {
Node::PageType ptype = Node::ArticlePage;
QStringList args = arg.first.split(QLatin1Char(' '));
if (args.size() > 1) {
@@ -365,18 +323,14 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
n->setLocation(doc.startLocation());
return n;
} else if (command == COMMAND_JSBASICTYPE) {
- QmlBasicTypeNode *n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
+ QmlBasicTypeNode *n =
+ new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
n->setLocation(doc.startLocation());
return n;
- }
- else if ((command == COMMAND_QMLSIGNAL) ||
- (command == COMMAND_QMLMETHOD) ||
- (command == COMMAND_QMLATTACHEDSIGNAL) ||
- (command == COMMAND_QMLATTACHEDMETHOD) ||
- (command == COMMAND_JSSIGNAL) ||
- (command == COMMAND_JSMETHOD) ||
- (command == COMMAND_JSATTACHEDSIGNAL) ||
- (command == COMMAND_JSATTACHEDMETHOD)) {
+ } else if ((command == COMMAND_QMLSIGNAL) || (command == COMMAND_QMLMETHOD)
+ || (command == COMMAND_QMLATTACHEDSIGNAL) || (command == COMMAND_QMLATTACHEDMETHOD)
+ || (command == COMMAND_JSSIGNAL) || (command == COMMAND_JSMETHOD)
+ || (command == COMMAND_JSATTACHEDSIGNAL) || (command == COMMAND_JSATTACHEDMETHOD)) {
Q_UNREACHABLE();
}
return nullptr;
@@ -401,11 +355,8 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc,
\note The two QML types \e{Component} and \e{QtObject}
never have a module qualifier.
*/
-bool CppCodeParser::splitQmlPropertyArg(const QString &arg,
- QString &type,
- QString &module,
- QString &qmlTypeName,
- QString &name,
+bool CppCodeParser::splitQmlPropertyArg(const QString &arg, QString &type, QString &module,
+ QString &qmlTypeName, QString &name,
const Location &location)
{
QStringList blankSplit = arg.split(QLatin1Char(' '));
@@ -426,8 +377,7 @@ bool CppCodeParser::splitQmlPropertyArg(const QString &arg,
}
QString msg = "Unrecognizable QML module/component qualifier for " + arg;
location.warning(tr(msg.toLatin1().data()));
- }
- else {
+ } else {
QString msg = "Missing property type for " + arg;
location.warning(tr(msg.toLatin1().data()));
}
@@ -463,15 +413,16 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
if (qmlType == nullptr)
qmlType = new QmlTypeNode(qdb_->primaryTreeRoot(), qmlTypeName);
- for (int i=0; i<topics.size(); ++i) {
+ for (int i = 0; i < topics.size(); ++i) {
QString cmd = topics.at(i).topic;
arg = topics.at(i).args;
- if ((cmd == COMMAND_QMLPROPERTY) || (cmd == COMMAND_QMLATTACHEDPROPERTY) ||
- (cmd == COMMAND_JSPROPERTY) || (cmd == COMMAND_JSATTACHEDPROPERTY)) {
+ if ((cmd == COMMAND_QMLPROPERTY) || (cmd == COMMAND_QMLATTACHEDPROPERTY)
+ || (cmd == COMMAND_JSPROPERTY) || (cmd == COMMAND_JSATTACHEDPROPERTY)) {
bool attached = topics.at(i).topic.contains(QLatin1String("attached"));
if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) {
if (qmlType != qdb_->findQmlType(module, qmlTypeName)) {
- QString msg = tr("All properties in a group must belong to the same type: '%1'").arg(arg);
+ QString msg = tr("All properties in a group must belong to the same type: '%1'")
+ .arg(arg);
doc.startLocation().warning(msg);
continue;
}
@@ -488,7 +439,8 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
sharedNodes << qpn;
}
} else {
- doc.startLocation().warning(tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
+ doc.startLocation().warning(
+ tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
}
}
@@ -522,10 +474,8 @@ const QSet<QString> &CppCodeParser::metaCommands()
\a node is guaranteed to be non-null.
*/
-void CppCodeParser::processMetaCommand(const Doc &doc,
- const QString &command,
- const ArgLocPair &argLocPair,
- Node *node)
+void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
+ const ArgLocPair &argLocPair, Node *node)
{
QString arg = argLocPair.first;
if (command == COMMAND_INHEADERFILE) {
@@ -533,8 +483,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
static_cast<Aggregate *>(node)->addIncludeFile(arg);
else
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
- }
- else if (command == COMMAND_OVERLOAD) {
+ } else if (command == COMMAND_OVERLOAD) {
/*
Note that this might set the overload flag of the
primary function. This is ok because the overload
@@ -547,8 +496,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
static_cast<SharedCommentNode *>(node)->setOverloadFlags();
else
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
- }
- else if (command == COMMAND_REIMP) {
+ } else if (command == COMMAND_REIMP) {
if (node->parent() && !node->parent()->isInternal()) {
if (node->isFunction()) {
FunctionNode *fn = static_cast<FunctionNode *>(node);
@@ -558,38 +506,37 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
// set, issue a warning.
if (fn->overridesThis().isEmpty() && isWorthWarningAbout(doc)) {
doc.location().warning(tr("Cannot find base function for '\\%1' in %2()")
- .arg(COMMAND_REIMP).arg(node->name()),
+ .arg(COMMAND_REIMP)
+ .arg(node->name()),
tr("The function either doesn't exist in any "
"base class with the same signature or it "
"exists but isn't virtual."));
}
fn->setReimpFlag();
- }
- else {
- doc.location().warning(tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
+ } else {
+ doc.location().warning(
+ tr("Ignored '\\%1' in %2").arg(COMMAND_REIMP).arg(node->name()));
}
}
- }
- else if (command == COMMAND_RELATES) {
+ } else if (command == COMMAND_RELATES) {
QStringList path = arg.split("::");
Aggregate *aggregate = qdb_->findRelatesNode(path);
if (aggregate == nullptr)
aggregate = new ProxyNode(node->root(), arg);
if (node->parent() == aggregate) { // node is already a child of aggregate
- doc.location().warning(tr("Invalid '\\%1' (already a member of '%2')")
- .arg(COMMAND_RELATES, arg));
+ doc.location().warning(
+ tr("Invalid '\\%1' (already a member of '%2')").arg(COMMAND_RELATES, arg));
} else {
if (node->isAggregate()) {
doc.location().warning(tr("Invalid '\\%1' not allowed in '\\%2'")
- .arg(COMMAND_RELATES, node->nodeTypeString()));
+ .arg(COMMAND_RELATES, node->nodeTypeString()));
} else if (!node->isRelatedNonmember() &&
//!node->parent()->name().isEmpty() &&
- !node->parent()->isNamespace() &&
- !node->parent()->isHeader()) {
+ !node->parent()->isNamespace() && !node->parent()->isHeader()) {
if (!doc.isInternal()) {
doc.location().warning(tr("Invalid '\\%1' ('%2' must be global)")
- .arg(COMMAND_RELATES, node->name()));
+ .arg(COMMAND_RELATES, node->name()));
}
} else if (!node->isRelatedNonmember() && !node->parent()->isHeader()) {
aggregate->adoptChild(node);
@@ -603,51 +550,41 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
Node *clone = node->clone(aggregate);
if (clone == nullptr) {
doc.location().warning(tr("Invalid '\\%1' (multiple uses not allowed in '%2')")
- .arg(COMMAND_RELATES, node->nodeTypeString()));
+ .arg(COMMAND_RELATES, node->nodeTypeString()));
} else {
clone->setRelatedNonmember(true);
}
}
}
- }
- else if (command == COMMAND_CONTENTSPAGE) {
+ } else if (command == COMMAND_CONTENTSPAGE) {
setLink(node, Node::ContentsLink, arg);
- }
- else if (command == COMMAND_NEXTPAGE) {
+ } else if (command == COMMAND_NEXTPAGE) {
setLink(node, Node::NextLink, arg);
- }
- else if (command == COMMAND_PREVIOUSPAGE) {
+ } else if (command == COMMAND_PREVIOUSPAGE) {
setLink(node, Node::PreviousLink, arg);
- }
- else if (command == COMMAND_STARTPAGE) {
+ } else if (command == COMMAND_STARTPAGE) {
setLink(node, Node::StartLink, arg);
- }
- else if (command == COMMAND_QMLINHERITS) {
+ } else if (command == COMMAND_QMLINHERITS) {
if (node->name() == arg)
doc.location().warning(tr("%1 tries to inherit itself").arg(arg));
else if (node->isQmlType() || node->isJsType()) {
QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(arg);
}
- }
- else if (command == COMMAND_QMLINSTANTIATES) {
+ } else if (command == COMMAND_QMLINSTANTIATES) {
if (node->isQmlType() || node->isJsType()) {
ClassNode *classNode = qdb_->findClassNode(arg.split("::"));
if (classNode)
node->setClassNode(classNode);
else
doc.location().warning(tr("C++ class %1 not found: \\instantiates %1").arg(arg));
- }
- else
+ } else
doc.location().warning(tr("\\instantiates is only allowed in \\qmltype"));
- }
- else if (command == COMMAND_QMLDEFAULT) {
+ } else if (command == COMMAND_QMLDEFAULT) {
node->markDefault();
- }
- else if (command == COMMAND_QMLREADONLY) {
+ } else if (command == COMMAND_QMLREADONLY) {
node->markReadOnly(1);
- }
- else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
+ } else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
if (node->isQmlType() || node->isJsType())
node->setAbstract(true);
} else if (command == COMMAND_DEPRECATED) {
@@ -656,13 +593,14 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
// Note: \ingroup and \inpublicgroup are the same (and now recognized as such).
qdb_->addToGroup(arg, node);
} else if (command == COMMAND_INMODULE) {
- qdb_->addToModule(arg,node);
+ qdb_->addToModule(arg, node);
} else if (command == COMMAND_INQMLMODULE) {
- qdb_->addToQmlModule(arg,node);
+ qdb_->addToQmlModule(arg, node);
} else if (command == COMMAND_INJSMODULE) {
qdb_->addToJsModule(arg, node);
} else if (command == COMMAND_MAINCLASS) {
- node->doc().location().warning(tr("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
+ node->doc().location().warning(
+ tr("'\\mainclass' is deprecated. Consider '\\ingroup mainclasses'"));
} else if (command == COMMAND_OBSOLETE) {
node->setStatus(Node::Obsolete);
} else if (command == COMMAND_NONREENTRANT) {
@@ -695,8 +633,9 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
} else if (command == COMMAND_QTVARIABLE) {
node->setQtVariable(arg);
if (!node->isModule() && !node->isQmlModule())
- doc.location().warning(tr("Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
- .arg(COMMAND_QTVARIABLE));
+ doc.location().warning(
+ tr("Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
+ .arg(COMMAND_QTVARIABLE));
} else if (command == COMMAND_NOAUTOLIST) {
node->setNoAutoList(true);
}
@@ -721,7 +660,8 @@ void CppCodeParser::processMetaCommands(const Doc &doc, Node *node)
/*!
Parse QML/JS signal/method topic commands.
*/
-FunctionNode *CppCodeParser::parseOtherFuncArg(const QString &topic, const Location &location, const QString &funcArg)
+FunctionNode *CppCodeParser::parseOtherFuncArg(const QString &topic, const Location &location,
+ const QString &funcArg)
{
QString funcName;
QString returnType;
@@ -827,42 +767,40 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
oldMacroNode->doc().location().warning(tr("(The previous doc is here)"));
}
return macro;
- }
+}
void CppCodeParser::setExampleFileLists(PageNode *pn)
{
QString examplePath = pn->name();
- QString proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pro";
- QString fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName);
+ QString proFileName =
+ examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pro";
+ QString fullPath =
+ Config::findFile(pn->doc().location(), exampleFiles, exampleDirs, proFileName);
if (fullPath.isEmpty()) {
QString tmp = proFileName;
proFileName = examplePath + QLatin1Char('/') + "qbuild.pro";
- fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName);
+ fullPath = Config::findFile(pn->doc().location(), exampleFiles, exampleDirs, proFileName);
if (fullPath.isEmpty()) {
- proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".qmlproject";
- fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
- proFileName);
+ proFileName = examplePath + QLatin1Char('/')
+ + examplePath.split(QLatin1Char('/')).last() + ".qmlproject";
+ fullPath =
+ Config::findFile(pn->doc().location(), exampleFiles, exampleDirs, proFileName);
if (fullPath.isEmpty()) {
- proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pyproject";
- fullPath = Config::findFile(pn->doc().location(),
- exampleFiles,
- exampleDirs,
+ proFileName = examplePath + QLatin1Char('/')
+ + examplePath.split(QLatin1Char('/')).last() + ".pyproject";
+ fullPath = Config::findFile(pn->doc().location(), exampleFiles, exampleDirs,
proFileName);
if (fullPath.isEmpty()) {
- QString details = QLatin1String("Example directories: ") + exampleDirs.join(QLatin1Char(' '));
+ QString details = QLatin1String("Example directories: ")
+ + exampleDirs.join(QLatin1Char(' '));
if (!exampleFiles.isEmpty())
- details += QLatin1String(", example files: ") + exampleFiles.join(QLatin1Char(' '));
- pn->location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details);
- pn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath), details);
+ details += QLatin1String(", example files: ")
+ + exampleFiles.join(QLatin1Char(' '));
+ pn->location().warning(
+ tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details);
+ pn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath),
+ details);
return;
}
}
@@ -874,11 +812,13 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
sizeOfBoringPartOfName = sizeOfBoringPartOfName - 2;
fullPath.truncate(fullPath.lastIndexOf('/'));
- QStringList exampleFiles = Config::getFilesHere(fullPath, exampleNameFilter, Location(), excludeDirs, excludeFiles);
+ QStringList exampleFiles = Config::getFilesHere(fullPath, exampleNameFilter, Location(),
+ excludeDirs, excludeFiles);
// Search for all image files under the example project, excluding doc/images directory.
QSet<QString> excludeDocDirs(excludeDirs);
excludeDocDirs.insert(QDir(fullPath).canonicalPath() + "/doc/images");
- QStringList imageFiles = Config::getFilesHere(fullPath, exampleImageFilter, Location(), excludeDocDirs, excludeFiles);
+ QStringList imageFiles = Config::getFilesHere(fullPath, exampleImageFilter, Location(),
+ excludeDocDirs, excludeFiles);
if (!exampleFiles.isEmpty()) {
// move main.cpp and to the end, if it exists
QString mainCpp;
@@ -889,12 +829,13 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
mainCpp = fileName;
return true;
}
- return fileName.contains("/qrc_") || fileName.contains("/moc_") || fileName.contains("/ui_");
+ return fileName.contains("/qrc_") || fileName.contains("/moc_")
+ || fileName.contains("/ui_");
};
- exampleFiles.erase(std::remove_if(exampleFiles.begin(), exampleFiles.end(),
- isGeneratedOrMainCpp),
- exampleFiles.end());
+ exampleFiles.erase(
+ std::remove_if(exampleFiles.begin(), exampleFiles.end(), isGeneratedOrMainCpp),
+ exampleFiles.end());
if (!mainCpp.isEmpty())
exampleFiles.append(mainCpp);
@@ -918,10 +859,8 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
*/
bool CppCodeParser::isJSMethodTopic(const QString &t)
{
- return (t == COMMAND_JSSIGNAL ||
- t == COMMAND_JSMETHOD ||
- t == COMMAND_JSATTACHEDSIGNAL ||
- t == COMMAND_JSATTACHEDMETHOD);
+ return (t == COMMAND_JSSIGNAL || t == COMMAND_JSMETHOD || t == COMMAND_JSATTACHEDSIGNAL
+ || t == COMMAND_JSATTACHEDMETHOD);
}
/*!
@@ -930,10 +869,8 @@ bool CppCodeParser::isJSMethodTopic(const QString &t)
*/
bool CppCodeParser::isQMLMethodTopic(const QString &t)
{
- return (t == COMMAND_QMLSIGNAL ||
- t == COMMAND_QMLMETHOD ||
- t == COMMAND_QMLATTACHEDSIGNAL ||
- t == COMMAND_QMLATTACHEDMETHOD);
+ return (t == COMMAND_QMLSIGNAL || t == COMMAND_QMLMETHOD || t == COMMAND_QMLATTACHEDSIGNAL
+ || t == COMMAND_QMLATTACHEDMETHOD);
}
/*!
@@ -954,7 +891,8 @@ bool CppCodeParser::isQMLPropertyTopic(const QString &t)
return (t == COMMAND_QMLPROPERTY || t == COMMAND_QMLATTACHEDPROPERTY);
}
-void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeList &nodes, DocList &docs)
+void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeList &nodes,
+ DocList &docs)
{
if (isQMLPropertyTopic(topic) || isJSPropertyTopic(topic)) {
processQmlProperties(doc, nodes, docs);