summaryrefslogtreecommitdiffstats
path: root/src/qdoc/qdoc/src/qdoc/xmlgenerator.h
blob: 5f7ba67fd6d3c3e9506b912a56b9ef65f094efcc (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
// Copyright (C) 2019 Thibaut Cuvelier
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef XMLGENERATOR_H
#define XMLGENERATOR_H

#include "node.h"
#include "generator.h"
#include "filesystem/fileresolver.h"

#include <QtCore/qmap.h>
#include <QtCore/qstring.h>

QT_BEGIN_NAMESPACE

class XmlGenerator : public Generator
{
public:
    explicit XmlGenerator(FileResolver& file_resolver);

protected:
    QHash<QString, QString> refMap;

    static bool hasBrief(const Node *node);
    static bool isThreeColumnEnumValueTable(const Atom *atom);
    static bool isOneColumnValueTable(const Atom *atom);
    static int hOffset(const Node *node);

    static void rewritePropertyBrief(const Atom *atom, const Node *relative);
    static Node::NodeType typeFromString(const Atom *atom);
    static void setImageFileName(const Node *relative, const QString &fileName);
    static std::pair<QString, int> getAtomListValue(const Atom *atom);
    static std::pair<QString, QString> getTableWidthAttr(const Atom *atom);

    QString registerRef(const QString &ref, bool xmlCompliant = false);
    QString refForNode(const Node *node);
    QString linkForNode(const Node *node, const Node *relative);
    QString getLink(const Atom *atom, const Node *relative, const Node **node);
    QString getAutoLink(const Atom *atom, const Node *relative, const Node **node,
                        Node::Genus = Node::DontCare);

    std::pair<QString, QString> anchorForNode(const Node *node);

    static QString targetType(const Node *node);

protected:
    static const QRegularExpression m_funcLeftParen;
    const Node *m_linkNode { nullptr };
};

QT_END_NAMESPACE

#endif // XMLGENERATOR_H