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
IR::ContentBuilder Class Reference

Converts Atom chains to QList<IR::ContentBlock> trees. More...

#include <contentbuilder.h>

Collaboration diagram for IR::ContentBuilder:

Public Member Functions

 ContentBuilder (BriefHandling briefHandling=BriefHandling::Skip, int headingOffset=0, DiagnosticHandler diagnosticHandler={})
 Constructs a ContentBuilder.
QList< ContentBlockbuild (const Atom *firstAtom)
 Walks the atom chain starting at firstAtom and returns a list of ContentBlock trees representing the structured documentation body.

Detailed Description

Converts Atom chains to QList<IR::ContentBlock> trees.

ContentBuilder walks a linked list of Atom nodes (QDoc's internal documentation representation) and produces a structured tree of ContentBlock and InlineContent values suitable for template rendering.

Handled atom types: \list

  • ParaLeft, ParaRight – Paragraph blocks.
  • String – Text inline content.
  • C – Inline code spans.
  • Code, CodeBad, Qml – Code blocks with language attribute.
  • SectionLeft, SectionRight – Section containers.
  • SectionHeadingLeft, SectionHeadingRight – Section headings with level.
  • FormattingLeft, FormattingRight – Bold, italic, teletype, underline, subscript, superscript, parameter, uicontrol, trademark, link, index, notranslate, span.
  • ListLeft, ListRight – Ordered and unordered lists.
  • ListItemLeft, ListItemRight – List items.
  • ListItemNumber – List start number metadata.
  • NoteLeft, NoteRight – Note admonition blocks.
  • WarningLeft, WarningRight – Warning admonition blocks.
  • BriefLeft, BriefRight – Brief exclusion (skipped by default, or emitted as Paragraph with BriefHandling::Include).
  • Link, NavLink – Explicit links with unresolved target.
  • AutoLink, NavAutoLink – Auto-linked type names with unresolved target.
  • BR – Line break inline.
  • HR – Horizontal rule block.
  • Nop – No-operation (skipped).
  • BaseName – No-operation (skipped).
  • TableLeft, TableRight – Table containers with style attribute.
  • TableHeaderLeft, TableHeaderRight – Table header rows.
  • TableRowLeft, TableRowRight – Table data rows.
  • TableItemLeft, TableItemRight – Table cells with optional colspan/rowspan.
  • Image – Block-level image (wrapping Paragraph with centerAlign).
  • InlineImage – Inline image within a paragraph.
  • ImageText – Alt text consumed by the preceding Image or InlineImage handler.
  • ListTagLeft, ListTagRight – Value list tag items (ListItem blocks).
  • SinceTagLeft, SinceTagRight – Version tag items (skipped).
  • AnnotatedList – Placeholder Div.
  • GeneratedList – Placeholder Div. \endlist

Format-conditional atoms (FormatIf, FormatElse, FormatEndif) are skipped unconditionally. The template generator builds a format-agnostic IR that serves all output formats from a single build pass.

The optional BriefHandling parameter controls whether brief content (between BriefLeft and BriefRight atoms) is included in the output. The default is BriefHandling::Skip, which suppresses brief content. BriefHandling::Include causes brief content to be emitted as a Paragraph block.

ContentBuilder depends only on Atom (for reading the chain) and IR types (for producing output).

See also
ContentBlock, InlineContent

Definition at line 39 of file contentbuilder.h.

Constructor & Destructor Documentation

◆ ContentBuilder()

IR::ContentBuilder::ContentBuilder ( BriefHandling briefHandling = BriefHandling::Skip,
int headingOffset = 0,
DiagnosticHandler diagnosticHandler = {} )
explicit

Constructs a ContentBuilder.

The briefHandling parameter controls whether content between BriefLeft and BriefRight atoms is emitted as a Paragraph block (BriefHandling::Include) or suppressed (BriefHandling::Skip).

The headingOffset parameter shifts section heading levels to account for the page structure. QDoc's \section1 maps to level 1, but pages already use {

} for the title and {} for major sections. The legacy generators apply an offset derived from the node type; callers pass that same offset here so the IR produces correct heading levels without depending on Node.

Definition at line 109 of file contentbuilder.cpp.

References ContentBuilder().

Referenced by ContentBuilder().

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

Member Function Documentation

◆ build()

QList< ContentBlock > IR::ContentBuilder::build ( const Atom * firstAtom)

Walks the atom chain starting at firstAtom and returns a list of ContentBlock trees representing the structured documentation body.

Returns an empty list if firstAtom is \nullptr.

The builder is reset before processing, so a single ContentBuilder instance can be reused for multiple build() calls.

Definition at line 144 of file contentbuilder.cpp.


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