blob: c710d9570f32ae2524ec0a1231931904b8085de7 (
plain) (
tree)
|
|
<!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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>winapi_common: include/winapi/file.hpp Source File</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" />
</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">winapi_common
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @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&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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_f1714771db42b7b5a0cd2ebe6e9736ed.html">winapi</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">file.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com></span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// This file is part of the "winapi-common" project.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// For details, see https://github.com/egor-tensin/winapi-common.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// Distributed under the MIT License.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>  </div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  </div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include "handle.hpp"</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "path.hpp"</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>  </div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <boost/functional/hash.hpp></span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  </div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <windows.h></span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  </div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <cstddef></span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <functional></span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <string></span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <utility></span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  </div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="keyword">namespace </span>winapi {</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  </div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> FILE_ID_128& a, <span class="keyword">const</span> FILE_ID_128& b);</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  </div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="classwinapi_1_1File.html"> 29</a></span> <span class="keyword">class </span><a class="code" href="classwinapi_1_1File.html">File</a> : <span class="keyword">public</span> <a class="code" href="classwinapi_1_1Handle.html">Handle</a> {</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="keyword">public</span>:</div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structwinapi_1_1File_1_1ID.html"> 31</a></span>  <span class="keyword">struct </span><a class="code" href="structwinapi_1_1File_1_1ID.html">ID</a> {</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keyword">const</span> FILE_ID_INFO impl;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  </div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <a class="code" href="structwinapi_1_1File_1_1ID.html">ID</a>& other)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">return</span> impl.VolumeSerialNumber == other.impl.VolumeSerialNumber &&</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  impl.FileId == other.impl.FileId;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  }</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  };</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  </div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keyword">static</span> <a class="code" href="classwinapi_1_1File.html">File</a> <a class="code" href="classwinapi_1_1File.html#ad3bacd22beea28dcb0a0df846b5c4215">open_r</a>(<span class="keyword">const</span> std::string&);</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keyword">static</span> <a class="code" href="classwinapi_1_1File.html">File</a> <a class="code" href="classwinapi_1_1File.html#ad3bacd22beea28dcb0a0df846b5c4215">open_r</a>(<span class="keyword">const</span> <a class="code" href="classwinapi_1_1CanonicalPath.html">CanonicalPath</a>&);</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keyword">static</span> <a class="code" href="classwinapi_1_1File.html">File</a> <a class="code" href="classwinapi_1_1File.html#a7d7eeb56c9f33f6ec1814472c61e51f4">open_read_attributes</a>(<span class="keyword">const</span> std::string&);</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keyword">static</span> <a class="code" href="classwinapi_1_1File.html">File</a> <a class="code" href="classwinapi_1_1File.html#a7d7eeb56c9f33f6ec1814472c61e51f4">open_read_attributes</a>(<span class="keyword">const</span> <a class="code" href="classwinapi_1_1CanonicalPath.html">CanonicalPath</a>&);</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keyword">static</span> <a class="code" href="classwinapi_1_1File.html">File</a> <a class="code" href="classwinapi_1_1File.html#a36cda85b326592d7eadca5dc4a6b7981">open_w</a>(<span class="keyword">const</span> std::string&);</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keyword">static</span> <a class="code" href="classwinapi_1_1File.html">File</a> <a class="code" href="classwinapi_1_1File.html#a36cda85b326592d7eadca5dc4a6b7981">open_w</a>(<span class="keyword">const</span> <a class="code" href="classwinapi_1_1CanonicalPath.html">CanonicalPath</a>&);</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  </div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classwinapi_1_1File.html#a453828fe42006bc7b6e925c41d1e965e">remove</a>(<span class="keyword">const</span> std::string&);</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classwinapi_1_1File.html#a453828fe42006bc7b6e925c41d1e965e">remove</a>(<span class="keyword">const</span> <a class="code" href="classwinapi_1_1CanonicalPath.html">CanonicalPath</a>&);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  </div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classwinapi_1_1File.html#a4ae67aba44ba64654b888ace9b7dfb36"> 59</a></span>  <span class="keyword">explicit</span> <a class="code" href="classwinapi_1_1File.html#a4ae67aba44ba64654b888ace9b7dfb36">File</a>(<a class="code" href="classwinapi_1_1Handle.html">Handle</a>&& handle) : <a class="code" href="classwinapi_1_1Handle.html">Handle</a>{std::move(handle)} {}</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  std::size_t <a class="code" href="classwinapi_1_1File.html#ad3c43351e4c032caa78525fc15e64ca7">get_size</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  ID <a class="code" href="classwinapi_1_1File.html#aed36137d5b730166cfec4e0f8a5a6fdd">query_id</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> };</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  </div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> } <span class="comment">// namespace winapi</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="keyword">namespace </span>std {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  </div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">template</span> <></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="structstd_1_1hash_3_01winapi_1_1File_1_1ID_01_4.html"> 79</a></span> <span class="keyword">struct </span>hash<winapi::File::ID> {</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  std::size_t operator()(<span class="keyword">const</span> <a class="code" href="structwinapi_1_1File_1_1ID.html">winapi::File::ID</a>& <span class="keywordtype">id</span>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  std::size_t seed = 0;</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  boost::hash_combine(seed, <span class="keywordtype">id</span>.impl.VolumeSerialNumber);</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  boost::hash_combine(seed, <span class="keywordtype">id</span>.impl.FileId.Identifier);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">return</span> seed;</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  }</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> };</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  </div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> } <span class="comment">// namespace std</span></div>
<div class="ttc" id="aclasswinapi_1_1CanonicalPath_html"><div class="ttname"><a href="classwinapi_1_1CanonicalPath.html">winapi::CanonicalPath</a></div><div class="ttdoc">Absolute, canonical path.</div><div class="ttdef"><b>Definition:</b> <a href="path_8hpp_source.html#l00013">path.hpp:13</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html"><div class="ttname"><a href="classwinapi_1_1File.html">winapi::File</a></div><div class="ttdoc">File I/O.</div><div class="ttdef"><b>Definition:</b> <a href="file_8hpp_source.html#l00029">file.hpp:29</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_a36cda85b326592d7eadca5dc4a6b7981"><div class="ttname"><a href="classwinapi_1_1File.html#a36cda85b326592d7eadca5dc4a6b7981">winapi::File::open_w</a></div><div class="ttdeci">static File open_w(const std::string &)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00108">file.cpp:108</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_a453828fe42006bc7b6e925c41d1e965e"><div class="ttname"><a href="classwinapi_1_1File.html#a453828fe42006bc7b6e925c41d1e965e">winapi::File::remove</a></div><div class="ttdeci">static void remove(const std::string &)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00116">file.cpp:116</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_a4ae67aba44ba64654b888ace9b7dfb36"><div class="ttname"><a href="classwinapi_1_1File.html#a4ae67aba44ba64654b888ace9b7dfb36">winapi::File::File</a></div><div class="ttdeci">File(Handle &&handle)</div><div class="ttdef"><b>Definition:</b> <a href="file_8hpp_source.html#l00059">file.hpp:59</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_a7d7eeb56c9f33f6ec1814472c61e51f4"><div class="ttname"><a href="classwinapi_1_1File.html#a7d7eeb56c9f33f6ec1814472c61e51f4">winapi::File::open_read_attributes</a></div><div class="ttdeci">static File open_read_attributes(const std::string &)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00100">file.cpp:100</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_ad3bacd22beea28dcb0a0df846b5c4215"><div class="ttname"><a href="classwinapi_1_1File.html#ad3bacd22beea28dcb0a0df846b5c4215">winapi::File::open_r</a></div><div class="ttdeci">static File open_r(const std::string &)</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00092">file.cpp:92</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_ad3c43351e4c032caa78525fc15e64ca7"><div class="ttname"><a href="classwinapi_1_1File.html#ad3c43351e4c032caa78525fc15e64ca7">winapi::File::get_size</a></div><div class="ttdeci">std::size_t get_size() const</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00124">file.cpp:124</a></div></div>
<div class="ttc" id="aclasswinapi_1_1File_html_aed36137d5b730166cfec4e0f8a5a6fdd"><div class="ttname"><a href="classwinapi_1_1File.html#aed36137d5b730166cfec4e0f8a5a6fdd">winapi::File::query_id</a></div><div class="ttdeci">ID query_id() const</div><div class="ttdef"><b>Definition:</b> <a href="file_8cpp_source.html#l00139">file.cpp:139</a></div></div>
<div class="ttc" id="aclasswinapi_1_1Handle_html"><div class="ttname"><a href="classwinapi_1_1Handle.html">winapi::Handle</a></div><div class="ttdoc">HANDLE wrapper.</div><div class="ttdef"><b>Definition:</b> <a href="handle_8hpp_source.html#l00025">handle.hpp:25</a></div></div>
<div class="ttc" id="astructwinapi_1_1File_1_1ID_html"><div class="ttname"><a href="structwinapi_1_1File_1_1ID.html">winapi::File::ID</a></div><div class="ttdef"><b>Definition:</b> <a href="file_8hpp_source.html#l00031">file.hpp:31</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
|