Imported Upstream version 1.2
[platform/upstream/alure.git] / docs / html / files / istream-cpp.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
2
3 <html><head><title>File I/O - ALURE</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
4 if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
5
6 <!--  Generated by Natural Docs, version 1.4 -->
7 <!--  http://www.naturaldocs.org  -->
8
9 <!-- saved from url=(0026)http://www.naturaldocs.org -->
10
11
12
13
14 <div id=Content><div class="CSection"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="File_I/O"></a>File I/<wbr>O</h1><div class=CBody><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#File_I/O" >File I/<wbr>O</a></td><td class=SDescription></td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#alureSetIOCallbacks" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">alureSetIOCallbacks</a></td><td class=SDescription>Provides callbacks for alternative methods to handle file I/O. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
15
16 <div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Functions"></a>Functions</h3></div></div>
17
18 <div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="alureSetIOCallbacks"></a>alureSetIOCallbacks</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters colspan=4>ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>void&nbsp;</td><td class=PParameterPrefix nowrap>*</td><td class=PParameter nowrap width=100%>(*open)(const char *filename, ALuint mode),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>void&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*close)(void *handle),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>ALsizei&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*read)(void *handle, ALubyte *buf, ALuint bytes),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>ALsizei&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*write)(void *handle, const ALubyte *buf, ALuint bytes),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>alureInt64&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*seek)(void *handle, alureInt64 offset, int whence)</td></tr><tr><td class=PAfterParameters colspan=4>)</td></tr></table></td></tr></table></blockquote><p>Provides callbacks for alternative methods to handle file I/O.&nbsp; Passing NULL for all callbacks is a valid way to revert to normal I/O, otherwise they must all be specified.&nbsp; Changing the callbacks will not affect open files (they will continue using the callbacks that were set at the time they were opened).</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>open</td><td class=CDLDescription>This callback is called to open the named file.&nbsp; The given mode is the access rights the open file should have.&nbsp; Currently, this will always be 0 for read-only (applications should check this to make sure, as future versions may pass other values for other modes).&nbsp; Upon success, a non-NULL handle must be returned which will be used as a unique identifier for the file.</td></tr><tr><td class=CDLEntry>close</td><td class=CDLDescription>This callback is called to close an opened file handle.&nbsp; The handle will no longer be used after this function.</td></tr><tr><td class=CDLEntry>read</td><td class=CDLDescription>This callback is called when data needs to be read from the given handle.&nbsp; Up to the given number of bytes should be copied into &lsquo;buf&rsquo; and the number of bytes actually copied should be returned.&nbsp; Returning 0 means the end of the file has been reached (so non-blocking I/O methods should ensure at least 1 byte gets read), and negative indicates an error.</td></tr><tr><td class=CDLEntry>write</td><td class=CDLDescription>This callback is called when data needs to be written to the given handle.&nbsp; Up to the given number of bytes should be copied from &lsquo;buf&rsquo; and the number of bytes actually copied should be returned.&nbsp; A return value of 0 means no more data can be written (so non-blocking I/O methods should ensure at least 1 byte gets written), and negative indicates an error.</td></tr><tr><td class=CDLEntry>seek</td><td class=CDLDescription>This callback is called to reposition the offset of the file handle.&nbsp; The given offset is interpreted according to &lsquo;whence&rsquo;, which may be SEEK_SET (absolute position from the start of the file), SEEK_CUR (relative position from the current offset), or SEEK_END (absolute position from the end of the file), as defined by standard C.&nbsp; The new offset from the beginning of the file should be returned.&nbsp; If the file cannot seek, such as when using a FIFO, -1 should be returned.</td></tr></table><h4 class=CHeading>Returns</h4><p>AL_FALSE on error.</p><p><b>Version Added</b>: 1.1</p></div></div></div>
19
20 </div><!--Content-->
21
22
23 <div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
24
25
26 <div id=Menu><div class=MTitle>ALURE<div class=MSubTitle>API Reference</div></div><div class=MEntry><div class=MFile><a href="alure-cpp.html">Main and Miscellanious</a></div></div><div class=MEntry><div class=MFile><a href="buffer-cpp.html">File Loading</a></div></div><div class=MEntry><div class=MFile><a href="stream-cpp.html">Streaming</a></div></div><div class=MEntry><div class=MFile id=MSelected>File I/<wbr>O</div></div><div class=MEntry><div class=MFile><a href="streamplay-cpp.html">Automatic Playback</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div></div></div></div><script type="text/javascript"><!--
27 var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
28 --></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option  id=MSearchEverything selected value="General">Everything</option><option value="Functions">Functions</option></select></div></div><!--Menu-->
29
30
31
32 <!--START_ND_TOOLTIPS-->
33 <div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters colspan=4>ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>void&nbsp;</td><td class=PParameterPrefix nowrap>*</td><td class=PParameter nowrap width=100%>(*open)(const char *filename, ALuint mode),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>void&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*close)(void *handle),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>ALsizei&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*read)(void *handle, ALubyte *buf, ALuint bytes),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>ALsizei&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*write)(void *handle, const ALubyte *buf, ALuint bytes),</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class=PType nowrap>alureInt64&nbsp;</td><td class=PParameterPrefix nowrap></td><td class=PParameter nowrap width=100%>(*seek)(void *handle, alureInt64 offset, int whence)</td></tr><tr><td class=PAfterParameters colspan=4>)</td></tr></table></td></tr></table></blockquote>Provides callbacks for alternative methods to handle file I/O. </div></div><!--END_ND_TOOLTIPS-->
34
35
36
37
38 <div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
39
40
41 <script language=JavaScript><!--
42 if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>