1 | // Copyright (C) 2020 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 ENUMNODE_H |
5 | #define ENUMNODE_H |
6 | |
7 | #include "access.h" |
8 | #include "node.h" |
9 | #include "typedefnode.h" |
10 | |
11 | #include <QtCore/qglobal.h> |
12 | #include <QtCore/qlist.h> |
13 | #include <QtCore/qset.h> |
14 | #include <QtCore/qstring.h> |
15 | |
16 | QT_BEGIN_NAMESPACE |
17 | |
18 | class Aggregate; |
19 | |
20 | class EnumNode : public Node |
21 | { |
22 | public: |
23 | EnumNode(Aggregate *parent, const QString &name, bool isScoped = false) |
24 | : Node(Enum, parent, name), m_isScoped(isScoped) |
25 | { |
26 | } |
27 | |
28 | void addItem(const EnumItem &item); |
29 | void setFlagsType(TypedefNode *typedefNode); |
30 | bool hasItem(const QString &name) const { return m_names.contains(value: name); } |
31 | bool isScoped() const { return m_isScoped; } |
32 | |
33 | const QList<EnumItem> &items() const { return m_items; } |
34 | Access itemAccess(const QString &name) const; |
35 | const TypedefNode *flagsType() const { return m_flagsType; } |
36 | QString itemValue(const QString &name) const; |
37 | Node *clone(Aggregate *parent) override; |
38 | void setSince(const QString &value, const QString &since); |
39 | |
40 | private: |
41 | QList<EnumItem> m_items {}; |
42 | QSet<QString> m_names {}; |
43 | const TypedefNode *m_flagsType { nullptr }; |
44 | bool m_isScoped { false }; |
45 | }; |
46 | |
47 | QT_END_NAMESPACE |
48 | |
49 | #endif // ENUMNODE_H |
50 |