diff options
author | Martin Smith <martin.smith@digia.com> | 2014-01-31 11:56:10 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-31 21:04:52 +0200 |
commit | 5fecc6512f0e869713658502674665f9077cc340 (patch) | |
tree | 523f6ae6de75862b61694d9e090f62b42e5dff7d /src/tools/qdoc/tree.h | |
parent | e9954e31624c77d986077ec5431c7ec4a9b058e0 (diff) |
qdoc: Teach qdoc to use multiple trees (part 2)
qdoc now knows how to search the forrest of node
trees in an optimal order. But there remain some
problems with specific searches that cross module
boundaries. These include group membership and C++
and QML module membership, as well ass C++ base
class resolution. Part 3 will be concerned with
fixing these remaining bugs.
With this update, qdoc now takes less time to
generate the docs for Qt 5. Testing indicates
that qdoc run time has dropped from about 14
minutes to about 7.5 minutes on an iMac.
Task-number: QTBUG-35377
Change-Id: I6bded6ef54124b4f6e5914cad4548f0b600209b0
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/tree.h')
-rw-r--r-- | src/tools/qdoc/tree.h | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h index e1a08dd471..1fe0046ae5 100644 --- a/src/tools/qdoc/tree.h +++ b/src/tools/qdoc/tree.h @@ -46,6 +46,7 @@ #ifndef TREE_H #define TREE_H +#include <QtCore/qstack.h> #include "node.h" QT_BEGIN_NAMESPACE @@ -53,23 +54,36 @@ QT_BEGIN_NAMESPACE class QStringList; class QDocDatabase; +struct TargetRec +{ + public: + enum Type { Unknown, Target, Keyword, Contents, Class, Function, Page, Subtitle }; + TargetRec() : node_(0), priority_(INT_MAX), type_(Unknown) { } + bool isEmpty() const { return ref_.isEmpty(); } + Node* node_; + QString ref_; + int priority_; + Type type_; +}; +typedef QMultiMap<QString, TargetRec> TargetMap; +typedef QMultiMap<QString, DocNode*> DocNodeMultiMap; + class Tree { private: + friend class QDocForest; friend class QDocDatabase; typedef QMap<PropertyNode::FunctionRole, QString> RoleMap; typedef QMap<PropertyNode*, RoleMap> PropertyMap; - Tree(QDocDatabase* qdb); + Tree(const QString& module, QDocDatabase* qdb); ~Tree(); - /* API members */ ClassNode* findClassNode(const QStringList& path, Node* start = 0) const; NamespaceNode* findNamespaceNode(const QStringList& path) const; FunctionNode* findFunctionNode(const QStringList& parentPath, const FunctionNode* clone); - /* internal members */ Node* findNodeRecursive(const QStringList& path, int pathIndex, Node* start, @@ -90,19 +104,22 @@ class Tree int findFlags, bool qml) const; -// --------------------------------------------------------------------- QmlClassNode* findQmlTypeNode(const QStringList& path); Node* findNodeByNameAndType(const QStringList& path, Node::Type type, Node::SubType subtype, - Node* start, bool acceptCollision = false); InnerNode* findRelatesNode(const QStringList& path); - NameCollisionNode* checkForCollision(const QString& name) const; + NameCollisionNode* checkForCollision(const QString& name); NameCollisionNode* findCollisionNode(const QString& name) const; + QString findTarget(const QString& target, const Node* node) const; + void insertTarget(const QString& name, TargetRec::Type type, Node* node, int priority); + void resolveTargets(InnerNode* root); + const Node* findUnambiguousTarget(const QString& target, QString& ref, const Node* relative); + const DocNode* findDocNodeByTitle(const QString& title, const Node* relative = 0) const; void addPropertyFunction(PropertyNode *property, const QString &funcName, @@ -122,14 +139,20 @@ class Tree FunctionNode *findVirtualFunctionInBaseClasses(ClassNode *classe, FunctionNode *clone); NodeList allBaseClasses(const ClassNode *classe) const; + QString refForAtom(const Atom* atom); public: - static bool debug_; + const QString& moduleName() const { return module_; } private: + QString module_; QDocDatabase* qdb_; NamespaceNode root_; PropertyMap unresolvedPropertyMap; + DocNodeMultiMap docNodesByTitle_; + TargetMap nodesByTarget_; + //NodeMap nodesByName_; + //NodeMap nodesByTitle_; }; QT_END_NAMESPACE |