1/*
2 Interface of the KDE data protocol core operations
3
4 SPDX-FileCopyrightText: 2002 Leo Savernik <l.savernik@aon.at>
5
6 SPDX-License-Identifier: LGPL-2.0-only
7*/
8
9#ifndef DATAPROTOCOL_H
10#define DATAPROTOCOL_H
11
12// dataprotocol.* interprets the following defines
13// TESTKIO: define for test-driving
14// Both defines are mutually exclusive. Defining none of them compiles
15// DataProtocol for internal usage within libkiocore.
16
17/* Wondering what this is all about? Leo explained it to me:
18 *
19 * That's simple, you can compile it into a standalone executable that is
20 * registered like any other KIO worker.
21 *
22 * However, given that data-urls don't depend on any external data it seemed
23 * overkill, therefore I added a special hack that the kio-dataworker is invoked
24 * in-process on the client side.
25 */
26
27class QByteArray;
28
29class QUrl;
30
31#if !defined(TESTKIO)
32#include "dataworker_p.h"
33#endif
34
35namespace KIO
36{
37/* This KIO worker provides support of data urls as specified by rfc 2397
38 * See https://www.ietf.org/rfc/rfc2397.txt
39 */
40#if defined(TESTKIO)
41class DataProtocol : public TestWorker
42{
43#else
44class DataProtocol : public DataWorker
45{
46 Q_OBJECT
47#endif
48
49public:
50 DataProtocol();
51
52#if defined(TESTKIO)
53 void mimetype(const QUrl &url);
54 void get(const QUrl &url);
55#else
56 void mimetype(const QUrl &url) override;
57 void get(const QUrl &url) override;
58#endif
59 ~DataProtocol() override;
60};
61
62} /*end namespace*/
63
64#endif
65

source code of kio/src/core/dataprotocol_p.h