Syndication

dataretriever.h
1/*
2 SPDX-FileCopyrightText: 2001, 2002, 2003 Frerich Raabe <raabe@kde.org>
3
4 SPDX-License-Identifier: BSD-2-Clause
5*/
6
7#ifndef SYNDICATION_DATARETRIEVER_H
8#define SYNDICATION_DATARETRIEVER_H
9
10#include "syndication_export.h"
11
12#include <QObject>
13
14class QUrl;
15
16class QByteArray;
17
18namespace Syndication
19{
20/**
21 * Abstract baseclass for all data retriever classes. Subclass this to add
22 * a new retrieval algorithm which can then be plugged into the RSS loader.
23 * @see Loader, FileRetriever, OutputRetriever
24 */
25class SYNDICATION_EXPORT DataRetriever : public QObject
26{
27 Q_OBJECT
28public:
29 /**
30 * Default constructor.
31 */
33
34 /**
35 * Destructor.
36 */
37 ~DataRetriever() override;
38
39 /**
40 * Retrieve data from the given URL. This method is supposed to get
41 * reimplemented by subclasses. It will be called by the Loader
42 * class in case it needs to retrieve the data.
43 *
44 * @param url the URL to retrieve data from
45 *
46 * @see Loader::loadFrom()
47 */
48 virtual void retrieveData(const QUrl &url) = 0;
49
50 /**
51 * @return An error code which might give a more precise information
52 * about what went wrong in case the 'success' flag returned with
53 * the dataRetrieved() signal was 'false'. Note that the meaning of
54 * the returned integer depends on the actual data retriever.
55 */
56 virtual int errorCode() const = 0;
57
58 /**
59 * aborts the retrieval process.
60 */
61 virtual void abort() = 0;
62
63Q_SIGNALS:
64 /**
65 * Emit this signal to tell the Loader class that the retrieval
66 * process was finished.
67 * @param data Should contain the retrieved data and will get
68 * parsed by the Loader class.
69 * @param success Indicates whether there were any problems during
70 * the retrieval process. Pass 'true' to indicate that everything
71 * went seamlessy, 'false' to tell the Loader that something went
72 * wrong and that the data parameter might contain no or invalid
73 * data.
74 */
75
76 void dataRetrieved(const QByteArray &data, bool success);
77
78private:
79 DataRetriever(const DataRetriever &other);
80 DataRetriever &operator=(const DataRetriever &other);
81};
82
83} // namespace Syndication
84
85#endif // SYNDICATION_DATARETRIEVER_H
Abstract baseclass for all data retriever classes.
virtual void retrieveData(const QUrl &url)=0
Retrieve data from the given URL.
virtual void abort()=0
aborts the retrieval process.
virtual int errorCode() const =0
void dataRetrieved(const QByteArray &data, bool success)
Emit this signal to tell the Loader class that the retrieval process was finished.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:56 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.