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

\variable PublicationLocation::path More...

#include <locationplan.h>

Collaboration diagram for LocationPlan:

Public Types

using FileBase = std::function<QString(const Node *)>
using EntityLocations = QHash<const Node *, PublicationLocation>

Public Member Functions

 LocationPlan (LocationRules rules, EntityLocations entities)
const LocationRules & rules () const
qsizetype plannedCount () const
std::optional< PublicationLocation > entity (const Node *node) const
 Returns the planned location of node.
QString documentLocation (const Node *node) const
 Returns the location of node as one link target, or an empty string when the entity is not published.
QString exampleFile (const QString &file) const
 Returns the page path for the example source or image file.
QString fileBase (const Node *node) const
 Returns the file name stem of the page that documents node.
QString fileName (const Node *node) const
 Returns the file name of the page that documents node: its explicit URL if it has one, otherwise fileBase() with the format's extension.

Static Public Member Functions

static LocationPlan build (LocationRules rules, const Tree *tree)
 Plans the locations of every entity in tree under rules.
static LocationPlan buildPublished (LocationRules rules, const Tree *tree, const InclusionPolicy &policy)
 Plans the entities whose pages are produced under policy.
static QString resolveDocumentLocation (const Node *node, const FileBase &fileBase, const QString &fileExtension)
 Resolves the full document location of node from the caller's fileBase and fileExtension: the page file name followed by the anchor fragment for a member.
static QString resolveFragment (const Node *node)
 Resolves the anchor fragment of node on its page, without the separator, following the same redirects as resolveDocumentLocation().

Detailed Description

\variable PublicationLocation::path

The page path relative to the module's publication directory, or the explicit URL.

\variable PublicationLocation::fragment

The anchor within the page, without the {#} separator; empty for a page.

\variable PublicationLocation::explicitUrl

Whether path is an authored or imported URL that is used verbatim.

An explicit URL is not split into a page and a fragment, so it survives unchanged however it was spelled.

\inmodule QDoc

Plans where a tree's entities are published in one format, before rendering.

A plan is built from a frozen tree and fixed LocationRules. It records a PublicationLocation for every entity it visits: the page that documents the entity and the fragment that marks it there. Exchange metadata and link resolution read the plan instead of asking a generator, so every consumer sees the same answer and the answer cannot drift while pages render.

Entities that are not in the plan have no publication location.

The plan is not thread-safe: file bases are memoized from const queries. Create one plan per thread or synchronize externally.

Definition at line 44 of file locationplan.h.

Member Typedef Documentation

◆ EntityLocations

Definition at line 48 of file locationplan.h.

◆ FileBase

using LocationPlan::FileBase = std::function<QString(const Node *)>

Definition at line 47 of file locationplan.h.

Constructor & Destructor Documentation

◆ LocationPlan()

LocationPlan::LocationPlan ( LocationRules rules,
EntityLocations entities )

Definition at line 12 of file locationplanlookup.cpp.

References LocationPlan().

Referenced by LocationPlan().

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

Member Function Documentation

◆ build()

LocationPlan LocationPlan::build ( LocationRules rules,
const Tree * tree )
staticnodiscard

Plans the locations of every entity in tree under rules.

The walk covers the root namespace and its descendants, the tree's collection nodes, and its proxy aggregates, which is the same set the index export serializes. The tree is only read.

Definition at line 265 of file locationplan.cpp.

Referenced by buildPublished(), and processQdocconfFile().

Here is the caller graph for this function:

◆ buildPublished()

LocationPlan LocationPlan::buildPublished ( LocationRules rules,
const Tree * tree,
const InclusionPolicy & policy )
staticnodiscard

Plans the entities whose pages are produced under policy.

Exchange export uses build() instead: its compatibility inventory also includes entities that do not produce a local page.

Definition at line 295 of file locationplan.cpp.

References build(), Node< _Tp >::createContext(), Node< _Tp >::docMustBeGenerated(), Node< _Tp >::isClassNode(), Node< _Tp >::isCollectionNode(), Node< _Tp >::isExternalPage(), Node< _Tp >::isHeader(), InclusionFilter::isIncluded(), Node< _Tp >::isIndexNode(), Node< _Tp >::isNamespace(), Node< _Tp >::isPageNode(), and Node< _Tp >::parent().

Referenced by LocationPlanSet::build().

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

◆ documentLocation()

QString LocationPlan::documentLocation ( const Node * node) const
nodiscard

Returns the location of node as one link target, or an empty string when the entity is not published.

This is the form the index export writes.

Definition at line 39 of file locationplanlookup.cpp.

◆ entity()

std::optional< PublicationLocation > LocationPlan::entity ( const Node * node) const
nodiscard

Returns the planned location of node.

Returns no value when the entity is not published; querying the plan never invents a publication location.

Definition at line 23 of file locationplanlookup.cpp.

◆ exampleFile()

QString LocationPlan::exampleFile ( const QString & file) const
nodiscard

Returns the page path for the example source or image file.

Definition at line 457 of file locationplan.cpp.

◆ fileBase()

QString LocationPlan::fileBase ( const Node * node) const
nodiscard

Returns the file name stem of the page that documents node.

A member resolves through its parent page. A deprecated member carries the {-obsolete} suffix because it is documented on the obsolete sub-page, as HtmlGenerator::fileBase() does. A stem already recorded on the node is reused; otherwise the stem is computed from the rules and memoized here without writing to the node.

Definition at line 471 of file locationplan.cpp.

References Node< _Tp >::hasFileNameBase(), Node< _Tp >::isAggregate(), Node< _Tp >::isCollectionNode(), Node< _Tp >::isDeprecated(), Node< _Tp >::isPageNode(), and Node< _Tp >::parent().

Here is the call graph for this function:

◆ fileName()

QString LocationPlan::fileName ( const Node * node) const
nodiscard

Returns the file name of the page that documents node: its explicit URL if it has one, otherwise fileBase() with the format's extension.

A text page whose name carries an explicit extension other than HTML keeps that extension, as Generator::fileName() does, so a page the author named with a suffix is written and linked under that suffix. Returns an empty string when the node has no file base.

Definition at line 505 of file locationplan.cpp.

References Node< _Tp >::isCollectionNode(), and Node< _Tp >::isTextPageNode().

Here is the call graph for this function:

◆ plannedCount()

qsizetype LocationPlan::plannedCount ( ) const
inlinenodiscard

Definition at line 60 of file locationplan.h.

◆ resolveDocumentLocation()

QString LocationPlan::resolveDocumentLocation ( const Node * node,
const FileBase & fileBase,
const QString & fileExtension )
staticnodiscard

Resolves the full document location of node from the caller's fileBase and fileExtension: the page file name followed by the anchor fragment for a member.

This is the single home of the legacy location rules. A node with an explicit URL yields that URL. Members resolve through their parent's page, deprecated members through the obsolete sub-page, and functions that only document a property resolve to that property's anchor. Overloaded C++ and QML methods carry their overload number, as the rendered headings do, so a location names one overload and not the first one that shares the name. The fragment is the one resolveFragment() returns. Returns an empty string for an entity that has no page of its own.

Definition at line 372 of file locationplan.cpp.

References Class, Group, HeaderFile, Node< _Tp >::isCollectionNode(), Node< _Tp >::isDeprecated(), Node< _Tp >::isNamespace(), Node< _Tp >::isPageNode(), Node< _Tp >::isQmlType(), Node< _Tp >::isTextPageNode(), Module, Namespace, Node< _Tp >::nodeType(), Page, Node< _Tp >::parent(), Proxy, QmlModule, QmlType, Struct, and Union.

Referenced by Generator::fullDocumentLocation().

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

◆ resolveFragment()

QString LocationPlan::resolveFragment ( const Node * node)
staticnodiscard

Resolves the anchor fragment of node on its page, without the separator, following the same redirects as resolveDocumentLocation().

Returns an empty string for an entity that is a page of its own or has no anchor, such as an anonymous shared comment.

Rendered headings and planned locations both take their ids from here, so a link planned for an entity lands on the heading the page emits.

Definition at line 447 of file locationplan.cpp.

◆ rules()

const LocationRules & LocationPlan::rules ( ) const
inlinenodiscard

Definition at line 59 of file locationplan.h.


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