77 lines
15 KiB
HTML
77 lines
15 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Support Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheSupportKit.html" title="The Support Kit" /><link rel="prev" href="BMemoryIO.html" title="BMemoryIO" /><link rel="next" href="BStopWatch.html" title="BStopWatch" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BMemoryIO.html" title="BMemoryIO"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheSupportKit.html" title="The Support Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BStopWatch.html" title="BStopWatch"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Support Kit</div></div><div id="headerB">Prev: <a href="BMemoryIO.html">BMemoryIO</a> Up: <a href="TheSupportKit.html">The Support Kit</a> Next: <a href="BStopWatch.html">BStopWatch</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO"></a>BPositionIO</h2></div></div></div><a id="id1273753" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td>
|
||
<a class="link" href="BDataIO.html" title="BDataIO"><code class="classname">BDataIO</code></a>
|
||
</td></tr><tr><td>Mix-in Classes:</td><td>–</td></tr><tr><td>Declared In:</td><td><code class="filename">support/DataIO.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td>–</td></tr></tbody></table></td><td>
|
||
<a class="link overview" href="BPositionIO_Overview.html" title="BPositionIO">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BPositionIO.html#BPositionIO_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BPositionIO.html#BPositionIO_MemberFunctions">Member Functions</a></span></li></ul></div>
|
||
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_Constructor"></a>BPositionIO()</h4></div></div></div><code class="constructorsynopsis cpp"><span class="methodname">BPositionIO</span>();</code><p>
|
||
Does nothing. Constructors in derived classes should initialize the
|
||
object to default values—for example, set the current position to
|
||
the beginning of the data.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_Destructor"></a>~BPositionIO()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BPositionIO</span>();</code><p>
|
||
Does nothing.
|
||
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_Read"></a><a id="BPositionIO_ReadAt"></a>
|
||
Read(), ReadAt()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">ssize_t </span><span class="methodname">Read</span>(<span class="methodparam"><span class="type">void* </span><span class="parameter">buffer</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">numBytes</span></span>);</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">ssize_t </span><span class="methodname">ReadAt</span>(<span class="methodparam"><span class="type">off_t </span><span class="parameter">position</span></span>,<br /> <span class="methodparam"><span class="type">void* </span><span class="parameter">buffer</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">numBytes</span></span>) <span class="modifier">= 0</span>;</code><p>
|
||
<code class="methodname">Read()</code> copies <code class="parameter">numBytes</code> bytes
|
||
of data from the object to the <code class="parameter">buffer</code>. It
|
||
returns the number of bytes actually read (which may be 0) or an error
|
||
code if something goes wrong. <code class="methodname">Read()</code> is implemented using
|
||
<a class="link" href="BPositionIO.html#BPositionIO_Seek" title="Seek(), Position()"><code class="methodname">Seek()</code></a>,
|
||
<code class="methodname">ReadAt()</code>,
|
||
and <a class="link" href="BPositionIO.html#BPositionIO_Position"><code class="methodname">Position()</code></a>,
|
||
all of which are pure virtual functions.
|
||
</p><p>
|
||
<code class="methodname">ReadAt()</code> is a pure virtual that must be implemented by derived classes to
|
||
read <code class="parameter">numBytes</code> bytes of data beginning at <code class="parameter">position</code>
|
||
in the data source, and
|
||
to place them in the <code class="parameter">buffer</code>. It should return the number of bytes
|
||
actually read, or an error code if something goes wrong.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_Seek"></a><a id="BPositionIO_Position"></a>
|
||
Seek(), Position()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">off_t </span><span class="methodname">Seek</span>(<span class="methodparam"><span class="type">off_t </span><span class="parameter">position</span></span>,<br /> <span class="methodparam"><span class="type">int32 </span><span class="parameter">mode</span></span>) <span class="modifier">= 0</span>;</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">off_t </span><span class="methodname">Position</span>() <span class="modifier">const = 0</span>;</code><p>
|
||
<code class="methodname">Seek()</code> is implemented by derived classes to modify the current position
|
||
maintained by the object. The current position is an offset in bytes from
|
||
the beginning of the object's data. How the <code class="parameter">position</code> argument is
|
||
interpreted will depend on the <code class="parameter">mode</code> flag. Three possible modes should be
|
||
supported:
|
||
</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">SEEK_SET</code>.</span></p></td><td><p>The <code class="parameter">position</code> passed is an offset from the beginning of
|
||
allocated memory; in other words, the current position should be set to
|
||
<code class="parameter">position</code>.</p></td></tr><tr><td><p><span class="term"><code class="constant">SEEK_CUR</code>.</span></p></td><td><p>The <code class="parameter">position</code> argument is an offset from the current
|
||
position; the current position should be incremented by <code class="parameter">position</code>.</p></td></tr><tr><td><p><span class="term"><code class="constant">SEEK_END</code>.</span></p></td><td><p>The <code class="parameter">position</code> argument is an offset from the end of the
|
||
data; the current position should be the sum of <code class="parameter">position</code> plus the
|
||
number of bytes in the data.</p></td></tr></tbody></table><p>
|
||
For the <code class="constant">SEEK_SET</code> mode, <code class="parameter">position</code> should be a positive value. The other
|
||
modes permit negative offsets.
|
||
</p><p>
|
||
<code class="methodname">Seek()</code> should return the new position.
|
||
</p><p>
|
||
<code class="methodname">Position()</code> should return the current position.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_SetSize"></a>SetSize()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">SetSize</span>(<span class="methodparam"><span class="type">off_t </span><span class="parameter">numBytes</span></span>);</code><p>
|
||
Returns <code class="constant">B_ERROR</code> to indicate that, in general,
|
||
<code class="classname">BPositionIO</code> objects can't
|
||
set the amount of memory in the repositories they represent. However, the
|
||
<a class="link" href="BMallocIO.html" title="BMallocIO"><code class="classname">BMallocIO</code></a> class in this kit and
|
||
<a class="link" href="BFile.html" title="BFile"><code class="classname">BFile</code></a> in the
|
||
<a class="link" href="TheStorageKit.html" title="The Storage Kit">Storage Kit</a> implement
|
||
<code class="methodname">SetSize()</code> functions that override this default.
|
||
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPositionIO_Write"></a><a id="BPositionIO_WriteAt"></a>
|
||
Write(), WriteAt()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">ssize_t </span><span class="methodname">Write</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">void* </span><span class="parameter">buffer</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">numBytes</span></span>);</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">ssize_t </span><span class="methodname">WriteAt</span>(<span class="methodparam"><span class="type">off_t </span><span class="parameter">position</span></span>,<br /> <span class="methodparam"><span class="modifier">const </span><span class="type">void* </span><span class="parameter">buffer</span></span>,<br /> <span class="methodparam"><span class="type">size_t </span><span class="parameter">numBytes</span></span>) <span class="modifier">= 0</span>;</code><p>
|
||
<code class="methodname">Write()</code> copies <code class="parameter">numBytes</code>
|
||
bytes of data from the object into the <code class="parameter">buffer</code>. It
|
||
returns the number of bytes actually written (which may be 0) or an error
|
||
code if something goes wrong. <code class="methodname">Write()</code> is implemented using
|
||
<a class="link" href="BPositionIO.html#BPositionIO_Seek" title="Seek(), Position()"><code class="methodname">Seek()</code></a>,
|
||
<a class="link" href="BPositionIO.html#BPositionIO_Position"><code class="methodname">Position()</code></a>,
|
||
and <code class="methodname">WriteAt()</code>, all of which are pure virtual functions.
|
||
</p><p>
|
||
<code class="methodname">WriteAt()</code> is a pure virtual that must be implemented by derived classes
|
||
to copy <code class="parameter">numBytes</code> bytes of data from <code class="parameter">buffer</code>
|
||
and write them into the
|
||
object, starting at byte <code class="parameter">position</code> within the object. It should return the
|
||
number of bytes actually read, or an error code if something goes wrong.
|
||
</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BMemoryIO.html">BMemoryIO</a> Up: <a href="TheSupportKit.html">The Support Kit</a> Next: <a href="BStopWatch.html">BStopWatch</a> </div><div id="footerB"><div id="footerBL"><a href="BMemoryIO.html" title="BMemoryIO"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheSupportKit.html" title="The Support Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BStopWatch.html" title="BStopWatch"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|