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

KIO

  • sources
  • kde-4.14
  • kdelibs
  • 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 
28 class 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 
38 namespace 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::sendMetaData
void sendMetaData()
Sends metadata set with setAllMetaData.
Definition: dataslave.cpp:170
KIO::DataSlave::dispatchQueue
DispatchQueue dispatchQueue
Definition: dataslave.h:100
KIO::DataSlave::QueueStruct
structure for queuing.
Definition: dataslave.h:90
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
KIO::SlaveInterface::data
void data(const QByteArray &)
KIO::DataSlave::setConfig
virtual void setConfig(const MetaData &config)
Configure slave.
Definition: dataslave.cpp:156
QByteArray
KIO::DataSlave::suspended
virtual bool suspended()
Tells whether the kioslave is suspended.
Definition: dataslave.cpp:147
KIO::DataSlave::send
virtual void send(int cmd, const QByteArray &arr=QByteArray())
Sends the given command to the kioslave.
Definition: dataslave.cpp:120
slave.h
KIO::SlaveInterface::totalSize
void totalSize(KIO::filesize_t)
KIO::DataSlave::QueueStruct::ba
QByteArray ba
Definition: dataslave.h:94
KIO::DataSlave::QueueStruct::type
QueueType type
Definition: dataslave.h:91
global.h
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:396
KIO::DataSlave::mimetype
virtual void mimetype(const KUrl &url)=0
KUrl
KIO::Slave
Definition: slave.h:48
KIO::DataSlave::DataSlave
DataSlave()
Definition: dataslave.cpp:60
config
KSharedConfigPtr config()
DISPATCH_DECL
#define DISPATCH_DECL(type)
Definition: dataslave.h:31
DISPATCH_DECL1
#define DISPATCH_DECL1(type, paramtype, param)
Definition: dataslave.h:35
KIO::DataSlave::setAllMetaData
void setAllMetaData(const MetaData &)
Sets metadata.
Definition: dataslave.cpp:166
KIO::SlaveInterface::finished
void finished()
KIO::Slave::port
quint16 port()
Definition: slave.cpp:199
KIO::Slave::host
QString host()
Definition: slave.cpp:193
QTimer
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::QueueType
QueueType
identifiers of functions to be queued
Definition: dataslave.h:85
KIO::DataSlave::DispatchQueue
QList< QueueStruct > DispatchQueue
Definition: dataslave.h:99
KIO::DataSlave::Queue_sendMetaData
Definition: dataslave.h:86
KIO::DataSlave::resume
virtual void resume()
Resumes the operation of the attached kioslave.
Definition: dataslave.cpp:83
KIO::DataSlave::QueueStruct::QueueStruct
QueueStruct(QueueType type)
Definition: dataslave.h:97
QString
QList< QueueStruct >
KIO::DataSlave::Queue_finished
Definition: dataslave.h:86
KIO::SlaveInterface::mimeType
void mimeType(const QString &)
KIO::DataSlave::QueueStruct::s
QString s
Definition: dataslave.h:92
KIO::DataSlave::Queue_data
Definition: dataslave.h:86
KIO::Slave::user
QString user()
Definition: slave.cpp:205
KIO::DataSlave::QueueStruct::QueueStruct
QueueStruct()
Definition: dataslave.h:96
KIO::DataSlave::Queue_totalSize
Definition: dataslave.h:85
KIO::DataSlave::suspend
virtual void suspend()
Suspends the operation of the attached kioslave.
Definition: dataslave.cpp:77
KIO::DataSlave::Queue_mimeType
Definition: dataslave.h:85
KIO::Slave::passwd
QString passwd()
Definition: slave.cpp:211
KIO::DataSlave::~DataSlave
virtual ~DataSlave()
Definition: dataslave.cpp:69
KIO::DataSlave
This class provides a high performance implementation for the data url scheme (rfc2397).
Definition: dataslave.h:49
KIO::DataSlave::dispatchNext
void dispatchNext()
dispatches next queued method.
Definition: dataslave.cpp:101
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::DataSlave::QueueStruct::size
KIO::filesize_t size
Definition: dataslave.h:93
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:52 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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