summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2019-01-22 13:20:47 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-01-23 15:42:14 +0000
commitf17ec3aac885cd347a3d3c6d74541a9aadc5fc78 (patch)
treeae3692c73b8ee5b5b3370104140254fa299d0ee3
parent8933c91ccb650930f72343340c15c847df35df25 (diff)
QDoc: filter out internal nodes when processing args
CppCodeParser::processTopicArgs() neglected to check whether nodes are internal (or internals are to be included) before including them. Add Doc::isInternal() and CodeParser::showInternal() to let it check this and add the check. Tidied up surrounding code in the process. Change-Id: I9e1ca379a8e58c1519c345bbf98f441915998061 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--src/qdoc/codeparser.h3
-rw-r--r--src/qdoc/cppcodeparser.cpp31
-rw-r--r--src/qdoc/doc.cpp9
-rw-r--r--src/qdoc/doc.h1
4 files changed, 30 insertions, 14 deletions
diff --git a/src/qdoc/codeparser.h b/src/qdoc/codeparser.h
index 07cddd220..39abd9dab 100644
--- a/src/qdoc/codeparser.h
+++ b/src/qdoc/codeparser.h
@@ -83,13 +83,14 @@ protected:
static void extractPageLinkAndDesc(const QString& arg,
QString* link,
QString* desc);
+ static bool showInternal() { return showInternal_; }
QString moduleHeader_;
QString currentFile_;
QDocDatabase* qdb_;
+ static bool showInternal_;
private:
static QList<CodeParser *> parsers;
- static bool showInternal_;
static bool singleExec_;
};
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 83b989033..20341b769 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -1397,17 +1397,19 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL
processQmlProperties(doc, nodes, docs, true);
} else {
ArgList args = doc.metaCommandArgs(topic);
- Node *node = 0;
+ Node *node = nullptr;
if (args.size() == 1) {
- if (topic == COMMAND_FN)
- node = parserForLanguage("Clang")->parseFnArg(doc.location(), args[0].first);
- else if (topic == COMMAND_MACRO)
+ if (topic == COMMAND_FN) {
+ if (showInternal() || !doc.isInternal())
+ node = parserForLanguage("Clang")->parseFnArg(doc.location(), args[0].first);
+ } else if (topic == COMMAND_MACRO) {
node = parseMacroArg(doc.location(), args[0].first);
- else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic))
+ } else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) {
node = parseOtherFuncArg(topic, doc.location(), args[0].first);
- else
+ } else {
node = processTopicCommand(doc, topic, args[0]);
- if (node != 0) {
+ }
+ if (node != nullptr) {
nodes.append(node);
docs.append(doc);
}
@@ -1415,15 +1417,18 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL
QVector<SharedCommentNode*> sharedCommentNodes;
ArgList::ConstIterator arg = args.constBegin();
while (arg != args.constEnd()) {
- if (topic == COMMAND_FN)
- node = parserForLanguage("Clang")->parseFnArg(doc.location(), arg->first);
- else if (topic == COMMAND_MACRO)
+ node = nullptr;
+ if (topic == COMMAND_FN) {
+ if (showInternal() || !doc.isInternal())
+ node = parserForLanguage("Clang")->parseFnArg(doc.location(), arg->first);
+ } else if (topic == COMMAND_MACRO) {
node = parseMacroArg(doc.location(), arg->first);
- else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic))
+ } else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) {
node = parseOtherFuncArg(topic, doc.location(), arg->first);
- else
+ } else {
node = processTopicCommand(doc, topic, *arg);
- if (node != 0) {
+ }
+ if (node != nullptr) {
bool found = false;
for (SharedCommentNode *scn : sharedCommentNodes) {
if (scn->parent() == node->parent()) {
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index 9144b9011..a0d724695 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -3073,6 +3073,15 @@ const QSet<QString> &Doc::metaCommandsUsed() const
}
/*!
+ Returns true if the set of metacommands used in the doc
+ comment contains \e {internal}.
+ */
+bool Doc::isInternal() const
+{
+ return metaCommandsUsed().contains(QLatin1String("internal"));
+}
+
+/*!
Returns a reference to the list of topic commands used in the
current qdoc comment. Normally there is only one, but there
can be multiple \e{qmlproperty} commands, for example.
diff --git a/src/qdoc/doc.h b/src/qdoc/doc.h
index 0420f02a7..d9873c4bb 100644
--- a/src/qdoc/doc.h
+++ b/src/qdoc/doc.h
@@ -159,6 +159,7 @@ public:
bool hasTableOfContents() const;
bool hasKeywords() const;
bool hasTargets() const;
+ bool isInternal() const;
const QList<Atom *> &tableOfContents() const;
const QVector<int> &tableOfContentsLevels() const;
const QList<Atom *> &keywords() const;