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;
00047 class KBufferedSocket: public KStreamSocket
00048 {
00049 Q_OBJECT
00050 public:
00057 KBufferedSocket(const QString& host = QString::null, const QString& service = QString::null,
00058 QObject* parent = 0L, const char *name = 0L);
00059
00063 virtual ~KBufferedSocket();
00064
00068 virtual void setSocketDevice(KSocketDevice* device);
00069
00070 protected:
00074 virtual bool setSocketOptions(int opts);
00075
00076 public:
00083 virtual void close();
00084
00088 virtual Q_LONG bytesAvailable() const;
00089
00093 virtual Q_LONG waitForMore(int msecs, bool *timeout = 0L);
00094
00098 virtual Q_LONG readBlock(char *data, Q_ULONG maxlen);
00099
00106 virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
00107
00111 virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen);
00112
00119 virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress &from);
00120
00124 virtual Q_LONG writeBlock(const char *data, Q_ULONG len);
00125
00132 virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to);
00133
00137 virtual void enableRead(bool enable);
00138
00142 virtual void enableWrite(bool enable);
00143
00147 void setInputBuffering(bool enable);
00148
00152 KIOBufferBase* inputBuffer();
00153
00157 void setOutputBuffering(bool enable);
00158
00162 KIOBufferBase* outputBuffer();
00163
00167 virtual Q_ULONG bytesToWrite() const;
00168
00175 virtual void closeNow();
00176
00180 bool canReadLine() const;
00181
00185 QCString readLine();
00186
00187 protected:
00191 virtual void stateChanging(SocketState newState);
00192
00193 protected slots:
00197 virtual void slotReadActivity();
00198
00202 virtual void slotWriteActivity();
00203
00204 signals:
00208 void bytesWritten(int bytes);
00209
00210 private:
00211 KBufferedSocket(const KBufferedSocket&);
00212 KBufferedSocket& operator=(const KBufferedSocket&);
00213
00214 KBufferedSocketPrivate *d;
00215
00216 public:
00217
00226 inline void reset()
00227 { closeNow(); }
00228 };
00229
00230 }
00231
00232 #endif
This file is part of the documentation for kdecore Library Version 3.3.0.