1// Copyright (C) 2019 Thibaut Cuvelier
2// Copyright (C) 2021 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
4
5#ifndef XMLGENERATOR_H
6#define XMLGENERATOR_H
7
8#include "generator.h"
9#include "genustypes.h"
10#include "node.h"
11
12#include "filesystem/fileresolver.h"
13
14#include <QtCore/qmap.h>
15#include <QtCore/qstring.h>
16
17QT_BEGIN_NAMESPACE
18
19class XmlGenerator : public Generator
20{
21public:
22 explicit XmlGenerator(FileResolver& file_resolver);
23
24protected:
25 QHash<QString, QString> refMap;
26
27 static bool hasBrief(const Node *node);
28 static bool isThreeColumnEnumValueTable(const Atom *atom);
29 static bool isOneColumnValueTable(const Atom *atom);
30 static int hOffset(const Node *node);
31
32 static void rewritePropertyBrief(const Atom *atom, const Node *relative);
33 static NodeType typeFromString(const Atom *atom);
34 static void setImageFileName(const Node *relative, const QString &fileName);
35 static std::pair<QString, int> getAtomListValue(const Atom *atom);
36 static std::pair<QString, QString> getTableWidthAttr(const Atom *atom);
37
38 QString registerRef(const QString &ref, bool xmlCompliant = false);
39 QString refForNode(const Node *node);
40 QString linkForNode(const Node *node, const Node *relative);
41 QString getLink(const Atom *atom, const Node *relative, const Node **node);
42 QString getAutoLink(const Atom *atom, const Node *relative, const Node **node,
43 Genus = Genus::DontCare);
44
45 std::pair<QString, QString> anchorForNode(const Node *node);
46
47 static QString targetType(const Node *node);
48
49protected:
50 static const QRegularExpression m_funcLeftParen;
51 const Node *m_linkNode { nullptr };
52};
53
54QT_END_NAMESPACE
55
56#endif // XMLGENERATOR_H
57

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