/Src/Dependencies/Boost/libs/python/doc/v2/ResultConverter.html

http://hadesmem.googlecode.com/ · HTML · 124 lines · 105 code · 14 blank · 5 comment · 0 complexity · 7c0cd1f6d45fc4404637d8d8b7544ee0 MD5 · raw file

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <!-- Copyright David Abrahams 2006. Distributed under the Boost -->
  3. <!-- Software License, Version 1.0. (See accompanying -->
  4. <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. <link rel="stylesheet" type="text/css" href="../../../../boost.css">
  9. <title>Boost.Python - ResultConverter Concept</title>
  10. </head>
  11. <body link="#0000ff" vlink="#800080">
  12. <table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
  13. "header">
  14. <tr>
  15. <td valign="top" width="300">
  16. <h3><a href="../../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../../boost.png" border="0"></a></h3>
  17. </td>
  18. <td valign="top">
  19. <h1 align="center"><a href="../index.html">Boost.Python</a></h1>
  20. <h2 align="center">ResultConverter Concept</h2>
  21. </td>
  22. </tr>
  23. </table>
  24. <hr>
  25. <dl class="page-index">
  26. <dt><a href="#introduction">Introduction</a></dt>
  27. <dt><a href="#concept-requirements">Concept Requirements</a></dt>
  28. <dd>
  29. <dl class="page-index">
  30. <dt><a href="#ResultConverter-concept">ResultConverter Concept</a></dt>
  31. <dt><a href="#ResultConverterGenerator-concept">ResultConverterGenerator Concept</a></dt>
  32. </dl>
  33. </dd>
  34. </dl>
  35. <h2><a name="introduction"></a>Introduction</h2>
  36. <p>A ResultConverter for a type <code>T</code> is a type whose
  37. instances can be used to convert C++ return values of type
  38. <code>T</code> <code>to_python</code>. A ResultConverterGenerator is
  39. an MPL unary metafunction class which, given the return type of a C++
  40. function, returns a ResultConverter for that type. ResultConverters in
  41. Boost.Python generally inspect library's registry of converters to
  42. find a suitable converter, but converters which don't use the registry
  43. are also possible.
  44. <h2><a name="concept-requirements"></a>Concept Requirements</h2>
  45. <h3><a name="ResultConverter-concept"></a>ResultConverter Concept</h3>
  46. <p>In the table below, <code><b>C</b></code> denotes a ResultConverter
  47. type for a type <b><code>R</code></b> , <code><b>c</b></code> denotes
  48. an object of type <code><b>C</b></code> , and <code><b>r</b></code>
  49. denotes an object of type <code><b>R</b></code>.
  50. <table summary="ResultConverter expressions" border="1" cellpadding="5">
  51. <tr>
  52. <td><b>Expression</b></td>
  53. <td><b>Type</b></td>
  54. <td><b>Semantics</b></td>
  55. </tr>
  56. <tr>
  57. <td valign="top"><code>C c;</code></td>
  58. <td>
  59. <td>Constructs a <code>C</code> object.
  60. </tr>
  61. <tr>
  62. <td valign="top"><code>c.convertible()</code></td>
  63. <td>convertible to <code>bool</code></td>
  64. <td><code>false</code> iff no conversion from any <code>R</code> value
  65. to a Python object is possible.</td>
  66. </tr>
  67. <tr>
  68. <td valign="top"><code>c(r)</code></td>
  69. <td>convertible to <code>PyObject*</code></td>
  70. <td>A pointer to a Python object corresponding to <code>r</code>,
  71. or <code>0</code> iff <code>r</code> could not be converted
  72. <code>to_python</code>, in which case <a
  73. href="http://www.python.org/doc/current/api/exceptionHandling.html#l2h-71">PyErr_Occurred</a>
  74. should return non-zero.</td>
  75. </tr>
  76. <tr>
  77. <td valign="top"><code>c.get_pytype()</code></td>
  78. <td><code>PyTypeObject const*</code></td>
  79. <td>A pointer to a Python Type object corresponding to result of the conversion,
  80. or <code>0</code>. Used for documentation generation. If <code>0</code> is returned
  81. the generated type in the documentation will be <b>object</b> .</td>
  82. </tr>
  83. </table>
  84. <h3><a name="ResultConverterGenerator-concept"></a>ResultConverterGenerator Concept</h3>
  85. <p>In the table below, <code><b>G</b></code> denotes a
  86. ResultConverterGenerator type and <code><b>R</b></code> denotes a possible
  87. C++ function return type.
  88. <table summary="ResultConverterGenerator expressions" border="1" cellpadding="5">
  89. <tr>
  90. <td><b>Expression</b></td>
  91. <td><b>Requirements</b></td>
  92. </tr>
  93. <tr>
  94. <td valign="top"><code>G::apply&lt;R&gt;::type</code></td>
  95. <td>A ResultConverter type for <code>R</code>.</td>
  96. </table>
  97. <hr>
  98. <p>Revised
  99. <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
  100. 09 May, 2002 <!--Luann's birthday! -->
  101. <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
  102. </p>
  103. <p><i>&copy; Copyright <a href="http://www.boost.org/people/dave_abrahams.htm">Dave
  104. Abrahams</a> 2002. </i>
  105. <p>Permission to copy, use, modify, sell
  106. and distribute this software is granted provided this copyright notice appears
  107. in all copies. This software is provided "as is" without express or implied
  108. warranty, and with no claim as to its suitability for any purpose.
  109. </body>
  110. </html>