1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QHELPDBREADER_H
5#define QHELPDBREADER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the help generator tools. This header file may change from version
13// to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qbytearray.h>
19#include <QtCore/qobject.h>
20#include <QtCore/qstringlist.h>
21
22QT_BEGIN_NAMESPACE
23
24class QSqlQuery;
25
26class QHelpDBReader : public QObject
27{
28 Q_OBJECT
29
30public:
31 class IndexItem
32 {
33 public:
34 QString name;
35 QString identifier;
36 int fileId = 0;
37 QString anchor;
38 QStringList filterAttributes;
39 };
40
41 class FileItem
42 {
43 public:
44 QString name;
45 QString title;
46 QStringList filterAttributes;
47 };
48
49 class ContentsItem
50 {
51 public:
52 QByteArray data;
53 QStringList filterAttributes;
54 };
55
56 class IndexTable
57 {
58 public:
59 QList<IndexItem> indexItems;
60 QList<FileItem> fileItems;
61 QList<ContentsItem> contentsItems;
62 QStringList usedFilterAttributes;
63 };
64
65 QHelpDBReader(const QString &dbName);
66 QHelpDBReader(const QString &dbName, const QString &uniqueId, QObject *parent);
67 ~QHelpDBReader();
68
69 bool init();
70
71 QString namespaceName() const;
72 QString virtualFolder() const;
73 QString version() const;
74 IndexTable indexTable() const;
75 QList<QStringList> filterAttributeSets() const;
76 QMultiMap<QString, QByteArray> filesData(const QStringList &filterAttributes,
77 const QString &extensionFilter = {}) const;
78 QByteArray fileData(const QString &virtualFolder, const QString &filePath) const;
79
80 QStringList customFilters() const;
81 QStringList filterAttributes(const QString &filterName = {}) const;
82
83 QVariant metaData(const QString &name) const;
84
85private:
86 QString quote(const QString &string) const;
87 bool initDB();
88 QString qtVersionHeuristic() const;
89
90 bool m_initDone = false;
91 QString m_dbName;
92 QString m_uniqueId;
93 QString m_error;
94 std::unique_ptr<QSqlQuery> m_query;
95 mutable QString m_namespace;
96};
97
98QT_END_NAMESPACE
99
100#endif // QHELPDBREADER_H
101

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qttools/src/assistant/help/qhelpdbreader_p.h