kdecore Library API Documentation

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 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 // KDE4: remove this function 00230 inline void reset() 00231 { closeNow(); } 00232 }; 00233 00234 } // namespace KNetwork 00235 00236 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:26:06 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003