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.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_ATOMCONTEXT_H
5
#
define
QDOC_IR_ATOMCONTEXT_H
6
7
#
include
<
QJsonObject
>
8
#
include
<
QList
>
9
10
#
include
<
utility
>
11
12
QT_BEGIN_NAMESPACE
13
14
namespace
IR
{
15
16
struct
AtomContext
17
{
18
enum
class
ContextType
:
unsigned
char
{
19
Paragraph
,
20
Brief
,
21
Section
,
22
SectionHeading
,
23
List
,
24
ListItem
,
25
Note
,
26
Warning
,
27
Important
,
28
Details
,
29
CodeBlock
,
30
Table
,
31
TableRow
,
32
TableCell
,
33
Link
,
34
Caption
,
35
Footnote
,
36
Legalese
,
37
Quotation
,
38
Div
,
39
Sidebar
40
};
41
42
struct
Frame
{
43
ContextType
type
;
44
QJsonObject
attributes
;
45
};
46
47
void
push
(
ContextType
type, QJsonObject attrs = {})
48
{
49
m_stack.append(Frame{ type, std::move(attrs) });
50
}
51
52
Frame
pop
()
53
{
54
Q_ASSERT(!m_stack.isEmpty());
55
return
m_stack.takeLast();
56
}
57
58
[[nodiscard]]
bool
isInContext
(
ContextType
type)
const
59
{
60
for
(
auto
it = m_stack.crbegin(); it != m_stack.crend(); ++it) {
61
if
(it->type == type)
62
return
true
;
63
}
64
return
false
;
65
}
66
67
[[nodiscard]]
const
Frame
&
current
()
const
68
{
69
Q_ASSERT(!m_stack.isEmpty());
70
return
m_stack.constLast();
71
}
72
73
[[nodiscard]]
bool
isEmpty
()
const
{
return
m_stack.isEmpty(); }
74
75
[[nodiscard]]
qsizetype
depth
()
const
{
return
m_stack.size(); }
76
77
void
clear
() { m_stack.clear(); }
78
79
private
:
80
QList<Frame> m_stack;
81
};
82
83
}
// namespace IR
84
85
QT_END_NAMESPACE
86
87
#
endif
// QDOC_IR_ATOMCONTEXT_H
IR
Definition
builder.cpp:14
IR::AtomContext::Frame
Definition
atomcontext.h:42
IR::AtomContext::Frame::type
ContextType type
Definition
atomcontext.h:43
IR::AtomContext::Frame::attributes
QJsonObject attributes
Definition
atomcontext.h:44
IR::AtomContext
Definition
atomcontext.h:17
IR::AtomContext::ContextType
ContextType
Definition
atomcontext.h:18
IR::AtomContext::ContextType::CodeBlock
@ CodeBlock
Definition
atomcontext.h:29
IR::AtomContext::ContextType::Important
@ Important
Definition
atomcontext.h:27
IR::AtomContext::ContextType::Warning
@ Warning
Definition
atomcontext.h:26
IR::AtomContext::ContextType::Brief
@ Brief
Definition
atomcontext.h:20
IR::AtomContext::ContextType::Sidebar
@ Sidebar
Definition
atomcontext.h:39
IR::AtomContext::ContextType::Caption
@ Caption
Definition
atomcontext.h:34
IR::AtomContext::ContextType::Legalese
@ Legalese
Definition
atomcontext.h:36
IR::AtomContext::ContextType::Note
@ Note
Definition
atomcontext.h:25
IR::AtomContext::ContextType::Details
@ Details
Definition
atomcontext.h:28
IR::AtomContext::ContextType::SectionHeading
@ SectionHeading
Definition
atomcontext.h:22
IR::AtomContext::ContextType::Div
@ Div
Definition
atomcontext.h:38
IR::AtomContext::ContextType::List
@ List
Definition
atomcontext.h:23
IR::AtomContext::ContextType::Table
@ Table
Definition
atomcontext.h:30
IR::AtomContext::ContextType::Quotation
@ Quotation
Definition
atomcontext.h:37
IR::AtomContext::ContextType::Footnote
@ Footnote
Definition
atomcontext.h:35
IR::AtomContext::ContextType::Link
@ Link
Definition
atomcontext.h:33
IR::AtomContext::ContextType::ListItem
@ ListItem
Definition
atomcontext.h:24
IR::AtomContext::ContextType::TableRow
@ TableRow
Definition
atomcontext.h:31
IR::AtomContext::ContextType::Section
@ Section
Definition
atomcontext.h:21
IR::AtomContext::ContextType::TableCell
@ TableCell
Definition
atomcontext.h:32
IR::AtomContext::ContextType::Paragraph
@ Paragraph
Definition
atomcontext.h:19
IR::AtomContext::isInContext
bool isInContext(ContextType type) const
Definition
atomcontext.h:58
IR::AtomContext::pop
Frame pop()
Definition
atomcontext.h:52
IR::AtomContext::clear
void clear()
Definition
atomcontext.h:77
IR::AtomContext::current
const Frame & current() const
Definition
atomcontext.h:67
IR::AtomContext::isEmpty
bool isEmpty() const
Definition
atomcontext.h:73
IR::AtomContext::depth
qsizetype depth() const
Definition
atomcontext.h:75
IR::AtomContext::push
void push(ContextType type, QJsonObject attrs={})
Definition
atomcontext.h:47
qttools
src
qdoc
qdoc
src
qdoc
ir
atomcontext.h
Generated on
for Qt by
1.16.1