Sophie

Sophie

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

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: Metadata</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">Metadata </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Adding additional meta information to properties or methods can be very useful. So for instance, it allows to add ToolTips or the information what kind of editor should be created in the GUI. You can also tag certain properties to make only those available in a scripting engine which has a certain key set.</p>
<p>The metadata consists of a <code>key</code> and a <code>value</code>, both objects are forwarded to <a class="el" href="classrttr_1_1variant.html">variants</a>. So the only requirement for metadata is that it has to be copyable.</p>
<p>Please take a look at following 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">enum class</span> MetaData_Type</div><div class="line">{</div><div class="line">    SCRIPTABLE,</div><div class="line">    GUI</div><div class="line">};</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">    </div><div class="line">    <a class="code" href="classrttr_1_1registration.html#a3331d6ccc45422da21e36937edcce4e0">registration::property</a>(<span class="stringliteral">&quot;value&quot;</span>, &amp;g_Value)</div><div class="line">                  (    </div><div class="line">                      <a class="code" href="namespacerttr.html#a2cd2b848b4d218241a8b6e8f7cdbeb93">metadata</a>(MetaData_Type::SCRIPTABLE, <span class="keyword">false</span>), </div><div class="line">                      <a class="code" href="namespacerttr.html#a2cd2b848b4d218241a8b6e8f7cdbeb93">metadata</a>(<span class="stringliteral">&quot;Description&quot;</span>, <span class="stringliteral">&quot;This is a value.&quot;</span>)</div><div class="line">                  );</div><div class="line">}</div></div><!-- fragment --><p> In order to add metadata to a registered item you have to use the <code>()</code> operator of the returned <a class="el" href="classrttr_1_1registration_1_1bind.html">bind</a> object. Then you call for every metadata item you want to add, the function <a class="el" href="namespacerttr.html#a2cd2b848b4d218241a8b6e8f7cdbeb93">metadata()</a>.</p>
<p>It has following synopsis: </p><div class="fragment"><div class="line"><a class="code" href="namespacerttr.html#a2cd2b848b4d218241a8b6e8f7cdbeb93">rttr::detail::metadata</a> <a class="code" href="namespacerttr.html#a2cd2b848b4d218241a8b6e8f7cdbeb93">rttr::metadata</a>( variant key, variant <a class="code" href="namespacerttr.html#a54ecd8bad715cbc451e7aa8491667d4a">value</a> );</div></div><!-- fragment --><p>This will register a global property named <code>"value"</code> with two metadata informations. The first use an enum type as key, the second a string.</p>
<p>And the following snippet shows, how to retrieve this information: </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> main()</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"></div><div class="line">    <span class="keyword">property</span> prop = <a class="code" href="classrttr_1_1type.html#a9b754b6b0cccc39632323e3ee37f778e">type::get_global_property</a>(<span class="stringliteral">&quot;value&quot;</span>);</div><div class="line">    <a class="code" href="classrttr_1_1variant.html">variant</a> <a class="code" href="namespacerttr.html#a54ecd8bad715cbc451e7aa8491667d4a">value</a> = prop.get_metadata(MetaData_Type::SCRIPTABLE);</div><div class="line">    std::cout &lt;&lt; <a class="code" href="namespacerttr.html#a54ecd8bad715cbc451e7aa8491667d4a">value</a>.get_value&lt;<span class="keywordtype">bool</span>&gt;(); <span class="comment">// prints &quot;false&quot;</span></div><div class="line">    </div><div class="line">    <a class="code" href="namespacerttr.html#a54ecd8bad715cbc451e7aa8491667d4a">value</a> = prop.get_metadata(<span class="stringliteral">&quot;Description&quot;</span>);</div><div class="line">    std::cout &lt;&lt; <a class="code" href="namespacerttr.html#a54ecd8bad715cbc451e7aa8491667d4a">value</a>.get_value&lt;std::string&gt;(); <span class="comment">// prints &quot;This is a value.&quot;</span></div><div class="line">}</div></div><!-- fragment --><p>Every property, method, enumeration and constructor can have metadata.</p>
<hr/>
<div type="button" class="btn btn-default doxy-button"><a class="el" href="register_classes_page.html">previous</a></div><div class="btn btn-default doxy-button"><a class="el" href="default_arguments_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>