QtBase
v6.3.1
tests
auto
tools
moc
cxx11-enums.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** Copyright (C) 2011 Olivier Goffart.
4
** Contact: https://www.qt.io/licensing/
5
**
6
** This file is part of the test suite of the Qt Toolkit.
7
**
8
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and The Qt Company. For licensing terms
14
** and conditions see https://www.qt.io/terms-conditions. For further
15
** information use the contact form at https://www.qt.io/contact-us.
16
**
17
** GNU General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU
19
** General Public License version 3 as published by the Free Software
20
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21
** included in the packaging of this file. Please review the following
22
** information to ensure the GNU General Public License requirements will
23
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24
**
25
** $QT_END_LICENSE$
26
**
27
****************************************************************************/
28
29
#ifndef CXX11_ENUMS_H
30
#define CXX11_ENUMS_H
31
#include <QtCore/QObject>
32
33
class
CXX11Enums
34
{
35
Q_GADGET
36
public
:
37
enum class
EnumClass
{
A0
,
A1
,
A2
,
A3
};
38
enum
TypedEnum
:
char
{
B0
,
B1
,
B2
,
B3
};
39
enum class
TypedEnumClass
: char {
C0
,
C1
,
C2
,
C3
};
40
enum
NormalEnum
{
D2
= 2,
D3
,
D0
=0 ,
D1
};
41
enum class
ClassFlag
{
F0
= 1,
F1
= 2,
F2
= 4,
F3
= 8};
42
43
enum struct
EnumStruct
{
G0
,
G1
,
G2
,
G3
};
44
enum struct
TypedEnumStruct
: char {
H0
,
H1
,
H2
,
H3
};
45
enum struct
StructFlag
{
I0
= 1,
I1
= 2,
I2
= 4,
I3
= 8};
46
47
Q_DECLARE_FLAGS
(ClassFlags,
ClassFlag
)
48
Q_DECLARE_FLAGS
(StructFlags,
StructFlag
)
49
50
Q_ENUM
(
EnumClass
)
51
Q_ENUM
(
TypedEnum
)
52
Q_ENUM
(
TypedEnumClass
)
53
Q_ENUM
(
NormalEnum
)
54
Q_ENUM
(
EnumStruct
)
55
Q_ENUM
(
TypedEnumStruct
)
56
Q_FLAG
(ClassFlags)
57
Q_FLAG
(StructFlags)
58
};
59
60
// Also test the Q_ENUMS macro
61
class
CXX11Enums2
62
{
63
Q_GADGET
64
public
:
65
enum class
EnumClass
{
A0
,
A1
,
A2
,
A3
};
66
enum
TypedEnum
:
char
{
B0
,
B1
,
B2
,
B3
};
67
enum class
TypedEnumClass
: char {
C0
,
C1
,
C2
,
C3
};
68
enum
NormalEnum
{
D2
= 2,
D3
,
D0
=0 ,
D1
};
69
enum class
ClassFlag
{
F0
= 1,
F1
= 2,
F2
= 4,
F3
= 8 };
70
Q_DECLARE_FLAGS
(ClassFlags,
ClassFlag
)
71
Q_ENUMS
(
EnumClass
TypedEnum
TypedEnumClass
NormalEnum
)
72
Q_FLAGS
(ClassFlags)
73
};
74
75
#endif
// CXX11_ENUMS_H
CXX11Enums2
Definition:
cxx11-enums.h:62
CXX11Enums2::ClassFlag
ClassFlag
Definition:
cxx11-enums.h:69
CXX11Enums2::ClassFlag::F3
@ F3
CXX11Enums2::ClassFlag::F1
@ F1
CXX11Enums2::ClassFlag::F0
@ F0
CXX11Enums2::ClassFlag::F2
@ F2
CXX11Enums2::TypedEnum
TypedEnum
Definition:
cxx11-enums.h:66
CXX11Enums2::B1
@ B1
Definition:
cxx11-enums.h:66
CXX11Enums2::B2
@ B2
Definition:
cxx11-enums.h:66
CXX11Enums2::B3
@ B3
Definition:
cxx11-enums.h:66
CXX11Enums2::B0
@ B0
Definition:
cxx11-enums.h:66
CXX11Enums2::NormalEnum
NormalEnum
Definition:
cxx11-enums.h:68
CXX11Enums2::D3
@ D3
Definition:
cxx11-enums.h:68
CXX11Enums2::D2
@ D2
Definition:
cxx11-enums.h:68
CXX11Enums2::D0
@ D0
Definition:
cxx11-enums.h:68
CXX11Enums2::D1
@ D1
Definition:
cxx11-enums.h:68
CXX11Enums2::TypedEnumClass
TypedEnumClass
Definition:
cxx11-enums.h:67
CXX11Enums2::TypedEnumClass::C1
@ C1
CXX11Enums2::TypedEnumClass::C3
@ C3
CXX11Enums2::TypedEnumClass::C0
@ C0
CXX11Enums2::TypedEnumClass::C2
@ C2
CXX11Enums2::EnumClass
EnumClass
Definition:
cxx11-enums.h:65
CXX11Enums2::EnumClass::A1
@ A1
CXX11Enums2::EnumClass::A3
@ A3
CXX11Enums2::EnumClass::A2
@ A2
CXX11Enums2::EnumClass::A0
@ A0
CXX11Enums
Definition:
cxx11-enums.h:34
CXX11Enums::TypedEnumClass
TypedEnumClass
Definition:
cxx11-enums.h:39
CXX11Enums::TypedEnumClass::C1
@ C1
CXX11Enums::TypedEnumClass::C3
@ C3
CXX11Enums::TypedEnumClass::C0
@ C0
CXX11Enums::TypedEnumClass::C2
@ C2
CXX11Enums::NormalEnum
NormalEnum
Definition:
cxx11-enums.h:40
CXX11Enums::D1
@ D1
Definition:
cxx11-enums.h:40
CXX11Enums::D3
@ D3
Definition:
cxx11-enums.h:40
CXX11Enums::D0
@ D0
Definition:
cxx11-enums.h:40
CXX11Enums::D2
@ D2
Definition:
cxx11-enums.h:40
CXX11Enums::EnumStruct
EnumStruct
Definition:
cxx11-enums.h:43
CXX11Enums::EnumStruct::G0
@ G0
CXX11Enums::EnumStruct::G3
@ G3
CXX11Enums::EnumStruct::G1
@ G1
CXX11Enums::EnumStruct::G2
@ G2
CXX11Enums::StructFlag
StructFlag
Definition:
cxx11-enums.h:45
CXX11Enums::StructFlag::I2
@ I2
CXX11Enums::StructFlag::I1
@ I1
CXX11Enums::StructFlag::I3
@ I3
CXX11Enums::StructFlag::I0
@ I0
CXX11Enums::TypedEnum
TypedEnum
Definition:
cxx11-enums.h:38
CXX11Enums::B3
@ B3
Definition:
cxx11-enums.h:38
CXX11Enums::B1
@ B1
Definition:
cxx11-enums.h:38
CXX11Enums::B0
@ B0
Definition:
cxx11-enums.h:38
CXX11Enums::B2
@ B2
Definition:
cxx11-enums.h:38
CXX11Enums::TypedEnumStruct
TypedEnumStruct
Definition:
cxx11-enums.h:44
CXX11Enums::TypedEnumStruct::H1
@ H1
CXX11Enums::TypedEnumStruct::H3
@ H3
CXX11Enums::TypedEnumStruct::H2
@ H2
CXX11Enums::TypedEnumStruct::H0
@ H0
CXX11Enums::EnumClass
EnumClass
Definition:
cxx11-enums.h:37
CXX11Enums::EnumClass::A1
@ A1
CXX11Enums::EnumClass::A3
@ A3
CXX11Enums::EnumClass::A2
@ A2
CXX11Enums::EnumClass::A0
@ A0
CXX11Enums::ClassFlag
ClassFlag
Definition:
cxx11-enums.h:41
CXX11Enums::ClassFlag::F3
@ F3
CXX11Enums::ClassFlag::F1
@ F1
CXX11Enums::ClassFlag::F0
@ F0
CXX11Enums::ClassFlag::F2
@ F2
Q_DECLARE_FLAGS
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition:
qflags.h:210
Q_ENUM
#define Q_ENUM(x)
Definition:
qtmetamacros.h:104
Q_FLAG
#define Q_FLAG(x)
Definition:
qtmetamacros.h:105
Q_FLAGS
#define Q_FLAGS(x)
Definition:
qtmetamacros.h:100
Q_GADGET
#define Q_GADGET
Definition:
qtmetamacros.h:193
Q_ENUMS
#define Q_ENUMS(x)
Definition:
qtmetamacros.h:99
Generated by
1.9.1