From c77f7229d5c7e5017ddf90b1e9445251761878bf Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 16 Apr 2013 15:03:31 +0200 Subject: 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 --- src/tools/qdoc/qdocdatabase.cpp | 96 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 93 insertions(+), 3 deletions(-) (limited to 'src/tools/qdoc/qdocdatabase.cpp') 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) @@ -547,6 +545,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(*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(*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(*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 -- cgit v1.2.3