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

source code of qttools/src/qdoc/qdoc/src/qdoc/sharedcommentnode.h