|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Assistant of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QHELPDBREADER_H |
|
43 #define QHELPDBREADER_H |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists for the convenience |
|
50 // of the help generator tools. This header file may change from version |
|
51 // to version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 #include <QtCore/QObject> |
|
57 #include <QtCore/QStringList> |
|
58 #include <QtCore/QUrl> |
|
59 #include <QtCore/QByteArray> |
|
60 #include <QtCore/QSet> |
|
61 |
|
62 QT_BEGIN_NAMESPACE |
|
63 |
|
64 class QSqlQuery; |
|
65 |
|
66 class QHelpDBReader : public QObject |
|
67 { |
|
68 Q_OBJECT |
|
69 |
|
70 public: |
|
71 QHelpDBReader(const QString &dbName); |
|
72 QHelpDBReader(const QString &dbName, const QString &uniqueId, |
|
73 QObject *parent); |
|
74 ~QHelpDBReader(); |
|
75 |
|
76 bool init(); |
|
77 |
|
78 QString errorMessage() const; |
|
79 |
|
80 QString databaseName() const; |
|
81 QString namespaceName() const; |
|
82 QString virtualFolder() const; |
|
83 QList<QStringList> filterAttributeSets() const; |
|
84 QStringList files(const QStringList &filterAttributes, |
|
85 const QString &extensionFilter = QString()) const; |
|
86 bool fileExists(const QString &virtualFolder, const QString &filePath, |
|
87 const QStringList &filterAttributes = QStringList()) const; |
|
88 QByteArray fileData(const QString &virtualFolder, |
|
89 const QString &filePath) const; |
|
90 |
|
91 QStringList customFilters() const; |
|
92 QStringList filterAttributes(const QString &filterName = QString()) const; |
|
93 QStringList indicesForFilter(const QStringList &filterAttributes) const; |
|
94 void linksForKeyword(const QString &keyword, const QStringList &filterAttributes, |
|
95 QMap<QString, QUrl> &linkMap) const; |
|
96 |
|
97 void linksForIdentifier(const QString &id, const QStringList &filterAttributes, |
|
98 QMap<QString, QUrl> &linkMap) const; |
|
99 |
|
100 QList<QByteArray> contentsForFilter(const QStringList &filterAttributes) const; |
|
101 QUrl urlOfPath(const QString &relativePath) const; |
|
102 |
|
103 QSet<int> indexIds(const QStringList &attributes) const; |
|
104 bool createAttributesCache(const QStringList &attributes, |
|
105 const QSet<int> &indexIds); |
|
106 QVariant metaData(const QString &name) const; |
|
107 |
|
108 private: |
|
109 void initObject(const QString &dbName, const QString &uniqueId); |
|
110 QUrl buildQUrl(const QString &ns, const QString &folder, |
|
111 const QString &relFileName, const QString &anchor) const; |
|
112 QString mergeList(const QStringList &list) const; |
|
113 QString quote(const QString &string) const; |
|
114 |
|
115 bool m_initDone; |
|
116 QString m_dbName; |
|
117 QString m_uniqueId; |
|
118 QString m_error; |
|
119 QSqlQuery *m_query; |
|
120 mutable QString m_namespace; |
|
121 QSet<QString> m_viewAttributes; |
|
122 bool m_useAttributesCache; |
|
123 QSet<int> m_indicesCache; |
|
124 }; |
|
125 |
|
126 QT_END_NAMESPACE |
|
127 |
|
128 #endif |