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
classificationjson.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_CLASSIFICATIONJSON_H
5
#
define
QDOC_IR_CLASSIFICATIONJSON_H
6
7
#
include
"qdoc/access.h"
8
#
include
"qdoc/genustypes.h"
9
#
include
"qdoc/status.h"
10
11
#
include
<
QJsonObject
>
12
#
include
<
QString
>
13
14
#
include
<
optional
>
15
16
QT_BEGIN_NAMESPACE
17
18
using
namespace
Qt::Literals::StringLiterals;
19
20
namespace
IR
{
21
22
// Returns a JSON object with "id" and "label" keys.
23
// Classification fields use a stable kebab-case id for template
24
// conditionals and a human-readable label for display.
25
inline
QJsonObject
classificationObject
(
const
QString &id,
const
QString &label)
26
{
27
QJsonObject obj;
28
obj[
"id"_L1
] = id;
29
obj[
"label"_L1
] = label;
30
return
obj;
31
}
32
33
// Returns {id, label} for a NodeType, or std::nullopt for NoType.
34
inline
std
::
optional
<
QJsonObject
>
nodeTypeToJson
(
NodeType
t)
35
{
36
switch
(t) {
37
case
NodeType
::
NoType
:
38
return
std
::nullopt;
39
case
NodeType::Namespace:
40
return
classificationObject(
"namespace"_L1
,
"Namespace"_L1
);
41
case
NodeType::Class:
42
return
classificationObject(
"class"_L1
,
"Class"_L1
);
43
case
NodeType::Struct:
44
return
classificationObject(
"struct"_L1
,
"Struct"_L1
);
45
case
NodeType::Union:
46
return
classificationObject(
"union"_L1
,
"Union"_L1
);
47
case
NodeType::HeaderFile:
48
return
classificationObject(
"header-file"_L1
,
"Header file"_L1
);
49
case
NodeType::Page:
50
return
classificationObject(
"page"_L1
,
"Page"_L1
);
51
case
NodeType::Enum:
52
return
classificationObject(
"enum"_L1
,
"Enum"_L1
);
53
case
NodeType::Example:
54
return
classificationObject(
"example"_L1
,
"Example"_L1
);
55
case
NodeType::ExternalPage:
56
return
classificationObject(
"external-page"_L1
,
"External page"_L1
);
57
case
NodeType::TypeAlias:
58
return
classificationObject(
"type-alias"_L1
,
"Type alias"_L1
);
59
case
NodeType::Typedef:
60
return
classificationObject(
"typedef"_L1
,
"Typedef"_L1
);
61
case
NodeType::Function:
62
return
classificationObject(
"function"_L1
,
"Function"_L1
);
63
case
NodeType::Property:
64
return
classificationObject(
"property"_L1
,
"Property"_L1
);
65
case
NodeType::Proxy:
66
return
classificationObject(
"proxy"_L1
,
"Proxy"_L1
);
67
case
NodeType::Variable:
68
return
classificationObject(
"variable"_L1
,
"Variable"_L1
);
69
case
NodeType::Group:
70
return
classificationObject(
"group"_L1
,
"Group"_L1
);
71
case
NodeType::Module:
72
return
classificationObject(
"module"_L1
,
"Module"_L1
);
73
case
NodeType::Concept:
74
return
classificationObject(
"concept"_L1
,
"Concept"_L1
);
75
case
NodeType::QmlType:
76
return
classificationObject(
"qml-type"_L1
,
"QML type"_L1
);
77
case
NodeType::QmlValueType:
78
return
classificationObject(
"qml-value-type"_L1
,
"QML value type"_L1
);
79
case
NodeType::QmlModule:
80
return
classificationObject(
"qml-module"_L1
,
"QML module"_L1
);
81
case
NodeType::QmlProperty:
82
return
classificationObject(
"qml-property"_L1
,
"QML property"_L1
);
83
case
NodeType::QmlEnum:
84
return
classificationObject(
"qml-enum"_L1
,
"QML enum"_L1
);
85
case
NodeType::SharedComment:
86
return
classificationObject(
"shared-comment"_L1
,
"Shared comment"_L1
);
87
case
NodeType::Collection:
88
return
classificationObject(
"collection"_L1
,
"Collection"_L1
);
89
}
90
Q_UNREACHABLE();
91
}
92
93
// Returns {id, label} for a Genus, or std::nullopt for DontCare.
94
inline
std
::
optional
<
QJsonObject
>
genusToJson
(Genus g)
95
{
96
switch
(g) {
97
case
Genus::DontCare:
98
return
std
::nullopt;
99
case
Genus::CPP:
100
return
classificationObject(
"cpp"_L1
,
"C++"_L1
);
101
case
Genus::QML:
102
return
classificationObject(
"qml"_L1
,
"QML"_L1
);
103
case
Genus::DOC:
104
return
classificationObject(
"doc"_L1
,
"Overview"_L1
);
105
case
Genus::API:
106
return
classificationObject(
"api"_L1
,
"API"_L1
);
107
}
108
Q_UNREACHABLE();
109
}
110
111
// Returns {id, label} for a Status value.
112
inline
QJsonObject
statusToJson
(
Status
s)
113
{
114
switch
(s) {
115
case
Status::Deprecated:
116
return
classificationObject(
"deprecated"_L1
,
"Deprecated"_L1
);
117
case
Status::Preliminary:
118
return
classificationObject(
"preliminary"_L1
,
"Preliminary"_L1
);
119
case
Status::Active:
120
return
classificationObject(
"active"_L1
,
"Active"_L1
);
121
case
Status::Internal:
122
return
classificationObject(
"internal"_L1
,
"Internal"_L1
);
123
case
Status::InternalAuto:
124
return
classificationObject(
"internal-auto"_L1
,
"Internal (auto)"_L1
);
125
case
Status::DontDocument:
126
return
classificationObject(
"ignored"_L1
,
"Ignored"_L1
);
127
}
128
Q_UNREACHABLE();
129
}
130
131
// Returns {id, label} for an Access value.
132
inline
QJsonObject
accessToJson
(Access a)
133
{
134
switch
(a) {
135
case
Access::Public:
136
return
classificationObject(
"public"_L1
,
"Public"_L1
);
137
case
Access::Protected:
138
return
classificationObject(
"protected"_L1
,
"Protected"_L1
);
139
case
Access::Private:
140
return
classificationObject(
"private"_L1
,
"Private"_L1
);
141
}
142
Q_UNREACHABLE();
143
}
144
145
}
// namespace IR
146
147
QT_END_NAMESPACE
148
149
#
endif
// QDOC_IR_CLASSIFICATIONJSON_H
QQmlIncubator::Status
Status
Specifies the status of the QQmlIncubator.
Definition
qqmlincubator.h:29
NodeType
NodeType
Definition
genustypes.h:165
NodeType::NoType
@ NoType
Definition
genustypes.h:166
IR
Definition
builder.cpp:14
IR::accessToJson
QJsonObject accessToJson(Access a)
Definition
classificationjson.h:132
IR::nodeTypeToJson
std::optional< QJsonObject > nodeTypeToJson(NodeType t)
Definition
classificationjson.h:34
IR::genusToJson
std::optional< QJsonObject > genusToJson(Genus g)
Definition
classificationjson.h:94
IR::memberEntriesToJson
static QJsonArray memberEntriesToJson(const QList< CollectionInfo::MemberEntry > &entries)
Definition
document.cpp:104
IR::statusToJson
QJsonObject statusToJson(Status s)
Definition
classificationjson.h:112
IR::classificationObject
QJsonObject classificationObject(const QString &id, const QString &label)
Definition
classificationjson.h:25
IR::crumbStateString
static QString crumbStateString(NavigationInfo::CrumbState state)
Definition
document.cpp:300
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
IR::CollectionInfo
Definition
document.h:57
IR::CollectionInfo::toJson
QJsonObject toJson() const
Converts the CollectionInfo to a QJsonObject for template rendering.
Definition
document.cpp:127
IR::CppReferenceInfo
Definition
document.h:86
IR::CppReferenceInfo::toJson
QJsonObject toJson() const
Converts CppReferenceInfo to a QJsonObject for template rendering.
Definition
document.cpp:168
IR::Document
Intermediate representation for a documentation topic.
Definition
document.h:201
IR::Document::toJson
QJsonObject toJson() const
Converts the Document to a QJsonObject for template rendering.
Definition
document.cpp:390
IR::NavigationInfo
Definition
document.h:166
IR::NavigationInfo::CrumbState
CrumbState
Definition
document.h:167
IR::NavigationInfo::toJson
QJsonObject toJson() const
Converts NavigationInfo to a QJsonObject for template rendering.
Definition
document.cpp:325
IR::QmlTypeInfo
Definition
document.h:27
IR::QmlTypeInfo::toJson
QJsonObject toJson() const
\variable IR::Document::typeNoun
Definition
document.cpp:62
qttools
src
qdoc
qdoc
src
qdoc
ir
classificationjson.h
Generated on
for Qt by
1.18.0