mirror of
https://github.com/boostorg/python.git
synced 2026-01-26 06:42:27 +00:00
@@ -14,7 +14,7 @@
|
||||
span.c3 {color: #ff0000}
|
||||
h2.c2 {text-align: center}
|
||||
h1.c1 {text-align: center}
|
||||
</style>
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -74,7 +74,6 @@
|
||||
<dt><a href="#allow_null-spec"><code>allow_null</code></a></dt>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
<hr>
|
||||
|
||||
@@ -91,13 +90,12 @@
|
||||
<p><code>handle</code> is a smart pointer to a Python object type; it
|
||||
holds a pointer of type <code>T*</code>, where T is its template
|
||||
parameter. <code>T</code> must be either a type derived from
|
||||
<code>PyObject</code> or a <a href="definitions.html#POD">POD</a>
|
||||
type whose initial <code>sizeof(PyObject)</code> bytes are
|
||||
layout-compatible with <code>PyObject</code>. Use
|
||||
<code>handle<></code> at the boundary between tehe
|
||||
Python/'C' API and high-level code; prefer <code><a
|
||||
<code>PyObject</code> or a <a href="definitions.html#POD">POD</a> type
|
||||
whose initial <code>sizeof(PyObject)</code> bytes are layout-compatible
|
||||
with <code>PyObject</code>. Use <code>handle<></code> at the
|
||||
boundary between tehe Python/'C' API and high-level code; prefer <code><a
|
||||
href="object.html#object-spec">object</a></code> for a generalized
|
||||
interface to Python objects.
|
||||
interface to Python objects.</p>
|
||||
|
||||
<p><a name="upcast"></a>In this document, the term "upcast" refers to an
|
||||
operation which converts a pointer <code>Y*</code> to a base class
|
||||
@@ -174,7 +172,8 @@ virtual ~handle();
|
||||
</pre>
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b> <code>Py_XDECREF(</code><i>upcast</i><code><PyObject*>(m_p))</code></dt>
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XDECREF(</code><i>upcast</i><code><PyObject*>(m_p))</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
template <class Y>
|
||||
@@ -182,8 +181,9 @@ explicit handle(detail::borrowed<null_ok<Y> >* p);
|
||||
</pre>
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p)); m_p = </code><i>upcast</i><code><T*>(p);</code></dt>
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p));
|
||||
m_p = </code><i>upcast</i><code><T*>(p);</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
template <class Y>
|
||||
@@ -192,7 +192,8 @@ explicit handle(null_ok<detail::borrowed<Y> >* p);
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p)); m_p = </code><i>upcast</i><code><T*>(p);</code></dt>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p));
|
||||
m_p = </code><i>upcast</i><code><T*>(p);</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
template <class Y>
|
||||
@@ -201,7 +202,8 @@ explicit handle(detail::borrowed<Y>* p);
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p)); m_p = </code><i>upcast</i><code><T*>(<a href=
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p));
|
||||
m_p = </code><i>upcast</i><code><T*>(<a href=
|
||||
"errors.html#expect_non_null-spec">expect_non_null</a>(p));</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
@@ -211,7 +213,7 @@ explicit handle(null_ok<Y>* p);
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p)); m_p = </code><i>upcast</i><code><T*>(p);</code></dt>
|
||||
<code>m_p = </code><i>upcast</i><code><T*>(p);</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
template <class Y>
|
||||
@@ -220,8 +222,7 @@ explicit handle(Y* p);
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(p)); m_p = </code><i>upcast</i><code><T*>(<a
|
||||
href=
|
||||
<code>m_p = </code><i>upcast</i><code><T*>(<a href=
|
||||
"errors.html#expect_non_null-spec">expect_non_null</a>(p));</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
@@ -252,7 +253,8 @@ handle& operator=(handle<Y> const & r); // never throws
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(r.m_p)); Py_XDECREF(</code><i>upcast</i><code><PyObject*>(m_p)); m_p = r.m_p;</code></dt>
|
||||
<code>Py_XINCREF(</code><i>upcast</i><code><PyObject*>(r.m_p)); Py_XDECREF(</code><i>
|
||||
upcast</i><code><PyObject*>(m_p)); m_p = r.m_p;</code></dt>
|
||||
</dl>
|
||||
<pre>
|
||||
T* release();
|
||||
@@ -262,13 +264,13 @@ T* release();
|
||||
<dt><b>Effects:</b> <code>T* x = m_p; m_p = 0;return
|
||||
x;</code></dt>
|
||||
</dl>
|
||||
|
||||
<pre>
|
||||
void reset();
|
||||
</pre>
|
||||
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Effects:</b> <code>*this = handle<T>();</code></dt>
|
||||
<dt><b>Effects:</b>
|
||||
<code>*this = handle<T>();</code></dt>
|
||||
</dl>
|
||||
|
||||
<h4><a name="handle-spec-observers">Class <code>handle</code>
|
||||
@@ -301,28 +303,26 @@ operator bool_type() const; // never throws
|
||||
|
||||
<h3><a name="borrowed-spec"></a><code>borrowed</code></h3>
|
||||
<pre>
|
||||
template <class T>
|
||||
detail::borrowed<T>* borrowed(T* p)
|
||||
template <class T>
|
||||
detail::borrowed<T>* borrowed(T* p)
|
||||
{
|
||||
return (detail::borrowed<T>*)p;
|
||||
return (detail::borrowed<T>*)p;
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3><a name="allow_null-spec"></a><code>allow_null</code></h3>
|
||||
|
||||
<pre>
|
||||
template <class T>
|
||||
null_ok<T>* allow_null(T* p)
|
||||
template <class T>
|
||||
null_ok<T>* allow_null(T* p)
|
||||
{
|
||||
return (null_ok<T>*)p;
|
||||
return (null_ok<T>*)p;
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
13 November, 2002
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
13 November, 2002
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
</p>
|
||||
|
||||
<p class="c4">© Copyright <a href=
|
||||
|
||||
Reference in New Issue
Block a user