File indexing completed on 2024-04-14 03:58:20

0001 /*
0002  * SPDX-FileCopyrightText: 2003 Zack Rusin <zack@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 #ifndef SONNET_CLIENT_P_H
0007 #define SONNET_CLIENT_P_H
0008 
0009 #include <QObject>
0010 #include <QString>
0011 #include <QStringList>
0012 
0013 #include "sonnetcore_export.h"
0014 /*
0015  * The fact that this class inherits from QObject makes me
0016  * hugely unhappy. The reason for as of this writing is that
0017  * I don't really feel like writing my own KLibFactory
0018  * that would load anything else then QObject derivatives.
0019  */
0020 namespace Sonnet
0021 {
0022 class SpellerPlugin;
0023 
0024 /**
0025  * \internal
0026  * Client
0027  */
0028 class SONNETCORE_EXPORT Client : public QObject
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit Client(QObject *parent = nullptr);
0033 
0034     /**
0035      * @returns how reliable the answer is (higher is better).
0036      */
0037     virtual int reliability() const = 0;
0038 
0039     /**
0040      * Returns a dictionary for the given language.
0041      *
0042      * @param language specifies the language of the dictionary. If an
0043      *        empty string is passed the default language will be
0044      *        used. Has to be one of the values returned by
0045      *        languages()
0046      *
0047      * @returns a dictionary for the language or 0 if there was an error.
0048      */
0049     virtual SpellerPlugin *createSpeller(const QString &language) = 0;
0050 
0051     /**
0052      * @returns a list of supported languages.
0053      */
0054     virtual QStringList languages() const = 0;
0055 
0056     /**
0057      * @returns the name of the implementing class.
0058      */
0059     virtual QString name() const = 0;
0060 };
0061 }
0062 
0063 Q_DECLARE_INTERFACE(Sonnet::Client, "org.kde.sonnet.Client")
0064 
0065 #endif // SONNET_CLIENT_P_H