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
contentbuilder.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 QDOC_IR_CONTENTBUILDER_H
5#define QDOC_IR_CONTENTBUILDER_H
6
7#include "contentblock.h"
8
9#include <QJsonObject>
10#include <QList>
11#include <QString>
12
14
15class Atom;
16
17namespace IR {
18
20{
21public:
22 QList<ContentBlock> build(const Atom *firstAtom);
23
24private:
25 void processAtoms(const Atom *atom);
26 const Atom *skipFormatIfBlock(const Atom *atom);
27 const Atom *dispatchAtom(const Atom *atom);
28
29 void openBlock(BlockType type, QJsonObject attrs = {});
30 void closeBlock();
31 void addInline(InlineContent inline_);
32 void addLeafInline(InlineType type, const QString &text);
33 void pushInlineContainer(InlineContent container);
34
35 ContentBlock *resolveBlock();
36 InlineContent *resolveInline();
37
38 QList<ContentBlock> m_result;
39
40 // Index path through m_result / children hierarchy.
41 // First index selects from m_result; subsequent indices descend
42 // through children lists. Indices remain valid as long as we only
43 // append and never remove or reorder items.
44 QList<qsizetype> m_blockPath;
45
46 QList<qsizetype> m_inlinePath;
47
48 // Records m_inlinePath.size() at each openBlock() call, so that
49 // closeBlock() can verify/restore inline depth (one entry per
50 // m_blockPath entry, always in sync).
51 QList<qsizetype> m_inlineBaseDepths;
52
53 bool m_inBrief = false;
54 bool m_inLink = false;
55};
56
57} // namespace IR
58
59QT_END_NAMESPACE
60
61#endif // QDOC_IR_CONTENTBUILDER_H
#define ATOM_FORMATTING_TELETYPE
Definition atom.h:211
#define ATOM_FORMATTING_UNDERLINE
Definition atom.h:214
#define ATOM_FORMATTING_NOTRANSLATE
Definition atom.h:206
#define ATOM_FORMATTING_SUBSCRIPT
Definition atom.h:209
#define ATOM_FORMATTING_BOLD
Definition atom.h:202
#define ATOM_FORMATTING_TRADEMARK
Definition atom.h:212
#define ATOM_FORMATTING_ITALIC
Definition atom.h:204
#define ATOM_FORMATTING_LINK
Definition atom.h:205
#define ATOM_FORMATTING_SUPERSCRIPT
Definition atom.h:210
#define ATOM_FORMATTING_INDEX
Definition atom.h:203
#define ATOM_FORMATTING_UICONTROL
Definition atom.h:213
#define ATOM_FORMATTING_PARAMETER
Definition atom.h:207
The Atom class is the fundamental unit for representing documents internally.
Definition atom.h:19
AtomType type() const
Return the type of this atom.
Definition atom.h:153
@ TableRight
Definition atom.h:95
@ GeneratedList
Definition atom.h:50
@ BriefRight
Definition atom.h:27
@ TableHeaderRight
Definition atom.h:97
@ FormatElse
Definition atom.h:45
@ TableRowRight
Definition atom.h:99
@ Nop
Definition atom.h:72
@ WarningRight
Definition atom.h:109
@ ListTagRight
Definition atom.h:66
@ NavLink
Definition atom.h:71
@ ListItemNumber
Definition atom.h:64
@ SinceTagRight
Definition atom.h:89
@ CodeBad
Definition atom.h:32
@ AnnotatedList
Definition atom.h:22
@ SectionRight
Definition atom.h:82
@ SectionHeadingLeft
Definition atom.h:83
@ TableLeft
Definition atom.h:94
@ ListItemRight
Definition atom.h:68
@ TableItemRight
Definition atom.h:101
@ Code
Definition atom.h:31
@ ListLeft
Definition atom.h:63
@ NavAutoLink
Definition atom.h:70
@ BriefLeft
Definition atom.h:26
@ ListRight
Definition atom.h:69
@ ParaRight
Definition atom.h:76
@ Qml
Definition atom.h:77
@ FormattingLeft
Definition atom.h:48
@ FormattingRight
Definition atom.h:49
@ SectionHeadingRight
Definition atom.h:84
@ Link
Definition atom.h:61
@ FormatEndif
Definition atom.h:46
@ SinceTagLeft
Definition atom.h:88
@ AutoLink
Definition atom.h:23
@ TableItemLeft
Definition atom.h:100
@ NoteRight
Definition atom.h:74
@ BaseName
Definition atom.h:24
@ FormatIf
Definition atom.h:47
const Atom * next() const
Return the next atom in the atom list.
Definition atom.h:150
Converts Atom chains to QList<IR::ContentBlock> trees.
QList< ContentBlock > build(const Atom *firstAtom)
Walks the atom chain starting at firstAtom and returns a list of ContentBlock trees representing the ...
Definition builder.cpp:14
BlockType
static InlineType formattingToInlineType(const QString &formatting)
InlineType
Combined button and popup list for selecting options.
Represents a structural block element in documentation.
Represents inline content within a documentation block.