• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
dataslave.h
Go to the documentation of this file.
1// -*- c++ -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (c) 2003 Leo Savernik <l.savernik@aon.at>
5 * Derived from slave.h
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License version 2 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 **/
21
22#ifndef KIO_DATASLAVE_H
23#define KIO_DATASLAVE_H
24
25#include "global.h"
26#include "slave.h"
27
28class QTimer;
29
30// don't forget to sync DISPATCH_IMPL in dataslave.h
31#define DISPATCH_DECL(type) \
32 void dispatch_##type();
33
34// don't forget to sync DISPATCH_IMPL1 in dataslave.h
35#define DISPATCH_DECL1(type, paramtype, param) \
36 void dispatch_##type(paramtype param);
37
38namespace KIO {
39
49 class DataSlave : public KIO::Slave {
50 Q_OBJECT
51 public:
52 DataSlave();
53
54 virtual ~DataSlave();
55
56 virtual void setHost(const QString &host, quint16 port,
57 const QString &user, const QString &passwd);
58 virtual void setConfig(const MetaData &config);
59
60 virtual void suspend();
61 virtual void resume();
62 virtual bool suspended();
63 virtual void send(int cmd, const QByteArray &arr = QByteArray());
64
65 virtual void hold(const KUrl &url);
66
67 // pure virtual methods that are defined by the actual protocol
68 virtual void get(const KUrl &url) = 0;
69 virtual void mimetype(const KUrl &url) = 0;
70
71 protected:
76 void setAllMetaData(const MetaData &);
81 void sendMetaData();
82
83 // queuing methods
85 enum QueueType { Queue_mimeType = 1, Queue_totalSize,
86 Queue_sendMetaData, Queue_data, Queue_finished };
90 struct QueueStruct {
91 QueueType type;
92 QString s;
93 KIO::filesize_t size;
94 QByteArray ba;
95
96 QueueStruct() {}
97 QueueStruct(QueueType type) : type(type) {}
98 };
99 typedef QList<QueueStruct> DispatchQueue;
100 DispatchQueue dispatchQueue;
101
102 DISPATCH_DECL1(mimeType, const QString &, s)
103 DISPATCH_DECL1(totalSize, KIO::filesize_t, size)
104 DISPATCH_DECL(sendMetaData)
105 DISPATCH_DECL1(data, const QByteArray &, ba)
106 DISPATCH_DECL(finished)
107
108 protected Q_SLOTS:
112 void dispatchNext();
113 private:
114 MetaData meta_data;
115 bool _suspended;
116 QTimer *timer;
117 };
118
119}
120
121#undef DISPATCH_DECL
122#undef DISPATCH_DECL1
123
124#endif
KIO::DataSlave
This class provides a high performance implementation for the data url scheme (rfc2397).
Definition: dataslave.h:49
KIO::DataSlave::get
virtual void get(const KUrl &url)=0
KIO::DataSlave::dispatchNext
void dispatchNext()
dispatches next queued method.
Definition: dataslave.cpp:101
KIO::DataSlave::setConfig
virtual void setConfig(const MetaData &config)
Configure slave.
Definition: dataslave.cpp:156
KIO::DataSlave::~DataSlave
virtual ~DataSlave()
Definition: dataslave.cpp:69
KIO::DataSlave::QueueType
QueueType
identifiers of functions to be queued
Definition: dataslave.h:85
KIO::DataSlave::Queue_totalSize
@ Queue_totalSize
Definition: dataslave.h:85
KIO::DataSlave::Queue_mimeType
@ Queue_mimeType
Definition: dataslave.h:85
KIO::DataSlave::Queue_finished
@ Queue_finished
Definition: dataslave.h:86
KIO::DataSlave::Queue_sendMetaData
@ Queue_sendMetaData
Definition: dataslave.h:86
KIO::DataSlave::Queue_data
@ Queue_data
Definition: dataslave.h:86
KIO::DataSlave::DataSlave
DataSlave()
Definition: dataslave.cpp:60
KIO::DataSlave::DispatchQueue
QList< QueueStruct > DispatchQueue
Definition: dataslave.h:99
KIO::DataSlave::suspended
virtual bool suspended()
Tells whether the kioslave is suspended.
Definition: dataslave.cpp:147
KIO::DataSlave::setAllMetaData
void setAllMetaData(const MetaData &)
Sets metadata.
Definition: dataslave.cpp:166
KIO::DataSlave::hold
virtual void hold(const KUrl &url)
Puts the kioslave associated with url at halt, and return it to klauncher, in order to let another ap...
Definition: dataslave.cpp:73
KIO::DataSlave::send
virtual void send(int cmd, const QByteArray &arr=QByteArray())
Sends the given command to the kioslave.
Definition: dataslave.cpp:120
KIO::DataSlave::suspend
virtual void suspend()
Suspends the operation of the attached kioslave.
Definition: dataslave.cpp:77
KIO::DataSlave::resume
virtual void resume()
Resumes the operation of the attached kioslave.
Definition: dataslave.cpp:83
KIO::DataSlave::mimetype
virtual void mimetype(const KUrl &url)=0
KIO::DataSlave::sendMetaData
void sendMetaData()
Sends metadata set with setAllMetaData.
Definition: dataslave.cpp:170
KIO::DataSlave::dispatchQueue
DispatchQueue dispatchQueue
Definition: dataslave.h:100
KIO::DataSlave::setHost
virtual void setHost(const QString &host, quint16 port, const QString &user, const QString &passwd)
Set host for url.
Definition: dataslave.cpp:151
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:397
KIO::SlaveInterface::totalSize
void totalSize(KIO::filesize_t)
KIO::SlaveInterface::finished
void finished()
KIO::SlaveInterface::data
void data(const QByteArray &)
KIO::SlaveInterface::mimeType
void mimeType(const QString &)
KIO::Slave
Definition: slave.h:49
KIO::Slave::host
QString host()
Definition: slave.cpp:193
KIO::Slave::user
QString user()
Definition: slave.cpp:205
KIO::Slave::passwd
QString passwd()
Definition: slave.cpp:211
KIO::Slave::port
quint16 port()
Definition: slave.cpp:199
KUrl
QList
DISPATCH_DECL1
#define DISPATCH_DECL1(type, paramtype, param)
Definition: dataslave.h:35
DISPATCH_DECL
#define DISPATCH_DECL(type)
Definition: dataslave.h:31
global.h
config
KSharedConfigPtr config()
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
slave.h
KIO::DataSlave::QueueStruct
structure for queuing.
Definition: dataslave.h:90
KIO::DataSlave::QueueStruct::QueueStruct
QueueStruct()
Definition: dataslave.h:96
KIO::DataSlave::QueueStruct::ba
QByteArray ba
Definition: dataslave.h:94
KIO::DataSlave::QueueStruct::size
KIO::filesize_t size
Definition: dataslave.h:93
KIO::DataSlave::QueueStruct::QueueStruct
QueueStruct(QueueType type)
Definition: dataslave.h:97
KIO::DataSlave::QueueStruct::s
QString s
Definition: dataslave.h:92
KIO::DataSlave::QueueStruct::type
QueueType type
Definition: dataslave.h:91
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal