You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
528 lines
26 KiB
528 lines
26 KiB
13 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
|
||
|
<title>Python API for Applications — SIP 4.10.5 Reference Guide</title>
|
||
|
<link rel="stylesheet" href="_static/default.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
|
<script type="text/javascript">
|
||
|
var DOCUMENTATION_OPTIONS = {
|
||
|
URL_ROOT: '#',
|
||
|
VERSION: '4.10.5',
|
||
|
COLLAPSE_MODINDEX: false,
|
||
|
FILE_SUFFIX: '.html',
|
||
|
HAS_SOURCE: true
|
||
|
};
|
||
|
</script>
|
||
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
||
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
||
|
<link rel="top" title="SIP 4.10.5 Reference Guide" href="index.html" />
|
||
|
<link rel="next" title="The Build System" href="build_system.html" />
|
||
|
<link rel="prev" title="Using the C API when Embedding" href="embedding.html" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="related">
|
||
|
<h3>Navigation</h3>
|
||
|
<ul>
|
||
|
<li class="right" style="margin-right: 10px">
|
||
|
<a href="genindex.html" title="General Index"
|
||
|
accesskey="I">index</a></li>
|
||
|
<li class="right" >
|
||
|
<a href="modindex.html" title="Global Module Index"
|
||
|
accesskey="M">modules</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="build_system.html" title="The Build System"
|
||
|
accesskey="N">next</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="embedding.html" title="Using the C API when Embedding"
|
||
|
accesskey="P">previous</a> |</li>
|
||
|
<li><a href="index.html">SIP 4.10.5 Reference Guide</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<div class="document">
|
||
|
<div class="documentwrapper">
|
||
|
<div class="bodywrapper">
|
||
|
<div class="body">
|
||
|
|
||
|
<div class="section" id="module-sip">
|
||
|
<span id="ref-python-api"></span><h1>Python API for Applications<a class="headerlink" href="#module-sip" title="Permalink to this headline">¶</a></h1>
|
||
|
<p>The main purpose of the <tt class="xref docutils literal"><span class="pre">sip</span></tt> module is to provide functionality common to
|
||
|
all SIP generated bindings. It is loaded automatically and most of the time
|
||
|
you will completely ignore it. However, it does expose some functionality that
|
||
|
can be used by applications.</p>
|
||
|
<dl class="function">
|
||
|
<dt id="sip.cast">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">cast</tt><big>(</big><em>obj</em>, <em>type</em><big>)</big> → object<a class="headerlink" href="#sip.cast" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This does the Python equivalent of casting a C++ instance to one of its
|
||
|
sub or super-class types.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||
|
<li><em>obj</em> – the Python object.</li>
|
||
|
<li><em>type</em> – the type.</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a new Python object is that wraps the same C++ instance as <em>obj</em>, but
|
||
|
has the type <em>type</em>.</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.delete">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">delete</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#sip.delete" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>For C++ instances this calls the C++ destructor. For C structures it
|
||
|
returns the structure’s memory to the heap.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>obj</em> – the Python object.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.dump">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">dump</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#sip.dump" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This displays various bits of useful information about the internal state
|
||
|
of the Python object that wraps a C++ instance or C structure.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>obj</em> – the Python object.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.getapi">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">getapi</tt><big>(</big><em>name</em><big>)</big> → version<a class="headerlink" href="#sip.getapi" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>
|
||
|
<span class="versionmodified">New in version 4.9.</span></p>
|
||
|
<p>This returns the version number that has been set for an API. The version
|
||
|
number is either set explicitly by a call to <a title="sip.setapi" class="reference internal" href="#sip.setapi"><tt class="xref docutils literal"><span class="pre">sip.setapi()</span></tt></a> or
|
||
|
implicitly by importing the module that defines it.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>name</em> – the name of the API.</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">The version number that has been set for the API. An exception will
|
||
|
be raised if the API is unknown.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.isdeleted">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">isdeleted</tt><big>(</big><em>obj</em><big>)</big> → bool<a class="headerlink" href="#sip.isdeleted" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This checks if the C++ instance or C structure has been deleted and
|
||
|
returned to the heap.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>obj</em> – the Python object.</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if the C/C++ instance has been deleted.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.ispyowned">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">ispyowned</tt><big>(</big><em>obj</em><big>)</big> → bool<a class="headerlink" href="#sip.ispyowned" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This checks if the C++ instance or C structure is owned by Python.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>obj</em> – the Python object.</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if the C/C++ instance is owned by Python.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.setapi">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">setapi</tt><big>(</big><em>name</em>, <em>version</em><big>)</big><a class="headerlink" href="#sip.setapi" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>
|
||
|
<span class="versionmodified">New in version 4.9.</span></p>
|
||
|
<p>This sets the version number of an API. An exception is raised if a
|
||
|
different version number has already been set, either explicitly by a
|
||
|
previous call, or implicitly by importing the module that defines it.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||
|
<li><em>name</em> – the name of the API.</li>
|
||
|
<li><em>version</em> – The version number to set for the API. Version numbers must be
|
||
|
greater than or equal to 1.</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.setdeleted">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">setdeleted</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#sip.setdeleted" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This marks the C++ instance or C structure as having been deleted and
|
||
|
returned to the heap so that future references to it raise an exception
|
||
|
rather than cause a program crash. Normally SIP handles such things
|
||
|
automatically, but there may be circumstances where this isn’t possible.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>obj</em> – the Python object.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.settracemask">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">settracemask</tt><big>(</big><em>mask</em><big>)</big><a class="headerlink" href="#sip.settracemask" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>If the bindings have been created with SIP’s <a class="reference external" href="command_line.html#cmdoption-sip-r"><em class="xref">-r</em></a> command
|
||
|
line option then the generated code will include debugging statements that
|
||
|
trace the execution of the code. (It is particularly useful when trying to
|
||
|
understand the operation of a C++ library’s virtual function calls.)</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>mask</em> – the mask that determines which debugging statements are enabled.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>Debugging statements are generated at the following points:</p>
|
||
|
<ul class="simple">
|
||
|
<li>in a C++ virtual function (<em>mask</em> is <tt class="docutils literal"><span class="pre">0x0001</span></tt>)</li>
|
||
|
<li>in a C++ constructor (<em>mask</em> is <tt class="docutils literal"><span class="pre">0x0002</span></tt>)</li>
|
||
|
<li>in a C++ destructor (<em>mask</em> is <tt class="docutils literal"><span class="pre">0x0004</span></tt>)</li>
|
||
|
<li>in a Python type’s __init__ method (<em>mask</em> is <tt class="docutils literal"><span class="pre">0x0008</span></tt>)</li>
|
||
|
<li>in a Python type’s __del__ method (<em>mask</em> is <tt class="docutils literal"><span class="pre">0x0010</span></tt>)</li>
|
||
|
<li>in a Python type’s ordinary method (<em>mask</em> is <tt class="docutils literal"><span class="pre">0x0020</span></tt>).</li>
|
||
|
</ul>
|
||
|
<p>By default the trace mask is zero and all debugging statements are
|
||
|
disabled.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="data">
|
||
|
<dt id="sip.SIP_VERSION">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">SIP_VERSION</tt><a class="headerlink" href="#sip.SIP_VERSION" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd>This is a Python integer object that represents the SIP version number as
|
||
|
a 3 part hexadecimal number (e.g. v4.0.0 is represented as <tt class="docutils literal"><span class="pre">0x040000</span></tt>).
|
||
|
It was first implemented in SIP v4.2.</dd></dl>
|
||
|
|
||
|
<dl class="data">
|
||
|
<dt id="sip.SIP_VERSION_STR">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">SIP_VERSION_STR</tt><a class="headerlink" href="#sip.SIP_VERSION_STR" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd>This is a Python string object that defines the SIP version number as
|
||
|
represented as a string. For development snapshots it will start with
|
||
|
<tt class="docutils literal"><span class="pre">snapshot-</span></tt>. It was first implemented in SIP v4.3.</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.transferback">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">transferback</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#sip.transferback" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd>This function is a wrapper around <a title="sipTransferBack" class="reference external" href="c_api.html#sipTransferBack"><tt class="xref docutils literal"><span class="pre">sipTransferBack()</span></tt></a>.</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.transferto">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">transferto</tt><big>(</big><em>obj</em>, <em>owner</em><big>)</big><a class="headerlink" href="#sip.transferto" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd>This function is a wrapper around <a title="sipTransferTo" class="reference external" href="c_api.html#sipTransferTo"><tt class="xref docutils literal"><span class="pre">sipTransferTo()</span></tt></a>.</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.unwrapinstance">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">unwrapinstance</tt><big>(</big><em>obj</em><big>)</big> → integer<a class="headerlink" href="#sip.unwrapinstance" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns the address, as an integer, of a wrapped C/C++ structure or
|
||
|
class instance.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>obj</em> – the Python object.</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an integer that is the address of the C/C++ instance.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="class">
|
||
|
<dt id="sip.voidptr">
|
||
|
<em class="property">class </em><tt class="descclassname">sip.</tt><tt class="descname">voidptr</tt><a class="headerlink" href="#sip.voidptr" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This is the type object for the type SIP uses to represent a C/C++
|
||
|
<tt class="docutils literal"><span class="pre">void</span> <span class="pre">*</span></tt>. It may have a size associated with the address in which case
|
||
|
the Python buffer protocol is supported. This means that the memory can
|
||
|
be treated as a mutable array of bytes when wrapped with the <tt class="docutils literal"><span class="pre">buffer()</span></tt>
|
||
|
builtin. The type has the following methods.</p>
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.__init__">
|
||
|
<tt class="descname">__init__</tt><big>(</big><em>address</em><span class="optional">[</span>, <em>size=-1</em><span class="optional">[</span>, <em>writeable=True</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#sip.voidptr.__init__" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||
|
<li><em>address</em> – the address, either another <a title="sip.voidptr" class="reference internal" href="#sip.voidptr"><tt class="xref docutils literal"><span class="pre">sip.voidptr</span></tt></a>, <tt class="xref docutils literal"><span class="pre">None</span></tt>, a
|
||
|
Python Capsule, a Python CObject, or an integer.</li>
|
||
|
<li><em>size</em> – the optional associated size of the block of memory and is negative
|
||
|
if the size is not known.</li>
|
||
|
<li><em>writeable</em> – set if the memory is writeable. If it is not specified, and
|
||
|
<em>address</em> is a <a title="sip.voidptr" class="reference internal" href="#sip.voidptr"><tt class="xref docutils literal"><span class="pre">sip.voidptr</span></tt></a> instance then its value will be
|
||
|
used.</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.__int__">
|
||
|
<tt class="descname">__int__</tt><big>(</big><big>)</big> → integer<a class="headerlink" href="#sip.voidptr.__int__" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns the address as an integer.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the integer address.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.__hex__">
|
||
|
<tt class="descname">__hex__</tt><big>(</big><big>)</big> → string<a class="headerlink" href="#sip.voidptr.__hex__" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns the address as a hexadecimal string.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the hexadecimal string address.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.ascapsule">
|
||
|
<tt class="descname">ascapsule</tt><big>(</big><big>)</big> → capsule<a class="headerlink" href="#sip.voidptr.ascapsule" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>
|
||
|
<span class="versionmodified">New in version 4.10.</span></p>
|
||
|
<p>This returns the address as an unnamed Python Capsule. This requires
|
||
|
Python v3.1 or later or Python v2.7 or later.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the Capsule.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.ascobject">
|
||
|
<tt class="descname">ascobject</tt><big>(</big><big>)</big> → cObject<a class="headerlink" href="#sip.voidptr.ascobject" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns the address as a Python CObject. This is deprecated with
|
||
|
Python v3.1 or later.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the CObject.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.asstring">
|
||
|
<tt class="descname">asstring</tt><big>(</big><span class="optional">[</span><em>size=-1</em><span class="optional">]</span><big>)</big> → string/bytes<a class="headerlink" href="#sip.voidptr.asstring" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns a copy of the block of memory as a Python v2 string object
|
||
|
or a Python v3 bytes object.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>size</em> – the number of bytes to copy. If it is negative then the size
|
||
|
associated with the address is used. If there is no associated
|
||
|
size then an exception is raised.</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the string or bytes object.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.getsize">
|
||
|
<tt class="descname">getsize</tt><big>(</big><big>)</big> → integer<a class="headerlink" href="#sip.voidptr.getsize" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns the size associated with the address.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the associated size which will be negative if there is none.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.setsize">
|
||
|
<tt class="descname">setsize</tt><big>(</big><em>size</em><big>)</big><a class="headerlink" href="#sip.voidptr.setsize" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This sets the size associated with the address.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>size</em> – the size to associate. If it is negative then no size is
|
||
|
associated.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.getwriteable">
|
||
|
<tt class="descname">getwriteable</tt><big>(</big><big>)</big> → bool<a class="headerlink" href="#sip.voidptr.getwriteable" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This returns the writeable state of the memory.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if the memory is writeable.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="sip.voidptr.setwriteable">
|
||
|
<tt class="descname">setwriteable</tt><big>(</big><em>writeable</em><big>)</big><a class="headerlink" href="#sip.voidptr.setwriteable" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This sets the writeable state of the memory.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>writeable</em> – the writeable state to set.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="sip.wrapinstance">
|
||
|
<tt class="descclassname">sip.</tt><tt class="descname">wrapinstance</tt><big>(</big><em>addr</em>, <em>type</em><big>)</big> → object<a class="headerlink" href="#sip.wrapinstance" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd><p>This wraps a C structure or C++ class instance in a Python object. If the
|
||
|
instance has already been wrapped then a new reference to the existing
|
||
|
object is returned.</p>
|
||
|
<table class="docutils field-list" frame="void" rules="none">
|
||
|
<col class="field-name" />
|
||
|
<col class="field-body" />
|
||
|
<tbody valign="top">
|
||
|
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||
|
<li><em>addr</em> – the address of the instance as a number.</li>
|
||
|
<li><em>type</em> – the Python type of the instance.</li>
|
||
|
</ul>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the Python object that wraps the instance.</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="class">
|
||
|
<dt id="sip.wrapper">
|
||
|
<em class="property">class </em><tt class="descclassname">sip.</tt><tt class="descname">wrapper</tt><a class="headerlink" href="#sip.wrapper" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd>This is the type object of the base type of all instances wrapped by SIP.</dd></dl>
|
||
|
|
||
|
<dl class="class">
|
||
|
<dt id="sip.wrappertype">
|
||
|
<em class="property">class </em><tt class="descclassname">sip.</tt><tt class="descname">wrappertype</tt><a class="headerlink" href="#sip.wrappertype" title="Permalink to this definition">¶</a></dt>
|
||
|
<dd>This is the type object of the metatype of the <a title="sip.wrapper" class="reference internal" href="#sip.wrapper"><tt class="xref docutils literal"><span class="pre">sip.wrapper</span></tt></a> type.</dd></dl>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="sphinxsidebar">
|
||
|
<div class="sphinxsidebarwrapper">
|
||
|
<h4>Previous topic</h4>
|
||
|
<p class="topless"><a href="embedding.html"
|
||
|
title="previous chapter">Using the C API when Embedding</a></p>
|
||
|
<h4>Next topic</h4>
|
||
|
<p class="topless"><a href="build_system.html"
|
||
|
title="next chapter">The Build System</a></p>
|
||
|
<div id="searchbox" style="display: none">
|
||
|
<h3>Quick search</h3>
|
||
|
<form class="search" action="search.html" method="get">
|
||
|
<input type="text" name="q" size="18" />
|
||
|
<input type="submit" value="Go" />
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
<p class="searchtip" style="font-size: 90%">
|
||
|
Enter search terms or a module, class or function name.
|
||
|
</p>
|
||
|
</div>
|
||
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearer"></div>
|
||
|
</div>
|
||
|
<div class="related">
|
||
|
<h3>Navigation</h3>
|
||
|
<ul>
|
||
|
<li class="right" style="margin-right: 10px">
|
||
|
<a href="genindex.html" title="General Index"
|
||
|
>index</a></li>
|
||
|
<li class="right" >
|
||
|
<a href="modindex.html" title="Global Module Index"
|
||
|
>modules</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="build_system.html" title="The Build System"
|
||
|
>next</a> |</li>
|
||
|
<li class="right" >
|
||
|
<a href="embedding.html" title="Using the C API when Embedding"
|
||
|
>previous</a> |</li>
|
||
|
<li><a href="index.html">SIP 4.10.5 Reference Guide</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer">
|
||
|
© Copyright 2010 Riverbank Computing Limited.
|
||
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|