17#include <QtCore/qfileinfo.h>
21using namespace Qt::Literals;
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
56
57
58
59
62 traverseNode(root, handler);
66
67
68
69
70
71
72
73
74
75
76
77
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 auto *cn =
static_cast<CollectionNode *>(node);
109 handler.beginDocument(handler.fileName(node));
112 }
else if (cn->isGenericCollection()) {
116 QString name = cn->name().toLower();
117 name.replace(QChar(
' '), QString(
"-"));
118 QString filename = cn->tree()->physicalModuleName() +
"-" + name +
"."
119 + QFileInfo(handler.fileName(node)).suffix();
120 handler.beginDocument(filename);
125 handler.beginDocument(handler.fileName(node));
131 handler.beginDocument(handler.fileName(node));
135 handler.beginDocument(handler.fileName(node));
136 auto *qcn =
static_cast<QmlTypeNode *>(node);
140 handler.beginDocument(handler.fileName(node));
149 auto *aggregate =
static_cast<Aggregate *>(node);
150 const NodeList &children = aggregate->childNodes();
151 for (
auto *child : children) {
152 if (child->isPageNode()) {
153 traverseNode(child, handler);
154 }
else if (!node->parent() && child->isInAPI() && !child->isRelatedNonmember()
155 && !child->doc().isAutoGenerated()) {
157 child->location().warning(
158 u"No documentation generated for %1 '%2' in global scope."_s
159 .arg(child->nodeTypeString(), child->name()),
160 u"Maybe you forgot to use the '\\relates' command?"_s);
161 child->setStatus(Status::DontDocument);
162 }
else if (child->isQmlModule() && !child->wasSeen()) {
164 auto *qmlModule =
static_cast<CollectionNode *>(child);
165 for (
const auto *member : qmlModule->members()) {
166 member->location().warning(
167 u"Undocumented QML module '%1' referred by type '%2' or its members"_s
168 .arg(qmlModule->name(), member->name()),
169 u"Maybe you forgot to document '\\qmlmodule %1'?"_s
170 .arg(qmlModule->name()));
172 }
else if (child->isQmlType() && !child->hasDoc()) {
174 auto *qmlType =
static_cast<QmlTypeNode *>(child);
175 if (
auto qmid = qmlType->logicalModuleName(); !qmid.isEmpty())
176 qmlType->location().warning(
177 u"No such type '%1' in QML module '%2'"_s.arg(qmlType->name(), qmid));
184
185
186
187
188
189
190
191
192
193
194
197 if (!node->url().isNull())
202 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
Interface handling documentation generation during tree traversal.
virtual void generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker)=0
virtual void generateCppReferencePage(Aggregate *aggregate, CodeMarker *marker)=0
virtual void endDocument()=0
virtual void generateCollectionNode(CollectionNode *cn, CodeMarker *marker)=0
virtual void generateGenericCollectionPage(CollectionNode *cn, CodeMarker *marker)=0
virtual void generatePageNode(PageNode *pn, CodeMarker *marker)=0
virtual void mergeCollections(CollectionNode *cn)=0
virtual void generateProxyPage(Aggregate *aggregate, CodeMarker *marker)=0
Traverses the node tree and dispatches to a handler for documentation generation.
void traverse(Node *root, DocumentationHandler &handler)
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
Combined button and popup list for selecting options.
The Node class is the base class for all the nodes in QDoc's parse tree.
bool isExternalPage() const
Returns true if the node type is ExternalPage.
virtual bool docMustBeGenerated() const
This function is called to perform a test to decide if the node must have documentation generated.
bool isNamespace() const
Returns true if the node type is Namespace.
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
bool isHeader() const
Returns true if the node type is HeaderFile.
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Aggregate * parent() const
Returns the node's parent pointer.
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
bool isProxyNode() const
Returns true if the node type is Proxy.
NodeContext createContext() const
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
virtual bool isCollectionNode() const
Returns true if this is an instance of CollectionNode.
bool isIndexNode() const
Returns true if this node was created from something in an index file.