diff options
author | Martin Smith <[email protected]> | 2013-04-16 15:03:31 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-04-17 12:29:55 +0200 |
commit | c77f7229d5c7e5017ddf90b1e9445251761878bf (patch) | |
tree | 9813a8246a64795bab2f214443347863a5a2b963 /src/tools/qdoc/qdocdatabase.cpp | |
parent | 3ae271523ff7fb951df16cfccfaf84c0aa298e16 (diff) |
qdoc: Add index of obsolete members to obsolete page
qdoc has been modified to emit a compact list of the
classes that have one or more obsolete members. The
command is:
\generatelist obsoletecppmembers
This generates an index of all such classes,
where each class name is a link to the class's
subpage of obsolete members. A class's subpage
of obsolete members is also accessible from the
class's reference page, but now it is also
accessible from this index.
Also, The command shown has been added to the
page obsoleteclasses.html in the generated
output. This page already contains the index
of obsolete classes.
Currently, no such output is generated for
QML types and QML types with obsolete members.
But qdoc does accept commands for those:
\generatelist obsoleteqmltypes
and
\generatelist obsoleteqmlmembers
...but qdoc doesn't know what to do with
those commands yet.
Task-number: QTBUG-30270
Change-Id: If19a3b977f64c948e4bd6f14a9e0a287419baa8a
Reviewed-by: Jerome Pasion <[email protected]>
Diffstat (limited to 'src/tools/qdoc/qdocdatabase.cpp')
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 96 |
1 files changed, 93 insertions, 3 deletions
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 30a9efaadad..674917f6dca 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -430,6 +430,7 @@ void QDocDatabase::buildCollections() findAllLegaleseTexts(treeRoot()); findAllNamespaces(treeRoot()); findAllSince(treeRoot()); + findAllObsoleteThings(treeRoot()); } /*! @@ -451,9 +452,6 @@ void QDocDatabase::findAllClasses(const InnerNode* node) if ((*c)->status() == Node::Compat) { compatClasses_.insert(className, *c); } - else if ((*c)->status() == Node::Obsolete) { - obsoleteClasses_.insert(className, *c); - } else { nonCompatClasses_.insert(className, *c); if ((*c)->status() == Node::Main) @@ -548,6 +546,98 @@ void QDocDatabase::findAllNamespaces(const InnerNode* node) } /*! + Finds all nodes with status = Obsolete and sorts them into + maps. They can be C++ classes, QML types, or they can be + functions, enum types, typedefs, methods, etc. + */ +void QDocDatabase::findAllObsoleteThings(const InnerNode* node) +{ + NodeList::const_iterator c = node->childNodes().constBegin(); + while (c != node->childNodes().constEnd()) { + if ((*c)->access() != Node::Private) { + QString name = (*c)->name(); + if ((*c)->status() == Node::Obsolete) { + if ((*c)->type() == Node::Class) { + if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + name = (*c)->parent()->name() + "::" + name; + obsoleteClasses_.insert(name, *c); + } + else if ((*c)->type() == Node::Document && (*c)->subType() == Node::QmlClass) { + if (name.startsWith(QLatin1String("QML:"))) + name = name.mid(4); + name = (*c)->qmlModuleIdentifier() + "::" + name; + obsoleteQmlTypes_.insert(name,*c); + } + } + else if ((*c)->type() == Node::Class) { + InnerNode* n = static_cast<InnerNode*>(*c); + bool inserted = false; + NodeList::const_iterator p = n->childNodes().constBegin(); + while (p != n->childNodes().constEnd()) { + if ((*p)->access() != Node::Private) { + switch ((*p)->type()) { + case Node::Enum: + case Node::Typedef: + case Node::Function: + case Node::Property: + case Node::Variable: + if ((*p)->status() == Node::Obsolete) { + if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && + !(*c)->parent()->name().isEmpty()) + name = (*c)->parent()->name() + "::" + name; + classesWithObsoleteMembers_.insert(name, *c); + inserted = true; + } + break; + default: + break; + } + } + if (inserted) + break; + ++p; + } + } + else if ((*c)->type() == Node::Document && (*c)->subType() == Node::QmlClass) { + InnerNode* n = static_cast<InnerNode*>(*c); + bool inserted = false; + NodeList::const_iterator p = n->childNodes().constBegin(); + while (p != n->childNodes().constEnd()) { + if ((*p)->access() != Node::Private) { + switch ((*c)->type()) { + case Node::QmlProperty: + case Node::QmlSignal: + case Node::QmlSignalHandler: + case Node::QmlMethod: + if ((*c)->parent()) { + Node* parent = (*c)->parent(); + if (parent->subType() == Node::QmlPropertyGroup && parent->parent()) + parent = parent->parent(); + if (parent && parent->subType() == Node::QmlClass && !parent->name().isEmpty()) + name = parent->name() + "::" + name; + } + qmlTypesWithObsoleteMembers_.insert(name,*c); + inserted = true; + break; + default: + break; + } + } + if (inserted) + break; + ++p; + } + } + else if ((*c)->isInnerNode()) { + findAllObsoleteThings(static_cast<InnerNode*>(*c)); + } + } + ++c; + } +} + +/*! Finds all the nodes where a \e{since} command appeared in the qdoc comment and sorts them into maps according to the kind of node. |