blob: 546a4c177a6b649c124d4d6f9ef07b81c48f2116 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crashpad: crashpad::FileWriter Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="crashpad_doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Crashpad
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacecrashpad.html">crashpad</a></li><li class="navelem"><a class="el" href="classcrashpad_1_1FileWriter.html">FileWriter</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classcrashpad_1_1FileWriter-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">crashpad::FileWriter Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A file writer implementation that wraps traditional system file operations on files accessed through the filesystem.
<a href="classcrashpad_1_1FileWriter.html#details">More...</a></p>
<p><code>#include &quot;util/file/file_writer.h&quot;</code></p>
<div class="dynheader">
Inheritance diagram for crashpad::FileWriter:</div>
<div class="dyncontent">
<div class="center">
<img src="classcrashpad_1_1FileWriter.png" usemap="#crashpad::FileWriter_map" alt=""/>
<map id="crashpad::FileWriter_map" name="crashpad::FileWriter_map">
<area href="classcrashpad_1_1FileWriterInterface.html" title="An interface to write to files and other file-like objects with semantics matching the underlying pla..." alt="crashpad::FileWriterInterface" shape="rect" coords="0,56,182,80"/>
<area href="classcrashpad_1_1FileSeekerInterface.html" title="An interface to seek in files and other file-like objects with semantics matching the underlying plat..." alt="crashpad::FileSeekerInterface" shape="rect" coords="0,0,182,24"/>
</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:a6339ccd8d717911090ae0981bbbe2823"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileWriter.html#a6339ccd8d717911090ae0981bbbe2823">Open</a> (const base::FilePath &amp;path, <a class="el" href="namespacecrashpad.html#afa69b0967d9a6df659ff5d2a02ff3e51">FileWriteMode</a> write_mode, <a class="el" href="namespacecrashpad.html#a034ccc90eb0d1f587ee89275d822175d">FilePermissions</a> permissions)</td></tr>
<tr class="memdesc:a6339ccd8d717911090ae0981bbbe2823"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps <a class="el" href="namespacecrashpad.html#a62fc6876cc0c660f0ea8bd1dd0a07e82" title="Wraps OpenFileForWrite(), logging an error if the operation fails.">LoggingOpenFileForWrite()</a>. <a href="classcrashpad_1_1FileWriter.html#a6339ccd8d717911090ae0981bbbe2823">More...</a><br /></td></tr>
<tr class="separator:a6339ccd8d717911090ae0981bbbe2823"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab469a8fea3e50378b4125c049911b355"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileWriter.html#ab469a8fea3e50378b4125c049911b355">Close</a> ()</td></tr>
<tr class="memdesc:ab469a8fea3e50378b4125c049911b355"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps CheckedCloseHandle(). <a href="classcrashpad_1_1FileWriter.html#ab469a8fea3e50378b4125c049911b355">More...</a><br /></td></tr>
<tr class="separator:ab469a8fea3e50378b4125c049911b355"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88df535e600f9c9b57a44130de1d0eb0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileWriter.html#a88df535e600f9c9b57a44130de1d0eb0">Write</a> (const void *data, size_t size) override</td></tr>
<tr class="memdesc:a88df535e600f9c9b57a44130de1d0eb0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps <a class="el" href="namespacecrashpad.html#a8a91af9c690d2a280c463596bf82070b" title="Wraps WriteFile(), ensuring that exactly size bytes are written.">LoggingWriteFile()</a>, or provides an implementation with identical semantics. <a href="classcrashpad_1_1FileWriter.html#a88df535e600f9c9b57a44130de1d0eb0">More...</a><br /></td></tr>
<tr class="separator:a88df535e600f9c9b57a44130de1d0eb0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a841442d50f6edaacdfeafe859c42a876"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileWriter.html#a841442d50f6edaacdfeafe859c42a876">WriteIoVec</a> (std::vector&lt; <a class="el" href="structcrashpad_1_1WritableIoVec.html">WritableIoVec</a> &gt; *iovecs) override</td></tr>
<tr class="memdesc:a841442d50f6edaacdfeafe859c42a876"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps <code>writev()</code> on POSIX or provides an alternate implementation with identical semantics. This method will write entire buffers, continuing after a short write or after being interrupted. On non-POSIX this is a simple wrapper around <a class="el" href="classcrashpad_1_1FileWriter.html#a88df535e600f9c9b57a44130de1d0eb0" title="Wraps LoggingWriteFile(), or provides an implementation with identical semantics.">Write()</a>. <a href="classcrashpad_1_1FileWriter.html#a841442d50f6edaacdfeafe859c42a876">More...</a><br /></td></tr>
<tr class="separator:a841442d50f6edaacdfeafe859c42a876"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2dbaf9ac2c3f1802fea09843127d24e2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacecrashpad.html#a1e53a1957d9edcba8b406ea632b6daf2">FileOffset</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileWriter.html#a2dbaf9ac2c3f1802fea09843127d24e2">Seek</a> (<a class="el" href="namespacecrashpad.html#a1e53a1957d9edcba8b406ea632b6daf2">FileOffset</a> offset, int whence) override</td></tr>
<tr class="memdesc:a2dbaf9ac2c3f1802fea09843127d24e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps <a class="el" href="namespacecrashpad.html#a3d6cedc10e24145d4a0c1000c33f8a10" title="Wraps lseek() or SetFilePointerEx(). Logs an error if the operation fails.">LoggingSeekFile()</a> or provides an alternate implementation with identical semantics. <a href="classcrashpad_1_1FileWriter.html#a2dbaf9ac2c3f1802fea09843127d24e2">More...</a><br /></td></tr>
<tr class="separator:a2dbaf9ac2c3f1802fea09843127d24e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classcrashpad_1_1FileSeekerInterface"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcrashpad_1_1FileSeekerInterface')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classcrashpad_1_1FileSeekerInterface.html">crashpad::FileSeekerInterface</a></td></tr>
<tr class="memitem:a49a884bfb0a61461b0291c975aa15382 inherit pub_methods_classcrashpad_1_1FileSeekerInterface"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacecrashpad.html#a1e53a1957d9edcba8b406ea632b6daf2">FileOffset</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileSeekerInterface.html#a49a884bfb0a61461b0291c975aa15382">SeekGet</a> ()</td></tr>
<tr class="memdesc:a49a884bfb0a61461b0291c975aa15382 inherit pub_methods_classcrashpad_1_1FileSeekerInterface"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps <a class="el" href="classcrashpad_1_1FileSeekerInterface.html#a8d56f7d12dfcce3e4a39ad1524302aa1" title="Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics.">Seek()</a>, using <code>SEEK_CUR</code> to obtain the file’s current position. <a href="classcrashpad_1_1FileSeekerInterface.html#a49a884bfb0a61461b0291c975aa15382">More...</a><br /></td></tr>
<tr class="separator:a49a884bfb0a61461b0291c975aa15382 inherit pub_methods_classcrashpad_1_1FileSeekerInterface"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add2e1ee642d94c91ef722911e9aee250 inherit pub_methods_classcrashpad_1_1FileSeekerInterface"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1FileSeekerInterface.html#add2e1ee642d94c91ef722911e9aee250">SeekSet</a> (<a class="el" href="namespacecrashpad.html#a1e53a1957d9edcba8b406ea632b6daf2">FileOffset</a> offset)</td></tr>
<tr class="memdesc:add2e1ee642d94c91ef722911e9aee250 inherit pub_methods_classcrashpad_1_1FileSeekerInterface"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps <a class="el" href="classcrashpad_1_1FileSeekerInterface.html#a8d56f7d12dfcce3e4a39ad1524302aa1" title="Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics.">Seek()</a>, using <code>SEEK_SET</code>, ensuring that the seek succeeded and the file is positioned as desired. <a href="classcrashpad_1_1FileSeekerInterface.html#add2e1ee642d94c91ef722911e9aee250">More...</a><br /></td></tr>
<tr class="separator:add2e1ee642d94c91ef722911e9aee250 inherit pub_methods_classcrashpad_1_1FileSeekerInterface"><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>A file writer implementation that wraps traditional system file operations on files accessed through the filesystem. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="ab469a8fea3e50378b4125c049911b355"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab469a8fea3e50378b4125c049911b355">&#9670;&nbsp;</a></span>Close()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void crashpad::FileWriter::Close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps CheckedCloseHandle(). </p>
<dl class="section note"><dt>Note</dt><dd>It is only valid to call this method on an object that has had a successful <a class="el" href="classcrashpad_1_1FileWriter.html#a6339ccd8d717911090ae0981bbbe2823" title="Wraps LoggingOpenFileForWrite().">Open()</a> that has not yet been matched by a subsequent call to this method. </dd></dl>
</div>
</div>
<a id="a6339ccd8d717911090ae0981bbbe2823"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6339ccd8d717911090ae0981bbbe2823">&#9670;&nbsp;</a></span>Open()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool crashpad::FileWriter::Open </td>
<td>(</td>
<td class="paramtype">const base::FilePath &amp;&#160;</td>
<td class="paramname"><em>path</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespacecrashpad.html#afa69b0967d9a6df659ff5d2a02ff3e51">FileWriteMode</a>&#160;</td>
<td class="paramname"><em>write_mode</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespacecrashpad.html#a034ccc90eb0d1f587ee89275d822175d">FilePermissions</a>&#160;</td>
<td class="paramname"><em>permissions</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps <a class="el" href="namespacecrashpad.html#a62fc6876cc0c660f0ea8bd1dd0a07e82" title="Wraps OpenFileForWrite(), logging an error if the operation fails.">LoggingOpenFileForWrite()</a>. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the operation succeeded, <code>false</code> if it failed, with an error message logged.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>After a successful call, this method cannot be called again until after <a class="el" href="classcrashpad_1_1FileWriter.html#ab469a8fea3e50378b4125c049911b355" title="Wraps CheckedCloseHandle().">Close()</a>. </dd></dl>
</div>
</div>
<a id="a2dbaf9ac2c3f1802fea09843127d24e2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2dbaf9ac2c3f1802fea09843127d24e2">&#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"><a class="el" href="namespacecrashpad.html#a1e53a1957d9edcba8b406ea632b6daf2">FileOffset</a> crashpad::FileWriter::Seek </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespacecrashpad.html#a1e53a1957d9edcba8b406ea632b6daf2">FileOffset</a>&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>whence</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">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps <a class="el" href="namespacecrashpad.html#a3d6cedc10e24145d4a0c1000c33f8a10" title="Wraps lseek() or SetFilePointerEx(). Logs an error if the operation fails.">LoggingSeekFile()</a> or provides an alternate implementation with identical semantics. </p>
<dl class="section return"><dt>Returns</dt><dd>The return value of <a class="el" href="namespacecrashpad.html#a3d6cedc10e24145d4a0c1000c33f8a10" title="Wraps lseek() or SetFilePointerEx(). Logs an error if the operation fails.">LoggingSeekFile()</a>. <code>-1</code> on failure, with an error message logged.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>It is only valid to call this method between a successful <a class="el" href="classcrashpad_1_1FileWriter.html#a6339ccd8d717911090ae0981bbbe2823" title="Wraps LoggingOpenFileForWrite().">Open()</a> and a <a class="el" href="classcrashpad_1_1FileWriter.html#ab469a8fea3e50378b4125c049911b355" title="Wraps CheckedCloseHandle().">Close()</a>. </dd></dl>
<p>Implements <a class="el" href="classcrashpad_1_1FileSeekerInterface.html#a8d56f7d12dfcce3e4a39ad1524302aa1">crashpad::FileSeekerInterface</a>.</p>
</div>
</div>
<a id="a88df535e600f9c9b57a44130de1d0eb0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a88df535e600f9c9b57a44130de1d0eb0">&#9670;&nbsp;</a></span>Write()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool crashpad::FileWriter::Write </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#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">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps <a class="el" href="namespacecrashpad.html#a8a91af9c690d2a280c463596bf82070b" title="Wraps WriteFile(), ensuring that exactly size bytes are written.">LoggingWriteFile()</a>, or provides an implementation with identical semantics. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the operation succeeded, <code>false</code> if it failed, with an error message logged.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>It is only valid to call this method between a successful <a class="el" href="classcrashpad_1_1FileWriter.html#a6339ccd8d717911090ae0981bbbe2823" title="Wraps LoggingOpenFileForWrite().">Open()</a> and a <a class="el" href="classcrashpad_1_1FileWriter.html#ab469a8fea3e50378b4125c049911b355" title="Wraps CheckedCloseHandle().">Close()</a>. </dd></dl>
<p>Implements <a class="el" href="classcrashpad_1_1FileWriterInterface.html#a34e3a6edac09771c7746901b77acc5b1">crashpad::FileWriterInterface</a>.</p>
</div>
</div>
<a id="a841442d50f6edaacdfeafe859c42a876"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a841442d50f6edaacdfeafe859c42a876">&#9670;&nbsp;</a></span>WriteIoVec()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool crashpad::FileWriter::WriteIoVec </td>
<td>(</td>
<td class="paramtype">std::vector&lt; <a class="el" href="structcrashpad_1_1WritableIoVec.html">WritableIoVec</a> &gt; *&#160;</td>
<td class="paramname"><em>iovecs</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps <code>writev()</code> on POSIX or provides an alternate implementation with identical semantics. This method will write entire buffers, continuing after a short write or after being interrupted. On non-POSIX this is a simple wrapper around <a class="el" href="classcrashpad_1_1FileWriter.html#a88df535e600f9c9b57a44130de1d0eb0" title="Wraps LoggingWriteFile(), or provides an implementation with identical semantics.">Write()</a>. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the operation succeeded, <code>false</code> if it failed, with an error message logged.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The contents of <em>iovecs</em> are undefined when this method returns.</dd>
<dd>
It is only valid to call this method between a successful <a class="el" href="classcrashpad_1_1FileWriter.html#a6339ccd8d717911090ae0981bbbe2823" title="Wraps LoggingOpenFileForWrite().">Open()</a> and a <a class="el" href="classcrashpad_1_1FileWriter.html#ab469a8fea3e50378b4125c049911b355" title="Wraps CheckedCloseHandle().">Close()</a>. </dd></dl>
<p>Implements <a class="el" href="classcrashpad_1_1FileWriterInterface.html#a056d01fcfa12a49cff735cf4f63bc1ba">crashpad::FileWriterInterface</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>util/file/file_writer.h</li>
<li>util/file/file_writer.cc</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>