Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
documentationhandler.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef DOCUMENTATIONHANDLER_H
5#define DOCUMENTATIONHANDLER_H
6
7#include <QtCore/qstring.h>
8
10
11class Aggregate;
12class CodeMarker;
13class CollectionNode;
14class Node;
15class PageNode;
16class QmlTypeNode;
17
18// DocumentationHandler has a single implementor (TemplateGenerator) but is
19// preserved because it enables DocumentationTraverser to remain independent
20// of any concrete generator type. This separation allows the traverser to
21// be reused when legacy Generator is eventually refactored.
22
23/*!
24 \class DocumentationHandler
25 \internal
26 \brief Interface handling documentation generation during tree traversal.
27
28 DocumentationHandler defines the callbacks that DocumentationTraverser
29 invokes as it walks the node tree. Implementations control file lifecycle
30 and content generation while the traverser handles filtering, dispatch, and
31 recursion.
32
33 This separation enables composition over inheritance: both legacy Generator
34 and TemplateGenerator (new) can use the same traversal logic with different
35 handler implementations.
36
37 \sa DocumentationTraverser
38*/
40{
41public:
42 virtual ~DocumentationHandler() = default;
43
44 // === File Lifecycle ===
45 virtual void beginDocument(const QString &fileName) = 0;
46 virtual void endDocument() = 0;
47
48 // === Filename Computation ===
49 [[nodiscard]] virtual QString fileName(const Node *node) const = 0;
50
51 // === Content Generation ===
52 virtual void generateCollectionNode(CollectionNode *cn, CodeMarker *marker) = 0;
54 virtual void generatePageNode(PageNode *pn, CodeMarker *marker) = 0;
55 virtual void generateCppReferencePage(Aggregate *aggregate, CodeMarker *marker) = 0;
56 virtual void generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker) = 0;
57 virtual void generateProxyPage(Aggregate *aggregate, CodeMarker *marker) = 0;
58
59 // === Database Operations ===
60 virtual void mergeCollections(CollectionNode *cn) = 0;
61};
62
63QT_END_NAMESPACE
64
65#endif // DOCUMENTATIONHANDLER_H
A class for holding the members of a collection of doc pages.
Interface handling documentation generation during tree traversal.
virtual QString fileName(const Node *node) const =0
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 ~DocumentationHandler()=default
virtual void generateGenericCollectionPage(CollectionNode *cn, CodeMarker *marker)=0
virtual void generatePageNode(PageNode *pn, CodeMarker *marker)=0
virtual void mergeCollections(CollectionNode *cn)=0
virtual void beginDocument(const QString &fileName)=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)
DocumentationTraverser()=default
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
A PageNode is a Node that generates a documentation page.
Definition pagenode.h:19
Combined button and popup list for selecting options.
QList< Node * > NodeList
Definition node.h:45
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.
Definition node.h:99
virtual bool docMustBeGenerated() const
This function is called to perform a test to decide if the node must have documentation generated.
Definition node.h:195
bool isNamespace() const
Returns true if the node type is Namespace.
Definition node.h:108
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
Definition node.h:121
bool isHeader() const
Returns true if the node type is HeaderFile.
Definition node.h:105
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Definition node.h:153
Aggregate * parent() const
Returns the node's parent pointer.
Definition node.h:208
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
Definition node.h:136
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
Definition node.h:231
bool isProxyNode() const
Returns true if the node type is Proxy.
Definition node.h:113
NodeContext createContext() const
Definition node.cpp:174
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
Definition node.h:143
virtual bool isCollectionNode() const
Returns true if this is an instance of CollectionNode.
Definition node.h:144
bool isIndexNode() const
Returns true if this node was created from something in an index file.
Definition node.h:106