Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > d8d30ad953f2dbe7e871721325480315 > files > 357

librttr-devel-0.9.6-1.mga7.armv7hl.rpm

<!-- HTML header for doxygen 1.8.8-->
<!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="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.15"/>
        <script type="text/javascript" src="jquery.min.js"></script>
        <title>rttr: Register Types - Hello World</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link rel = "shortcut icon" type = "image/x-icon" href = "favicon.ico">
        <link rel = "stylesheet" href = "fonts/ptsans_regular_macroman/stylesheet.css">
        <link rel = "stylesheet" href = "fonts/source_code_pro_regular/stylesheet.css">
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="custom-doxygen.css" rel="stylesheet" type="text/css"/>
        <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="custom-bootstrap.css">
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="doxy-boot.js"></script>
    </head>
    <body>
     <!--
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">rttr 0.9.6</a>
                </div>
            </div>
        </nav>
        -->
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel panel-default" style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<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('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Register Types - Hello World </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Let's start with the traditional hello world example.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;rttr/registration&gt;</span></div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> f() { std::cout &lt;&lt; <span class="stringliteral">&quot;Hello World&quot;</span> &lt;&lt; std::endl; }</div><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespacerttr.html">rttr</a>;</div><div class="line"></div><div class="line"><a class="code" href="registration_8h.html#ac6326400f16225ee15b52eabcaae8130">RTTR_REGISTRATION</a></div><div class="line">{</div><div class="line">    <span class="keyword">using namespace </span><a class="code" href="namespacerttr.html">rttr</a>;</div><div class="line">    <a class="code" href="classrttr_1_1registration.html#a5da1c6eb947d700681faa7fec0bf23b7">registration::method</a>(<span class="stringliteral">&quot;f&quot;</span>, &amp;f);</div><div class="line">}</div><div class="line">  </div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">    <a class="code" href="classrttr_1_1type.html#afc7329cac11337f4022d7d10eebe80d3">type::invoke</a>(<span class="stringliteral">&quot;f&quot;</span>, {});</div><div class="line">}</div><div class="line"><span class="comment">// outputs: &quot;Hello World&quot;</span></div></div><!-- fragment --><p>When you need to reflect a property, or like in this case a free function, you need to include first <code>#include &lt;rttr/registration&gt;</code>. This will include everything necessary for creating the reflection information.</p>
<p>The macro <a class="el" href="registration_8h.html#ac6326400f16225ee15b52eabcaae8130">RTTR_REGISTRATION</a> must be placed outside of any function or class, just place directly into in your cpp file. This macro executes the register process before <code>main</code> is called, that has the advantage that this reflection information is directly available when <code>main</code> is called. When on the other hand the register calls are invoked manually, then these calls must be synchronized with the calls retrieving the type information. Otherwise invalid data will be returned. Remark that this macro can only be placed one-time in a source file, otherwise you will get an compile error.</p>
<p>The shortest way to invoke the function <code>f()</code> is to call type::invoke(). It requires the exact name of the free function and a vector of arguments. You can check whether the call was successful with checking the return value. When the returned <a class="el" href="classrttr_1_1variant.html">variant</a> is <a class="el" href="classrttr_1_1variant.html#aed6e6a2e29b4d1ac51a09b7d9037dd44">valid</a> the call was successful, otherwise not.</p>
<hr/>
<div class="btn btn-default doxy-button" disabled="true">previous</div><div class="btn btn-default doxy-button"><a class="el" href="register_methods_page.html">next</a></div> </div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<hr class="footer"/>
<address class="footer">
<small>
Generated on Thu Apr 11 2019 20:05:57 for rttr - 0.9.6 by 
<a href="http://www.doxygen.org/index.html">doxygen</a>.
</small>
</address>
</body>
</html>