blob: 9b17c2dbd839defb34e5b06900bb003de2f89480 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QHELPENGINEPLUGIN_H
#define QHELPENGINEPLUGIN_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qobject.h>
#include <QtCore/qplugin.h>
#include <QtHelp/qhelpenginecore.h>
#include <QtHelp/qhelplink.h>
#include <QtQmlLS/private/qqmllshelpplugininterface_p.h>
#include <optional>
#include <vector>
QT_BEGIN_NAMESPACE
// TODO (Qt 7.0)
// Remove this plugin from QtTools when the QtHelp lib is split into
// QtHelpCore and QtHelp. Then QmlLS can depend only on QtHelpCore.
class QQmlLSHelpProvider : public QQmlLSHelpProviderBase
{
public:
QQmlLSHelpProvider(const QString &qhcFile, QObject *parent = nullptr);
bool registerDocumentation(const QString &documentationFileName) override;
[[nodiscard]] QByteArray fileData(const QUrl &url) const override;
[[nodiscard]] std::vector<DocumentLink> documentsForIdentifier(const QString &id) const override;
[[nodiscard]] std::vector<DocumentLink> documentsForIdentifier(const QString &id, const QString &filterName) const override;
[[nodiscard]] std::vector<DocumentLink> documentsForKeyword(const QString &keyword) const override;
[[nodiscard]] std::vector<DocumentLink> documentsForKeyword(const QString &keyword, const QString &filterName) const override;
[[nodiscard]] QStringList registeredNamespaces() const override;
[[nodiscard]] QString error() const override;
private:
std::optional<QHelpEngineCore> m_helpEngine;
};
class QHelpEnginePlugin : public QObject, public QQmlLSHelpPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlLSHelpPluginInterface_iid)
Q_INTERFACES(QQmlLSHelpPluginInterface)
public:
QHelpEnginePlugin(QObject *parent = nullptr);
Q_DISABLE_COPY_MOVE(QHelpEnginePlugin)
std::unique_ptr<QQmlLSHelpProviderBase> initialize(const QString &collectionFile,
QObject *parent) override;
};
QT_END_NAMESPACE
#endif // QHELPENGINEPLUGIN_H
|