| 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 | #include "sharedcommentnode.h" |
| 5 | |
| 6 | #include "aggregate.h" |
| 7 | #include "functionnode.h" |
| 8 | #include "qmltypenode.h" |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | SharedCommentNode::SharedCommentNode(QmlTypeNode *parent, int count, QString &group) |
| 13 | : Node(NodeType::SharedComment, parent, group) |
| 14 | { |
| 15 | m_collective.reserve(asize: count); |
| 16 | } |
| 17 | |
| 18 | /*! |
| 19 | Searches the shared comment node's member nodes for function |
| 20 | nodes. Each function node's overload flag is set. |
| 21 | */ |
| 22 | void SharedCommentNode::setOverloadFlags() |
| 23 | { |
| 24 | for (auto *node : m_collective) { |
| 25 | if (node->isFunction()) |
| 26 | static_cast<FunctionNode *>(node)->setOverloadFlag(); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /*! |
| 31 | Clone this node on the heap and make the clone a child of |
| 32 | \a parent. |
| 33 | |
| 34 | Returns the pointer to the clone. |
| 35 | */ |
| 36 | Node *SharedCommentNode::clone(Aggregate *parent) |
| 37 | { |
| 38 | auto *scn = new SharedCommentNode(*this); // shallow copy |
| 39 | scn->setParent(nullptr); |
| 40 | parent->addChild(child: scn); |
| 41 | |
| 42 | return scn; |
| 43 | } |
| 44 | |
| 45 | /*! |
| 46 | Sets the related nonmember flag in this node and in each |
| 47 | node in the shared comment's collective to \a value. |
| 48 | */ |
| 49 | void SharedCommentNode::setRelatedNonmember(bool value) |
| 50 | { |
| 51 | Node::setRelatedNonmember(value); |
| 52 | for (auto *node : m_collective) |
| 53 | node->setRelatedNonmember(value); |
| 54 | } |
| 55 | |
| 56 | QT_END_NAMESPACE |
| 57 |
