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

tdecore

  • tdecore
kbufferedio.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 2001 Thiago Macieira <thiago.macieira@kdemail.net>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef KBUFFEREDIO_H
22 #define KBUFFEREDIO_H
23 
24 #include <tqcstring.h>
25 #include <tqptrlist.h>
26 #include "kasyncio.h"
27 
28 class TDEBufferedIOPrivate;
56 class TDECORE_EXPORT TDEBufferedIO: public KAsyncIO
57 {
58  Q_OBJECT
59 
60 
61 protected:
62  // no default public constructor
63  TDEBufferedIO();
64 
65 public:
69  enum closeModes
70  {
71  availRead = 0x01,
72  dirtyWrite = 0x02,
73  involuntary = 0x10,
74  delayed = 0x20,
75  closedNow = 0x40
76  };
77 
82  virtual ~TDEBufferedIO();
83 
92  virtual void closeNow() = 0;
93 
115  virtual bool setBufferSize(int rsize, int wsize = -2);
116 
121 #ifdef USE_QT3
122  virtual int bytesAvailable() const;
123 #endif // USE_QT3
124 #ifdef USE_QT4
125  virtual qint64 bytesAvailable() const;
126 #endif // USE_QT4
127 
134  virtual int waitForMore(int msec) = 0;
135 
140 #ifdef USE_QT3
141  virtual int bytesToWrite() const;
142 #endif // USE_QT3
143 #ifdef USE_QT4
144  virtual qint64 bytesToWrite() const;
145 #endif // USE_QT4
146 
155  virtual bool canReadLine() const;
156 
157  // readBlock, peekBlock and writeBlock are not defined in this class (thus, left
158  // pure virtual) because this does not mean only reading and writing
159  // to the buffers. It may be necessary to do I/O to complete the
160  // transaction (e.g., user wants to read more than is in the buffer).
161  // Reading and writing to the buffer are available for access through
162  // protected member functions
163 
176  virtual int peekBlock(char *data, uint maxlen) = 0;
177 
190  virtual int unreadBlock(const char *data, uint len);
191 
192 signals:
197  void bytesWritten(int nbytes);
198 
199  // There is no read signal here. We use the readyRead signal inherited
200  // from KAsyncIO for that purpose
201 
216  void closed(int state);
217 
218 protected:
223  TQPtrList<TQByteArray> inBuf;
224 
229  TQPtrList<TQByteArray> outBuf;
230 
231  unsigned inBufIndex ,
232  outBufIndex ;
233 
244  virtual unsigned consumeReadBuffer(unsigned nbytes, char *destbuffer, bool discard = true);
245 
257  virtual void consumeWriteBuffer(unsigned nbytes);
258 
270  virtual unsigned feedReadBuffer(unsigned nbytes, const char *buffer, bool atBeginning = false);
271 
280  virtual unsigned feedWriteBuffer(unsigned nbytes, const char *buffer);
281 
286  virtual unsigned readBufferSize() const;
287 
292  virtual unsigned writeBufferSize() const;
293 
294 protected:
295  virtual void virtual_hook( int id, void* data );
296 private:
297  TDEBufferedIOPrivate *d;
298 };
299 
300 #endif // KBUFFEREDIO_H
TDEBufferedIO::inBuf
TQPtrList< TQByteArray > inBuf
For an explanation on how this buffer work, please refer to the comments at the top of kbufferedio...
Definition: kbufferedio.h:223
TDEBufferedIO::outBuf
TQPtrList< TQByteArray > outBuf
For an explanation on how this buffer work, please refer to the comments at the top of kbufferedio...
Definition: kbufferedio.h:229
KAsyncIO
Asynchronous I/O Support.
Definition: kasyncio.h:42
TDEBufferedIO::closeModes
closeModes
The modes for closed() signal.
Definition: kbufferedio.h:69
TDEBufferedIO
This abstract class implements basic functionality for buffered input/output.
Definition: kbufferedio.h:56

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.