diff options
author | Martin Smith <martin.smith@digia.com> | 2014-05-23 13:26:36 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-01 13:40:53 +0200 |
commit | 46959875cf7ddeb9bbcee883e4bfaef63992b870 (patch) | |
tree | 727c786536dbd21b28eaa8fcaf429259c97f6dc1 /src/tools/qdoc/node.h | |
parent | bb794270ec6cffb5f95bd7d18056b9e7bede7baa (diff) |
qdoc: Give documenter more control of linking
This update is preparation for implementing the actual task
described in the bug. To implement it required converting
the QML type node and the QML basic type node to be first
order tree nodes instead of subtypes of the documentation
node. This cleans up a lot of messy logic in some places.
It was also necessary to split the getLink() function in the
html output generator into two functions, one still called
getLink(), which handles the \l command, and one called
qetAutoLink() which is called for generating auto links.
This should make qdoc run faster.
The basic infrastructure was also added for parsing the
string in the square brackets for the \l command.
There will be a further update to complete this task.
Note that some autolinks might not be generated due to
this change. I haven't seen any yet, but I believe there
will be some. This can be fixed later, if it is a problem.
Task-number: QTBUG-39221
Change-Id: I8135229984398408205ba901b9ef95ceac74683c
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/tools/qdoc/node.h')
-rw-r--r-- | src/tools/qdoc/node.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index bbbc29d51a..ebdaad9010 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -49,12 +49,11 @@ #include "codechunk.h" #include "doc.h" -#include "location.h" -#include "text.h" QT_BEGIN_NAMESPACE class Node; +class Tree; class EnumNode; class ClassNode; class InnerNode; @@ -83,6 +82,7 @@ class Node public: enum Type { + NoType, Namespace, Class, Document, @@ -93,12 +93,14 @@ public: Variable, Group, Module, + QmlType, QmlModule, QmlPropertyGroup, QmlProperty, QmlSignal, QmlSignalHandler, QmlMethod, + QmlBasicType, LastType }; @@ -110,8 +112,6 @@ public: Image, Page, ExternalPage, - QmlClass, - QmlBasicType, DitaMap, Collision, LastSubtype @@ -248,11 +248,13 @@ public: virtual bool wasSeen() const { return false; } virtual void appendGroupName(const QString& ) { } virtual QString element() const { return QString(); } + virtual Tree* tree() const { return 0; } bool isIndexNode() const { return indexNodeFlag_; } Type type() const { return nodeType_; } virtual SubType subType() const { return NoSubType; } bool match(const NodeTypeList& types) const; InnerNode* parent() const { return parent_; } + const Node* root() const; InnerNode* relates() const { return relatesTo_; } const QString& name() const { return name_; } QString moduleName() const; @@ -318,6 +320,8 @@ public: static QString nodeSubtypeString(unsigned t); static int incPropertyGroupCount(); static void clearPropertyGroupCount(); + static void initialize(); + static Type goal(const QString& t) { return goals_.value(t); } protected: Node(Type type, InnerNode* parent, const QString& name); @@ -347,6 +351,7 @@ private: QString outSubDir_; static QStringMap operators_; static int propertyGroupCount_; + static QMap<QString,Node::Type> goals_; }; class InnerNode : public Node @@ -435,6 +440,11 @@ public: NamespaceNode(InnerNode* parent, const QString& name); virtual ~NamespaceNode() { } virtual bool isNamespace() const { return true; } + virtual Tree* tree() const { return tree_; } + void setTree(Tree* t) { tree_ = t; } + + private: + Tree* tree_; }; struct RelatedClass @@ -583,7 +593,7 @@ struct ImportRec { typedef QList<ImportRec> ImportList; -class QmlClassNode : public DocNode +class QmlClassNode : public InnerNode { public: QmlClassNode(InnerNode* parent, const QString& name); @@ -635,7 +645,7 @@ private: ImportList importList_; }; -class QmlBasicTypeNode : public DocNode +class QmlBasicTypeNode : public InnerNode { public: QmlBasicTypeNode(InnerNode* parent, @@ -719,17 +729,13 @@ public: EnumItem() { } EnumItem(const QString& name, const QString& value) : nam(name), val(value) { } - EnumItem(const QString& name, const QString& value, const Text &txt) - : nam(name), val(value), txt(txt) { } const QString& name() const { return nam; } const QString& value() const { return val; } - const Text &text() const { return txt; } private: QString nam; QString val; - Text txt; }; class EnumNode : public LeafNode |