1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QDataSource Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QDataSource Class Reference</h1><br clear="all">
<p>
The QDataSource class is an asynchronous producer of data.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qasyncio-h.html">qasyncio.h</a>></code>
<p>
Inherits <a href="qasyncio.html">QAsyncIO</a>.
<p>Inherited by <a href="qiodevicesource.html">QIODeviceSource</a>.
<p><a href="qdatasource-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn">virtualint<a href="#1e015e"><b>readyToSend</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#f9b57b"><b>sendTo</b></a>(QDataSink*, intcount)</div>
<li><div class="fn">void<a href="#88292d"><b>maybeReady</b></a>()</div>
<li><div class="fn">virtualbool<a href="#121cd0"><b>rewindable</b></a>()const</div>
<li><div class="fn">virtualvoid<a href="#70ae9e"><b>enableRewind</b></a>(bool)</div>
<li><div class="fn">virtualvoid<a href="#9061dd"><b>rewind</b></a>()</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QDataSource class is an asynchronous producer of data.
<p>
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.
<p>See also <a href="qasyncio.html">QAsyncIO</a>, <a href="qdatasink.html">QDataSink</a> and <a href="qdatapump.html">QDataPump</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn">void<a name="70ae9e"></a>QDataSource::enableRewind(bool) <code>[virtual]</code></h3>
<p>If this function is called with <em>on</em> set to TRUE, and <a href="#121cd0">rewindable</a>()
is TRUE, then the data source must take measures to allow the <a href="#9061dd">rewind</a>()
function to subsequently operate as described. If rewindable() is FALSE,
the function should call QDataSource::enableRewind(), which aborts with
a <a href="qapplication.html#0e1d68">qFatal</a>() error.
<p>For example, a network connection may choose to utilize 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.
<p>Reimplemented in <a href="qiodevicesource.html#22bde1">QIODeviceSource</a>.
<h3 class="fn">void<a name="88292d"></a>QDataSource::maybeReady()</h3>
<p>This should be called whenever <a href="#1e015e">readyToSend</a>() might have become non-zero.
It is merely calls <a href="qasyncio.html#ba677b">QAsyncIO::ready</a>() if readyToSend() is non-zero.
<h3 class="fn">int<a name="1e015e"></a>QDataSource::readyToSend() <code>[virtual]</code></h3>
<p>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 <a href="#9061dd">rewind</a>()), it may return -1.
<p>Reimplemented in <a href="qiodevicesource.html#2e58fe">QIODeviceSource</a>.
<h3 class="fn">void<a name="9061dd"></a>QDataSource::rewind() <code>[virtual]</code></h3>
<p>This function rewinds the data source. This may only be called if
<a href="#70ae9e">enableRewind</a>(TRUE) has been previously called.
<p>Reimplemented in <a href="qiodevicesource.html#4e70f1">QIODeviceSource</a>.
<h3 class="fn">bool<a name="121cd0"></a>QDataSource::rewindable()const <code>[virtual]</code></h3>
<p>This function should return TRUE if the data source can be rewound.
<p>The default returns FALSE.
<p>Reimplemented in <a href="qiodevicesource.html#9e4680">QIODeviceSource</a>.
<h3 class="fn">void<a name="f9b57b"></a>QDataSource::sendTo(<a href="qdatasink.html">QDataSink</a>*, intcount) <code>[virtual]</code></h3>
<p>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 <a href="#1e015e">readyToSend</a>(). The source must
use all the provided data, and the sink will be prepared to accept at
least this much data.
<p>Reimplemented in <a href="qiodevicesource.html#bb20f1">QIODeviceSource</a>.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|