1 | // Copyright (C) 2021 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 SHAREDCOMMENTNODE_H |
5 | #define SHAREDCOMMENTNODE_H |
6 | |
7 | #include "node.h" |
8 | |
9 | #include <QtCore/qglobal.h> |
10 | #include <QtCore/qlist.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class Aggregate; |
15 | class QmlTypeNode; |
16 | |
17 | class SharedCommentNode : public Node |
18 | { |
19 | public: |
20 | explicit SharedCommentNode(Node *node) : Node(Node::SharedComment, node->parent(), QString()) |
21 | { |
22 | m_collective.reserve(asize: 1); |
23 | append(node); |
24 | } |
25 | SharedCommentNode(QmlTypeNode *parent, int count, QString &group); |
26 | ~SharedCommentNode() override { m_collective.clear(); } |
27 | |
28 | [[nodiscard]] bool isPropertyGroup() const override |
29 | { |
30 | return !name().isEmpty() && !m_collective.isEmpty() && (m_collective.at(i: 0)->isQmlProperty()); |
31 | } |
32 | [[nodiscard]] qsizetype count() const { return m_collective.size(); } |
33 | void append(Node *node) |
34 | { |
35 | m_collective.append(t: node); |
36 | node->setSharedCommentNode(this); |
37 | setGenus(node->genus()); |
38 | } |
39 | void sort() { std::sort(first: m_collective.begin(), last: m_collective.end(), comp: Node::nodeNameLessThan); } |
40 | [[nodiscard]] const QList<Node *> &collective() const { return m_collective; } |
41 | void setOverloadFlags(); |
42 | void setRelatedNonmember(bool value) override; |
43 | Node *clone(Aggregate *parent) override; |
44 | |
45 | private: |
46 | QList<Node *> m_collective {}; |
47 | }; |
48 | |
49 | QT_END_NAMESPACE |
50 | |
51 | #endif // SHAREDCOMMENTNODE_H |
52 |