File indexing completed on 2023-09-24 04:08:29
0001 /* 0002 Interface of the KDE data protocol core operations 0003 0004 SPDX-FileCopyrightText: 2002 Leo Savernik <l.savernik@aon.at> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 0009 #ifndef DATAPROTOCOL_H 0010 #define DATAPROTOCOL_H 0011 0012 // dataprotocol.* interprets the following defines 0013 // TESTKIO: define for test-driving 0014 // Both defines are mutually exclusive. Defining none of them compiles 0015 // DataProtocol for internal usage within libkiocore. 0016 0017 /* Wondering what this is all about? Leo explained it to me: 0018 * 0019 * That's simple, you can compile it into a standalone executable that is 0020 * registered like any other KIO worker. 0021 * 0022 * However, given that data-urls don't depend on any external data it seemed 0023 * overkill, therefore I added a special hack that the kio-dataworker is invoked 0024 * in-process on the client side. 0025 */ 0026 0027 class QByteArray; 0028 0029 class QUrl; 0030 0031 #if !defined(TESTKIO) 0032 #include "dataworker_p.h" 0033 #endif 0034 0035 namespace KIO 0036 { 0037 /** This KIO worker provides support of data urls as specified by rfc 2397 0038 * @see https://www.ietf.org/rfc/rfc2397.txt 0039 * @author Leo Savernik 0040 */ 0041 #if defined(TESTKIO) 0042 class DataProtocol : public TestWorker 0043 { 0044 #else 0045 class DataProtocol : public DataWorker 0046 { 0047 Q_OBJECT 0048 #endif 0049 0050 public: 0051 DataProtocol(); 0052 0053 #if defined(TESTKIO) 0054 void mimetype(const QUrl &url); 0055 void get(const QUrl &url); 0056 #else 0057 void mimetype(const QUrl &url) override; 0058 void get(const QUrl &url) override; 0059 #endif 0060 ~DataProtocol() override; 0061 }; 0062 0063 } /*end namespace*/ 0064 0065 #endif