| 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 NAMESPACENODE_H |
| 5 | #define NAMESPACENODE_H |
| 6 | |
| 7 | #include "aggregate.h" |
| 8 | |
| 9 | #include <QtCore/qglobal.h> |
| 10 | #include <QtCore/qstring.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | class Tree; |
| 15 | |
| 16 | class NamespaceNode : public Aggregate |
| 17 | { |
| 18 | public: |
| 19 | NamespaceNode(Aggregate *parent, const QString &name) : Aggregate(NodeType::Namespace, parent, name) {} |
| 20 | ~NamespaceNode() override = default; |
| 21 | [[nodiscard]] Tree *tree() const override { return (parent() ? parent()->tree() : m_tree); } |
| 22 | |
| 23 | [[nodiscard]] bool isFirstClassAggregate() const override { return true; } |
| 24 | [[nodiscard]] bool isRelatableType() const override { return true; } |
| 25 | [[nodiscard]] bool wasSeen() const override { return m_seen; } |
| 26 | void markSeen() { m_seen = true; } |
| 27 | void setTree(Tree *t) { m_tree = t; } |
| 28 | [[nodiscard]] const NodeList &includedChildren() const; |
| 29 | void includeChild(Node *child); |
| 30 | void setWhereDocumented(const QString &t) { m_whereDocumented = t; } |
| 31 | [[nodiscard]] bool isDocumentedHere() const; |
| 32 | [[nodiscard]] bool hasDocumentedChildren() const; |
| 33 | void reportDocumentedChildrenInUndocumentedNamespace() const; |
| 34 | [[nodiscard]] bool docMustBeGenerated() const override; |
| 35 | void setDocNode(NamespaceNode *ns) { m_docNode = ns; } |
| 36 | [[nodiscard]] NamespaceNode *docNode() const { return m_docNode; } |
| 37 | |
| 38 | private: |
| 39 | bool m_seen { false }; |
| 40 | Tree *m_tree { nullptr }; |
| 41 | QString m_whereDocumented {}; |
| 42 | NamespaceNode *m_docNode { nullptr }; |
| 43 | NodeList m_includedChildren {}; |
| 44 | }; |
| 45 | |
| 46 | QT_END_NAMESPACE |
| 47 | |
| 48 | #endif // NAMESPACENODE_H |
| 49 | |