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 * Class is returned by from Loader. It acts
21 * as the actual spellchecker.
22 *
23 * @author Zack Rusin <zack@kde.org>
24 * @short class used for actual spell checking
25 */
26class SONNETCORE_EXPORT SpellerPlugin
27{
28public:
29 virtual ~SpellerPlugin();
30
31 /**
32 * Checks the given word.
33 * @return 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 * @return 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 * @return 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 * @return 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 * @return 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 SpellerPlugin(const QString &lang);
81
82private:
83 std::unique_ptr<SpellerPluginPrivate> const d;
84};
85}
86
87#endif
88

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