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

tdeio/tdeio

dataslave.h
00001 // -*- c++ -*-
00002 /*
00003  *  This file is part of the KDE libraries
00004  *  Copyright (c) 2003 Leo Savernik <l.savernik@aon.at>
00005  *  Derived from slave.h
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Library General Public
00009  *  License version 2 as published by the Free Software Foundation.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public License
00017  *  along with this library; see the file COPYING.LIB.  If not, write to
00018  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  *  Boston, MA 02110-1301, USA.
00020  **/
00021 
00022 #ifndef __TDEIO_DATASLAVE_H__
00023 #define __TDEIO_DATASLAVE_H__
00024 
00025 #include <tdeio/global.h>
00026 #include <tdeio/slave.h>
00027 
00028 class TQTimer;
00029 
00030 // don't forget to sync DISPATCH_IMPL in dataslave.h
00031 #define DISPATCH_DECL(type) \
00032     void dispatch_##type();
00033 
00034 // don't forget to sync DISPATCH_IMPL1 in dataslave.h
00035 #define DISPATCH_DECL1(type, paramtype, param) \
00036     void dispatch_##type(paramtype param);
00037 
00038 namespace TDEIO {
00039 
00049     class DataSlave : public TDEIO::Slave {
00050     Q_OBJECT
00051     public:
00052     DataSlave();
00053 
00054         virtual ~DataSlave();
00055 
00056         virtual void setHost(const TQString &host, int port,
00057             const TQString &user, const TQString &passwd);
00058     virtual void setConfig(const MetaData &config);
00059 
00060         virtual void suspend();
00061         virtual void resume();
00062         virtual bool suspended();
00063         virtual void send(int cmd, const TQByteArray &data = TQByteArray());
00064 
00065     virtual void hold(const KURL &url);
00066 
00067     // pure virtual methods that are defined by the actual protocol
00068     virtual void get(const KURL &url) = 0;
00069     virtual void mimetype(const KURL &url) = 0;
00070 
00071     protected:
00076     void setAllMetaData(const MetaData &);
00081     void sendMetaData();
00082 
00083     // queueing methods
00085     enum QueueType { Queue_mimeType = 1, Queue_totalSize,
00086         Queue_sendMetaData, Queue_data, Queue_finished };
00090     struct QueueStruct {
00091       QueueType type;
00092       TQString s;
00093       TDEIO::filesize_t size;
00094       TQByteArray ba;
00095 
00096       QueueStruct() {}
00097       QueueStruct(QueueType type) : type(type) {}
00098     };
00099         typedef TQValueList<QueueStruct> DispatchQueue;
00100     DispatchQueue dispatchQueue;
00101 
00102     DISPATCH_DECL1(mimeType, const TQString &, s)
00103     DISPATCH_DECL1(totalSize, TDEIO::filesize_t, size)
00104     DISPATCH_DECL(sendMetaData)
00105     DISPATCH_DECL1(data, const TQByteArray &, ba)
00106     DISPATCH_DECL(finished)
00107 
00108     protected slots:
00112     void dispatchNext();
00113     protected:
00114     virtual void virtual_hook( int id, void* data );
00115     private:
00116     MetaData meta_data;
00117     bool _suspended;
00118     TQTimer *timer;
00119     };
00120 
00121 }
00122 
00123 #undef DISPATCH_DECL
00124 #undef DISPATCH_DECL1
00125 
00126 #endif /*__TDEIO_DATASLAVE_H__*/

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.7.6.1
This website is maintained by Timothy Pearson.