kio Library: dataslave.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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., 59 Temple Place - Suite 330,
    00019  *  Boston, MA 02111-1307, USA.
    00020  **/
    00021
    00022 #ifndef __KIO_DATASLAVE_H__
    00023 #define __KIO_DATASLAVE_H__
    00024
    00025 #include <kio/global.h>
    00026 #include <kio/slave.h>
    00027
    00028 class QTimer;
    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 KIO {
    00039
    00049     class DataSlave : public KIO::Slave {
    00050     Q_OBJECT
    00051     public:
    00052     DataSlave();
    00053
    00054         virtual ~DataSlave();
    00055
    00056         virtual void setHost(const QString &host, int port,
    00057             const QString &user, const QString &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 QByteArray &arr = QByteArray());
    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       QString s;
    00093       KIO::filesize_t size;
    00094       QByteArray ba;
    00095
    00096       QueueStruct() {}
    00097       QueueStruct(QueueType type) : type(type) {}
    00098     };
    00099         typedef QValueList<QueueStruct> DispatchQueue;
    00100     DispatchQueue dispatchQueue;
    00101
    00102     DISPATCH_DECL1(mimeType, const QString &, s)
    00103     DISPATCH_DECL1(totalSize, KIO::filesize_t, size)
    00104     DISPATCH_DECL(sendMetaData)
    00105     DISPATCH_DECL1(data, const QByteArray &, 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     QTimer *timer;
    00119     };
    00120
    00121 }
    00122
    00123 #undef DISPATCH_DECL
    00124 #undef DISPATCH_DECL1
    00125
    00126 #endif /*__KIO_DATASLAVE_H__*/

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:52 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003