kbufferedsocket.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00233 inline void reset()
00234 { closeNow(); }
00235 };
00236
00237 }
00238
00239 #endif
This file is part of the documentation for kdecore Library Version 3.3.90.