diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-10-15 11:19:12 +0200 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-11-09 23:30:45 +0100 |
commit | 4cdcfe335eba1142c6b9a56408b88caa6660974c (patch) | |
tree | b0f835a83305d6826e67101cf300bd7c28d2b404 /src/qdoc/generator.cpp | |
parent | 12f8258efcab39a571df4cbb8cacf5bfc2eb8a82 (diff) |
qdoc: Unify generated documentation between \typedef and \typealias
\typedef can be used as a substitute for \typealias for documenting
aliases. Since they are identical in terms of usage, unify also the
way they are documented:
- Remove 'typedef' and '(alias)' from both the summary and details
sections, making both appear as types.
- Remove automatically generated 'This is a type alias for ...' note
for type aliases. This typically resulted in duplicate statements.
- Use '-typedef' anchor suffix for both.
- Use 'typedef' as element for both in .index files and webxml output
format.
- Add template parameters for type aliases for DocBook generator;
these were previously missing.
Fixes: QTBUG-87622
Change-Id: I93986a2dc91c3c3dff9e21f5bf5cf19d0b55c4df
Reviewed-by: Topi ReiniΓΆ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/generator.cpp')
-rw-r--r-- | src/qdoc/generator.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 81f0583f6..6be40cce7 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -625,17 +625,14 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir) case Node::Enum: anchorRef = QLatin1Char('#') + node->name() + "-enum"; break; - case Node::TypeAlias: - anchorRef = QLatin1Char('#') + node->name() + "-alias"; - break; case Node::Typedef: { - const TypedefNode *tdef = static_cast<const TypedefNode *>(node); - if (tdef->associatedEnum()) { + const auto *tdef = static_cast<const TypedefNode *>(node); + if (tdef->associatedEnum()) return fullDocumentLocation(tdef->associatedEnum()); - } + } Q_FALLTHROUGH(); + case Node::TypeAlias: anchorRef = QLatin1Char('#') + node->name() + "-typedef"; break; - } case Node::Property: anchorRef = QLatin1Char('#') + node->name() + "-prop"; break; @@ -806,8 +803,6 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) // Reimplements clause and type alias info precede body text if (fn && !fn->overridesThis().isEmpty()) generateReimplementsClause(fn, marker); - else if (node->isTypeAlias()) - generateAddendum(node, TypeAlias, marker, false); else if (node->isProperty()) { if (static_cast<const PropertyNode *>(node)->propertyType() != PropertyNode::Standard) generateAddendum(node, BindableProperty, marker); @@ -1407,22 +1402,6 @@ void Generator::generateAddendum(const Node *node, Addendum type, CodeMarker *ma } break; } - case TypeAlias: - { - if (!node->isTypeAlias()) - return; - const auto *ta = static_cast<const TypeAliasNode *>(node); - text << "This is a type alias for "; - if (ta->aliasedNode() && ta->aliasedNode()->isInAPI()) { - text << Atom(Atom::LinkNode, CodeMarker::stringForNode(ta->aliasedNode())) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << Atom(Atom::String, ta->aliasedNode()->plainFullName(ta->parent())) - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << "."; - } else { - text << Atom(Atom::String, ta->aliasedType()) << "."; - } - break; - } case BindableProperty: { text << "This property supports " @@ -2186,9 +2165,8 @@ QString Generator::typeString(const Node *node) case Node::Enum: return "enum"; case Node::Typedef: - return "typedef"; case Node::TypeAlias: - return "alias"; + return "typedef"; case Node::Function: { const auto fn = static_cast<const FunctionNode *>(node); switch (fn->metaness()) { |