File indexing completed on 2024-04-14 14:55:11

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-2013 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) 2009 by Richard Moore
0013  *         <a href="mailto:rich at kde dot org">rich at kde dot org</a>
0014  *
0015  * This program is free software; you can redistribute it
0016  * and/or modify it under the terms of the GNU General
0017  * Public License as published by the Free Software Foundation;
0018  * either version 2, or (at your option)
0019  * any later version.
0020  *
0021  * This program is distributed in the hope that it will be useful,
0022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0024  * GNU General Public License for more details.
0025  *
0026  * ============================================================ */
0027 
0028 #ifndef MEDIAWIKI_MEDIAWIKI_H
0029 #define MEDIAWIKI_MEDIAWIKI_H
0030 
0031 // Qt includes
0032 
0033 #include <QString>
0034 #include <QUrl>
0035 #include <QNetworkAccessManager>
0036 #include <QNetworkCookieJar>
0037 
0038 // Local includes
0039 
0040 #include "mediawiki_export.h"
0041 
0042 namespace mediawiki
0043 {
0044 
0045 /**
0046  * @brief Provides access to wiki powered by MediaWiki.
0047  */
0048 class MEDIAWIKI_EXPORT MediaWiki
0049 {
0050 
0051 public:
0052 
0053     /**
0054      * @brief Constructs a MediaWiki by its url api.
0055      * @param url the url api of the wiki
0056      * @param customUserAgent you can specify the user agent to use
0057                               which will be concatenated with the postfix user agent
0058      *                        else the postfix user agent is used only
0059      */
0060     explicit MediaWiki(const QUrl& url, const QString& customUserAgent = QString());
0061 
0062     /**
0063      * @brief Destructs the MediaWiki.
0064      */
0065     ~MediaWiki();
0066 
0067     /**
0068      * @brief Returns the url api of the wiki.
0069      * @returns the url api of the wiki
0070      */
0071     QUrl url() const;
0072 
0073     /**
0074      * @brief Returns the user agent of the wiki.
0075      * @return the user agent of the wiki
0076      */
0077     QString userAgent() const;
0078 
0079     /**
0080      * @brief Returns the network manager instance of the wiki.
0081      * @return the network manager instance of the wiki
0082      */
0083     QNetworkAccessManager* manager() const;
0084 
0085 private:
0086 
0087     class MediaWikiPrivate;
0088     MediaWikiPrivate* const d_ptr;
0089 
0090     friend class JobPrivate;
0091 };
0092 
0093 } // namespace mediawiki
0094 
0095 #endif // MEDIAWIKI_MEDIAWIKI_H