summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodemarker.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2017-09-19 14:11:11 +0200
committerMartin Smith <martin.smith@qt.io>2017-11-16 09:08:11 +0000
commitb7a6bbf420d1eed9daefd232dc48933e7d6f7c4e (patch)
tree3f1a7a76feceecb88eab6280a58eb2e531bef5df /src/qdoc/cppcodemarker.cpp
parentd39f463b90d2668138b37f2fc5fdf67296c753bb (diff)
downloadqttools-b7a6bbf420d1eed9daefd232dc48933e7d6f7c4e.tar.gz
qdoc: Handle shared comments better
The shared comment in qdoc was originally meant only for use with the \fn command, and only for multiple \fn commands in the same class. But it proved to be useful for other things, so people started using it in other contexts, even though it didn't work there. This update should handle them all. For example, when listing multiple \fn commands, they no longer need be for functions in the same class. Also, multiple \typedef commands are handled correctly. Change-Id: I4be86026a227d74822f5f2295577adf0fe170d49 Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc/cppcodemarker.cpp')
-rw-r--r--src/qdoc/cppcodemarker.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp
index 8488260fd..cdaecebd9 100644
--- a/src/qdoc/cppcodemarker.cpp
+++ b/src/qdoc/cppcodemarker.cpp
@@ -674,7 +674,7 @@ QList<Section> CppCodeMarker::sections(const Aggregate *inner,
NodeList::ConstIterator r = inner->relatedNodes().constBegin();
while (r != inner->relatedNodes().constEnd()) {
- if ((*r)->type() == Node::Function) {
+ if ((*r)->isFunction()) {
FunctionNode *func = static_cast<FunctionNode *>(*r);
if (func->isMacro())
insert(macros, *r, style, status);
@@ -689,25 +689,20 @@ QList<Section> CppCodeMarker::sections(const Aggregate *inner,
NodeList::ConstIterator c = inner->childNodes().constBegin();
while (c != inner->childNodes().constEnd()) {
- if ((*c)->type() == Node::Enum ||
- (*c)->type() == Node::Typedef) {
+ if ((*c)->isSharingComment()) {
+ // do nothing
+ } else if ((*c)->isEnumType() || (*c)->isTypedef()) {
insert(memberTypes, *c, style, status);
- }
- else if ((*c)->type() == Node::Property) {
+ } else if ((*c)->isProperty()) {
insert(properties, *c, style, status);
- }
- else if ((*c)->type() == Node::Variable) {
+ } else if ((*c)->isVariable()) {
if (!(*c)->doc().isEmpty())
insert(memberVariables, *c, style, status);
- }
- else if ((*c)->type() == Node::Function) {
+ } else if ((*c)->isFunction()) {
FunctionNode *function = static_cast<FunctionNode *>(*c);
- if (!function->isInCollective()) {
- if (!function->hasAssociatedProperties() || !function->doc().isEmpty())
- insert(memberFunctions, function, style, status);
- }
- }
- else if ((*c)->type() == Node::SharedComment) {
+ if (!function->hasAssociatedProperties() || !function->doc().isEmpty())
+ insert(memberFunctions, function, style, status);
+ } else if ((*c)->isSharedCommentNode()) {
SharedCommentNode *scn = static_cast<SharedCommentNode *>(*c);
if (!scn->doc().isEmpty())
insert(memberFunctions, scn, style, status);