summaryrefslogtreecommitdiffstats
path: root/src/qdoc/qdoc/src/qdoc/pagenode.h
blob: 14231bccdd4587e9b5c4233752632015b410b0c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef PAGENODE_H
#define PAGENODE_H

#include "node.h"

#include <QtCore/qglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>

QT_BEGIN_NAMESPACE

class Aggregate;

class PageNode : public Node
{
public:
    PageNode(Aggregate *parent, const QString &name) : Node(Page, parent, name) {}
    PageNode(NodeType type, Aggregate *parent, const QString &name) : Node(type, parent, name) {}

    [[nodiscard]] bool isPageNode() const override { return true; }
    [[nodiscard]] bool isTextPageNode() const override
    {
        return !isAggregate();
    } // PageNode but not Aggregate

    [[nodiscard]] QString title() const override { return m_title; }
    [[nodiscard]] QString subtitle() const override { return m_subtitle; }
    [[nodiscard]] QString fullTitle() const override;
    bool setTitle(const QString &title) override;
    bool setSubtitle(const QString &subtitle) override
    {
        m_subtitle = subtitle;
        return true;
    }
    [[nodiscard]] virtual QString imageFileName() const { return QString(); }
    virtual void setImageFileName(const QString &) {}

    [[nodiscard]] bool noAutoList() const { return m_noAutoList; }
    void setNoAutoList(bool b) { m_noAutoList = b; }
    [[nodiscard]] const QStringList &groupNames() const { return m_groupNames; }
    void appendGroupName(const QString &t) override { m_groupNames.append(t); }

    [[nodiscard]] const PageNode *navigationParent() const { return m_navParent; }
    void setNavigationParent(const PageNode *parent) { m_navParent = parent; }

    void markAttribution() { is_attribution = true; }
    [[nodiscard]] bool isAttribution() const { return is_attribution; }

protected:
    friend class Node;

protected:
    bool m_noAutoList { false };
    QString m_title {};
    QString m_subtitle {};
    QStringList m_groupNames {};

    // Marks the PageNode as being or not being an attribution.
    // A PageNode that is an attribution represents a page that serves
    // to present the third party software that a project uses,
    // together with its license, link to the website of the project
    // and so on.
    // PageNode that are attribution are expected to be generate only
    // for the Qt project by the QAttributionScanner, as part of the
    // built of Qt's documentation.
    //
    // PageNodes that are attribution are marked primarily so that
    // QDoc is able to generate a specialized list of attributions for
    // a specific module through the use of the "\generatedlist"
    // command, and behave like any other PageNode otherwise.
    bool is_attribution{ false };

private:
    const PageNode *m_navParent { nullptr };
};

QT_END_NAMESPACE

#endif // PAGENODE_H