Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
listplaceholder.cpp
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
#
include
"listplaceholder.h"
5
6
QT_BEGIN_NAMESPACE
7
8
using
namespace
Qt::Literals::StringLiterals;
9
10
namespace
IR
{
11
12
/*!
13
\enum IR::ListPlaceholderVariant
14
\internal
15
\brief Discriminator naming the catalog shape carried by a
16
\c{BlockType::ListPlaceholder} block.
17
18
The content builder picks a variant when emitting a list-placeholder
19
for \\generatelist or \\annotatedlist; the list-expander pass
20
matches on the variant when populating the catalog. Adding a
21
catalog form means adding an enumerator here and a matching arm in
22
\c{toString()}, so a missing string mapping fails to compile.
23
24
\value AnnotatedGroup The annotated members of a documentation
25
group, emitted for \\annotatedlist \e{<group>}.
26
\value AnnotatedExamples The annotated list of example projects,
27
emitted for \\generatelist annotatedexamples.
28
\value AnnotatedClasses The annotated list of public classes,
29
emitted for \\generatelist annotatedclasses.
30
\value CompactClasses The compact, alphabetically-grouped classes
31
index, emitted for \\generatelist classes \e{[<rootname>]}.
32
*/
33
34
/*!
35
\fn QString IR::toString(ListPlaceholderVariant variant)
36
\internal
37
38
Returns the canonical kebab-case string used as the \c variant
39
attribute of the placeholder block in JSON output. The string is
40
the contract between the content builder, the list-expander pass,
41
and the templates: every consumer matches on the same value, and
42
\c{toString()} is the single source of truth.
43
*/
44
QString
toString
(
ListPlaceholderVariant
variant)
45
{
46
switch
(variant) {
47
case
ListPlaceholderVariant::AnnotatedGroup:
return
u"annotated-group"_s;
48
case
ListPlaceholderVariant::AnnotatedExamples:
return
u"annotated-examples"_s;
49
case
ListPlaceholderVariant::AnnotatedClasses:
return
u"annotated-classes"_s;
50
case
ListPlaceholderVariant::CompactClasses:
return
u"compact-classes"_s;
51
}
52
Q_UNREACHABLE_RETURN({});
53
}
54
55
/*!
56
\fn std::optional<IR::ListPlaceholderVariant> IR::parseListPlaceholderVariant(
57
QStringView variant)
58
\internal
59
60
Reverse of \c{toString()}: maps the canonical kebab-case string
61
back to a \c{ListPlaceholderVariant}, or \c{std::nullopt} for an
62
unrecognized value. Used by the list-expander pass to dispatch
63
on the placeholder block's \c{variant} attribute without
64
introducing a parallel set of string literals.
65
*/
66
std
::optional<
ListPlaceholderVariant
>
parseListPlaceholderVariant
(QStringView variant)
67
{
68
if
(variant == u"annotated-group")
69
return
ListPlaceholderVariant
::
AnnotatedGroup
;
70
if
(variant == u"annotated-examples")
71
return
ListPlaceholderVariant
::
AnnotatedExamples
;
72
if
(variant == u"annotated-classes")
73
return
ListPlaceholderVariant
::
AnnotatedClasses
;
74
if
(variant == u"compact-classes")
75
return
ListPlaceholderVariant
::
CompactClasses
;
76
return
std
::nullopt;
77
}
78
79
}
// namespace IR
80
81
QT_END_NAMESPACE
IR
Definition
builder.cpp:14
IR::ListPlaceholderVariant
ListPlaceholderVariant
Definition
listplaceholder.h:16
IR::ListPlaceholderVariant::CompactClasses
@ CompactClasses
Definition
listplaceholder.h:20
IR::ListPlaceholderVariant::AnnotatedClasses
@ AnnotatedClasses
Definition
listplaceholder.h:19
IR::ListPlaceholderVariant::AnnotatedExamples
@ AnnotatedExamples
Definition
listplaceholder.h:18
IR::ListPlaceholderVariant::AnnotatedGroup
@ AnnotatedGroup
Definition
listplaceholder.h:17
IR::toString
QString toString(ListPlaceholderVariant variant)
Definition
listplaceholder.cpp:44
IR::parseListPlaceholderVariant
std::optional< ListPlaceholderVariant > parseListPlaceholderVariant(QStringView variant)
Definition
listplaceholder.cpp:66
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qttools
src
qdoc
qdoc
src
qdoc
ir
listplaceholder.cpp
Generated on
for Qt by
1.18.0