File indexing completed on 2024-04-28 08:50:25

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2009 Fredy Yanardi <fyanardi@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SUGGESTIONENGINE_H
0008 #define SUGGESTIONENGINE_H
0009 
0010 #include <QObject>
0011 
0012 /**
0013  * Parent class for all suggestion engines. Each suggestion engine is responsible for
0014  * parsing the reply from the suggestion provider (host)
0015  */
0016 class SuggestionEngine : public QObject
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     /**
0022      * Constructor.
0023      * @param engineName the engine name
0024      */
0025     SuggestionEngine(const QString &engineName, QObject *parent = nullptr);
0026 
0027     /**
0028      * Get the request URL for the suggestion service
0029      */
0030     QString requestURL() const;
0031 
0032     /**
0033      * Get the engine name for this engine
0034      */
0035     QString engineName() const;
0036 
0037     /**
0038      * To be reimplemented by subclass. Parse the suggestion reply to a QStringList
0039      */
0040     virtual QStringList parseSuggestion(const QByteArray &response) const = 0;
0041 
0042 protected:
0043     QString m_engineName;
0044     QString m_requestURL;
0045 };
0046 
0047 #endif // SUGGESTIONENGINE_H
0048