/usr/include/syndication/dataretriever.h is in kdepimlibs5-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | /*
* Copyright (c) 2001, 2002, 2003 Frerich Raabe <raabe@kde.org>
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
* accompanying file 'COPYING'.
*/
#ifndef SYNDICATION_DATARETRIEVER_H
#define SYNDICATION_DATARETRIEVER_H
#include "ksyndication_export.h"
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QProcess>
namespace KIO
{
class Job;
}
class KJob;
class KUrl;
class QByteArray;
namespace Syndication
{
/**
* Abstract baseclass for all data retriever classes. Subclass this to add
* a new retrieval algorithm which can then be plugged into the RSS loader.
* @see Loader, FileRetriever, OutputRetriever
*/
class SYNDICATION_EXPORT DataRetriever : public QObject
{
Q_OBJECT
public:
/**
* Default constructor.
*/
DataRetriever();
/**
* Destructor.
*/
virtual ~DataRetriever();
/**
* Retrieve data from the given URL. This method is supposed to get
* reimplemented by subclasses. It will be called by the Loader
* class in case it needs to retrieve the data.
*
* @param url the URL to retrieve data from
*
* @see Loader::loadFrom()
*/
virtual void retrieveData(const KUrl& url) = 0;
/**
* @return An error code which might give a more precise information
* about what went wrong in case the 'success' flag returned with
* the dataRetrieved() signal was 'false'. Note that the meaning of
* the returned integer depends on the actual data retriever.
*/
virtual int errorCode() const = 0;
/**
* aborts the retrieval process.
*/
virtual void abort() = 0;
Q_SIGNALS:
/**
* Emit this signal to tell the Loader class that the retrieval
* process was finished.
* @param data Should contain the retrieved data and will get
* parsed by the Loader class.
* @param success Indicates whether there were any problems during
* the retrieval process. Pass 'true' to indicate that everything
* went seamlessy, 'false' to tell the Loader that something went
* wrong and that the data parameter might contain no or invalid
* data.
*/
void dataRetrieved(const QByteArray& data, bool success);
private:
DataRetriever(const DataRetriever& other);
DataRetriever& operator=(const DataRetriever& other);
};
/**
* Implements a data retriever which executes a program and stores returned
* by the program on stdout. To be used with Loader::loadFrom().
* @see DataRetriever, Loader::loadFrom()
*/
class SYNDICATION_EXPORT OutputRetriever : public DataRetriever
{
Q_OBJECT
public:
/**
* Default constructor.
*/
OutputRetriever();
/**
* Destructor.
*/
virtual ~OutputRetriever();
/**
* Executes the program referenced by the given URL and retrieves
* the data which the program prints to stdout.
* @param url An URL which is supposed to reference an executable
* file.
* @see Loader::loadFrom()
*/
virtual void retrieveData(const KUrl& url);
/**
* @return The error code for the last process of retrieving data.
* 0 is returned in case there was no error, otherwise an error
* code which depends on the particular program which was run is
* returned.
*/
virtual int errorCode() const;
virtual void abort() {}
private Q_SLOTS:
void slotFinished ( int exitCode, QProcess::ExitStatus exitStatus ) ;
private:
OutputRetriever(const OutputRetriever& other);
OutputRetriever& operator=(const OutputRetriever& other);
struct OutputRetrieverPrivate;
OutputRetrieverPrivate* const d;
};
/**
* Implements a file retriever, to be used with Loader::loadFrom().
* @see DataRetriever, Loader::loadFrom()
*/
class SYNDICATION_EXPORT FileRetriever : public DataRetriever
{
Q_OBJECT
public:
/**
* Default constructor.
*/
FileRetriever();
/**
* Destructor.
*/
virtual ~FileRetriever();
/**
* Downloads the file referenced by the given URL and passes it's
* contents on to the Loader.
* @param url An URL referencing a file which is assumed to
* reference valid XML.
* @see Loader::loadFrom()
*/
virtual void retrieveData(const KUrl& url);
/**
* @return The error code for the last process of retrieving data.
* The returned numbers correspond directly to the error codes
* <a href="http://developer.kde.org/documentation/library/cvs-api/classref/kio/KIO.html#Error">as
* defined by KIO</a>.
*/
virtual int errorCode() const;
/**
* aborts the retrieval process.
*/
virtual void abort();
/**
* sets whether the retriever should use the KHTML cache or
* always refetch the file. By default, the cache is used.
*
* @param enabled whether to use the HTML cache or not
*/
static void setUseCache(bool enabled);
/**
* sets the user agent string sent to the remote server
*
* @param userAgent user agent string
*/
static void setUserAgent(const QString& userAgent);
Q_SIGNALS:
/**
* Signals a permanent redirection. The redirection itself is
* handled internally, so you don't need to call Loader::loadFrom()
* with the new URL. This signal is useful in case you want to
* notify the user, or adjust a database entry.
*
* @param url the new URL after the redirection
*
* @see Loader::loadFrom()
*/
void permanentRedirection(const KUrl& url);
protected Q_SLOTS:
void slotTimeout();
private Q_SLOTS:
void slotData(KIO::Job*job, const QByteArray& data);
void slotResult(KJob* job);
void slotPermanentRedirection(KIO::Job* job, const KUrl& fromUrl,
const KUrl& toUrl);
private:
static bool m_useCache;
static QString m_userAgent;
FileRetriever(const FileRetriever& other);
FileRetriever& operator=(const FileRetriever& other);
struct FileRetrieverPrivate;
FileRetrieverPrivate* const d;
};
} // namespace Syndication
#endif // SYNDICATION_DATARETRIEVER_H
|