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
qmultimedia_enum_to_string_converter_p.h
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
QMULTIMEDIA_ENUM_TO_STRING_CONVERTER_P_H
5
#
define
QMULTIMEDIA_ENUM_TO_STRING_CONVERTER_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
QtCore
/
qdebug
.
h
>
19
#
include
<
QtCore
/
qstring
.
h
>
20
#
include
<
QtCore
/
private
/
qglobal_p
.
h
>
21
22
#
include
<
optional
>
23
24
QT_BEGIN_NAMESPACE
25
26
#
define
QT_MM_CAT
(
x
,
y
)
QT_MM_IMPL_CAT
(
x
,
y
)
27
#
define
QT_MM_IMPL_CAT
(
x
,
y
)
x
##
y
28
29
// clang-format off
30
31
#
define
QT_MM_IMPL_GEN_CASE_MAP_ENUM_TO_STRING
(
SYMBOL
,
STRING
)
32
case
SYMBOL
:
33
return
QStringLiteral
(
STRING
)
;
34
35
// clang-format on
36
37
#
define
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING
(
seq
)
38
QT_MM_CAT
(
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_1
seq
,
_END
)
39
static_assert
(
true
,
"force semicolon"
)
40
#
define
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_1
(
x
,
y
)
41
QT_MM_IMPL_GEN_CASE_MAP_ENUM_TO_STRING
(
x
,
y
)
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_2
42
#
define
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_2
(
x
,
y
)
43
QT_MM_IMPL_GEN_CASE_MAP_ENUM_TO_STRING
(
x
,
y
)
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_1
44
#
define
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_1_END
45
#
define
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_2_END
46
47
namespace
QtMultimediaPrivate
{
48
49
struct
EnumName
50
{
51
};
52
53
template
<
typename
Enum,
typename
Role =
EnumName
>
54
struct
StringResolver
55
{
56
static
std
::
optional
<
QString
>
toQString
(Enum);
57
};
58
59
}
// namespace QtMultimediaPrivate
60
61
// clang-format off
62
63
#
define
QT_MM_MAKE_STRING_RESOLVER
(
Enum
,
EnumName
,
...
)
64
template
<
>
65
struct
QtMultimediaPrivate
::
StringResolver
<
Enum
,
EnumName
>
66
{
67
static
std
::
optional
<
QString
>
toQString
(
Enum
arg
)
68
{
69
switch
(
arg
)
{
70
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING
(
__VA_ARGS__
)
;
71
default
:
72
return
std
::
nullopt
;
73
}
74
}
75
}
;
76
static_assert
(
true
,
"force semicolon"
)
77
78
// clang-format on
79
80
#
define
QT_MM_DEFINE_QDEBUG_ENUM
(
EnumType
)
81
QDebug
operator
<<
(
QDebug
dbg
,
EnumType
arg
)
82
{
83
QDebugStateSaver
saver
(
dbg
)
;
84
dbg
.
noquote
(
)
;
85
std
::
optional
<
QString
>
resolved
=
86
QtMultimediaPrivate
::
StringResolver
<
EnumType
>
::
toQString
(
arg
)
;
87
if
(
resolved
)
88
dbg
<<
*
resolved
;
89
else
90
dbg
<<
"Unknown Enum value"
;
91
return
dbg
;
92
}
93
static_assert
(
true
,
"force semicolon"
)
94
95
QT_END_NAMESPACE
96
97
#
endif
// QMULTIMEDIA_ENUM_TO_STRING_CONVERTER_P_H
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_1
#define QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_1(x, y)
Definition
qmultimedia_enum_to_string_converter_p.h:40
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_2
#define QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING_2(x, y)
Definition
qmultimedia_enum_to_string_converter_p.h:42
QT_MM_IMPL_CAT
#define QT_MM_IMPL_CAT(x, y)
Definition
qmultimedia_enum_to_string_converter_p.h:27
QT_MM_IMPL_GEN_CASE_MAP_ENUM_TO_STRING
#define QT_MM_IMPL_GEN_CASE_MAP_ENUM_TO_STRING(SYMBOL, STRING)
Definition
qmultimedia_enum_to_string_converter_p.h:31
QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING
#define QT_MM_IMPL_GEN_CASES_ENUM_TO_STRING(seq)
Definition
qmultimedia_enum_to_string_converter_p.h:37
QT_MM_CAT
#define QT_MM_CAT(x, y)
Definition
qmultimedia_enum_to_string_converter_p.h:26
QtMultimediaPrivate::EnumName
Definition
qmultimedia_enum_to_string_converter_p.h:50
QtMultimediaPrivate::StringResolver
Definition
qmultimedia_enum_to_string_converter_p.h:55
QtMultimediaPrivate::StringResolver::toQString
static std::optional< QString > toQString(Enum)
qtmultimedia
src
multimedia
qmultimedia_enum_to_string_converter_p.h
Generated on
for Qt by
1.18.0