• 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
28class TDEBufferedIOPrivate;
56class TDECORE_EXPORT TDEBufferedIO: public KAsyncIO
57{
58 TQ_OBJECT
59
60
61protected:
62 // no default public constructor
63 TDEBufferedIO();
64
65public:
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 virtual int bytesAvailable() const;
122
129 virtual int waitForMore(int msec) = 0;
130
135 virtual int bytesToWrite() const;
136
145 virtual bool canReadLine() const;
146
147 // readBlock, peekBlock and writeBlock are not defined in this class (thus, left
148 // pure virtual) because this does not mean only reading and writing
149 // to the buffers. It may be necessary to do I/O to complete the
150 // transaction (e.g., user wants to read more than is in the buffer).
151 // Reading and writing to the buffer are available for access through
152 // protected member functions
153
166 virtual int peekBlock(char *data, uint maxlen) = 0;
167
180 virtual int unreadBlock(const char *data, uint len);
181
182signals:
187 void bytesWritten(int nbytes);
188
189 // There is no read signal here. We use the readyRead signal inherited
190 // from KAsyncIO for that purpose
191
206 void closed(int state);
207
208protected:
213 TQPtrList<TQByteArray> inBuf;
214
219 TQPtrList<TQByteArray> outBuf;
220
221 unsigned inBufIndex ,
222 outBufIndex ;
223
234 virtual unsigned consumeReadBuffer(unsigned nbytes, char *destbuffer, bool discard = true);
235
247 virtual void consumeWriteBuffer(unsigned nbytes);
248
260 virtual unsigned feedReadBuffer(unsigned nbytes, const char *buffer, bool atBeginning = false);
261
270 virtual unsigned feedWriteBuffer(unsigned nbytes, const char *buffer);
271
276 virtual unsigned readBufferSize() const;
277
282 virtual unsigned writeBufferSize() const;
283
284protected:
285 virtual void virtual_hook( int id, void* data );
286private:
287 TDEBufferedIOPrivate *d;
288};
289
290#endif // KBUFFEREDIO_H
KAsyncIO
Asynchronous I/O Support.
Definition: kasyncio.h:39
TDEBufferedIO
This abstract class implements basic functionality for buffered input/output.
Definition: kbufferedio.h:57
TDEBufferedIO::waitForMore
virtual int waitForMore(int msec)=0
Waits for more data to be available and returns the amount of available data then.
TDEBufferedIO::closeNow
virtual void closeNow()=0
Closes the stream now, discarding the contents of the write buffer.
TDEBufferedIO::closed
void closed(int state)
This signal gets sent when the stream is closed.
TDEBufferedIO::peekBlock
virtual int peekBlock(char *data, uint maxlen)=0
Reads into the user buffer at most maxlen bytes, but does not consume that data from the read buffer.
TDEBufferedIO::bytesWritten
void bytesWritten(int nbytes)
This signal gets sent whenever bytes are written from the buffer.
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:213
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:219
TDEBufferedIO::closeModes
closeModes
The modes for closed() signal.
Definition: kbufferedio.h:70

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.9.4
This website is maintained by Timothy Pearson.