diff options
author | Martin Smith <martin.smith@qt.io> | 2019-04-24 16:17:19 +0200 |
---|---|---|
committer | Martin Smith <martin.smith@qt.io> | 2019-05-06 12:36:32 +0000 |
commit | 72eac2f5f3d8ea839c915455e4eed66118d06505 (patch) | |
tree | 1f336a8fdaa04df4980066474fee2a67662effbb /src/qdoc/cppcodeparser.cpp | |
parent | 9a514b9791297afcf237a453a4eb5d89b9be3af5 (diff) | |
download | qttools-72eac2f5f3d8ea839c915455e4eed66118d06505.tar.gz |
qdoc: Make QDoc warn about undocumented public classes
QDoc was marking all undocumented public API elements as
"internal" and "private" because most of these undocumented
elements should not be documented. The standard way to tell
QDoc not to warn about an undocumented elemewnt in the public
API is to give it a QDoc comment with the command "\internl"
in it. But it was decided this would require too much work
to eliminate all the warnings, because there are so many
undocumented elements in the Qt public API that we really
don't want to be documented. So we decided to just mark them
all as both internal and private in QDoc itself, and that
eliminated a great many useless QDoc warnings.
But it also meant that QDoc would no longer warn when a
public element was left undocumented by mistake. This is
most often seen in C++ classes that are in the public API
but are not documented. QFutureInterface is an example of
a class that is not documented but should be documented
because it is useful.
This change lets QDoc warn that a class in the public API
was not documented with a \class comment.
Special cases:
1. If the undocumented class has no members, don't warn that it was
not documented with a \class comment.
2. If the undocumented class's name contains the word "Private" it
is probably not meant to be in the public API, so don't warn that
it has no \class comment.
3. If the undocumented class has no function members, then don't
warn that it has no \class comment.
4. If the undocumented class is marked DontDocument, then don't
warn that it has no \class comment.
The other part of this change relates to item 4 above. To mark a
class or struct as DontDocument required adding a new topic
command to QDoc. The new topic command is \dontdocument. The
argument to this command is a list of class and struct names. The
list is enclosed in parentheses. For example:
\dontdocument (QMacAutoReleasePool QIncompatibleFlag
...
QTextCodec::ConverterState QThreadStorageData)
QDoc looks up each name in the list and marks it DontDocument.
The documentation generator then sees the node is marked
DontDocument and ignores the node. This makes it a lot easier to
tell QDoc which public classes and structs should not generate
the warning about no documentation.
Task-number: QTBUG-57183
Change-Id: I7eee48de03ca7aeb72c63ae90ba373503d41612d
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 05d177f73..f6f2eb5f2 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -60,6 +60,7 @@ CppCodeParser::CppCodeParser() if (topicCommands_.isEmpty()) { topicCommands_ << COMMAND_CLASS << COMMAND_DITAMAP + << COMMAND_DONTDOCUMENT << COMMAND_ENUM << COMMAND_EXAMPLE << COMMAND_EXTERNALPAGE @@ -970,6 +971,8 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL node = parseMacroArg(doc.location(), args[0].first); } else if (isQMLMethodTopic(topic) || isJSMethodTopic(topic)) { node = parseOtherFuncArg(topic, doc.location(), args[0].first); + } else if (topic == COMMAND_DONTDOCUMENT) { + qdb_->primaryTree()->addToDontDocumentMap(args[0].first); } else { node = processTopicCommand(doc, topic, args[0]); } |