boost/libs/python/doc/html/reference/concepts/resultconverter.html
2021-10-05 21:37:46 +02:00

211 lines
10 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ResultConverter</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Boost.Python Reference Manual">
<link rel="up" href="../concepts.html" title="Chapter 1. Concepts">
<link rel="prev" href="holdergenerator.html" title="HolderGenerator">
<link rel="next" href="objectwrapper.html" title="ObjectWrapper">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../../images/boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="holdergenerator.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="objectwrapper.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="concepts.resultconverter"></a><a class="link" href="resultconverter.html" title="ResultConverter">ResultConverter</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="resultconverter.html#concepts.resultconverter.introduction">Introduction</a></span></dt>
<dt><span class="section"><a href="resultconverter.html#concepts.resultconverter.resultconverter_concept_requirem">ResultConverter
Concept Requirements</a></span></dt>
<dt><span class="section"><a href="resultconverter.html#concepts.resultconverter.resultconvertergenerator_concept">ResultConverterGenerator
Concept Requirements</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="concepts.resultconverter.introduction"></a><a class="link" href="resultconverter.html#concepts.resultconverter.introduction" title="Introduction">Introduction</a>
</h3></div></div></div>
<p>
A ResultConverter for a type <code class="computeroutput"><span class="identifier">T</span></code>
is a type whose instances can be used to convert C++ return values of type
<code class="computeroutput"><span class="identifier">T</span></code> <code class="computeroutput"><span class="identifier">to_python</span></code>.
A ResultConverterGenerator is an MPL unary metafunction class which, given
the return type of a C++ function, returns a ResultConverter for that type.
ResultConverters in Boost.Python generally inspect library's registry of
converters to find a suitable converter, but converters which don't use
the registry are also possible.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="concepts.resultconverter.resultconverter_concept_requirem"></a><a class="link" href="resultconverter.html#concepts.resultconverter.resultconverter_concept_requirem" title="ResultConverter Concept Requirements">ResultConverter
Concept Requirements</a>
</h3></div></div></div>
<p>
In the table below, <code class="computeroutput"><span class="identifier">C</span></code> denotes
a ResultConverter type for a type <code class="computeroutput"><span class="identifier">R</span></code>,
<code class="computeroutput"><span class="identifier">c</span></code> denotes an object of
type <code class="computeroutput"><span class="identifier">C</span></code>, and <code class="computeroutput"><span class="identifier">r</span></code> denotes an object of type <code class="computeroutput"><span class="identifier">R</span></code>.
</p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Type
</p>
</th>
<th>
<p>
Semantics
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">C</span> <span class="identifier">c</span></code>
</p>
</td>
<td>
</td>
<td>
<p>
Constructs a <code class="computeroutput"><span class="identifier">c</span></code>
object.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">c</span><span class="special">.</span><span class="identifier">convertible</span><span class="special">()</span></code>
</p>
</td>
<td>
<p>
convertible to <code class="computeroutput"><span class="keyword">bool</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="keyword">false</span></code> iff no conversion
from any <code class="computeroutput"><span class="identifier">R</span></code> value
to a Python object is possible.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">c</span><span class="special">(</span><span class="identifier">r</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
convertible to <code class="computeroutput"><span class="identifier">PyObject</span><span class="special">*</span></code>
</p>
</td>
<td>
<p>
A pointer to a Python object corresponding to <code class="computeroutput"><span class="identifier">r</span></code>,
or <code class="computeroutput"><span class="number">0</span></code> iff <code class="computeroutput"><span class="identifier">r</span></code> could not be converted <code class="computeroutput"><span class="identifier">to_python</span></code>, in which case <code class="computeroutput"><span class="identifier">PyErr_Occurred</span></code> should return
non-zero.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">c</span><span class="special">.</span><span class="identifier">get_pytype</span><span class="special">()</span></code>
</p>
</td>
<td>
<p>
<code class="computeroutput"><span class="identifier">PyTypeObject</span> <span class="keyword">const</span> <span class="special">*</span></code>
</p>
</td>
<td>
<p>
A pointer to a Python Type object corresponding to result of
the conversion, or <code class="computeroutput"><span class="number">0</span></code>.
Used for documentation generation. If <code class="computeroutput"><span class="number">0</span></code>
is returned the generated type in the documentation will be object.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="concepts.resultconverter.resultconvertergenerator_concept"></a><a class="link" href="resultconverter.html#concepts.resultconverter.resultconvertergenerator_concept" title="ResultConverterGenerator Concept Requirements">ResultConverterGenerator
Concept Requirements</a>
</h3></div></div></div>
<p>
In the table below, <code class="computeroutput"><span class="identifier">G</span></code> denotes
a ResultConverterGenerator type and <code class="computeroutput"><span class="identifier">R</span></code>
denotes a possible C++ function return type.
</p>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Requirements
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">G</span><span class="special">::</span><span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
</p>
</td>
<td>
<p>
A ResultConverter type for <code class="computeroutput"><span class="identifier">R</span></code>.
</p>
</td>
</tr></tbody>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="holdergenerator.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="objectwrapper.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>