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 PAGENODE_H
5#define PAGENODE_H
6
7#include "node.h"
8
9#include <QtCore/qglobal.h>
10#include <QtCore/qstring.h>
11#include <QtCore/qstringlist.h>
12
13QT_BEGIN_NAMESPACE
14
15class Aggregate;
16
17class PageNode : public Node
18{
19public:
20 PageNode(Aggregate *parent, const QString &name) : Node(Page, parent, name) {}
21 PageNode(NodeType type, Aggregate *parent, const QString &name) : Node(type, parent, name) {}
22
23 [[nodiscard]] bool isPageNode() const override { return true; }
24 [[nodiscard]] bool isTextPageNode() const override
25 {
26 return !isAggregate();
27 } // PageNode but not Aggregate
28
29 [[nodiscard]] QString title() const override { return m_title; }
30 [[nodiscard]] QString subtitle() const override { return m_subtitle; }
31 [[nodiscard]] QString fullTitle() const override;
32 bool setTitle(const QString &title) override;
33 bool setSubtitle(const QString &subtitle) override
34 {
35 m_subtitle = subtitle;
36 return true;
37 }
38 [[nodiscard]] virtual QString imageFileName() const { return QString(); }
39 virtual void setImageFileName(const QString &) {}
40
41 [[nodiscard]] bool noAutoList() const { return m_noAutoList; }
42 void setNoAutoList(bool b) { m_noAutoList = b; }
43 [[nodiscard]] const QStringList &groupNames() const { return m_groupNames; }
44 void appendGroupName(const QString &t) override { m_groupNames.append(t); }
45
46 [[nodiscard]] const PageNode *navigationParent() const { return m_navParent; }
47 void setNavigationParent(const PageNode *parent) { m_navParent = parent; }
48
49 void markAttribution() { is_attribution = true; }
50 [[nodiscard]] bool isAttribution() const { return is_attribution; }
51
52protected:
53 friend class Node;
54
55protected:
56 bool m_noAutoList { false };
57 QString m_title {};
58 QString m_subtitle {};
59 QStringList m_groupNames {};
60
61 // Marks the PageNode as being or not being an attribution.
62 // A PageNode that is an attribution represents a page that serves
63 // to present the third party software that a project uses,
64 // together with its license, link to the website of the project
65 // and so on.
66 // PageNode that are attribution are expected to be generate only
67 // for the Qt project by the QAttributionScanner, as part of the
68 // built of Qt's documentation.
69 //
70 // PageNodes that are attribution are marked primarily so that
71 // QDoc is able to generate a specialized list of attributions for
72 // a specific module through the use of the "\generatedlist"
73 // command, and behave like any other PageNode otherwise.
74 bool is_attribution{ false };
75
76private:
77 const PageNode *m_navParent { nullptr };
78};
79
80QT_END_NAMESPACE
81
82#endif // PAGENODE_H
83

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