18#include <QtCore/qfileinfo.h>
22using namespace Qt::Literals;
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
54
57
58
59
60
63 traverseNode(root, handler);
67
68
69
70
71
72
73
74
75
76
77
78
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 auto *cn =
static_cast<CollectionNode *>(node);
110 handler.beginDocument(handler.fileName(node));
113 }
else if (cn->isGenericCollection()) {
117 QString name = cn->name().toLower();
118 name.replace(QChar(
' '), QString(
"-"));
119 QString filename = cn->tree()->physicalModuleName() +
"-" + name +
"."
120 + QFileInfo(handler.fileName(node)).suffix();
121 handler.beginDocument(filename);
126 handler.beginDocument(handler.fileName(node));
132 handler.beginDocument(handler.fileName(node));
136 handler.beginDocument(handler.fileName(node));
137 auto *qcn =
static_cast<QmlTypeNode *>(node);
141 handler.beginDocument(handler.fileName(node));
150 auto *aggregate =
static_cast<Aggregate *>(node);
151 const NodeList &children = aggregate->childNodes();
152 for (
auto *child : children) {
153 if (child->isPageNode()) {
154 traverseNode(child, handler);
155 }
else if (!node->parent() && child->isInAPI() && !child->isRelatedNonmember()
156 && !child->doc().isAutoGenerated()) {
158 child->location().warning(
159 u"No documentation generated for %1 '%2' in global scope."_s
160 .arg(child->nodeTypeString(), child->name()),
161 u"Maybe you forgot to use the '\\relates' command?"_s);
162 child->setStatus(Status::DontDocument);
163 }
else if (child->isQmlModule() && !child->wasSeen()) {
165 auto *qmlModule =
static_cast<CollectionNode *>(child);
166 for (
const auto *member : qmlModule->members()) {
167 member->location().warning(
168 u"Undocumented QML module '%1' referred by type '%2' or its members"_s
169 .arg(qmlModule->name(), member->name()),
170 u"Maybe you forgot to document '\\qmlmodule %1'?"_s
171 .arg(qmlModule->name()));
173 }
else if (child->isQmlType() && !child->hasDoc()) {
175 auto *qmlType =
static_cast<QmlTypeNode *>(child);
176 if (
auto qmid = qmlType->logicalModuleName(); !qmid.isEmpty())
177 qmlType->location().warning(
178 u"No such type '%1' in QML module '%2'"_s.arg(qmlType->name(), qmid));
185
186
187
188
189
190
191
192
193
194
195
198 if (!node->url().isNull())
203 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.