mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 18:12:43 +00:00
Separate init.hpp docs from class.hpp
[SVN r15616]
This commit is contained in:
@@ -64,41 +64,6 @@
|
||||
<code>bases</code> synopsis</a></dt>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
<dt><a href="#init-spec">Class template <code>init</code></a></dt>
|
||||
|
||||
<dd>
|
||||
<dl class="page-index">
|
||||
<dt><a href="#init-spec-synopsis">Class template
|
||||
<code>init</code> synopsis</a></dt>
|
||||
|
||||
<dt><a href="#init-spec-ctors">Class <code>init</code>
|
||||
constructors</a></dt>
|
||||
|
||||
<dt><a href=
|
||||
"#init-expressions"><em>init-expressions</em></a></dt>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
<dt><a href="#optional-spec">Class template
|
||||
<code>optional</code></a></dt>
|
||||
|
||||
<dd>
|
||||
<dl class="page-index">
|
||||
<dt><a href="#optional-spec-synopsis">Class template
|
||||
<code>optional</code> synopsis</a></dt>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
<dt><a href="#init_with_call_policies-spec">Class template
|
||||
<code>init_with_call_policies</code></a></dt>
|
||||
|
||||
<dd>
|
||||
<dl class="page-index">
|
||||
<dt><a href="#init_with_call_policies-spec-synopsis">Class
|
||||
template <code>init_with_call_policies</code> synopsis</a></dt>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
@@ -208,14 +173,14 @@
|
||||
<code>HeldType</code> instance, as shown in <a href=
|
||||
"call_method.html#example">this example</a>. This argument is not
|
||||
included in the <em><a href=
|
||||
"#init-expressions">init-expression</a></em> passed to <a href=
|
||||
"#class-spec-modifiers"><code>def(init_expr)</code></a>, below, nor is
|
||||
it passed explicitly by users when Python instances of <code>T</code>
|
||||
are created. This idiom allows C++ virtual functions which will be
|
||||
overridden in Python to access the Python object so the Python method
|
||||
can be invoked. Boost.Python automatically registers additional
|
||||
converters which allow wrapped instances of <code>T</code> to be passed
|
||||
to wrapped C++ functions expecting <code>HeldType</code>
|
||||
"init.html#init-expressions">init-expression</a></em> passed to <a
|
||||
href="#class-spec-modifiers"><code>def(init_expr)</code></a>, below,
|
||||
nor is it passed explicitly by users when Python instances of
|
||||
<code>T</code> are created. This idiom allows C++ virtual functions
|
||||
which will be overridden in Python to access the Python object so the
|
||||
Python method can be invoked. Boost.Python automatically registers
|
||||
additional converters which allow wrapped instances of <code>T</code>
|
||||
to be passed to wrapped C++ functions expecting <code>HeldType</code>
|
||||
arguments.</li>
|
||||
|
||||
<li>Because Boost.Python will always allow wrapped instances of
|
||||
@@ -247,7 +212,7 @@
|
||||
namespace boost { namespace python
|
||||
{
|
||||
template <class T
|
||||
<font color="#007F00"> , class Bases = bases<>
|
||||
<font color="#007F00"> , class Bases = bases<>
|
||||
, class HeldType = T
|
||||
, class NonCopyable = <i>unspecified</i>
|
||||
>
|
||||
@@ -326,7 +291,7 @@ class_(char const* name, char const* docstring, Init init_spec);
|
||||
<a href="definitions.html#ntbs">ntbs</a>. If <code>init_spec</code> is
|
||||
supplied, it must be either the special enumeration constant
|
||||
<code>no_init</code> or an <a href=
|
||||
"#init-expression">init-expression</a> compatible with
|
||||
"init.html#init-expression">init-expression</a> compatible with
|
||||
<code>T</code>.</dt>
|
||||
|
||||
<dt><b>Effects:</b> Constructs a <code>class_</code> object holding a
|
||||
@@ -370,10 +335,10 @@ class_& def(Init init_expr);
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Requires:</b> <code>init_expr</code> is the result of an <a
|
||||
href="#init-expression">init-expression</a> compatible with
|
||||
href="init.html#init-expression">init-expression</a> compatible with
|
||||
<code>T</code>.</dt>
|
||||
|
||||
<dt><b>Effects:</b> For each <a href="#init-expressions">valid
|
||||
<dt><b>Effects:</b> For each <a href="init.html#init-expressions">valid
|
||||
prefix</a> <em>P</em> of <code>Init</code>, adds an
|
||||
<code>__init__(</code>...<code>)</code> function overload to the
|
||||
extension class accepting <em>P</em> as arguments. Each overload
|
||||
@@ -414,9 +379,9 @@ class_& def(char const* name, Fn fn, A1 const& a1, A2 const& a2, A3
|
||||
<li>
|
||||
If <code>a1</code> is the result of an <a href=
|
||||
"OverloadDispatch.html"><em>overload-dispatch-expression</em></a>,
|
||||
only the second is allowed and fn must be a pointer to
|
||||
function or pointer to member function whose signature is
|
||||
compatible with A1.
|
||||
only the second is allowed and fn must be a pointer to function
|
||||
or pointer to member function whose signature is compatible with
|
||||
A1.
|
||||
|
||||
<dl>
|
||||
<dt><b>Effects:</b> For each <a href=
|
||||
@@ -652,137 +617,6 @@ class_& def_pickle(PickleSuite const&);
|
||||
<br>
|
||||
|
||||
|
||||
<h3><a name="init-spec"></a>Class template <code>init<T1 =</code>
|
||||
<i>unspecified</i><code>, T2 =</code>
|
||||
<i>unspecified</i><code>,</code>...<code>Tn</code> =
|
||||
<i>unspecified</i><code>></code></h3>
|
||||
|
||||
<p>A <a href="../../../mpl/doc/ref/Sequences.html">MPL sequence</a> which
|
||||
can be used to specify a family of one or more <code>__init__</code>
|
||||
functions. Only the last <code>T</code><i><small>i</small></i> supplied
|
||||
may be an instantiation of <a href=
|
||||
"#optional-spec"><code>optional</code></a><code><</code>...<code>></code>.</p>
|
||||
|
||||
<h4><a name="init-spec-synopsis"></a>Class template <code>init</code>
|
||||
synopsis</h4>
|
||||
<pre>
|
||||
namespace boost { namespace python
|
||||
{
|
||||
template <T1 = <i>unspecified</i>,...T<i>n</i> = <i>unspecified</i>>
|
||||
struct init
|
||||
{
|
||||
init(char const* doc = 0);
|
||||
template <class Keywords> init(Keywords const& kw, char const* doc = 0);
|
||||
template <class Keywords> init(char const* doc, Keywords const& kw);
|
||||
|
||||
template <class CallPolicies>
|
||||
<em>unspecified</em> operator[](CallPolicies const& policies) const
|
||||
};
|
||||
}}
|
||||
</pre>
|
||||
|
||||
<h4><a name="init-spec-ctors"></a>Class template <code>init</code>
|
||||
constructors</h4>
|
||||
<pre>
|
||||
init(char const* doc = 0);
|
||||
template <class Keywords> init(Keywords const& kw, char const* doc = 0);
|
||||
template <class Keywords> init(char const* doc, Keywords const& kw);
|
||||
</pre>
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Requires:</b> If supplied, <code>doc</code> is an <a href=
|
||||
"definitions.html#ntbs">ntbs</a>. If supplied, <code>kw</code> is the
|
||||
result of a <a href="args.html#keyword-expression"></a></dt>
|
||||
|
||||
<dt><b>Effects:</b> The result is an <em>init-expression</em> whose
|
||||
<em>docstring</em> is <code>doc</code> and whose <em>keywords</em> are
|
||||
a reference to <code>kw</code>. If the first form is used, the
|
||||
resulting expression's <em>keywords</em> are empty. The expression's
|
||||
<em>call policies</em> are an instance of <a href=
|
||||
"default_call_policies.html#default_call_policies-spec">default_call_policies</a>.
|
||||
If <code>T</code><i><small>n</small></i> is <a href=
|
||||
"#optional-spec"><code>optional</code></a><code><U1, U2,</code>...
|
||||
<code>U</code><small><i>m</i></small><code>></code>, the
|
||||
expression's <em>valid prefixes</em> are given by:</dt>
|
||||
|
||||
<dd>
|
||||
<blockquote>
|
||||
(<code>T1, T2,</code>...<code>T</code><i><small>n-1</small></i>),
|
||||
(<code>T1, T2,</code>...<code>T</code><i><small>n-1</small></i>
|
||||
<code>, U1</code>),
|
||||
(<code>T1, T2,</code>...<code>T</code><i><small>n-1</small></i>
|
||||
<code>, U1, U2</code>),
|
||||
...(<code>T1, T2,</code>...<code>T</code><i><small>n-1</small></i>
|
||||
<code>, U1, U2,</code>...<code>U</code><i><small>m</small></i>).
|
||||
</blockquote>
|
||||
Otherwise, the expression has one <em>valid prefix</em> given by the
|
||||
the template arguments the user specified.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="init-spec-observers"></a>Class template <code>init</code>
|
||||
observer functions</h4>
|
||||
<pre>
|
||||
template <class Policies>
|
||||
<em>unspecified</em> operator[](Policies const& policies) const
|
||||
</pre>
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Requires:</b> Policies is a model of <a href=
|
||||
"CallPolicies.html">CallPolicies</a>.</dt>
|
||||
|
||||
<dt><b>Effects:</b> Returns a new <a href=
|
||||
"#init-expressions"><em>init-expression</em></a> with all the same
|
||||
properties as the <code>init</code> object except that its
|
||||
<em>call policies</em> are replaced by a reference to
|
||||
<code>policies</code>.</dt>
|
||||
</dl>
|
||||
|
||||
<h4><a name="init-expressions"><em>init-expressions</em></a></h4>
|
||||
An <em>init-expression</em> is a transport vehicle for the following
|
||||
properties, used to describe a family of <code>__init__</code> methods to
|
||||
be generated for an extension class:
|
||||
|
||||
<blockquote>
|
||||
<dl class="properties">
|
||||
<dt><b>docstring:</b> An <a href="definitions.html#ntbs">ntbs</a>
|
||||
whose value will bound to the method's <code>__doc__</code>
|
||||
attribute</dt>
|
||||
|
||||
<dt><b>keywords:</b> A <a href=
|
||||
"args.html#keyword-expression">keyword-expression</a> which will be
|
||||
used to name (a trailing subsequence of) the arguments to the
|
||||
generated <code>__init__</code> function(s).</dt>
|
||||
|
||||
<dt><b>call policies:</b> An instance of a model of <a href=
|
||||
"CallPolicies.html">CallPolicies</a>.</dt>
|
||||
|
||||
<dt><b>argument types:</b> An MPL sequence of C++ argument types
|
||||
which will be used to construct the wrapped C++ object. An init
|
||||
expression has one or more <b>valid prefixes</b> which are given by a
|
||||
sequence of prefixes of its argument types.</dt>
|
||||
</dl>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="optional-spec"></a>Class template <code>optional<T1
|
||||
=</code> <i>unspecified</i><code>, T2 =</code>
|
||||
<i>unspecified</i><code>,</code>...<code>Tn</code> =
|
||||
<i>unspecified</i><code>></code></h3>
|
||||
|
||||
<p>A <a href="../../../mpl/doc/ref/Sequences.html">MPL sequence</a> which
|
||||
can be used to specify the optional arguments to an <code>__init__</code>
|
||||
function.</p>
|
||||
|
||||
<h4><a name="optional-spec-synopsis"></a>Class template
|
||||
<code>optional</code> synopsis</h4>
|
||||
<pre>
|
||||
namespace boost { namespace python
|
||||
{
|
||||
template <T1 = <i>unspecified</i>,...T<i>n</i> = <i>unspecified</i>>
|
||||
struct optional {};
|
||||
}}
|
||||
</pre>
|
||||
|
||||
<h3><a name="bases-spec"></a>Class template
|
||||
<code>bases<T1, T2,</code>...<code>TN></code></h3>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user