1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2019 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the tools applications of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 ** included in the packaging of this file. Please review the following 22 ** information to ensure the GNU General Public License requirements will 23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 ** 25 ** $QT_END_LICENSE$ 26 ** 27 ****************************************************************************/ 28 29 #ifndef QDOCINDEXFILES_H 30 #define QDOCINDEXFILES_H 31 32 #include "node.h" 33 #include "tree.h" 34 35 QT_BEGIN_NAMESPACE 36 37 class Atom; 38 class Generator; 39 class QStringList; 40 class QDocDatabase; 41 class WebXMLGenerator; 42 class QXmlStreamReader; 43 class QXmlStreamWriter; 44 class QXmlStreamAttributes; 45 46 // A callback interface for extending index sections 47 class IndexSectionWriter 48 { 49 public: ~IndexSectionWriter()50 virtual ~IndexSectionWriter() {} 51 virtual void append(QXmlStreamWriter &writer, Node *node) = 0; 52 }; 53 54 class QDocIndexFiles 55 { 56 friend class QDocDatabase; 57 friend class WebXMLGenerator; // for using generateIndexSections() 58 59 private: 60 static QDocIndexFiles *qdocIndexFiles(); 61 static void destroyQDocIndexFiles(); 62 63 QDocIndexFiles(); 64 ~QDocIndexFiles(); 65 66 void readIndexes(const QStringList &indexFiles); 67 void readIndexFile(const QString &path); 68 void readIndexSection(QXmlStreamReader &reader, Node *current, const QString &indexUrl); 69 void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes, 70 Node *node); 71 void resolveIndex(); 72 73 void generateIndex(const QString &fileName, const QString &url, const QString &title, 74 Generator *g); 75 void generateFunctionSection(QXmlStreamWriter &writer, FunctionNode *fn); 76 void generateFunctionSections(QXmlStreamWriter &writer, Aggregate *aggregate); 77 bool generateIndexSection(QXmlStreamWriter &writer, Node *node, 78 IndexSectionWriter *post = nullptr); 79 void generateIndexSections(QXmlStreamWriter &writer, Node *node, 80 IndexSectionWriter *post = nullptr); 81 82 private: 83 static QDocIndexFiles *qdocIndexFiles_; 84 QDocDatabase *qdb_; 85 Generator *gen_; 86 QString project_; 87 QVector<QPair<ClassNode *, QString>> basesList_; 88 bool storeLocationInfo_; 89 }; 90 91 QT_END_NAMESPACE 92 93 #endif 94