File indexing completed on 2024-04-28 04:00:54
0001 /* 0002 * voikkodict.h 0003 * 0004 * SPDX-FileCopyrightText: 2015 Jesse Jaara <jesse.jaara@gmail.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #ifndef SONNET_VOIKKODICT_H 0010 #define SONNET_VOIKKODICT_H 0011 0012 #include "spellerplugin_p.h" 0013 #include <libvoikko/voikko.h> 0014 0015 #include <QHash> 0016 #include <QScopedPointer> 0017 0018 class VoikkoClient; 0019 class VoikkoDictPrivate; 0020 0021 class VoikkoDict : public Sonnet::SpellerPlugin 0022 { 0023 public: 0024 /** 0025 * Declare VoikkoClient as friend so we can use the protected constructor. 0026 */ 0027 friend class VoikkoClient; 0028 0029 ~VoikkoDict(); 0030 0031 bool isCorrect(const QString &word) const override; 0032 QStringList suggest(const QString &word) const override; 0033 0034 bool storeReplacement(const QString &bad, const QString &good) override; 0035 bool addToPersonal(const QString &word) override; 0036 bool addToSession(const QString &word) override; 0037 0038 /** 0039 * @returns true if initializing Voikko backend failed. 0040 */ 0041 bool initFailed() const Q_DECL_NOEXCEPT; 0042 0043 protected: 0044 /** 0045 * Constructor is protected so that only spellers created 0046 * and validated through VoikkoClient can be used. 0047 */ 0048 explicit VoikkoDict(const QString &language) Q_DECL_NOEXCEPT; 0049 0050 private: 0051 QScopedPointer<VoikkoDictPrivate> d; 0052 }; 0053 0054 #endif // SONNET_VOIKKODICT_H