Files
entt/classentt_1_1HashedString.html
2018-07-10 16:37:27 +02:00

305 lines
15 KiB
HTML

<!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>
<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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>entt: entt::HashedString 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" />
</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">entt
&#160;<span id="projectnumber">2.7.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</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="namespaceentt.html">entt</a></li><li class="navelem"><a class="el" href="classentt_1_1HashedString.html">HashedString</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classentt_1_1HashedString-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">entt::HashedString Class Reference<span class="mlabels"><span class="mlabel">final</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>Zero overhead resource identifier.
<a href="classentt_1_1HashedString.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:af511100177b5e0213bf5b0efb3f4f528"><td class="memItemLeft" align="right" valign="top"><a id="af511100177b5e0213bf5b0efb3f4f528"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1HashedString.html#af511100177b5e0213bf5b0efb3f4f528">hash_type</a> = std::uint64_t</td></tr>
<tr class="memdesc:af511100177b5e0213bf5b0efb3f4f528"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unsigned integer type. <br /></td></tr>
<tr class="separator:af511100177b5e0213bf5b0efb3f4f528"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><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:af9ae25ce87c6183a71026d2c64501f98"><td class="memTemplParams" colspan="2">template&lt;std::size_t N&gt; </td></tr>
<tr class="memitem:af9ae25ce87c6183a71026d2c64501f98"><td class="memTemplItemLeft" align="right" valign="top">constexpr&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classentt_1_1HashedString.html#af9ae25ce87c6183a71026d2c64501f98">HashedString</a> (const char(&amp;str)[N]) ENTT_NOEXCEPT</td></tr>
<tr class="memdesc:af9ae25ce87c6183a71026d2c64501f98"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a hashed string from an array of const chars. <a href="#af9ae25ce87c6183a71026d2c64501f98">More...</a><br /></td></tr>
<tr class="separator:af9ae25ce87c6183a71026d2c64501f98"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56c7a79123eb7f0b63f0b0e218a111b9"><td class="memItemLeft" align="right" valign="top">constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1HashedString.html#a56c7a79123eb7f0b63f0b0e218a111b9">HashedString</a> (ConstCharWrapper wrapper) ENTT_NOEXCEPT</td></tr>
<tr class="memdesc:a56c7a79123eb7f0b63f0b0e218a111b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explicit constructor on purpose to avoid constructing a hashed string directly from a <code>const char *</code>. <a href="#a56c7a79123eb7f0b63f0b0e218a111b9">More...</a><br /></td></tr>
<tr class="separator:a56c7a79123eb7f0b63f0b0e218a111b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac93c062eb14c80be82bd75bb6e853be0"><td class="memItemLeft" align="right" valign="top">constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1HashedString.html#ac93c062eb14c80be82bd75bb6e853be0">operator const char *</a> () const ENTT_NOEXCEPT</td></tr>
<tr class="memdesc:ac93c062eb14c80be82bd75bb6e853be0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the human-readable representation of a hashed string. <a href="#ac93c062eb14c80be82bd75bb6e853be0">More...</a><br /></td></tr>
<tr class="separator:ac93c062eb14c80be82bd75bb6e853be0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47843deb0d550b5a6e1129a9b913d85f"><td class="memItemLeft" align="right" valign="top">constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1HashedString.html#a47843deb0d550b5a6e1129a9b913d85f">operator hash_type</a> () const ENTT_NOEXCEPT</td></tr>
<tr class="memdesc:a47843deb0d550b5a6e1129a9b913d85f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the numeric representation of a hashed string. <a href="#a47843deb0d550b5a6e1129a9b913d85f">More...</a><br /></td></tr>
<tr class="separator:a47843deb0d550b5a6e1129a9b913d85f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa5ca9b72d2fa65f2a4796a4ffae00c11"><td class="memItemLeft" align="right" valign="top">constexpr bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classentt_1_1HashedString.html#aa5ca9b72d2fa65f2a4796a4ffae00c11">operator==</a> (const <a class="el" href="classentt_1_1HashedString.html">HashedString</a> &amp;other) const ENTT_NOEXCEPT</td></tr>
<tr class="memdesc:aa5ca9b72d2fa65f2a4796a4ffae00c11"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compares two hashed strings. <a href="#aa5ca9b72d2fa65f2a4796a4ffae00c11">More...</a><br /></td></tr>
<tr class="separator:aa5ca9b72d2fa65f2a4796a4ffae00c11"><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>Zero overhead resource identifier. </p>
<p>A hashed string is a compile-time tool that allows users to use human-readable identifers in the codebase while using their numeric counterparts at runtime.<br />
Because of that, a hashed string can also be used in constant expressions if required. </p>
<p class="definition">Definition at line <a class="el" href="hashed__string_8hpp_source.html#l00022">22</a> of file <a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="af9ae25ce87c6183a71026d2c64501f98"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af9ae25ce87c6183a71026d2c64501f98">&#9670;&nbsp;</a></span>HashedString() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;std::size_t N&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr entt::HashedString::HashedString </td>
<td>(</td>
<td class="paramtype">const char(&amp;)&#160;</td>
<td class="paramname"><em>str</em>[N]</td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructs a hashed string from an array of const chars. </p>
<p>Forcing template resolution avoids implicit conversions. An human-readable identifier can be anything but a plain, old bunch of characters.<br />
Example of use: </p><div class="fragment"><div class="line"><a class="code" href="classentt_1_1HashedString.html#af9ae25ce87c6183a71026d2c64501f98">HashedString</a> sh{<span class="stringliteral">&quot;my.png&quot;</span>};</div></div><!-- fragment --><dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">N</td><td>Number of characters of the identifier. </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">str</td><td>Human-readable identifer. </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="hashed__string_8hpp_source.html#l00056">56</a> of file <a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>.</p>
</div>
</div>
<a id="a56c7a79123eb7f0b63f0b0e218a111b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a56c7a79123eb7f0b63f0b0e218a111b9">&#9670;&nbsp;</a></span>HashedString() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr entt::HashedString::HashedString </td>
<td>(</td>
<td class="paramtype">ConstCharWrapper&#160;</td>
<td class="paramname"><em>wrapper</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Explicit constructor on purpose to avoid constructing a hashed string directly from a <code>const char *</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">wrapper</td><td>Helps achieving the purpose by relying on overloading. </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="hashed__string_8hpp_source.html#l00066">66</a> of file <a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ac93c062eb14c80be82bd75bb6e853be0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac93c062eb14c80be82bd75bb6e853be0">&#9670;&nbsp;</a></span>operator const char *()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr entt::HashedString::operator const char * </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the human-readable representation of a hashed string. </p>
<dl class="section return"><dt>Returns</dt><dd>The string used to initialize the instance. </dd></dl>
<p class="definition">Definition at line <a class="el" href="hashed__string_8hpp_source.html#l00074">74</a> of file <a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>.</p>
</div>
</div>
<a id="a47843deb0d550b5a6e1129a9b913d85f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a47843deb0d550b5a6e1129a9b913d85f">&#9670;&nbsp;</a></span>operator hash_type()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr entt::HashedString::operator <a class="el" href="classentt_1_1HashedString.html#af511100177b5e0213bf5b0efb3f4f528">hash_type</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the numeric representation of a hashed string. </p>
<dl class="section return"><dt>Returns</dt><dd>The numeric representation of the instance. </dd></dl>
<p class="definition">Definition at line <a class="el" href="hashed__string_8hpp_source.html#l00080">80</a> of file <a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>.</p>
</div>
</div>
<a id="aa5ca9b72d2fa65f2a4796a4ffae00c11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5ca9b72d2fa65f2a4796a4ffae00c11">&#9670;&nbsp;</a></span>operator==()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr bool entt::HashedString::operator== </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classentt_1_1HashedString.html">HashedString</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Compares two hashed strings. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">other</td><td>Hashed string with which to compare. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if the two hashed strings are identical, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="hashed__string_8hpp_source.html#l00087">87</a> of file <a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/entt/core/<a class="el" href="hashed__string_8hpp_source.html">hashed_string.hpp</a></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.13
</small></address>
</body>
</html>