返回介绍

QDataSource Class

发布于 2019-10-04 14:59:20 字数 3228 浏览 1106 评论 0 收藏 0

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

#include <qasyncio.h>

Inherits QAsyncIO.

Inherited by QIODeviceSource.

List of all member functions.

Public Members

  • virtual int readyToSend () = 0
  • virtual void sendTo ( QDataSink *, intcount ) = 0
  • void maybeReady ()
  • virtual bool rewindable () const
  • virtual void enableRewind ( boolon )
  • 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 QDataSource 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 QAsyncIO, QDataSink and QDataPump.


Member Function Documentation

void QDataSource::enableRewind ( boolon ) [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 QDataSource::enableRewind(), which aborts with a qFatal() 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 QIODeviceSource.

void QDataSource::maybeReady ()

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

int QDataSource::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 QIODeviceSource.

void QDataSource::rewind () [virtual]

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

Reimplemented in QIODeviceSource.

bool QDataSource::rewindable () const [virtual]

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

The default returns FALSE.

Reimplemented in QIODeviceSource.

void QDataSource::sendTo ( QDataSink*, intcount ) [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 QIODeviceSource.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文