blob: 03d7a308296f31fddd96999500cba9de56c7bc80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTMETAENUM_H
#define ABSTRACTMETAENUM_H
#include "abstractmetalang_typedefs.h"
#include "enclosingclassmixin.h"
#include "parser/codemodel_enums.h"
#include "typesystem_typedefs.h"
#include <QtCore/QSharedDataPointer>
#include <QtCore/QString>
#include <optional>
QT_FORWARD_DECLARE_CLASS(QDebug)
class AbstractMetaEnumData;
class AbstractMetaEnumValueData;
class Documentation;
class EnumValue;
class EnumTypeEntry;
class AbstractMetaEnumValue
{
public:
AbstractMetaEnumValue();
AbstractMetaEnumValue(const AbstractMetaEnumValue &);
AbstractMetaEnumValue &operator=(const AbstractMetaEnumValue &);
AbstractMetaEnumValue(AbstractMetaEnumValue &&) noexcept;
AbstractMetaEnumValue &operator=(AbstractMetaEnumValue &&) noexcept;
~AbstractMetaEnumValue();
EnumValue value() const;
void setValue(EnumValue value);
QString stringValue() const;
void setStringValue(const QString &v);
QString name() const;
void setName(const QString &name);
bool isDeprecated() const;
void setDeprecated(bool deprecated);
Documentation documentation() const;
void setDocumentation(const Documentation& doc);
int usedBits() const;
private:
QSharedDataPointer<AbstractMetaEnumValueData> d;
};
class AbstractMetaEnum : public EnclosingClassMixin
{
public:
AbstractMetaEnum();
AbstractMetaEnum(const AbstractMetaEnum &);
AbstractMetaEnum &operator=(const AbstractMetaEnum &);
AbstractMetaEnum(AbstractMetaEnum &&) noexcept;
AbstractMetaEnum &operator=(AbstractMetaEnum &&) noexcept;
~AbstractMetaEnum();
const AbstractMetaEnumValueList &values() const;
AbstractMetaEnumValueList nonRejectedValues() const;
void addEnumValue(const AbstractMetaEnumValue &enumValue);
std::optional<AbstractMetaEnumValue> findEnumValue(QStringView value) const;
QString name() const;
QString qualifiedCppName() const;
Access access() const;
void setAccess(Access a);
bool isPrivate() const { return access() == Access::Private; }
bool isProtected() const { return access() == Access::Protected; }
bool isDeprecated() const;
void setDeprecated(bool deprecated);
bool hasDeprecatedValues() const;
AbstractMetaEnumValueList deprecatedValues() const;
const Documentation &documentation() const;
void setDocumentation(const Documentation& doc);
QString qualifier() const;
QString package() const;
QString fullName() const;
EnumKind enumKind() const;
void setEnumKind(EnumKind kind);
bool isAnonymous() const;
// Has the enum been declared inside a Q_ENUMS() macro in its enclosing class?
bool hasQEnumsDeclaration() const;
void setHasQEnumsDeclaration(bool on);
EnumTypeEntryCPtr typeEntry() const;
void setTypeEntry(const EnumTypeEntryCPtr &entry);
bool isSigned() const;
void setSigned(bool s);
QString underlyingType() const;
void setUnderlyingType(const QString &underlyingType);
static QString intTypeForSize(int usedBits, bool isSigned);
int usedBits() const;
private:
QSharedDataPointer<AbstractMetaEnumData> d;
};
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const AbstractMetaEnumValue &ae);
QDebug operator<<(QDebug d, const AbstractMetaEnum *ae);
QDebug operator<<(QDebug d, const AbstractMetaEnum &ae);
#endif
#endif // ABSTRACTMETAENUM_H
|