diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-04-21 23:57:46 +0200 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-04-23 10:19:54 +0200 |
commit | e967772fe884dd8a488a359c122c9cbae9d94c55 (patch) | |
tree | 570c6bb5f46ef5409f4508a746dbde4542f7d7a9 /src/qdoc/node.h | |
parent | 95cd9078938bcd88fdfbba707911e8111f59f195 (diff) |
qdoc: properly implement \typealias command
\typealias was already a command recognized by QDoc, but it was simply
treated as a synonym for \typedef and was not documented. Implement
proper support for the command:
- Add [alias] designation both in type summary and details.
- Auto-generate information about the aliased type, including a link
if aliasing a public, documented type.
- Auto-convert aliases documented with \typedef to type aliases.
- Add basic support for aliases also to DocBook and WebXML generators.
- Document \typealias.
Fixes: QTBUG-82712
Change-Id: Iafa8c7def0a7488d7521fbc2862290a9bb3167ff
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/node.h')
-rw-r--r-- | src/qdoc/node.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/qdoc/node.h b/src/qdoc/node.h index b7293f408..4ec01673f 100644 --- a/src/qdoc/node.h +++ b/src/qdoc/node.h @@ -86,6 +86,7 @@ public: ExternalPage, Function, Typedef, + TypeAlias, Property, Variable, Group, @@ -198,8 +199,8 @@ public: bool isRelatedNonmember() const { return relatedNonmember_; } bool isStruct() const { return nodeType_ == Struct; } bool isSharedCommentNode() const { return nodeType_ == SharedComment; } - bool isTypeAlias() const { return nodeType_ == Typedef; } - bool isTypedef() const { return nodeType_ == Typedef; } + bool isTypeAlias() const { return nodeType_ == TypeAlias; } + bool isTypedef() const { return nodeType_ == Typedef || nodeType_ == TypeAlias; } bool isUnion() const { return nodeType_ == Union; } bool isVariable() const { return nodeType_ == Variable; } bool isGenericCollection() const { return (nodeType_ == Node::Collection); } @@ -892,8 +893,8 @@ private: class TypedefNode : public Node { public: - TypedefNode(Aggregate *parent, const QString &name) - : Node(Typedef, parent, name), associatedEnum_(nullptr) + TypedefNode(Aggregate *parent, const QString &name, NodeType type = Typedef) + : Node(type, parent, name), associatedEnum_(nullptr) { } @@ -912,16 +913,21 @@ private: class TypeAliasNode : public TypedefNode { public: - TypeAliasNode(Aggregate *parent, const QString &name, const QString &aliasedType) - : TypedefNode(parent, name), aliasedType_(aliasedType) + TypeAliasNode(Aggregate *parent, + const QString &name, + const QString &aliasedType) + : TypedefNode(parent, name, NodeType::TypeAlias), aliasedType_(aliasedType) { } - QString aliasedType() { return aliasedType_; } + const QString &aliasedType() const { return aliasedType_; } + const Node *aliasedNode() const { return aliasedNode_; } + void setAliasedNode(const Node *node) { aliasedNode_ = node; } Node *clone(Aggregate *parent) override; private: QString aliasedType_; + const Node *aliasedNode_ {}; }; inline void EnumNode::setFlagsType(TypedefNode *t) |