File indexing completed on 2024-04-21 15:32:07

0001 /** ===========================================================
0002  * @file
0003  *
0004  * This file is a part of KDE project
0005  * <a href="https://commits.kde.org/libmediawiki">libmediawiki</a>
0006  *
0007  * @date   2011-03-22
0008  * @brief  a MediaWiki C++ interface for KDE
0009  *
0010  * @author Copyright (C) 2011-2012 by Gilles Caulier
0011  *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
0012  * @author Copyright (C) 2011 by Manuel Campomanes
0013  *         <a href="mailto:campomanes dot manuel at gmail dot com">campomanes dot manuel at gmail dot com</a>
0014  * @author Copyright (C) 2010 by Vincent Garcia
0015  *         <a href="mailto:xavier dot vincent dot garcia at gmail dot com">xavier dot vincent dot garcia at gmail dot com</a>
0016  *
0017  * This program is free software; you can redistribute it
0018  * and/or modify it under the terms of the GNU General
0019  * Public License as published by the Free Software Foundation;
0020  * either version 2, or (at your option)
0021  * any later version.
0022  *
0023  * This program is distributed in the hope that it will be useful,
0024  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0025  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0026  * GNU General Public License for more details.
0027  *
0028  * ============================================================ */
0029 
0030 #ifndef PARSE_H
0031 #define PARSE_H
0032 
0033 // Qt includes
0034 
0035 #include <QString>
0036 #include <QLocale>
0037 
0038 // Local includes
0039 
0040 #include "job.h"
0041 #include "mediawiki_export.h"
0042 
0043 namespace mediawiki
0044 {
0045 
0046 class MediaWiki;
0047 class ParsePrivate;
0048 
0049 class MEDIAWIKI_EXPORT Parse : public Job
0050 {
0051     Q_OBJECT
0052     Q_DECLARE_PRIVATE(Parse)
0053 
0054 public:
0055 
0056     /**
0057      * @brief Indicates all possible error conditions found during the processing of the job.
0058      */
0059     enum
0060     {
0061          /**
0062          * @brief An internal error occurred.
0063          */
0064         InternalError= Job::UserDefinedError+1,
0065 
0066         /**
0067          * @brief The page parameter cannot be used together with the text and title parameters
0068          */
0069         TooManyParams,
0070 
0071         /**
0072          * @brief The page you specified doesn't exist
0073          */
0074         MissingPage
0075     };
0076 
0077     explicit Parse(MediaWiki& mediawiki, QObject* const parent = nullptr);
0078     ~Parse() override;
0079 
0080     void setText(const QString& param);
0081 
0082     void setTitle(const QString& param);
0083 
0084     void setPageName(const QString& param);
0085 
0086     void setUseLang(const QString& param);
0087 
0088     void start() override;
0089 
0090     Q_SIGNALS:
0091 
0092     void result(const QString& text);
0093 
0094 private Q_SLOTS:
0095 
0096     void doWorkSendRequest();
0097     void doWorkProcessReply();
0098 };
0099 
0100 } // namespace mediawiki
0101 
0102 #endif // PARSE_H