| 1 | // Copyright (C) 2024 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 QQMLLSHELPPLUGININTERFACE_H | 
| 5 | #define QQMLLSHELPPLUGININTERFACE_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 purely as an | 
| 12 | // implementation detail.  This header file may change from version to | 
| 13 | // version without notice, or even be removed. | 
| 14 | // | 
| 15 | // We mean it. | 
| 16 | // | 
| 17 |  | 
| 18 | #include <QtCore/qstring.h> | 
| 19 | #include <QtCore/qurl.h> | 
| 20 | #include <QtCore/qobject.h> | 
| 21 | #include <vector> | 
| 22 |  | 
| 23 | QT_BEGIN_NAMESPACE | 
| 24 |  | 
| 25 | class QQmlLSHelpProviderBase | 
| 26 | { | 
| 27 | public: | 
| 28 |     struct DocumentLink | 
| 29 |     { | 
| 30 |         QUrl url; | 
| 31 |         QString title; | 
| 32 |     }; | 
| 33 |  | 
| 34 | public: | 
| 35 |     virtual ~QQmlLSHelpProviderBase() = default; | 
| 36 |     virtual bool registerDocumentation(const QString &documentationFileName) = 0; | 
| 37 |     [[nodiscard]] virtual QByteArray fileData(const QUrl &url) const = 0; | 
| 38 |     [[nodiscard]] virtual std::vector<DocumentLink> documentsForIdentifier(const QString &id) const = 0; | 
| 39 |     [[nodiscard]] virtual std::vector<DocumentLink> | 
| 40 |     documentsForIdentifier(const QString &id, const QString &filterName) const = 0; | 
| 41 |     [[nodiscard]] virtual std::vector<DocumentLink> documentsForKeyword(const QString &keyword) const = 0; | 
| 42 |     [[nodiscard]] virtual std::vector<DocumentLink> | 
| 43 |     documentsForKeyword(const QString &keyword, const QString &filterName) const = 0; | 
| 44 |     [[nodiscard]] virtual QStringList registeredNamespaces() const = 0; | 
| 45 |     [[nodiscard]] virtual QString error() const = 0; | 
| 46 | }; | 
| 47 |  | 
| 48 | class QQmlLSHelpPluginInterface | 
| 49 | { | 
| 50 | public: | 
| 51 |     QQmlLSHelpPluginInterface() = default; | 
| 52 |     virtual ~QQmlLSHelpPluginInterface() = default; | 
| 53 |     Q_DISABLE_COPY_MOVE(QQmlLSHelpPluginInterface) | 
| 54 |  | 
| 55 |     virtual std::unique_ptr<QQmlLSHelpProviderBase> initialize(const QString &collectionFile, | 
| 56 |                                                                QObject *parent) = 0; | 
| 57 | }; | 
| 58 |  | 
| 59 | #define QQmlLSHelpPluginInterface_iid "org.qt-project.Qt.QmlLS.HelpPlugin/1.0" | 
| 60 | Q_DECLARE_INTERFACE(QQmlLSHelpPluginInterface, QQmlLSHelpPluginInterface_iid) | 
| 61 |  | 
| 62 | QT_END_NAMESPACE | 
| 63 |  | 
| 64 | #endif // QQMLLSHELPPLUGININTERFACE_H | 
| 65 |  |