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 "node.h"
9#include "generator.h"
10#include "filesystem/fileresolver.h"
11
12#include <QtCore/qmap.h>
13#include <QtCore/qstring.h>
14
15QT_BEGIN_NAMESPACE
16
17class XmlGenerator : public Generator
18{
19public:
20 explicit XmlGenerator(FileResolver& file_resolver);
21
22protected:
23 QHash<QString, QString> refMap;
24
25 static bool hasBrief(const Node *node);
26 static bool isThreeColumnEnumValueTable(const Atom *atom);
27 static bool isOneColumnValueTable(const Atom *atom);
28 static int hOffset(const Node *node);
29
30 static void rewritePropertyBrief(const Atom *atom, const Node *relative);
31 static Node::NodeType typeFromString(const Atom *atom);
32 static void setImageFileName(const Node *relative, const QString &fileName);
33 static std::pair<QString, int> getAtomListValue(const Atom *atom);
34 static std::pair<QString, QString> getTableWidthAttr(const Atom *atom);
35
36 QString registerRef(const QString &ref, bool xmlCompliant = false);
37 QString refForNode(const Node *node);
38 QString linkForNode(const Node *node, const Node *relative);
39 QString getLink(const Atom *atom, const Node *relative, const Node **node);
40 QString getAutoLink(const Atom *atom, const Node *relative, const Node **node,
41 Node::Genus = Node::DontCare);
42
43 std::pair<QString, QString> anchorForNode(const Node *node);
44
45 static QString targetType(const Node *node);
46
47protected:
48 static const QRegularExpression m_funcLeftParen;
49 const Node *m_linkNode { nullptr };
50};
51
52QT_END_NAMESPACE
53
54#endif // XMLGENERATOR_H
55

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