summaryrefslogtreecommitdiffstats
path: root/src/qdoc/tree.h
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2018-07-06 09:54:36 +0200
committerMartin Smith <martin.smith@qt.io>2018-10-23 14:15:23 +0000
commitfcdb57ed07d36b0b72f41da974550f505a162077 (patch)
treea456bc1ca3002fb1e90ab689f81247b65782c790 /src/qdoc/tree.h
parent2144c9bb23e672ad76170ba605d8155dda0509cd (diff)
qdoc: Reorganize Qdoc's Node class hierarchy
This is a significant refactoring of QDoc's Node class hierarchy, which is meant to make maintenance of QDoc easier, and which will enable further development of QDoc as a library and plugin. Class DocumentNode is renamed to class PageNode, and it inherits the Node base class instead of inheriting class Aggregate. Class Aggregate inherits class PageNode instead of the Node base class. IOW, class DocumentNode and class Aggregate have swapped places in the class hierarchy, and DocumentNode has changed its name to PageNode. This makes the Node hierarchy more logical because: 1. Every entity that causes a documentation page to be written is a PageNode. 2. Only those PageNodes that can have children are Aggregates. Thus the HeaderFile subtype of the former DocumentNode has been promoted to class HeaderNode, which is a subclass of Aggregate. This makes sense because the old HeaderFile DocumentNode caused a documentation page to be generated, and that documentation page was very much like a class reference page. The \headerfile command is not used a lot in the Qt documentation but there are some useful cases, so it is worth making a subclass of Aggregate to handle them. The HeaderNode is now processed very much like the ClassNode and the NamespaceNode. Developers should be advised that isDocumentNode() is now isPageNode(), but isPageNode() can no longer be used to decide if an Aggregate* is a PageNode* (DocumentNode*), because Aggregate is now a subclass of PageNode. So a new convenience function is added: isTextPageNode(), which returns true if your Node* is a PageNode but not an Aggregate. IOW, isTextPageNode() returns true if the Node* is some kind of text page that doesn't represent a C++ or QML declaration. Class ExampleNode is a subclass of PageNode, not Aggregate. IOW, an ExampleNode no longer has children. Instead, the example files and example images that belong to the example are stored as string lists. It seems to work, but there might be problems in help files I haven't found yet. Class CollectionNode is now a subclass of Node instead of LeafNode. Class LeafNode is removed. All former subclasses of LeafNode are now subclasses of Node. This change also removes a lot of DITA bitrot. Work remaining to be done: 1. Remove the remaining DITA bitrot. 2. Consider letting QmlProperty and JsProperty be instances of Property and use the Genus value to distiguish them. 3. Also consider replacing QmlPropertyGroup and JsPropertyGroup with a single PropertyGroup and use the Genus value to distinguish them. This update also rearranges the parameters passed to the clang parser, and it removes some diff conflict lines that got saved by mistake. Change-Id: I918f83030c48d96db4a5588ab53458f221a5374e Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/tree.h')
-rw-r--r--src/qdoc/tree.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/qdoc/tree.h b/src/qdoc/tree.h
index 136928fc1..145f9f8aa 100644
--- a/src/qdoc/tree.h
+++ b/src/qdoc/tree.h
@@ -81,7 +81,7 @@ struct TargetLoc
};
typedef QMultiMap<QString, TargetRec*> TargetMap;
-typedef QMultiMap<QString, DocumentNode*> DocumentNodeMultiMap;
+typedef QMultiMap<QString, PageNode*> PageNodeMultiMap;
typedef QMap<QString, QmlTypeNode*> QmlTypeMap;
typedef QMultiMap<QString, const ExampleNode*> ExampleNodeMap;
typedef QVector<TargetLoc*> TargetList;
@@ -115,7 +115,7 @@ class Tree
Node* findNodeRecursive(const QStringList& path,
int pathIndex,
Node* start,
- const NodeTypeList& types) const;
+ const QList<int> &types) const;
const Node* findNodeForTarget(const QStringList& path,
const QString& target,
@@ -139,7 +139,7 @@ class Tree
QmlTypeNode* findQmlTypeNode(const QStringList& path);
Node* findNodeByNameAndType(const QStringList& path, Node::NodeType type) const;
- Aggregate* findRelatesNode(const QStringList& path);
+ PageNode* findRelatesNode(const QStringList& path);
QString getRef(const QString& target, const Node* node) const;
void insertTarget(const QString& name,
const QString& title,
@@ -148,7 +148,7 @@ class Tree
int priority);
void resolveTargets(Aggregate* root);
const Node* findUnambiguousTarget(const QString& target, Node::Genus genus, QString& ref) const;
- const DocumentNode* findDocumentNodeByTitle(const QString& title) const;
+ const PageNode* findPageNodeByTitle(const QString& title) const;
void addPropertyFunction(PropertyNode *property,
const QString &funcName,
@@ -171,19 +171,19 @@ class Tree
NodeList allBaseClasses(const ClassNode *classe) const;
QString refForAtom(const Atom* atom);
- CNMap* getCollectionMap(Node::Genus genus);
+ CNMap* getCollectionMap(Node::NodeType type);
const CNMap& groups() const { return groups_; }
const CNMap& modules() const { return modules_; }
const CNMap& qmlModules() const { return qmlModules_; }
const CNMap& jsModules() const { return jsModules_; }
- CollectionNode* getCollection(const QString& name, Node::Genus genus);
- CollectionNode* findCollection(const QString& name, Node::Genus genus);
+ CollectionNode* getCollection(const QString& name, Node::NodeType type);
+ CollectionNode* findCollection(const QString& name, Node::NodeType type);
- CollectionNode* findGroup(const QString& name) { return findCollection(name, Node::DOC); }
- CollectionNode* findModule(const QString& name) { return findCollection(name, Node::CPP); }
- CollectionNode* findQmlModule(const QString& name) { return findCollection(name, Node::QML); }
- CollectionNode* findJsModule(const QString& name) { return findCollection(name, Node::JS); }
+ CollectionNode* findGroup(const QString& name) { return findCollection(name, Node::Group); }
+ CollectionNode* findModule(const QString& name) { return findCollection(name, Node::Module); }
+ CollectionNode* findQmlModule(const QString& name) { return findCollection(name, Node::QmlModule); }
+ CollectionNode* findJsModule(const QString& name) { return findCollection(name, Node::JsModule); }
CollectionNode* addGroup(const QString& name) { return findGroup(name); }
CollectionNode* addModule(const QString& name) { return findModule(name); }
@@ -238,7 +238,7 @@ private:
QDocDatabase* qdb_;
NamespaceNode root_;
PropertyMap unresolvedPropertyMap;
- DocumentNodeMultiMap docNodesByTitle_;
+ PageNodeMultiMap pageNodesByTitle_;
TargetMap nodesByTargetRef_;
TargetMap nodesByTargetTitle_;
CNMap groups_;