TQDataSource Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQDataSource Class Reference
[obsolete]

The TQDataSource class is an asynchronous producer of data. More...

`#include <ntqasyncio.h>`

Inherits TQAsyncIO.

Inherited by TQIODeviceSource.

List of all member functions.

## Public Members

- virtual int readyToSend () = 0
- virtual void sendTo ( TQDataSink *, int count ) = 0
- void maybeReady ()
- virtual bool rewindable () const
- virtual void enableRewind ( bool on )
- virtual void rewind ()

## Detailed Description

This class is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

The TQDataSource class is an asynchronous producer of data.

A data source is an object which provides data from some source in an asynchronous manner. This means that at some time not determined by the data source, blocks of data will be taken from it for processing. The data source is able to limit the maximum size of such blocks which it is currently able to provide.

See also TQAsyncIO, TQDataSink, and TQDataPump.

## Member Function Documentation

### void TQDataSource::enableRewind ( bool on )`[virtual]`

If this function is called with on set to true, and rewindable() is true, then the data source must take measures to allow the rewind() function to subsequently operate as described. If rewindable() is false, the function should call TQDataSource::enableRewind(), which aborts with a tqFatal() error.

For example, a network connection may choose to use a disk cache of input only if rewinding is enabled before the first buffer-full of data is discarded, returning false in rewindable() if that first buffer is discarded.

Reimplemented in TQIODeviceSource.

### void TQDataSource::maybeReady ()

This should be called whenever readyToSend() might have become non-zero. It is merely calls TQAsyncIO::ready() if readyToSend() is non-zero.

### int TQDataSource::readyToSend ()`[pure virtual]`

The data source should return a value indicating how much data it is ready to provide. This may be 0. If the data source knows it will never be able to provide any more data (until after a rewind()), it may return -1.

Reimplemented in TQIODeviceSource.

### void TQDataSource::rewind ()`[virtual]`

This function rewinds the data source. This may only be called if enableRewind(true) has been previously called.

Reimplemented in TQIODeviceSource.

### bool TQDataSource::rewindable () const`[virtual]`

This function should return true if the data source can be rewound.

The default returns false.

Reimplemented in TQIODeviceSource.

### void TQDataSource::sendTo ( TQDataSink *, int count )`[pure virtual]`

This function is called to extract data from the source, by sending it to the given data sink. The count will be no more than the amount indicated by the most recent call to readyToSend(). The source must use all the provided data, and the sink will be prepared to accept at least this much data.

Reimplemented in TQIODeviceSource.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.