Syndication Library
dataretriever.h
00001 /* 00002 * Copyright (c) 2001, 2002, 2003 Frerich Raabe <raabe@kde.org> 00003 * 00004 * This program is distributed in the hope that it will be useful, but WITHOUT 00005 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00006 * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the 00007 * accompanying file 'COPYING'. 00008 */ 00009 00010 #ifndef SYNDICATION_DATARETRIEVER_H 00011 #define SYNDICATION_DATARETRIEVER_H 00012 00013 #include "ksyndication_export.h" 00014 00015 #include <QtCore/QObject> 00016 #include <QtCore/QString> 00017 #include <QtCore/QProcess> 00018 00019 namespace KIO 00020 { 00021 class Job; 00022 } 00023 class KJob; 00024 class KUrl; 00025 00026 class QByteArray; 00027 00028 namespace Syndication 00029 { 00030 00036 class SYNDICATION_EXPORT DataRetriever : public QObject 00037 { 00038 Q_OBJECT 00039 public: 00043 DataRetriever(); 00044 00048 virtual ~DataRetriever(); 00049 00059 virtual void retrieveData(const KUrl& url) = 0; 00060 00067 virtual int errorCode() const = 0; 00068 00072 virtual void abort() = 0; 00073 00074 Q_SIGNALS: 00087 void dataRetrieved(const QByteArray& data, bool success); 00088 00089 private: 00090 DataRetriever(const DataRetriever& other); 00091 DataRetriever& operator=(const DataRetriever& other); 00092 }; 00093 00094 00100 class SYNDICATION_EXPORT OutputRetriever : public DataRetriever 00101 { 00102 Q_OBJECT 00103 00104 public: 00105 00109 OutputRetriever(); 00110 00114 virtual ~OutputRetriever(); 00115 00123 virtual void retrieveData(const KUrl& url); 00124 00131 virtual int errorCode() const; 00132 00133 virtual void abort() {} 00134 00135 private Q_SLOTS: 00136 void slotFinished ( int exitCode, QProcess::ExitStatus exitStatus ) ; 00137 00138 private: 00139 OutputRetriever(const OutputRetriever& other); 00140 OutputRetriever& operator=(const OutputRetriever& other); 00141 00142 struct OutputRetrieverPrivate; 00143 OutputRetrieverPrivate* const d; 00144 }; 00145 00150 class SYNDICATION_EXPORT FileRetriever : public DataRetriever 00151 { 00152 Q_OBJECT 00153 00154 public: 00155 00159 FileRetriever(); 00160 00164 virtual ~FileRetriever(); 00165 00173 virtual void retrieveData(const KUrl& url); 00174 00181 virtual int errorCode() const; 00182 00186 virtual void abort(); 00187 00194 static void setUseCache(bool enabled); 00195 00201 static void setUserAgent(const QString& userAgent); 00202 00203 Q_SIGNALS: 00204 00215 void permanentRedirection(const KUrl& url); 00216 00217 protected Q_SLOTS: 00218 00219 void slotTimeout(); 00220 00221 private Q_SLOTS: 00222 00223 void slotData(KIO::Job*job, const QByteArray& data); 00224 void slotResult(KJob* job); 00225 void slotPermanentRedirection(KIO::Job* job, const KUrl& fromUrl, 00226 const KUrl& toUrl); 00227 00228 private: 00229 00230 static bool m_useCache; 00231 static QString m_userAgent; 00232 00233 FileRetriever(const FileRetriever& other); 00234 FileRetriever& operator=(const FileRetriever& other); 00235 00236 struct FileRetrieverPrivate; 00237 FileRetrieverPrivate* const d; 00238 }; 00239 00240 } // namespace Syndication 00241 00242 #endif // SYNDICATION_DATARETRIEVER_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:45:59 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 04:45:59 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.