kdecore Library: kbufferedsocket.h Source File (kdecore Library)

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

# kbufferedsocket.h

    00001 /*  -*- C++ -*-
    00002  *  Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
    00003  *
    00004  *
    00005  *  Permission is hereby granted, free of charge, to any person obtaining
    00006  *  a copy of this software and associated documentation files (the
    00007  *  "Software"), to deal in the Software without restriction, including
    00008  *  without limitation the rights to use, copy, modify, merge, publish,
    00009  *  distribute, sublicense, and/or sell copies of the Software, and to
    00010  *  permit persons to whom the Software is furnished to do so, subject to
    00011  *  the following conditions:
    00012  *
    00013  *  The above copyright notice and this permission notice shall be included
    00014  *  in all copies or substantial portions of the Software.
    00015  *
    00016  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00017  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00018  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    00019  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    00020  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    00021  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    00022  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00023  */
    00024
    00025 #ifndef KBUFFEREDSOCKET_H
    00026 #define KBUFFEREDSOCKET_H
    00027
    00028 #include <qobject.h>
    00029 #include <qcstring.h>
    00030 #include <qvaluelist.h>
    00031 #include "kstreamsocket.h"
    00032 #include <kdelibs_export.h>
    00033
    00034 class KIOBufferBase;
    00035
    00036 namespace KNetwork {
    00037
    00038 class KBufferedSocketPrivate;
    00052 class KDECORE_EXPORT KBufferedSocket: public KStreamSocket
    00053 {
    00054   Q_OBJECT
    00055 public:
    00064   KBufferedSocket(const QString& node = QString::null, const QString& service = QString::null,
    00065           QObject* parent = 0L, const char *name = 0L);
    00066
    00070   virtual ~KBufferedSocket();
    00071
    00075   virtual void setSocketDevice(KSocketDevice* device);
    00076
    00077 protected:
    00081   virtual bool setSocketOptions(int opts);
    00082
    00083 public:
    00090   virtual void close();
    00091
    00095   virtual Q_LONG bytesAvailable() const;
    00096
    00100   virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L);
    00101
    00105   virtual Q_LONG readBlock(char *data, Q_ULONG maxlen);
    00106
    00113   virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
    00114
    00118   virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen);
    00119
    00126   virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress &from);
    00127
    00131   virtual Q_LONG writeBlock(const char *data, Q_ULONG len);
    00132
    00139   virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to);
    00140
    00144   virtual void enableRead(bool enable);
    00145
    00149   virtual void enableWrite(bool enable);
    00150
    00154   void setInputBuffering(bool enable);
    00155
    00159   KIOBufferBase* inputBuffer();
    00160
    00164   void setOutputBuffering(bool enable);
    00165
    00169   KIOBufferBase* outputBuffer();
    00170
    00174   virtual Q_ULONG bytesToWrite() const;
    00175
    00182   virtual void closeNow();
    00183
    00187   bool canReadLine() const;
    00188
    00192   QCString readLine();
    00193
    00194 protected:
    00198   virtual void stateChanging(SocketState newState);
    00199
    00200 protected slots:
    00204   virtual void slotReadActivity();
    00205
    00209   virtual void slotWriteActivity();
    00210
    00211 signals:
    00215   void bytesWritten(int bytes);
    00216
    00217 private:
    00218   KBufferedSocket(const KBufferedSocket&);
    00219   KBufferedSocket& operator=(const KBufferedSocket&);
    00220
    00221   KBufferedSocketPrivate *d;
    00222
    00223 public:
    00224   // KDE4: remove this function
    00233   inline void reset()
    00234   { closeNow(); }
    00235 };
    00236
    00237 }               // namespace KNetwork
    00238
    00239 #endif

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