diff options
author | Topi Reinio <topi.reinio@digia.com> | 2015-06-09 10:59:10 +0200 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@digia.com> | 2015-07-24 10:36:03 +0000 |
commit | 7a85be3371b9022815fdb208ee05cb3d302b9cb7 (patch) | |
tree | 8c44355c29fa229b365bdeda0286e197bd031e81 /src/tools/qdoc/htmlgenerator.cpp | |
parent | 80dbdf0de3bfe5f0710a1c37932ef81cbdb5fbff (diff) |
qdoc: Improve searching of collection nodes
QDocDatabase provided a way to search for a collection node in
the primary tree only. This was insufficient for use cases where
we want to list groups, C++ classes or QML types in other modules
using the \generatelist or \annotatedlist commands.
This commit does the following changes:
- Add a function to find a collection node across all
trees, use it for generating output for the list commands
and generating C++ class/QML/JS type requisite tables.
- Modify the code for \generatelist command to accept
'qmltypesbymodule' and 'jstypesbymodule' as parameters.
- Modify constness of some functions to enable above
changes.
Change-Id: I3dbdadfd224754db4bdc1602a5ffab9d46c51f00
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/htmlgenerator.cpp')
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index fc880b404f..e345e1745d 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -471,7 +471,7 @@ QString HtmlGenerator::generateLinksToBrokenLinksPage(CodeMarker* marker, int& c */ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) { - int skipAhead = 0; + int idx, skipAhead = 0; static bool in_para = false; switch (atom->type()) { @@ -661,7 +661,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark break; case Atom::AnnotatedList: { - CollectionNode* cn = qdb_->getCollection(atom->string(), Node::DOC); + const CollectionNode* cn = qdb_->getCollectionNode(atom->string(), Node::DOC); if (cn) generateList(cn, marker, atom->string()); } @@ -683,16 +683,25 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark else if (atom->string() == QLatin1String("qmltypes")) { generateCompactList(Generic, relative, qdb_->getQmlTypes(), true, QStringLiteral("")); } - else if (atom->string().contains("classesbymodule")) { - QString physicalModuleName = atom->string().mid(atom->string().indexOf("classesbymodule") + 15).trimmed(); + else if ((idx = atom->string().indexOf(QStringLiteral("bymodule"))) != -1) { + QString moduleName = atom->string().mid(idx + 8).trimmed(); + Node::Genus genus = Node::CPP; + if (atom->string().startsWith(QStringLiteral("qml"))) + genus = Node::QML; + else if (atom->string().startsWith(QStringLiteral("js"))) + genus = Node::JS; QDocDatabase* qdb = QDocDatabase::qdocDB(); - CollectionNode* cn = qdb->findModule(physicalModuleName); + const CollectionNode* cn = qdb->getCollectionNode(moduleName, genus); if (cn) { - NodeMap m; - cn->getMemberClasses(m); - if (!m.isEmpty()) { - generateAnnotatedList(relative, marker, m); + if (genus == Node::CPP) { + NodeMap m; + cn->getMemberClasses(m); + if (!m.isEmpty()) { + generateAnnotatedList(relative, marker, m); + } } + else + generateAnnotatedList(relative, marker, cn->members()); } } else if (atom->string() == QLatin1String("classhierarchy")) { @@ -2131,7 +2140,7 @@ void HtmlGenerator::generateRequisites(Aggregate *inner, CodeMarker *marker) if (inner->type() == Node::Class || inner->type() == Node::Namespace) { //add the QT variable to the map if (!inner->physicalModuleName().isEmpty()) { - CollectionNode* cn = qdb_->findModule(inner->physicalModuleName()); + const CollectionNode* cn = qdb_->getCollectionNode(inner->physicalModuleName(), Node::CPP); if (cn && !cn->qtVariable().isEmpty()) { text.clear(); text << "QT += " + cn->qtVariable(); @@ -2241,11 +2250,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker) //add the module name and version to the map QString logicalModuleVersion; - CollectionNode* collection = 0; - if (qcn->isJsNode()) - collection = qdb_->findJsModule(qcn->logicalModuleName()); - else - collection = qdb_->findQmlModule(qcn->logicalModuleName()); + const CollectionNode* collection = qdb_->getCollectionNode(qcn->logicalModuleName(), qcn->genus()); if (collection) logicalModuleVersion = collection->logicalModuleVersion(); else |