1// Copyright (C) 2021 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 QDOCINDEXFILES_H
5#define QDOCINDEXFILES_H
6
7#include "node.h"
8#include "tree.h"
9
10QT_BEGIN_NAMESPACE
11
12class Atom;
13class FunctionNode;
14class Generator;
15class QDocDatabase;
16class WebXMLGenerator;
17class QXmlStreamReader;
18class QXmlStreamWriter;
19class QXmlStreamAttributes;
20
21// A callback interface for extending index sections
22class IndexSectionWriter
23{
24public:
25 virtual ~IndexSectionWriter() = default;
26 virtual void append(QXmlStreamWriter &writer, Node *node) = 0;
27};
28
29class QDocIndexFiles
30{
31 friend class QDocDatabase;
32 friend class WebXMLGenerator; // for using generateIndexSections()
33
34private:
35 static QDocIndexFiles *qdocIndexFiles();
36 static void destroyQDocIndexFiles();
37
38 QDocIndexFiles();
39 ~QDocIndexFiles();
40
41 void readIndexes(const QStringList &indexFiles);
42 void readIndexFile(const QString &path);
43 void readIndexSection(QXmlStreamReader &reader, Node *current, const QString &indexUrl);
44 void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes,
45 Node *node);
46 void resolveIndex();
47 int indexForNode(Node *node);
48 bool adoptRelatedNode(Aggregate *adoptiveParent, int index);
49
50 void generateIndex(const QString &fileName, const QString &url, const QString &title,
51 Generator *g);
52 void generateFunctionSection(QXmlStreamWriter &writer, FunctionNode *fn);
53 void generateFunctionSections(QXmlStreamWriter &writer, Aggregate *aggregate);
54 bool generateIndexSection(QXmlStreamWriter &writer, Node *node,
55 IndexSectionWriter *post = nullptr);
56 void generateIndexSections(QXmlStreamWriter &writer, Node *node,
57 IndexSectionWriter *post = nullptr);
58 QString appendAttributesToSignature(const FunctionNode *fn) const noexcept;
59
60private:
61 static QDocIndexFiles *s_qdocIndexFiles;
62 QDocDatabase *m_qdb {};
63 Generator *m_gen {};
64 QString m_project;
65 QList<std::pair<ClassNode *, QString>> m_basesList;
66 NodeList m_relatedNodes;
67 bool m_storeLocationInfo;
68};
69
70QT_END_NAMESPACE
71
72#endif
73

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