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
atomcontext.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\struct IR::AtomContext
6
\headerfile ir/atomcontext.h
7
\inmodule QDoc
8
\brief Stack-based state tracker for atom chain traversal.
9
10
AtomContext tracks where a content builder is in the document tree
11
during atom chain processing. Instead of using scattered boolean
12
flags (such as \c in_para, \c m_inLink, or \c m_inSectionHeading),
13
it maintains an explicit stack of typed context frames.
14
15
Each frame records a context type (Paragraph, List, CodeBlock, etc.)
16
and optional attributes (language, heading level, list style). The
17
stack naturally handles arbitrarily nested structures such as lists
18
within lists or code blocks inside admonitions.
19
20
AtomContext is a pure value type with no dependencies on QDoc
21
infrastructure. It depends only on Qt types (QList, QJsonObject).
22
*/
23
24
/*!
25
\enum IR::AtomContext::ContextType
26
\headerfile ir/atomcontext.h
27
\inmodule QDoc
28
\brief Identifies the kind of document structure a frame represents.
29
30
Each value corresponds to a block-level context that can appear
31
in a documentation page. The values align with BlockType in
32
contentblock.h, plus a few traversal-specific contexts such as
33
Brief and Link.
34
35
\value Paragraph A block of running text, typically containing inline
36
formatting such as bold, italic, code, and links.
37
\value Brief The brief description of a documentable entity. This is a
38
traversal-specific context with no BlockType counterpart;
39
ContentBuilder uses it to exclude brief content from the body,
40
since IR::Builder captures the brief separately.
41
\value Section A grouping of related content under a heading, such as
42
a \c{\section1} or \c{\section2} block. Sections can nest to
43
form the document's outline hierarchy.
44
\value SectionHeading The heading text within a section. Frame
45
attributes typically include \c{"level"} to indicate the
46
heading depth (1 through 4).
47
\value List An ordered or unordered list. Frame attributes typically
48
include \c{"listType"} with a value such as \c{"bullet"} or
49
\c{"numeric"}.
50
\value ListItem A single item within a list, usually containing one
51
or more paragraphs.
52
\value Note An admonition that highlights supplementary information
53
for the reader, rendered from \c{\\note} commands.
54
\value Warning An admonition that alerts readers to potential
55
pitfalls, rendered from \c{\\warning} commands.
56
\value Important An admonition that emphasizes critical information
57
the reader shouldn't overlook.
58
\value Details A collapsible or expandable block of supplementary
59
content, rendered from \c{\\details} commands.
60
\value CodeBlock A block of preformatted source code. Frame
61
attributes typically include \c{"language"} to identify the
62
programming language for syntax highlighting.
63
\value Table A tabular layout of rows and cells.
64
\value TableRow A single row within a table.
65
\value TableCell An individual cell within a table row.
66
\value Link An inline hyperlink context. This is a traversal-specific
67
context used to track that ContentBuilder is inside a link's
68
display text, so nested formatting is added as children of the
69
link rather than as siblings.
70
\value Caption Descriptive text associated with a table or figure.
71
\value Footnote A supplementary note referenced from the main text.
72
\value Legalese A block of legal text, rendered from \c{\\legalese}
73
commands.
74
\value Quotation A block quotation, rendered from \c{\\quotation}
75
commands.
76
\value Div A generic container block, used for content that doesn't
77
map to a more specific type. Also used for placeholder blocks
78
such as annotated lists and generated lists.
79
\value Sidebar A block of tangentially related content, typically
80
rendered alongside the main text.
81
*/
82
83
/*!
84
\struct IR::AtomContext::Frame
85
\headerfile ir/atomcontext.h
86
\inmodule QDoc
87
\brief A single entry on the context stack.
88
89
Each frame records the context type and optional attributes
90
such as \c{"language"} for code blocks or \c{"level"} for
91
section headings.
92
*/
93
94
/*!
95
\variable IR::AtomContext::Frame::type
96
\brief The context type for this frame.
97
*/
98
99
/*!
100
\variable IR::AtomContext::Frame::attributes
101
\brief Optional key-value attributes for this context frame.
102
*/
103
104
/*!
105
\fn void IR::AtomContext::push(ContextType type, QJsonObject attrs)
106
\brief Pushes a new context frame onto the stack.
107
*/
108
109
/*!
110
\fn IR::AtomContext::Frame IR::AtomContext::pop()
111
\brief Removes and returns the topmost context frame.
112
*/
113
114
/*!
115
\fn bool IR::AtomContext::isInContext(ContextType type) const
116
\brief Returns \c true if any ancestor frame matches \a type.
117
*/
118
119
/*!
120
\fn const IR::AtomContext::Frame &IR::AtomContext::current() const
121
\brief Returns a reference to the topmost context frame.
122
*/
123
124
/*!
125
\fn bool IR::AtomContext::isEmpty() const
126
\brief Returns \c true if the context stack is empty.
127
*/
128
129
/*!
130
\fn qsizetype IR::AtomContext::depth() const
131
\brief Returns the number of frames on the context stack.
132
*/
133
134
/*!
135
\fn void IR::AtomContext::clear()
136
\brief Removes all frames from the context stack.
137
*/
qttools
src
qdoc
qdoc
src
qdoc
ir
atomcontext.qdoc
Generated on
for Qt by
1.16.1