• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

k3bufferedsocket.h

Go to the documentation of this file.
00001 /*  -*- C++ -*-
00002  *  Copyright (C) 2003,2005 Thiago Macieira <thiago@kde.org>
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 <kdecore_export.h>
00029 #include "k3streamsocket.h"
00030 
00031 #include <QtCore/QObject>
00032 #include <QtCore/QByteArray>
00033 #include <QtCore/QList>
00034 
00035 namespace KNetwork {
00036 
00037 class KBufferedSocketPrivate;
00057 class KDECORE_EXPORT KBufferedSocket: public KStreamSocket
00058 {
00059   Q_OBJECT
00060 public:
00068   explicit KBufferedSocket(const QString& node = QString(), const QString& service = QString(),
00069           QObject* parent = 0L);
00070 
00074   virtual ~KBufferedSocket();
00075 
00079   virtual void setSocketDevice(KSocketDevice* device);
00080 
00081 protected:
00085   virtual bool setSocketOptions(int opts);
00086 
00087 public:
00094   virtual void close();
00095 
00099   virtual qint64 bytesAvailable() const;
00100 
00104   virtual qint64 waitForMore(int msecs, bool *timeout = 0L);
00105 
00109   virtual void enableRead(bool enable);
00110 
00114   virtual void enableWrite(bool enable);
00115 
00119   void setInputBuffering(bool enable);
00120 
00124   void setOutputBuffering(bool enable);
00125 
00129   virtual qint64 bytesToWrite() const;
00130 
00137   virtual void closeNow();
00138 
00142   virtual bool canReadLine() const;
00143 
00144   // KDE4: make virtual, add timeout to match the Qt4 signature
00145   //       and move to another class up the hierarchy
00150   void waitForConnect();
00151 
00152 protected:
00158   virtual qint64 readData(char *data, qint64 maxlen, KSocketAddress *from);
00159 
00165   virtual qint64 peekData(char *data, qint64 maxlen, KSocketAddress *from);
00166 
00172   virtual qint64 writeData(const char *data, qint64 len, const KSocketAddress* to);
00173 
00177   virtual qint64 readLineData(char *data, qint64 maxSize);
00178 
00182   virtual void stateChanging(SocketState newState);
00183 
00184 protected Q_SLOTS:
00188   virtual void slotReadActivity();
00189 
00193   virtual void slotWriteActivity();
00194 
00195 #if 0
00196   // Already present in QIODevice
00197 Q_SIGNALS:
00201   void bytesWritten(int bytes);
00202 #endif
00203 
00204 private:
00205   KBufferedSocket(const KBufferedSocket&);
00206   KBufferedSocket& operator=(const KBufferedSocket&);
00207 
00208   KBufferedSocketPrivate* const d;
00209 };
00210 
00211 }               // namespace KNetwork
00212 
00213 #endif

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal