# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# connection.h

    00001 // -*- c++ -*-
    00002 /* This file is part of the KDE libraries
    00003     Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
    00004                        David Faure <faure@kde.org>
    00005
    00006     This library is free software; you can redistribute it and/or
    00007     modify it under the terms of the GNU Library General Public
    00008     License as published by the Free Software Foundation; either
    00009     version 2 of the License, or (at your option) any later version.
    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 __connection_h__
    00023 #define __connection_h__ "$Id: connection.h,v 1.28.2.1 2003/05/17 11:19:22 mueller Exp $"
    00024
    00025 #include <sys/types.h>
    00026
    00027 #include <stdio.h>
    00028 #include <qptrlist.h>
    00029
    00030 class KSocket;
    00031 class QSocketNotifier;
    00032
    00033 namespace KIO {
    00034
    00035     struct Task {
    00036         int cmd;
    00037         QByteArray data;
    00038     };
    00039
    00046     class Connection : public QObject
    00047     {
    00048         Q_OBJECT
    00049     public:
    00050         Connection();
    00051         virtual ~Connection();
    00052
    00053         void init(KSocket *sock);
    00054         void init(int fd_in, int fd_out); // Used by KDENOX
    00055         void connect(QObject *receiver = 0, const char *member = 0);
    00056         void close();
    00057
    00058         int fd_from() const { return fd_in; }
    00059         int fd_to() const { return fileno( f_out ); }
    00060
    00061         bool inited() const { return (fd_in != -1) && (f_out != 0); }
    00062
    00063         // send (queues the command to be sent)
    00064         void send(int cmd, const QByteArray &arr = QByteArray());
    00065
    00066         // send (without queue)
    00067         bool sendnow( int _cmd, const QByteArray &data );
    00068
    00075         int read( int* _cmd, QByteArray & );
    00076
    00080         void suspend();
    00081
    00085         void resume();
    00086
    00090         bool suspended() const { return m_suspended; }
    00091
    00092     protected slots:
    00093         void dequeue();
    00094
    00095     protected:
    00096
    00097
    00098     private:
    00099         int fd_in;
    00100         FILE *f_out;
    00101         KSocket *socket;
    00102         QSocketNotifier *notifier;
    00103         QObject *receiver;
    00104         const char *member;
    00105         QPtrList<Task> tasks;
    00106         bool m_suspended;
    00107     private:
    00108         class ConnectionPrivate* d;
    00109     };
    00110
    00111 }
    00112
    00113 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:12:43 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001