| 1 | /* |
| 2 | * kspell_hunspellclient.h |
| 3 | * |
| 4 | * SPDX-FileCopyrightText: 2009 Montel Laurent <montel@kde.org> |
| 5 | * |
| 6 | * SPDX-License-Identifier: LGPL-2.1-or-later |
| 7 | */ |
| 8 | #ifndef KSPELL_HUNSPELLCLIENT_H |
| 9 | #define KSPELL_HUNSPELLCLIENT_H |
| 10 | |
| 11 | #include "client_p.h" |
| 12 | #include <QMap> |
| 13 | #include <memory> |
| 14 | |
| 15 | class Hunspell; |
| 16 | |
| 17 | namespace Sonnet |
| 18 | { |
| 19 | class SpellerPlugin; |
| 20 | } |
| 21 | |
| 22 | using Sonnet::SpellerPlugin; |
| 23 | |
| 24 | class HunspellClient : public Sonnet::Client |
| 25 | { |
| 26 | Q_OBJECT |
| 27 | Q_INTERFACES(Sonnet::Client) |
| 28 | Q_PLUGIN_METADATA(IID "org.kde.sonnet.Client" ) |
| 29 | public: |
| 30 | explicit HunspellClient(QObject *parent = nullptr); |
| 31 | ~HunspellClient() override; |
| 32 | |
| 33 | int reliability() const override |
| 34 | { |
| 35 | return 40; |
| 36 | } |
| 37 | |
| 38 | SpellerPlugin *createSpeller(const QString &language) override; |
| 39 | |
| 40 | QStringList languages() const override; |
| 41 | |
| 42 | QString name() const override |
| 43 | { |
| 44 | return QStringLiteral("Hunspell" ); |
| 45 | } |
| 46 | |
| 47 | private: |
| 48 | QMap<QString, QString> m_languagePaths; |
| 49 | QMap<QString, std::weak_ptr<Hunspell>> m_hunspellCache; |
| 50 | QMap<QString, QString> m_languageAliases; |
| 51 | }; |
| 52 | |
| 53 | #endif |
| 54 | |