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; 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 // KDE4: remove this function 00226 inline void reset() 00227 { closeNow(); } 00228 }; 00229 00230 } // namespace KNetwork 00231 00232 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:09 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003