1/*
2 * SPDX-FileCopyrightText: 2004 Zack Rusin <zack@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6#ifndef SONNET_SPELLERPLUGIN_P_H
7#define SONNET_SPELLERPLUGIN_P_H
8
9#include <QString>
10#include <QStringList>
11
12#include "sonnetcore_export.h"
13
14#include <memory>
15
16namespace Sonnet
17{
18class SpellerPluginPrivate;
19/*!
20 * \internal
21 * \brief class used for actual spell checking.
22 *
23 * Class is returned by from Loader. It acts
24 * as the actual spellchecker.
25 */
26class SONNETCORE_EXPORT SpellerPlugin
27{
28public:
29 virtual ~SpellerPlugin();
30
31 /*!
32 * Checks the given word.
33 * Returns false if the word is misspelled. true otherwise
34 */
35 virtual bool isCorrect(const QString &word) const = 0;
36
37 /*!
38 * Checks the given word.
39 * Returns true if the word is misspelled. false otherwise
40 */
41 bool isMisspelled(const QString &word) const;
42
43 /*!
44 * Fetches suggestions for the word.
45 *
46 * Returns list of all suggestions for the word
47 */
48 virtual QStringList suggest(const QString &word) const = 0;
49
50 /*!
51 * Convenient method calling isCorrect() and suggest()
52 * if the word isn't correct.
53 */
54 virtual bool checkAndSuggest(const QString &word, QStringList &suggestions) const;
55
56 /*!
57 * Stores user defined good replacement for the bad word.
58 * Returns true on success
59 */
60 virtual bool storeReplacement(const QString &bad, const QString &good) = 0;
61
62 /*!
63 * Adds word to the list of of personal words.
64 * Returns true on success
65 */
66 virtual bool addToPersonal(const QString &word) = 0;
67
68 /*!
69 * Adds word to the words recognizable in the current session.
70 * Returns true on success
71 */
72 virtual bool addToSession(const QString &word) = 0;
73
74 /*!
75 * Returns language supported by this dictionary.
76 */
77 QString language() const;
78
79protected:
80 /*!
81 */
82 SpellerPlugin(const QString &lang);
83
84private:
85 std::unique_ptr<SpellerPluginPrivate> const d;
86};
87}
88
89#endif
90

source code of sonnet/src/core/spellerplugin_p.h