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
TemplateGenerator Class Reference

Generates documentation using external templates and a pre-built IR. More...

#include <templategenerator.h>

Inheritance diagram for TemplateGenerator:
Collaboration diagram for TemplateGenerator:

Public Types

using RenderFailureHandler = std::function<void(const QString &message)>

Public Member Functions

 TemplateGenerator (FileResolver &fileResolver, QDocDatabase &qdb, const QString &formatformat, RenderFailureHandler reportFailure)
 Constructs a producer for format using fileResolver and qdb.
 ~TemplateGenerator () override
void prepare () override
 Prepares the producer for an output run.
void produce () override
 Produces documentation output.
void finalize () override
 Finalizes output production.
QString format () const override
 Returns the format identifier for this producer (e.g., "HTML", "DocBook", "template").
void planLocations (const LocationPlanSet &publications)
void beginDocument (const QString &fileName) override
void endDocument () override
QString fileName (const Node *node) const override
void generateCollectionNode (CollectionNode *cn, CodeMarker *markermarker) override
void generateGenericCollectionPage (CollectionNode *cn, CodeMarker *markermarker) override
void generatePageNode (PageNode *pn, CodeMarker *markermarker) override
void generateCppReferencePage (Aggregate *aggregate, CodeMarker *markermarker) override
void generateQmlTypePage (QmlTypeNode *qcn, CodeMarker *markermarker) override
void generateProxyPage (Aggregate *aggregate, CodeMarker *markermarker) override
void mergeCollections (CollectionNode *cn) override
QString fileExtension () const
Public Member Functions inherited from OutputProducer
virtual ~OutputProducer ()=default
Public Member Functions inherited from DocumentationHandler
virtual ~DocumentationHandler ()=default

Friends

class TemplateGeneratorTest

Detailed Description

Generates documentation using external templates and a pre-built IR.

TemplateGenerator implements OutputProducer and DocumentationHandler to generate documentation without inheriting from Generator. It uses DocumentationTraverser for tree traversal and delegates content generation to templates via the IR system.

The generator follows a composition-based design: \list

See also
DocumentationTraverser, DocumentationHandler, OutputProducer, IR::Builder

TemplateGenerator implements OutputProducer and DocumentationHandler to generate documentation without inheriting from Generator. It uses DocumentationTraverser for tree traversal and delegates content generation to templates via the IR system.

The generator follows a composition-based design: \list

See also
DocumentationTraverser, DocumentationHandler, OutputProducer

Definition at line 52 of file templategenerator.h.

Member Typedef Documentation

◆ RenderFailureHandler

Definition at line 55 of file templategenerator.h.

Constructor & Destructor Documentation

◆ TemplateGenerator()

TemplateGenerator::TemplateGenerator ( FileResolver & fileResolver,
QDocDatabase & qdb,
const QString & format,
RenderFailureHandler reportFailure )
explicit

Constructs a producer for format using fileResolver and qdb.

The required reportFailure callback reports a render diagnostic and records that the QDoc run must exit non-zero.

Definition at line 121 of file templategenerator.cpp.

References TemplateGenerator(), OutputProducerRegistry::instance(), and OutputProducerRegistry::registerProducer().

Referenced by TemplateGenerator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~TemplateGenerator()

TemplateGenerator::~TemplateGenerator ( )
override

Definition at line 131 of file templategenerator.cpp.

References OutputProducerRegistry::instance(), and OutputProducerRegistry::unregisterProducer().

Here is the call graph for this function:

Member Function Documentation

◆ beginDocument()

void TemplateGenerator::beginDocument ( const QString & fileName)
overridevirtual

Implements DocumentationHandler.

Definition at line 301 of file templategenerator.cpp.

◆ endDocument()

void TemplateGenerator::endDocument ( )
overridevirtual

Implements DocumentationHandler.

Definition at line 308 of file templategenerator.cpp.

◆ fileExtension()

QString TemplateGenerator::fileExtension ( ) const
nodiscard

Definition at line 462 of file templategenerator.cpp.

◆ fileName()

QString TemplateGenerator::fileName ( const Node * node) const
nodiscardoverridevirtual

Implements DocumentationHandler.

Definition at line 328 of file templategenerator.cpp.

◆ finalize()

void TemplateGenerator::finalize ( )
overridevirtual

Finalizes output production.

Called once per format at the end of the run.

Implements OutputProducer.

Definition at line 291 of file templategenerator.cpp.

◆ format()

QString TemplateGenerator::format ( ) const
nodiscardoverridevirtual

Returns the format identifier for this producer (e.g., "HTML", "DocBook", "template").

Used for format selection and matching. The identifier is case-sensitive and must match the value used in configuration files.

Implements OutputProducer.

Definition at line 296 of file templategenerator.cpp.

◆ generateCollectionNode()

void TemplateGenerator::generateCollectionNode ( CollectionNode * cn,
CodeMarker * marker )
overridevirtual

Implements DocumentationHandler.

Definition at line 333 of file templategenerator.cpp.

References IR::Builder::buildPageIR().

Here is the call graph for this function:

◆ generateCppReferencePage()

void TemplateGenerator::generateCppReferencePage ( Aggregate * aggregate,
CodeMarker * marker )
overridevirtual

Implements DocumentationHandler.

Definition at line 378 of file templategenerator.cpp.

References IR::Builder::buildPageIR(), and NodeExtractor::extractAllMembersIR().

Here is the call graph for this function:

◆ generateGenericCollectionPage()

void TemplateGenerator::generateGenericCollectionPage ( CollectionNode * cn,
CodeMarker * marker )
overridevirtual

Implements DocumentationHandler.

Definition at line 348 of file templategenerator.cpp.

References IR::Builder::buildPageIR().

Here is the call graph for this function:

◆ generatePageNode()

void TemplateGenerator::generatePageNode ( PageNode * pn,
CodeMarker * marker )
overridevirtual

Implements DocumentationHandler.

Definition at line 363 of file templategenerator.cpp.

References IR::Builder::buildPageIR().

Here is the call graph for this function:

◆ generateProxyPage()

void TemplateGenerator::generateProxyPage ( Aggregate * aggregate,
CodeMarker * marker )
overridevirtual

Implements DocumentationHandler.

Definition at line 444 of file templategenerator.cpp.

◆ generateQmlTypePage()

void TemplateGenerator::generateQmlTypePage ( QmlTypeNode * qcn,
CodeMarker * marker )
overridevirtual

Implements DocumentationHandler.

Definition at line 411 of file templategenerator.cpp.

References IR::Builder::buildPageIR(), and NodeExtractor::extractAllMembersIR().

Here is the call graph for this function:

◆ mergeCollections()

void TemplateGenerator::mergeCollections ( CollectionNode * cn)
overridevirtual

Implements DocumentationHandler.

Definition at line 457 of file templategenerator.cpp.

References QDocDatabase::mergeCollections().

Here is the call graph for this function:

◆ planLocations()

void TemplateGenerator::planLocations ( const LocationPlanSet & publications)

Definition at line 136 of file templategenerator.cpp.

◆ prepare()

void TemplateGenerator::prepare ( )
overridevirtual

Prepares the producer for an output run.

Called once per format after configuration is loaded.

Implements OutputProducer.

Definition at line 151 of file templategenerator.cpp.

References Generator::autolinkErrors(), Config::createInclusionPolicy(), Generator::noLinkErrors(), and Generator::qmlTypeContext().

Here is the call graph for this function:

◆ produce()

void TemplateGenerator::produce ( )
overridevirtual

Produces documentation output.

Called after prepare() to create the actual documentation files.

Implements OutputProducer.

Definition at line 283 of file templategenerator.cpp.

References QDocDatabase::primaryTreeRoot(), and DocumentationTraverser::traverse().

Here is the call graph for this function:

◆ TemplateGeneratorTest

friend class TemplateGeneratorTest
friend

Definition at line 123 of file templategenerator.h.


The documentation for this class was generated from the following files: