shooter/SFML-mingw32/doc/html/classsf_1_1InputStream.html

282 lines
17 KiB
HTML
Raw Normal View History

2021-10-09 13:41:12 +03:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SFML - Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html;"/>
<meta charset="utf-8"/>
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">SFML 2.5.1</span>
</div>
</div>
<div id="content">
<!-- Generated by Doxygen 1.8.14 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1InputStream.html">InputStream</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classsf_1_1InputStream-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">sf::InputStream Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span><div class="ingroups"><a class="el" href="group__system.html">System module</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Abstract class for custom file input streams.
<a href="classsf_1_1InputStream.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="InputStream_8hpp_source.html">InputStream.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for sf::InputStream:</div>
<div class="dyncontent">
<div class="center">
<img src="classsf_1_1InputStream.png" usemap="#sf::InputStream_map" alt=""/>
<map id="sf::InputStream_map" name="sf::InputStream_map">
<area href="classsf_1_1FileInputStream.html" title="Implementation of input stream based on a file. " alt="sf::FileInputStream" shape="rect" coords="0,56,140,80"/>
<area href="classsf_1_1MemoryInputStream.html" title="Implementation of input stream based on a memory chunk. " alt="sf::MemoryInputStream" shape="rect" coords="150,56,290,80"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a4b2eb0f92323e630bd0542bc6191682e"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputStream.html#a4b2eb0f92323e630bd0542bc6191682e">~InputStream</a> ()</td></tr>
<tr class="memdesc:a4b2eb0f92323e630bd0542bc6191682e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Virtual destructor. <a href="#a4b2eb0f92323e630bd0542bc6191682e">More...</a><br /></td></tr>
<tr class="separator:a4b2eb0f92323e630bd0542bc6191682e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8dd89c74c1acb693203f50e750c6ae53"><td class="memItemLeft" align="right" valign="top">virtual Int64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputStream.html#a8dd89c74c1acb693203f50e750c6ae53">read</a> (void *data, Int64 size)=0</td></tr>
<tr class="memdesc:a8dd89c74c1acb693203f50e750c6ae53"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read data from the stream. <a href="#a8dd89c74c1acb693203f50e750c6ae53">More...</a><br /></td></tr>
<tr class="separator:a8dd89c74c1acb693203f50e750c6ae53"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76aba8e5d5cf9b1c5902d5e04f7864fc"><td class="memItemLeft" align="right" valign="top">virtual Int64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputStream.html#a76aba8e5d5cf9b1c5902d5e04f7864fc">seek</a> (Int64 position)=0</td></tr>
<tr class="memdesc:a76aba8e5d5cf9b1c5902d5e04f7864fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the current reading position. <a href="#a76aba8e5d5cf9b1c5902d5e04f7864fc">More...</a><br /></td></tr>
<tr class="separator:a76aba8e5d5cf9b1c5902d5e04f7864fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a599515b9ccdbddb6fef5a98424fd559c"><td class="memItemLeft" align="right" valign="top">virtual Int64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputStream.html#a599515b9ccdbddb6fef5a98424fd559c">tell</a> ()=0</td></tr>
<tr class="memdesc:a599515b9ccdbddb6fef5a98424fd559c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the current reading position in the stream. <a href="#a599515b9ccdbddb6fef5a98424fd559c">More...</a><br /></td></tr>
<tr class="separator:a599515b9ccdbddb6fef5a98424fd559c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a311eaaaa65d636728e5153b574b72d5d"><td class="memItemLeft" align="right" valign="top">virtual Int64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputStream.html#a311eaaaa65d636728e5153b574b72d5d">getSize</a> ()=0</td></tr>
<tr class="memdesc:a311eaaaa65d636728e5153b574b72d5d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the size of the stream. <a href="#a311eaaaa65d636728e5153b574b72d5d">More...</a><br /></td></tr>
<tr class="separator:a311eaaaa65d636728e5153b574b72d5d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract class for custom file input streams. </p>
<p>This class allows users to define their own file input sources from which SFML can load resources.</p>
<p>SFML resource classes like <a class="el" href="classsf_1_1Texture.html" title="Image living on the graphics card that can be used for drawing. ">sf::Texture</a> and <a class="el" href="classsf_1_1SoundBuffer.html" title="Storage for audio samples defining a sound. ">sf::SoundBuffer</a> provide loadFromFile and loadFromMemory functions, which read data from conventional sources. However, if you have data coming from a different source (over a network, embedded, encrypted, compressed, etc) you can derive your own class from <a class="el" href="classsf_1_1InputStream.html" title="Abstract class for custom file input streams. ">sf::InputStream</a> and load SFML resources with their loadFromStream function.</p>
<p>Usage example: </p><div class="fragment"><div class="line"><span class="comment">// custom stream class that reads from inside a zip file</span></div><div class="line"><span class="keyword">class </span>ZipStream : <span class="keyword">public</span> <a class="code" href="classsf_1_1InputStream.html">sf::InputStream</a></div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"></div><div class="line"> ZipStream(std::string archive);</div><div class="line"></div><div class="line"> <span class="keywordtype">bool</span> open(std::string filename);</div><div class="line"></div><div class="line"> Int64 <a class="code" href="classsf_1_1InputStream.html#a8dd89c74c1acb693203f50e750c6ae53">read</a>(<span class="keywordtype">void</span>* data, Int64 size);</div><div class="line"></div><div class="line"> Int64 <a class="code" href="classsf_1_1InputStream.html#a76aba8e5d5cf9b1c5902d5e04f7864fc">seek</a>(Int64 position);</div><div class="line"></div><div class="line"> Int64 <a class="code" href="classsf_1_1InputStream.html#a599515b9ccdbddb6fef5a98424fd559c">tell</a>();</div><div class="line"></div><div class="line"> Int64 <a class="code" href="classsf_1_1InputStream.html#a311eaaaa65d636728e5153b574b72d5d">getSize</a>();</div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"></div><div class="line"> ...</div><div class="line">};</div><div class="line"></div><div class="line"><span class="comment">// now you can load textures...</span></div><div class="line"><a class="code" href="classsf_1_1Texture.html">sf::Texture</a> texture;</div><div class="line">ZipStream stream(<span class="stringliteral">&quot;resources.zip&quot;</span>);</div><div class="line">stream.open(<span class="stringliteral">&quot;images/img.png&quot;</span>);</div><div class="line">texture.<a class="code" href="classsf_1_1Texture.html#a786b486a46b1c6d1c16ff4af61ecc601">loadFromStream</a>(stream);</div><div class="line"></div><div class="line"><span class="comment">// musics...</span></div><div class="line"><a class="code" href="classsf_1_1Music.html">sf::Music</a> music;</div><div class="line">ZipStream stream(<span class="stringliteral">&quot;resources.zip&quot;</span>);</div><div class="line">stream.open(<span class="stringliteral">&quot;musics/msc.ogg&quot;</span>);</div><div class="line">music.<a class="code" href="classsf_1_1Music.html#a4e55d1910a26858b44778c26b237d673">openFromStream</a>(stream);</div><div class="line"></div><div class="line"><span class="comment">// etc.</span></div></div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="InputStream_8hpp_source.html#l00041">41</a> of file <a class="el" href="InputStream_8hpp_source.html">InputStream.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a4b2eb0f92323e630bd0542bc6191682e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4b2eb0f92323e630bd0542bc6191682e">&#9670;&nbsp;</a></span>~InputStream()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual sf::InputStream::~InputStream </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Virtual destructor. </p>
<p class="definition">Definition at line <a class="el" href="InputStream_8hpp_source.html#l00049">49</a> of file <a class="el" href="InputStream_8hpp_source.html">InputStream.hpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a311eaaaa65d636728e5153b574b72d5d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a311eaaaa65d636728e5153b574b72d5d">&#9670;&nbsp;</a></span>getSize()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual Int64 sf::InputStream::getSize </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the size of the stream. </p>
<dl class="section return"><dt>Returns</dt><dd>The total number of bytes available in the stream, or -1 on error </dd></dl>
<p>Implemented in <a class="el" href="classsf_1_1FileInputStream.html#aabdcaa315e088e008eeb9711ecc796e8">sf::FileInputStream</a>, and <a class="el" href="classsf_1_1MemoryInputStream.html#a6ade3ca45de361ffa0a718595f0b6763">sf::MemoryInputStream</a>.</p>
</div>
</div>
<a id="a8dd89c74c1acb693203f50e750c6ae53"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8dd89c74c1acb693203f50e750c6ae53">&#9670;&nbsp;</a></span>read()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual Int64 sf::InputStream::read </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Int64&#160;</td>
<td class="paramname"><em>size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Read data from the stream. </p>
<p>After reading, the stream's reading position must be advanced by the amount of bytes read.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>Buffer where to copy the read data </td></tr>
<tr><td class="paramname">size</td><td>Desired number of bytes to read</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes actually read, or -1 on error </dd></dl>
<p>Implemented in <a class="el" href="classsf_1_1FileInputStream.html#ad1e94c4152429f485db224c44ee1eb50">sf::FileInputStream</a>, and <a class="el" href="classsf_1_1MemoryInputStream.html#adff5270c521819639154d42d76fd4c34">sf::MemoryInputStream</a>.</p>
</div>
</div>
<a id="a76aba8e5d5cf9b1c5902d5e04f7864fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76aba8e5d5cf9b1c5902d5e04f7864fc">&#9670;&nbsp;</a></span>seek()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual Int64 sf::InputStream::seek </td>
<td>(</td>
<td class="paramtype">Int64&#160;</td>
<td class="paramname"><em>position</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the current reading position. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">position</td><td>The position to seek to, from the beginning</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The position actually sought to, or -1 on error </dd></dl>
<p>Implemented in <a class="el" href="classsf_1_1FileInputStream.html#abdaf5700d4e1de07568e7829106b4eb9">sf::FileInputStream</a>, and <a class="el" href="classsf_1_1MemoryInputStream.html#aa2ac8fda2bdb4c95248ae90c71633034">sf::MemoryInputStream</a>.</p>
</div>
</div>
<a id="a599515b9ccdbddb6fef5a98424fd559c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a599515b9ccdbddb6fef5a98424fd559c">&#9670;&nbsp;</a></span>tell()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual Int64 sf::InputStream::tell </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the current reading position in the stream. </p>
<dl class="section return"><dt>Returns</dt><dd>The current position, or -1 on error. </dd></dl>
<p>Implemented in <a class="el" href="classsf_1_1FileInputStream.html#a768c5fdb3be79e2d71d1bce911f8741c">sf::FileInputStream</a>, and <a class="el" href="classsf_1_1MemoryInputStream.html#a7ad4bdf721f29de8f66421ff29e23ee4">sf::MemoryInputStream</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="InputStream_8hpp_source.html">InputStream.hpp</a></li>
</ul>
</div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
Copyright &copy; Laurent Gomila &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
</div>
</div>
</body>
</html>