arg.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. Copyright 2012 Eric Niebler
  4. Distributed under the Boost
  5. Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <header name="boost/proto/transform/arg.hpp">
  9. <para>Contains definition of the childN transforms and friends.</para>
  10. <namespace name="boost">
  11. <namespace name="proto">
  12. <struct name="_expr">
  13. <inherit><classname>proto::transform</classname>&lt; _expr &gt;</inherit>
  14. <purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the current expression unmodified. </purpose>
  15. <description>
  16. <para>
  17. Example:
  18. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  19. <classname>proto::terminal</classname>&lt;int&gt;::type &amp; j = proto::_expr()(i);
  20. assert( boost::addressof(i) == boost::addressof(j) );</programlisting>
  21. </para>
  22. </description>
  23. <struct name="impl">
  24. <template>
  25. <template-type-parameter name="Expr"/>
  26. <template-type-parameter name="State"/>
  27. <template-type-parameter name="Data"/>
  28. </template>
  29. <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
  30. <typedef name="result_type">
  31. <type>Expr</type>
  32. </typedef>
  33. <method-group name="public member functions">
  34. <method name="operator()" cv="const">
  35. <type>Expr</type>
  36. <parameter name="expr">
  37. <paramtype>typename impl::expr_param</paramtype>
  38. <description>
  39. <para>The current expression. </para>
  40. </description>
  41. </parameter>
  42. <parameter name="">
  43. <paramtype>typename impl::state_param</paramtype>
  44. </parameter>
  45. <parameter name="">
  46. <paramtype>typename impl::data_param</paramtype>
  47. </parameter>
  48. <description>
  49. <para>
  50. Returns the current expression.
  51. </para>
  52. </description>
  53. <returns>
  54. <para>
  55. <computeroutput>expr</computeroutput>
  56. </para>
  57. </returns>
  58. <throws>
  59. <simpara>Will not throw.</simpara>
  60. </throws>
  61. </method>
  62. </method-group>
  63. </struct>
  64. </struct>
  65. <struct name="_state">
  66. <inherit><classname>proto::transform</classname>&lt; _state &gt;</inherit>
  67. <purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the current state unmodified. </purpose>
  68. <description>
  69. <para>
  70. Example:
  71. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  72. char ch = proto::_state()(i, 'a');
  73. assert( ch == 'a' );</programlisting>
  74. </para>
  75. </description>
  76. <struct name="impl">
  77. <template>
  78. <template-type-parameter name="Expr"/>
  79. <template-type-parameter name="State"/>
  80. <template-type-parameter name="Data"/>
  81. </template>
  82. <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
  83. <typedef name="result_type">
  84. <type>State</type>
  85. </typedef>
  86. <method-group name="public member functions">
  87. <method name="operator()" cv="const">
  88. <type>State</type>
  89. <parameter name="">
  90. <paramtype>typename impl::expr_param</paramtype>
  91. </parameter>
  92. <parameter name="state">
  93. <paramtype>typename impl::state_param</paramtype>
  94. <description>
  95. <para>The current state. </para>
  96. </description>
  97. </parameter>
  98. <parameter name="">
  99. <paramtype>typename impl::data_param</paramtype>
  100. </parameter>
  101. <description>
  102. <para>
  103. Returns the current state.
  104. </para>
  105. </description>
  106. <returns>
  107. <para>
  108. <computeroutput>state</computeroutput>
  109. </para>
  110. </returns>
  111. <throws>
  112. <simpara>Will not throw.</simpara>
  113. </throws>
  114. </method>
  115. </method-group>
  116. </struct>
  117. </struct>
  118. <struct name="_data">
  119. <inherit><classname>proto::transform</classname>&lt; _data &gt;</inherit>
  120. <purpose>
  121. A <conceptname>PrimitiveTransform</conceptname> that returns the current data unmodified.
  122. If the data (third) parameter is a transform environment, it returns the value associated
  123. with the <code><classname>proto::data_type</classname></code> key. Otherwise, it returns
  124. the data parameter unmodified.
  125. </purpose>
  126. <description>
  127. <para>
  128. If the data (third) parameter is a transform environment, it returns the value associated
  129. with the <code><classname>proto::data_type</classname></code> key. Otherwise, it returns
  130. the data parameter unmodified.
  131. </para>
  132. <para>
  133. <emphasis role="bold">Example:</emphasis>
  134. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  135. std::string str("hello");
  136. std::string &amp; d1 = proto::_data()(i, 'a', str);
  137. assert( &amp;str == &amp;d1 );
  138. std::string &amp; d2 = proto::_data()(i, 'a', (<globalname>proto::data</globalname> = boost::ref(str)));
  139. assert( &amp;str == &amp;d2 );</programlisting>
  140. </para>
  141. </description>
  142. <struct name="impl">
  143. <template>
  144. <template-type-parameter name="Expr"/>
  145. <template-type-parameter name="State"/>
  146. <template-type-parameter name="Data"/>
  147. </template>
  148. <inherit><type>
  149. mpl::if_c&lt;
  150. <classname>proto::is_env</classname>&lt;Data&gt;::value,
  151. <classname>proto::_env_var</classname>&lt;<classname>proto::data_type</classname>&gt;,
  152. <classname>proto::_env</classname>
  153. &gt;::type::template impl&lt;Expr, State, Data&gt;</type></inherit>
  154. </struct>
  155. </struct>
  156. <struct name="_child_c">
  157. <template>
  158. <template-nontype-parameter name="N">
  159. <type>int</type>
  160. </template-nontype-parameter>
  161. </template>
  162. <inherit><classname>proto::transform</classname>&lt; _child_c&lt;N&gt; &gt;</inherit>
  163. <purpose>A <conceptname>PrimitiveTransform</conceptname> that returns N-th child of the current expression. </purpose>
  164. <description>
  165. <para>
  166. Example:
  167. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  168. <classname>proto::terminal</classname>&lt;int&gt;::type &amp; j = proto::_child_c&lt;0&gt;()(-i);
  169. assert( boost::addressof(i) == boost::addressof(j) );</programlisting>
  170. </para>
  171. </description>
  172. <struct name="impl">
  173. <template>
  174. <template-type-parameter name="Expr"/>
  175. <template-type-parameter name="State"/>
  176. <template-type-parameter name="Data"/>
  177. </template>
  178. <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
  179. <typedef name="result_type">
  180. <type>typename <classname>proto::result_of::child_c</classname>&lt; Expr, N &gt;::type</type>
  181. </typedef>
  182. <method-group name="public member functions">
  183. <method name="operator()" cv="const">
  184. <type>typename <classname>proto::result_of::child_c</classname>&lt; Expr, N &gt;::type</type>
  185. <parameter name="expr">
  186. <paramtype>typename impl::expr_param</paramtype>
  187. <description>
  188. <para>The current expression. </para>
  189. </description>
  190. </parameter>
  191. <parameter name="">
  192. <paramtype>typename impl::state_param</paramtype>
  193. </parameter>
  194. <parameter name="">
  195. <paramtype>typename impl::data_param</paramtype>
  196. </parameter>
  197. <description>
  198. <para>
  199. Returns the N-th child of <computeroutput>expr</computeroutput>
  200. </para>
  201. </description>
  202. <requires>
  203. <para>
  204. <computeroutput>Expr::proto_arity::value &gt; N</computeroutput>
  205. </para>
  206. </requires>
  207. <returns>
  208. <para>
  209. <computeroutput><functionname>proto::child_c</functionname>&lt;N&gt;(expr)</computeroutput>
  210. </para>
  211. </returns>
  212. <throws>
  213. <simpara>Will not throw.</simpara>
  214. </throws>
  215. </method>
  216. </method-group>
  217. </struct>
  218. </struct>
  219. <struct name="_value">
  220. <inherit><classname>proto::transform</classname>&lt; _value &gt;</inherit>
  221. <purpose>A <conceptname>PrimitiveTransform</conceptname> that returns the value of the current terminal expression. </purpose>
  222. <description>
  223. <para>
  224. Example:
  225. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  226. int j = proto::_value()(i);
  227. assert( 42 == j );</programlisting>
  228. </para>
  229. </description>
  230. <struct name="impl">
  231. <template>
  232. <template-type-parameter name="Expr"/>
  233. <template-type-parameter name="State"/>
  234. <template-type-parameter name="Data"/>
  235. </template>
  236. <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
  237. <typedef name="result_type">
  238. <type>typename <classname>proto::result_of::value</classname>&lt; Expr &gt;::type</type>
  239. </typedef>
  240. <method-group name="public member functions">
  241. <method name="operator()" cv="const">
  242. <type>typename <classname>proto::result_of::value</classname>&lt; Expr &gt;::type</type>
  243. <parameter name="expr">
  244. <paramtype>typename impl::expr_param</paramtype>
  245. <description>
  246. <para>The current expression. </para>
  247. </description>
  248. </parameter>
  249. <parameter name="">
  250. <paramtype>typename impl::state_param</paramtype>
  251. </parameter>
  252. <parameter name="">
  253. <paramtype>typename impl::data_param</paramtype>
  254. </parameter>
  255. <description>
  256. <para>
  257. Returns the value of the specified terminal expression.
  258. </para>
  259. </description>
  260. <requires>
  261. <para>
  262. <computeroutput>Expr::proto_arity::value == 0</computeroutput>.
  263. </para>
  264. </requires>
  265. <returns>
  266. <para>
  267. <computeroutput><functionname>proto::value</functionname>(expr)</computeroutput>
  268. </para>
  269. </returns>
  270. <throws>
  271. <simpara>Will not throw.</simpara>
  272. </throws>
  273. </method>
  274. </method-group>
  275. </struct>
  276. </struct>
  277. <struct name="_void">
  278. <inherit><classname>proto::transform</classname>&lt; _void &gt;</inherit>
  279. <purpose>A <conceptname>PrimitiveTransform</conceptname> that does nothing and returns void. </purpose>
  280. <struct name="impl">
  281. <template>
  282. <template-type-parameter name="Expr"/>
  283. <template-type-parameter name="State"/>
  284. <template-type-parameter name="Data"/>
  285. </template>
  286. <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
  287. <typedef name="result_type">
  288. <type>void</type>
  289. </typedef>
  290. <method-group name="public member functions">
  291. <method name="operator()" cv="const">
  292. <type>void</type>
  293. <parameter name="">
  294. <paramtype>typename impl::expr_param</paramtype>
  295. </parameter>
  296. <parameter name="">
  297. <paramtype>typename impl::state_param</paramtype>
  298. </parameter>
  299. <parameter name="">
  300. <paramtype>typename impl::data_param</paramtype>
  301. </parameter>
  302. <description>
  303. <para>
  304. Does nothing.
  305. </para>
  306. </description>
  307. <throws>
  308. <simpara>Will not throw.</simpara>
  309. </throws>
  310. </method>
  311. </method-group>
  312. </struct>
  313. </struct>
  314. <struct name="_byref">
  315. <inherit><classname>proto::callable</classname></inherit>
  316. <purpose>A unary callable <conceptname>PolymorphicFunctionObject</conceptname> that wraps its argument
  317. in a <computeroutput>boost::reference_wrapper&lt;&gt;</computeroutput>.</purpose>
  318. <description>
  319. <para>
  320. Example:
  321. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  322. boost::reference_wrapper&lt;<classname>proto::terminal</classname>&lt;int&gt;::type&gt; j
  323. = <classname>proto::when</classname>&lt;<classname>proto::_</classname>, proto::_byref(_)&gt;()(i);
  324. assert( boost::addressof(i) == boost::addressof(j.get()) );</programlisting>
  325. </para>
  326. </description>
  327. <struct-specialization name="result">
  328. <template>
  329. <template-type-parameter name="This"/>
  330. <template-type-parameter name="T"/>
  331. </template>
  332. <specialization>
  333. <template-arg>This(T &amp;)</template-arg>
  334. </specialization>
  335. <typedef name="type">
  336. <type>boost::reference_wrapper&lt; T &gt; const</type>
  337. </typedef>
  338. </struct-specialization>
  339. <struct-specialization name="result">
  340. <template>
  341. <template-type-parameter name="This"/>
  342. <template-type-parameter name="T"/>
  343. </template>
  344. <specialization>
  345. <template-arg>This(T)</template-arg>
  346. </specialization>
  347. <typedef name="type">
  348. <type>boost::reference_wrapper&lt; T const &gt; const</type>
  349. </typedef>
  350. </struct-specialization>
  351. <method-group name="public member functions">
  352. <method name="operator()" cv="const">
  353. <type>boost::reference_wrapper&lt; T &gt; const</type>
  354. <template>
  355. <template-type-parameter name="T"/>
  356. </template>
  357. <parameter name="t">
  358. <paramtype>T &amp;</paramtype>
  359. <description>
  360. <para>The object to wrap </para>
  361. </description>
  362. </parameter>
  363. <description>
  364. <para>
  365. Wrap the parameter <computeroutput>t</computeroutput> in a
  366. <computeroutput>boost::reference_wrapper&lt;&gt;</computeroutput>
  367. </para>
  368. </description>
  369. <returns>
  370. <para>
  371. <computeroutput>boost::ref(t)</computeroutput>
  372. </para>
  373. </returns>
  374. <throws>
  375. <simpara>Will not throw.</simpara>
  376. </throws>
  377. </method>
  378. <method name="operator()" cv="const">
  379. <type>boost::reference_wrapper&lt; T const &gt; const</type>
  380. <template>
  381. <template-type-parameter name="T"/>
  382. </template>
  383. <parameter name="t">
  384. <paramtype>T const &amp;</paramtype>
  385. </parameter>
  386. <description>
  387. <para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para>
  388. </description>
  389. </method>
  390. </method-group>
  391. </struct>
  392. <struct name="_byval">
  393. <inherit><classname>proto::callable</classname></inherit>
  394. <purpose>
  395. A unary callable <conceptname>PolymorphicFunctionObject</conceptname> that strips references and
  396. <computeroutput>boost::reference_wrapper&lt;&gt;</computeroutput> from its argument.
  397. </purpose>
  398. <description>
  399. <para>
  400. Example:
  401. <programlisting><classname>proto::terminal</classname>&lt;int&gt;::type i = {42};
  402. int j = 67;
  403. int k = <classname>proto::when</classname>&lt;<classname>proto::_</classname>, proto::_byval(<classname>proto::_state</classname>)&gt;()(i, boost::ref(j));
  404. assert( 67 == k );</programlisting>
  405. </para>
  406. </description>
  407. <struct-specialization name="result">
  408. <template>
  409. <template-type-parameter name="This"/>
  410. <template-type-parameter name="T"/>
  411. </template>
  412. <specialization>
  413. <template-arg>This(boost::reference_wrapper&lt; T &gt;)</template-arg>
  414. </specialization>
  415. <inherit>result&lt;This(T)&gt;</inherit>
  416. </struct-specialization>
  417. <struct-specialization name="result">
  418. <template>
  419. <template-type-parameter name="This"/>
  420. <template-type-parameter name="T"/>
  421. </template>
  422. <specialization>
  423. <template-arg>This(T &amp;)</template-arg>
  424. </specialization>
  425. <inherit>result&lt;This(T)&gt;</inherit>
  426. </struct-specialization>
  427. <struct-specialization name="result">
  428. <template>
  429. <template-type-parameter name="This"/>
  430. <template-type-parameter name="T"/>
  431. </template>
  432. <specialization>
  433. <template-arg>This(T)</template-arg>
  434. </specialization>
  435. <typedef name="type">
  436. <type>T</type>
  437. </typedef>
  438. </struct-specialization>
  439. <method-group name="public member functions">
  440. <method name="operator()" cv="const">
  441. <type>T</type>
  442. <template>
  443. <template-type-parameter name="T"/>
  444. </template>
  445. <parameter name="t">
  446. <paramtype>T const &amp;</paramtype>
  447. <description>
  448. <para>The object to unref </para>
  449. </description>
  450. </parameter>
  451. <returns>
  452. <para>
  453. <computeroutput>t</computeroutput>
  454. </para>
  455. </returns>
  456. <throws>
  457. <simpara>Will not throw.</simpara>
  458. </throws>
  459. </method>
  460. <method name="operator()" cv="const">
  461. <type>T</type>
  462. <template>
  463. <template-type-parameter name="T"/>
  464. </template>
  465. <parameter name="t">
  466. <paramtype>boost::reference_wrapper&lt; T &gt; const &amp;</paramtype>
  467. </parameter>
  468. <description>
  469. <para>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </para>
  470. </description>
  471. </method>
  472. </method-group>
  473. </struct>
  474. </namespace>
  475. </namespace>
  476. </header>