1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
<!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.9.1"/>
<title>libsigc++: sigc::adapts< T_functor > Struct Template 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="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-extra.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 style="padding-left: 0.5em;">
<div id="projectname">libsigc++
 <span id="projectnumber">2.10.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacesigc.html">sigc</a></li><li class="navelem"><a class="el" href="structsigc_1_1adapts.html">adapts</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-attribs">Public Attributes</a> |
<a href="structsigc_1_1adapts-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">sigc::adapts< T_functor > Struct Template Reference<div class="ingroups"><a class="el" href="group__adaptors.html">Adaptors</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Base type for adaptors.
<a href="structsigc_1_1adapts.html#details">More...</a></p>
<p><code>#include <sigc++/adaptors/adaptor_trait.h></code></p>
<div class="dynheader">
Inheritance diagram for sigc::adapts< T_functor >:</div>
<div class="dyncontent">
<div class="center"><img src="structsigc_1_1adapts__inherit__graph.png" border="0" usemap="#sigc_1_1adapts_3_01T__functor_01_4_inherit__map" alt="Inheritance graph"/></div>
<map name="sigc_1_1adapts_3_01T__functor_01_4_inherit__map" id="sigc_1_1adapts_3_01T__functor_01_4_inherit__map">
<area shape="rect" id="node4" href="structsigc_1_1bind__functor_3_010_00_01T__functor_00_01T__bound_00_01nil_00_01nil_00_01nil_00_01nil_00_01nil_00_01nil_01_4.html" title="Adaptor that binds an argument to the wrapped functor. " alt="" coords="628,5,807,61"/><area shape="rect" id="node5" href="structsigc_1_1bind__functor_3-1_00_01T__functor_00_01T__type1_00_01nil_00_01nil_00_01nil_00_01nil_00_01nil_00_01nil_01_4.html" title="Adaptor that binds 1 argument(s) to the wrapped functor. " alt="" coords="630,85,805,141"/><area shape="rect" id="node6" href="structsigc_1_1bind__return__functor.html" title="Adaptor that fixes the return value of the wrapped functor. " alt="" coords="627,165,807,206"/><area shape="rect" id="node7" href="structsigc_1_1exception__catch__functor.html" title="sigc::exception_catch\l_functor\< T_functor \>" alt="" coords="636,230,799,271"/><area shape="rect" id="node8" href="structsigc_1_1exception__catch__functor_3_01T__functor_00_01T__catcher_00_01void_01_4.html" title="sigc::exception_catch\l_functor\< T_functor,\l T_catcher, void \>" alt="" coords="638,295,797,351"/><area shape="rect" id="node9" href="structsigc_1_1hide__functor_3_010_00_01T__functor_01_4.html" title="Adaptor that adds a dummy parameter to the wrapped functor. " alt="" coords="650,374,785,415"/><area shape="rect" id="node10" href="structsigc_1_1hide__functor_3-1_00_01T__functor_01_4.html" title="Adaptor that adds a dummy parameter to the wrapped functor. " alt="" coords="650,439,785,481"/><area shape="rect" id="node11" href="structsigc_1_1retype__functor.html" title="Adaptor that performs C-style casts on the parameters passed on to the functor. " alt="" coords="643,505,791,546"/><area shape="rect" id="node12" href="structsigc_1_1retype__return__functor.html" title="Adaptor that performs a C-style cast on the return value of a functor. " alt="" coords="636,570,799,611"/><area shape="rect" id="node13" href="structsigc_1_1retype__return__functor_3_01void_00_01T__functor_01_4.html" title="Adaptor that performs a C-style cast on the return value of a functor. " alt="" coords="619,635,816,677"/><area shape="rect" id="node14" href="classsigc_1_1track__obj__functor1.html" title="track_obj_functor1 wraps a functor and stores a reference to a trackable object. " alt="" coords="631,701,804,742"/><area shape="rect" id="node2" href="structsigc_1_1adaptor__base.html" title="A hint to the compiler. " alt="" coords="192,381,335,408"/><area shape="rect" id="node3" href="structsigc_1_1functor__base.html" title="A hint to the compiler. " alt="" coords="5,381,144,408"/><area shape="rect" id="node15" href="classsigc_1_1track__obj__functor2.html" title="track_obj_functor2 wraps a functor and stores 2 references to trackable objects. " alt="" coords="864,537,1037,578"/><area shape="rect" id="node16" href="classsigc_1_1track__obj__functor3.html" title="track_obj_functor3 wraps a functor and stores 3 references to trackable objects. " alt="" coords="864,602,1037,643"/><area shape="rect" id="node17" href="classsigc_1_1track__obj__functor4.html" title="track_obj_functor4 wraps a functor and stores 4 references to trackable objects. " alt="" coords="864,667,1037,709"/><area shape="rect" id="node18" href="classsigc_1_1track__obj__functor5.html" title="track_obj_functor5 wraps a functor and stores 5 references to trackable objects. " alt="" coords="864,733,1037,774"/><area shape="rect" id="node19" href="classsigc_1_1track__obj__functor6.html" title="track_obj_functor6 wraps a functor and stores 6 references to trackable objects. " alt="" coords="864,798,1037,839"/><area shape="rect" id="node20" href="classsigc_1_1track__obj__functor7.html" title="track_obj_functor7 wraps a functor and stores 7 references to trackable objects. " alt="" coords="864,863,1037,905"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<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:a5c3f3b614455552f4cd5d88b1f330248"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structsigc_1_1adaptor__trait.html">adaptor_trait</a>< T_functor >::<a class="el" href="structsigc_1_1adapts.html#a5c3f3b614455552f4cd5d88b1f330248">adaptor_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1adapts.html#a5c3f3b614455552f4cd5d88b1f330248">adaptor_type</a></td></tr>
<tr class="separator:a5c3f3b614455552f4cd5d88b1f330248"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a914e75556dae1fdcf0162c4c99aca79d"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structsigc_1_1adaptor__trait.html">adaptor_trait</a>< T_functor >::<a class="el" href="structsigc_1_1adapts.html#a914e75556dae1fdcf0162c4c99aca79d">result_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1adapts.html#a914e75556dae1fdcf0162c4c99aca79d">result_type</a></td></tr>
<tr class="separator:a914e75556dae1fdcf0162c4c99aca79d"><td class="memSeparator" colspan="2"> </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:a947b69ccbdcabd4ef4163dcab96096f8"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1adapts.html#a947b69ccbdcabd4ef4163dcab96096f8">adapts</a> (const T_functor& _A_functor)</td></tr>
<tr class="memdesc:a947b69ccbdcabd4ef4163dcab96096f8"><td class="mdescLeft"> </td><td class="mdescRight">Constructs an adaptor that wraps the passed functor. <a href="#a947b69ccbdcabd4ef4163dcab96096f8">More...</a><br /></td></tr>
<tr class="separator:a947b69ccbdcabd4ef4163dcab96096f8"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a2f4b37eb160708baf17de57f2abce7a7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structsigc_1_1adapts.html#a5c3f3b614455552f4cd5d88b1f330248">adaptor_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1adapts.html#a2f4b37eb160708baf17de57f2abce7a7">functor_</a></td></tr>
<tr class="memdesc:a2f4b37eb160708baf17de57f2abce7a7"><td class="mdescLeft"> </td><td class="mdescRight">Adaptor that is invoked from operator()(). <a href="#a2f4b37eb160708baf17de57f2abce7a7">More...</a><br /></td></tr>
<tr class="separator:a2f4b37eb160708baf17de57f2abce7a7"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template<class T_functor><br />
struct sigc::adapts< T_functor ></h3>
<p>Base type for adaptors. </p>
<p><a class="el" href="structsigc_1_1adapts.html" title="Base type for adaptors. ">sigc::adapts</a> wraps adaptors, functors, function pointers and class methods. It contains a single member functor which is always a <a class="el" href="structsigc_1_1adaptor__base.html" title="A hint to the compiler. ">sigc::adaptor_base</a>. The typedef adaptor_type defines the exact type that is used to store the adaptor, functor, function pointer or class method passed into the constructor. It differs from <em>T_functor</em> unless <em>T_functor</em> inherits from <a class="el" href="structsigc_1_1adaptor__base.html" title="A hint to the compiler. ">sigc::adaptor_base</a>.</p>
<dl class="section user"><dt>Example of a simple adaptor:</dt><dd><div class="fragment"><div class="line"><span class="keyword">namespace </span>my_ns</div>
<div class="line">{</div>
<div class="line"><span class="keyword">template</span> <<span class="keyword">class</span> T_functor></div>
<div class="line"><span class="keyword">struct </span>my_adaptor : <span class="keyword">public</span> <a class="code" href="structsigc_1_1adapts.html">sigc::adapts</a><T_functor></div>
<div class="line">{</div>
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> T_arg1=<span class="keywordtype">void</span>, <span class="keyword">class</span> T_arg2=<span class="keywordtype">void</span>></div>
<div class="line"> <span class="keyword">struct </span>deduce_result_type</div>
<div class="line"> { <span class="keyword">typedef</span> <a class="code" href="namespacesigc.html#ab7791439fb79592300826fe076a8e3d1">sigc::deduce_result_t<T_functor, T_arg1, T_arg2></a> type; };</div>
<div class="line"> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structsigc_1_1functor__trait.html#af1324bf0d3cec3d1f2e39e932b228d6d">sigc::functor_trait<T_functor>::result_type</a> <a class="code" href="structsigc_1_1adapts.html#a914e75556dae1fdcf0162c4c99aca79d">result_type</a>;</div>
<div class="line"> <span class="comment">//</span></div>
<div class="line"> result_type</div>
<div class="line"> operator()() <span class="keyword">const</span>;</div>
<div class="line"> <span class="comment">//</span></div>
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> T_arg1></div>
<div class="line"> <span class="keyword">typename</span> deduce_result_type<T_arg1>::type</div>
<div class="line"> operator()(T_arg1 _A_arg1) <span class="keyword">const</span>;</div>
<div class="line"> <span class="comment">//</span></div>
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> T_arg1, <span class="keyword">class</span> T_arg2></div>
<div class="line"> <span class="keyword">typename</span> deduce_result_type<T_arg1, T_arg2>::type</div>
<div class="line"> operator()(T_arg1 _A_arg1, T_arg2 _A_arg2) <span class="keyword">const</span>;</div>
<div class="line"> <span class="comment">//</span></div>
<div class="line"> <span class="comment">// Constructs a my_adaptor object that wraps the passed functor.</span></div>
<div class="line"> <span class="comment">// Initializes adapts<T_functor>::functor_, which is invoked from operator()().</span></div>
<div class="line"> <span class="keyword">explicit</span> my_adaptor(<span class="keyword">const</span> T_functor& _A_functor)</div>
<div class="line"> : <a class="code" href="namespacesigc.html">sigc</a>::<a class="code" href="structsigc_1_1adapts.html#a947b69ccbdcabd4ef4163dcab96096f8">adapts</a><T_functor>(_A_functor) {}</div>
<div class="line">};</div>
<div class="line">} <span class="comment">// end namespace my_ns</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// Specialization of sigc::visitor for my_adaptor.</span></div>
<div class="line"><span class="keyword">namespace </span><a class="code" href="namespacesigc.html">sigc</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">template</span> <<span class="keyword">class</span> T_functor></div>
<div class="line"><span class="keyword">struct </span>visitor<my_ns::my_adaptor<T_functor> ></div>
<div class="line">{</div>
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> T_action></div>
<div class="line"> <span class="keyword">static</span> <span class="keywordtype">void</span> do_visit_each(<span class="keyword">const</span> T_action& _A_action,</div>
<div class="line"> <span class="keyword">const</span> my_ns::my_adaptor<T_functor>& _A_target)</div>
<div class="line"> {</div>
<div class="line"> <a class="code" href="group__sigcfunctors.html#ga64cb7832acc1e58efb5ffe0b4f5e9404">sigc::visit_each</a>(_A_action, _A_target.functor_);</div>
<div class="line"> }</div>
<div class="line">};</div>
<div class="line">} <span class="comment">// end namespace sigc</span></div>
</div><!-- fragment --></dd></dl>
<p>If you implement your own adaptor, you must also provide your specialization of sigc::visitor<>::do_visit_each<>() that will forward the call to the functor(s) your adapter is wrapping. Otherwise, pointers stored within the functor won't be invalidated when a <a class="el" href="structsigc_1_1trackable.html" title="Base class for objects with auto-disconnection. ">sigc::trackable</a> object is destroyed and you can end up executing callbacks on destroyed objects.</p>
<p>Your specialization of sigc::visitor<> must be in namespace sigc. </p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a class="anchor" id="a5c3f3b614455552f4cd5d88b1f330248"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template <class T_functor> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structsigc_1_1adaptor__trait.html">adaptor_trait</a><T_functor>::<a class="el" href="structsigc_1_1adapts.html#a5c3f3b614455552f4cd5d88b1f330248">adaptor_type</a> <a class="el" href="structsigc_1_1adapts.html">sigc::adapts</a>< T_functor >::<a class="el" href="structsigc_1_1adapts.html#a5c3f3b614455552f4cd5d88b1f330248">adaptor_type</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a class="anchor" id="a914e75556dae1fdcf0162c4c99aca79d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template <class T_functor> </div>
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="structsigc_1_1adaptor__trait.html">adaptor_trait</a><T_functor>::<a class="el" href="structsigc_1_1adapts.html#a914e75556dae1fdcf0162c4c99aca79d">result_type</a> <a class="el" href="structsigc_1_1adapts.html">sigc::adapts</a>< T_functor >::<a class="el" href="structsigc_1_1adapts.html#a914e75556dae1fdcf0162c4c99aca79d">result_type</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="a947b69ccbdcabd4ef4163dcab96096f8"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template <class T_functor> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structsigc_1_1adapts.html">sigc::adapts</a>< T_functor >::<a class="el" href="structsigc_1_1adapts.html">adapts</a> </td>
<td>(</td>
<td class="paramtype">const T_functor & </td>
<td class="paramname"><em>_A_functor</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>Constructs an adaptor that wraps the passed functor. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">_A_functor</td><td>Functor to invoke from operator()(). </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="a2f4b37eb160708baf17de57f2abce7a7"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template <class T_functor> </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structsigc_1_1adapts.html#a5c3f3b614455552f4cd5d88b1f330248">adaptor_type</a> <a class="el" href="structsigc_1_1adapts.html">sigc::adapts</a>< T_functor >::functor_</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">mutable</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Adaptor that is invoked from operator()(). </p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Sep 20 2016 12:13:57 for libsigc++ by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|