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
TemplatePackage Struct Reference

\variable TemplatePackageInput::engineCapabilities More...

#include <templatepackage.h>

Collaboration diagram for TemplatePackage:

Classes

struct  Template
 \typealias TemplatePackage::Diagnostic More...
struct  Format
 \variable TemplatePackage::Template::path More...

Public Types

using Diagnostic = OutputSelection::Diagnostic

Public Member Functions

bool hasErrors () const
 Returns true if any diagnostic blocks use of the package.
const Format * findFormat (const QString &formatformat) const
 Returns the effective entry for the case-sensitive identity format, or {nullptr} if the package does not provide it.
PipelineCapabilities capabilities () const
 Returns the template pipeline's capabilities as OutputSelection expects them.

Static Public Member Functions

static QString builtinId ()
 Returns the identifier of the package built into QDoc.
static QString manifestFileName ()
 Returns the file name a package directory must contain.
static QStringList roles ()
 Returns the roles every format must map to a template, in rendering order.
static TemplatePackage resolve (const Config &configconfig, const TemplatePackageInput &inputinput={})
 Resolves the package that config selects through {template.package}, or the built-in package when the setting is absent, using the engine facts in input.

Public Attributes

QString id
Location location
bool loaded = false
QStringList searchPaths
QVector< Format > formats
QVector< Diagnostic > diagnostics

Static Public Attributes

static constexpr int supportedSchemaVersion = 1
static constexpr int providedTemplateApiVersion = 1

Detailed Description

\variable TemplatePackageInput::engineCapabilities

The optional capability names this QDoc build can honor.

A manifest that requires a capability absent from this set is an error. QDoc currently declares no optional capabilities, so the production set is empty until the engine grows an explicitly supported feature.

\variable TemplatePackageInput::builtinRoot

The directory holding the built-in {qdoc:default} package.

The directory must contain a manifest like any other package. The default names the templates embedded in the QDoc executable.

\inmodule QDoc

Resolves the effective template package declared by a configuration.

A package is a directory holding a {qdoc-template.json} manifest. The manifest declares the manifest schema version, the template API version it was written against, an optional single parent to extend, optional engine capabilities it requires, and the formats it provides. Each format carries a default file extension and maps the page roles QDoc renders to template files. Paths are relative to the manifest that declares them.

Inheritance is explicit and single-parent. A child inherits every parent format and role mapping and overrides only what it declares. Declaring a format as false drops it from the effective package. An override that names a missing file breaks the format rather than falling back to the parent's template. Lists do not concatenate: each manifest's requirements are validated on their own.

The built-in package is addressed as {qdoc:default} and loads through the same code path as an external directory, so QDoc itself carries no branding. Resolution reads files but never writes, never renders, and never emits diagnostics; the caller presents errors before publication.

Definition at line 26 of file templatepackage.h.

Member Typedef Documentation

◆ Diagnostic

Member Function Documentation

◆ builtinId()

QString TemplatePackage::builtinId ( )
staticnodiscard

Returns the identifier of the package built into QDoc.

Definition at line 461 of file templatepackage.cpp.

◆ capabilities()

PipelineCapabilities TemplatePackage::capabilities ( ) const
nodiscard

Returns the template pipeline's capabilities as OutputSelection expects them.

The pipeline is available when every manifest loaded. Complete formats are supported, broken formats remain declared ownership claims, and declared extensions become the pipeline defaults.

Definition at line 639 of file templatepackage.cpp.

References PipelineCapabilities::available, loaded, PipelineCapabilities::pipeline, and Template.

◆ findFormat()

const TemplatePackage::Format * TemplatePackage::findFormat ( const QString & format) const
nodiscard

Returns the effective entry for the case-sensitive identity format, or {nullptr} if the package does not provide it.

The pointer borrows storage from this package and remains valid only while that storage is alive and unchanged. A returned entry may be broken.

Definition at line 623 of file templatepackage.cpp.

◆ hasErrors()

bool TemplatePackage::hasErrors ( ) const
nodiscard

Returns true if any diagnostic blocks use of the package.

Definition at line 607 of file templatepackage.cpp.

◆ manifestFileName()

QString TemplatePackage::manifestFileName ( )
staticnodiscard

Returns the file name a package directory must contain.

Definition at line 469 of file templatepackage.cpp.

◆ resolve()

TemplatePackage TemplatePackage::resolve ( const Config & config,
const TemplatePackageInput & input = {} )
staticnodiscard

Resolves the package that config selects through {template.package}, or the built-in package when the setting is absent, using the engine facts in input.

A relative package path is taken from the directory of the configuration file that declared it. Returns diagnostics as data; the caller must check hasErrors() before trusting formats or capabilities().

Definition at line 496 of file templatepackage.cpp.

References loaded, and ConfigVar::location().

Here is the call graph for this function:

◆ roles()

QStringList TemplatePackage::roles ( )
staticnodiscard

Returns the roles every format must map to a template, in rendering order.

The roles mirror the generator's entry points: a documentation page, a collection page, a C++ reference page, a QML type page, a member list, and an obsolete member list.

Definition at line 481 of file templatepackage.cpp.

Member Data Documentation

◆ diagnostics

QVector<Diagnostic> TemplatePackage::diagnostics

Definition at line 54 of file templatepackage.h.

◆ formats

QVector<Format> TemplatePackage::formats

Definition at line 53 of file templatepackage.h.

◆ id

QString TemplatePackage::id

Definition at line 49 of file templatepackage.h.

◆ loaded

bool TemplatePackage::loaded = false

Definition at line 51 of file templatepackage.h.

Referenced by capabilities(), and resolve().

◆ location

Location TemplatePackage::location

Definition at line 50 of file templatepackage.h.

◆ providedTemplateApiVersion

int TemplatePackage::providedTemplateApiVersion = 1
staticconstexpr

Definition at line 31 of file templatepackage.h.

◆ searchPaths

QStringList TemplatePackage::searchPaths

Definition at line 52 of file templatepackage.h.

◆ supportedSchemaVersion

int TemplatePackage::supportedSchemaVersion = 1
staticconstexpr

Definition at line 30 of file templatepackage.h.


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