• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

kbufferedio.h
00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (C) 2001 Thiago Macieira <thiago.macieira@kdemail.net>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef KBUFFEREDIO_H
00022 #define KBUFFEREDIO_H
00023 
00024 #include <tqcstring.h>
00025 #include <tqptrlist.h>
00026 #include "kasyncio.h"
00027 
00028 class TDEBufferedIOPrivate;
00056 class TDECORE_EXPORT TDEBufferedIO: public KAsyncIO
00057 {
00058   Q_OBJECT
00059   
00060 
00061 protected:
00062   // no default public constructor
00063   TDEBufferedIO();
00064 
00065 public:
00069   enum closeModes
00070   {
00071     availRead = 0x01,
00072     dirtyWrite = 0x02,
00073     involuntary = 0x10,
00074     delayed = 0x20,
00075     closedNow = 0x40
00076   };
00077 
00082   virtual ~TDEBufferedIO();
00083 
00092   virtual void closeNow() = 0;
00093 
00115   virtual bool setBufferSize(int rsize, int wsize = -2);
00116 
00121 #ifdef USE_QT3
00122   virtual int bytesAvailable() const;
00123 #endif // USE_QT3
00124 #ifdef USE_QT4
00125   virtual qint64 bytesAvailable() const;
00126 #endif // USE_QT4
00127 
00134   virtual int waitForMore(int msec) = 0;
00135 
00140 #ifdef USE_QT3
00141   virtual int bytesToWrite() const;
00142 #endif // USE_QT3
00143 #ifdef USE_QT4
00144   virtual qint64 bytesToWrite() const;
00145 #endif // USE_QT4
00146 
00155   virtual bool canReadLine() const;
00156 
00157   // readBlock, peekBlock and writeBlock are not defined in this class (thus, left
00158   // pure virtual) because this does not mean only reading and writing
00159   // to the buffers. It may be necessary to do I/O to complete the
00160   // transaction (e.g., user wants to read more than is in the buffer).
00161   // Reading and writing to the buffer are available for access through
00162   // protected member functions
00163 
00176   virtual int peekBlock(char *data, uint maxlen) = 0;
00177 
00190   virtual int unreadBlock(const char *data, uint len);
00191 
00192 signals:
00197   void bytesWritten(int nbytes);
00198 
00199   // There is no read signal here. We use the readyRead signal inherited
00200   // from KAsyncIO for that purpose
00201 
00216   void closed(int state);
00217 
00218 protected:
00223   TQPtrList<TQByteArray> inBuf;
00224 
00229   TQPtrList<TQByteArray> outBuf;
00230 
00231   unsigned inBufIndex , 
00232     outBufIndex  ;
00233 
00244   virtual unsigned consumeReadBuffer(unsigned nbytes, char *destbuffer, bool discard = true);
00245 
00257   virtual void consumeWriteBuffer(unsigned nbytes);
00258 
00270   virtual unsigned feedReadBuffer(unsigned nbytes, const char *buffer, bool atBeginning = false);
00271 
00280   virtual unsigned feedWriteBuffer(unsigned nbytes, const char *buffer);
00281 
00286   virtual unsigned readBufferSize() const;
00287 
00292   virtual unsigned writeBufferSize() const;
00293 
00294 protected:
00295   virtual void virtual_hook( int id, void* data );
00296 private:
00297   TDEBufferedIOPrivate *d;
00298 };
00299 
00300 #endif // KBUFFEREDIO_H

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.