Files
entt/resolve_8hpp_source.html
2024-10-23 15:07:48 +02:00

178 lines
21 KiB
HTML

<!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" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EnTT: src/entt/meta/resolve.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>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.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-awesome.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 id="projectrow">
<td id="projectalign">
<div id="projectname">EnTT<span id="projectnumber">&#160;3.14.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_66e9674e8206a335795995fa32a03c91.html">entt</a></li><li class="navelem"><a class="el" href="dir_c5715f7ee899854a669b87bbaa642de0.html">meta</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">resolve.hpp</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="preprocessor">#ifndef ENTT_META_RESOLVE_HPP</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="preprocessor">#define ENTT_META_RESOLVE_HPP</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="preprocessor">#include &lt;type_traits&gt;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include &quot;../core/type_info.hpp&quot;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include &quot;../locator/locator.hpp&quot;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#include &quot;context.hpp&quot;</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include &quot;meta.hpp&quot;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include &quot;node.hpp&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include &quot;range.hpp&quot;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespaceentt.html">entt</a> {</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type&gt;</div>
<div class="foldopen" id="foldopen00021" data-start="{" data-end="}">
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="namespaceentt.html#ad86fb3538f9ba64b4695cf45c020458e"> 21</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<span class="keyword">const</span> <a class="code hl_class" href="classentt_1_1meta__ctx.html">meta_ctx</a> &amp;ctx) <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">auto</span> &amp;&amp;context = internal::meta_context::from(ctx);</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">return</span> {ctx, internal::resolve&lt;std::remove_cv_t&lt;std::remove_reference_t&lt;Type&gt;&gt;&gt;(context)};</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span>}</div>
</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="keyword">template</span>&lt;<span class="keyword">typename</span> Type&gt;</div>
<div class="foldopen" id="foldopen00032" data-start="{" data-end="}">
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea"> 32</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>() <a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">noexcept</a> {</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">resolve&lt;Type&gt;</a>(<a class="code hl_class" href="classentt_1_1locator.html">locator&lt;meta_ctx&gt;::value_or</a>());</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>}</div>
</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="foldopen" id="foldopen00041" data-start="{" data-end="}">
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"><a class="line" href="namespaceentt.html#a894939ee94a38b6843a8d29ab770f36a"> 41</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <span class="keyword">inline</span> <a class="code hl_struct" href="structentt_1_1iterable__adaptor.html">meta_range</a>&lt;<a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a>, <span class="keyword">typename</span> <span class="keyword">decltype</span>(internal::meta_context::value)::const_iterator&gt; <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<span class="keyword">const</span> <a class="code hl_class" href="classentt_1_1meta__ctx.html">meta_ctx</a> &amp;ctx) <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keyword">auto</span> &amp;&amp;context = internal::meta_context::from(ctx);</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">return</span> {{ctx, context.value.cbegin()}, {ctx, context.value.cend()}};</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span>}</div>
</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
<div class="foldopen" id="foldopen00050" data-start="{" data-end="}">
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="namespaceentt.html#a1a1cf09707283197b9914fa8520e7592"> 50</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <span class="keyword">inline</span> <a class="code hl_struct" href="structentt_1_1iterable__adaptor.html">meta_range</a>&lt;<a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a>, <span class="keyword">typename</span> <span class="keyword">decltype</span>(internal::meta_context::value)::const_iterator&gt; <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>() <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<a class="code hl_class" href="classentt_1_1locator.html">locator&lt;meta_ctx&gt;::value_or</a>());</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span>}</div>
</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="foldopen" id="foldopen00060" data-start="{" data-end="}">
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"><a class="line" href="namespaceentt.html#a669729b83f4e0e2433cbf2a881745e22"> 60</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <span class="keyword">inline</span> <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<span class="keyword">const</span> <a class="code hl_class" href="classentt_1_1meta__ctx.html">meta_ctx</a> &amp;ctx, <span class="keyword">const</span> <a class="code hl_typedef" href="namespaceentt.html#a7f3ac95ffe482bbd1a70b624ef8bb641">id_type</a> <span class="keywordtype">id</span>) <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordflow">for</span>(<span class="keyword">auto</span> &amp;&amp;<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">curr</a>: <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(ctx)) {</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordflow">if</span>(<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">curr</a>.second.id() == id) {</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">curr</a>.second;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> }</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> }</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">return</span> <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a>{};</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span>}</div>
</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="foldopen" id="foldopen00075" data-start="{" data-end="}">
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"><a class="line" href="namespaceentt.html#a4493a8ed8dc4bc71b11058973c0fd9aa"> 75</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <span class="keyword">inline</span> <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<span class="keyword">const</span> <a class="code hl_typedef" href="namespaceentt.html#a7f3ac95ffe482bbd1a70b624ef8bb641">id_type</a> <span class="keywordtype">id</span>) <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<a class="code hl_class" href="classentt_1_1locator.html">locator&lt;meta_ctx&gt;::value_or</a>(), <span class="keywordtype">id</span>);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span>}</div>
</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="foldopen" id="foldopen00085" data-start="{" data-end="}">
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"><a class="line" href="namespaceentt.html#a7072f59c8738e44792806ab65c693032"> 85</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <span class="keyword">inline</span> <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<span class="keyword">const</span> <a class="code hl_class" href="classentt_1_1meta__ctx.html">meta_ctx</a> &amp;ctx, <span class="keyword">const</span> <a class="code hl_struct" href="structentt_1_1type__info.html">type_info</a> &amp;info) <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keyword">auto</span> &amp;&amp;context = internal::meta_context::from(ctx);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keyword">const</span> <span class="keyword">auto</span> *<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">elem</a> = internal::try_resolve(context, info);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="keywordflow">return</span> (<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">elem</a> != <span class="keyword">nullptr</span>) ? <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a>{ctx, *<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">elem</a>} : <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a>{};</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>}</div>
</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="foldopen" id="foldopen00096" data-start="{" data-end="}">
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"><a class="line" href="namespaceentt.html#a28dcce4d98f6a27c4c61e814466900b2"> 96</a></span>[[<a class="code hl_function" href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">nodiscard</a>]] <span class="keyword">inline</span> <a class="code hl_class" href="classentt_1_1meta__type.html">meta_type</a> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<span class="keyword">const</span> <a class="code hl_struct" href="structentt_1_1type__info.html">type_info</a> &amp;info) <span class="keyword">noexcept</span> {</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordflow">return</span> <a class="code hl_function" href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">resolve</a>(<a class="code hl_class" href="classentt_1_1locator.html">locator&lt;meta_ctx&gt;::value_or</a>(), info);</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span>}</div>
</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> </div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span>} <span class="comment">// namespace entt</span></div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclassentt_1_1locator_html"><div class="ttname"><a href="classentt_1_1locator.html">entt::locator</a></div><div class="ttdoc">Service locator, nothing more.</div><div class="ttdef"><b>Definition</b> <a href="locator_8hpp_source.html#l00027">locator.hpp:27</a></div></div>
<div class="ttc" id="aclassentt_1_1meta__ctx_html"><div class="ttname"><a href="classentt_1_1meta__ctx.html">entt::meta_ctx</a></div><div class="ttdoc">Opaque meta context type.</div><div class="ttdef"><b>Definition</b> <a href="context_8hpp_source.html#l00034">context.hpp:34</a></div></div>
<div class="ttc" id="aclassentt_1_1meta__type_html"><div class="ttname"><a href="classentt_1_1meta__type.html">entt::meta_type</a></div><div class="ttdoc">Opaque wrapper for types.</div><div class="ttdef"><b>Definition</b> <a href="meta_8hpp_source.html#l01153">meta.hpp:1153</a></div></div>
<div class="ttc" id="anamespaceentt_html"><div class="ttname"><a href="namespaceentt.html">entt</a></div><div class="ttdoc">EnTT default namespace.</div><div class="ttdef"><b>Definition</b> <a href="dense__map_8hpp_source.html#l00022">dense_map.hpp:22</a></div></div>
<div class="ttc" id="anamespaceentt_html_a12e4d0c58f9c4cc6f5513c39c530b9b7"><div class="ttname"><a href="namespaceentt.html#a12e4d0c58f9c4cc6f5513c39c530b9b7">entt::make_obj_using_allocator</a></div><div class="ttdeci">constexpr Type make_obj_using_allocator(const Allocator &amp;allocator, Args &amp;&amp;...args)</div><div class="ttdoc">Uses-allocator construction utility (waiting for C++20).</div><div class="ttdef"><b>Definition</b> <a href="memory_8hpp_source.html#l00219">memory.hpp:219</a></div></div>
<div class="ttc" id="anamespaceentt_html_a7f3ac95ffe482bbd1a70b624ef8bb641"><div class="ttname"><a href="namespaceentt.html#a7f3ac95ffe482bbd1a70b624ef8bb641">entt::id_type</a></div><div class="ttdeci">std::uint32_t id_type</div><div class="ttdoc">Alias declaration for type identifiers.</div><div class="ttdef"><b>Definition</b> <a href="core_2fwd_8hpp_source.html#l00014">fwd.hpp:14</a></div></div>
<div class="ttc" id="anamespaceentt_html_a9dc2ece8ba5dafc463abdceb1f55eaea"><div class="ttname"><a href="namespaceentt.html#a9dc2ece8ba5dafc463abdceb1f55eaea">entt::resolve</a></div><div class="ttdeci">meta_type resolve() noexcept</div><div class="ttdoc">Returns the meta type associated with a given type.</div><div class="ttdef"><b>Definition</b> <a href="#l00032">resolve.hpp:32</a></div></div>
<div class="ttc" id="astructentt_1_1iterable__adaptor_html"><div class="ttname"><a href="structentt_1_1iterable__adaptor.html">entt::iterable_adaptor</a></div><div class="ttdoc">Utility class to create an iterable object from a pair of iterators.</div><div class="ttdef"><b>Definition</b> <a href="iterator_8hpp_source.html#l00141">iterator.hpp:141</a></div></div>
<div class="ttc" id="astructentt_1_1type__info_html"><div class="ttname"><a href="structentt_1_1type__info.html">entt::type_info</a></div><div class="ttdoc">Implementation specific information about a type.</div><div class="ttdef"><b>Definition</b> <a href="type__info_8hpp_source.html#l00133">type_info.hpp:133</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>