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
00033 class KIOBufferBase;
00034
00035 namespace KNetwork {
00036
00037 class KBufferedSocketPrivate;
00051 class KBufferedSocket: public KStreamSocket
00052 {
00053 Q_OBJECT
00054 public:
00061 KBufferedSocket(const QString& node = QString::null, const QString& service = QString::null,
00062 QObject* parent = 0L, const char *name = 0L);
00063
00067 virtual ~KBufferedSocket();
00068
00072 virtual void setSocketDevice(KSocketDevice* device);
00073
00074 protected:
00078 virtual bool setSocketOptions(int opts);
00079
00080 public:
00087 virtual void close();
00088
00092 virtual Q_LONG bytesAvailable() const;
00093
00097 virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L);
00098
00102 virtual Q_LONG readBlock(char *data, Q_ULONG maxlen);
00103
00110 virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
00111
00115 virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen);
00116
00123 virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress &from);
00124
00128 virtual Q_LONG writeBlock(const char *data, Q_ULONG len);
00129
00136 virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to);
00137
00141 virtual void enableRead(bool enable);
00142
00146 virtual void enableWrite(bool enable);
00147
00151 void setInputBuffering(bool enable);
00152
00156 KIOBufferBase* inputBuffer();
00157
00161 void setOutputBuffering(bool enable);
00162
00166 KIOBufferBase* outputBuffer();
00167
00171 virtual Q_ULONG bytesToWrite() const;
00172
00179 virtual void closeNow();
00180
00184 bool canReadLine() const;
00185
00189 QCString readLine();
00190
00191 protected:
00195 virtual void stateChanging(SocketState newState);
00196
00197 protected slots:
00201 virtual void slotReadActivity();
00202
00206 virtual void slotWriteActivity();
00207
00208 signals:
00212 void bytesWritten(int bytes);
00213
00214 private:
00215 KBufferedSocket(const KBufferedSocket&);
00216 KBufferedSocket& operator=(const KBufferedSocket&);
00217
00218 KBufferedSocketPrivate *d;
00219
00220 public:
00221
00230 inline void reset()
00231 { closeNow(); }
00232 };
00233
00234 }
00235
00236 #endif
This file is part of the documentation for kdecore Library Version 3.3.1.