• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
dataslave.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2003 Leo Savernik <l.savernik@aon.at>
4  * Derived from slave.h
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License version 2 as published by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  **/
20 
21 #ifndef __TDEIO_DATASLAVE_H__
22 #define __TDEIO_DATASLAVE_H__
23 
24 #include <tdeio/global.h>
25 #include <tdeio/slave.h>
26 
27 class TQTimer;
28 
29 // don't forget to sync DISPATCH_IMPL in dataslave.h
30 #define DISPATCH_DECL(type) \
31  void dispatch_##type();
32 
33 // don't forget to sync DISPATCH_IMPL1 in dataslave.h
34 #define DISPATCH_DECL1(type, paramtype, param) \
35  void dispatch_##type(paramtype param);
36 
37 namespace TDEIO {
38 
48  class DataSlave : public TDEIO::Slave {
49  TQ_OBJECT
50  public:
51  DataSlave();
52 
53  virtual ~DataSlave();
54 
55  virtual void setHost(const TQString &host, int port,
56  const TQString &user, const TQString &passwd);
57  virtual void setConfig(const MetaData &config);
58 
59  virtual void suspend();
60  virtual void resume();
61  virtual bool suspended();
62  virtual void send(int cmd, const TQByteArray &data = TQByteArray());
63 
64  virtual void hold(const KURL &url);
65 
66  // pure virtual methods that are defined by the actual protocol
67  virtual void get(const KURL &url) = 0;
68  virtual void mimetype(const KURL &url) = 0;
69 
70  protected:
75  void setAllMetaData(const MetaData &);
80  void sendMetaData();
81 
82  // queueing methods
84  enum QueueType { Queue_mimeType = 1, Queue_totalSize,
85  Queue_sendMetaData, Queue_data, Queue_finished };
89  struct QueueStruct {
90  QueueType type;
91  TQString s;
92  TDEIO::filesize_t size;
93  TQByteArray ba;
94 
95  QueueStruct() {}
96  QueueStruct(QueueType type) : type(type) {}
97  };
98  typedef TQValueList<QueueStruct> DispatchQueue;
99  DispatchQueue dispatchQueue;
100 
101  DISPATCH_DECL1(mimeType, const TQString &, s)
102  DISPATCH_DECL1(totalSize, TDEIO::filesize_t, size)
103  DISPATCH_DECL(sendMetaData)
104  DISPATCH_DECL1(data, const TQByteArray &, ba)
105  DISPATCH_DECL(finished)
106 
107  protected slots:
111  void dispatchNext();
112  protected:
113  virtual void virtual_hook( int id, void* data );
114  private:
115  MetaData meta_data;
116  bool _suspended;
117  TQTimer *timer;
118  };
119 
120 }
121 
122 #undef DISPATCH_DECL
123 #undef DISPATCH_DECL1
124 
125 #endif /*__TDEIO_DATASLAVE_H__*/
TDEIO::DataSlave
This class provides a high performance implementation for the data url scheme (rfc2397).
Definition: dataslave.h:48
TDEIO::DataSlave::dispatchNext
void dispatchNext()
dispatches next queued method.
Definition: dataslave.cpp:99
TDEIO::DataSlave::setAllMetaData
void setAllMetaData(const MetaData &)
Sets metadata.
Definition: dataslave.cpp:163
TDEIO::DataSlave::QueueType
QueueType
identifiers of functions to be queued
Definition: dataslave.h:84
TDEIO::DataSlave::sendMetaData
void sendMetaData()
Sends metadata set with setAllMetaData.
Definition: dataslave.cpp:167
TDEIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:516
TDEIO::Slave
Attention developers: If you change the implementation of TDEIO::Slave, do not use connection() or sl...
Definition: slave.h:44
TDEIO::Slave::passwd
TQString passwd()
Definition: slave.h:138
TDEIO::Slave::port
int port()
Definition: slave.h:128
TDEIO::Slave::user
TQString user()
Definition: slave.h:133
TDEIO::Slave::host
TQString host()
Definition: slave.h:123
TDEIO
A namespace for TDEIO globals.
Definition: authinfo.h:29
TDEIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition: global.h:39
TDEIO::DataSlave::QueueStruct
structure for queueing.
Definition: dataslave.h:89

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.