⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sipref.html

📁 这是关于RFC3261实现sip的源代码
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<li><a class="reference" href="#sipconvertfromsliceobject" id="id160" name="id160">9.20&nbsp;&nbsp;&nbsp;sipConvertFromSliceObject()</a></li><li><a class="reference" href="#sipconverttocpp" id="id161" name="id161">9.21&nbsp;&nbsp;&nbsp;sipConvertToCpp()</a></li><li><a class="reference" href="#sipconverttoinstance" id="id162" name="id162">9.22&nbsp;&nbsp;&nbsp;sipConvertToInstance()</a></li><li><a class="reference" href="#sipconverttomappedtype" id="id163" name="id163">9.23&nbsp;&nbsp;&nbsp;sipConvertToMappedType()</a></li><li><a class="reference" href="#sipdisconnectrx" id="id164" name="id164">9.24&nbsp;&nbsp;&nbsp;sipDisconnectRx()</a></li><li><a class="reference" href="#sipemitsignal" id="id165" name="id165">9.25&nbsp;&nbsp;&nbsp;sipEmitSignal()</a></li><li><a class="reference" href="#sipfindmappedtype" id="id166" name="id166">9.26&nbsp;&nbsp;&nbsp;sipFindMappedType()</a></li><li><a class="reference" href="#sipforceconverttoinstance" id="id167" name="id167">9.27&nbsp;&nbsp;&nbsp;sipForceConvertToInstance()</a></li><li><a class="reference" href="#sipforceconverttomappedtype" id="id168" name="id168">9.28&nbsp;&nbsp;&nbsp;sipForceConvertToMappedType()</a></li><li><a class="reference" href="#sipfree" id="id169" name="id169">9.29&nbsp;&nbsp;&nbsp;sipFree()</a></li><li><a class="reference" href="#sipgetsender" id="id170" name="id170">9.30&nbsp;&nbsp;&nbsp;sipGetSender()</a></li><li><a class="reference" href="#sipgetwrapper" id="id171" name="id171">9.31&nbsp;&nbsp;&nbsp;sipGetWrapper()</a></li><li><a class="reference" href="#sipinttypeclassmap" id="id172" name="id172">9.32&nbsp;&nbsp;&nbsp;sipIntTypeClassMap</a></li><li><a class="reference" href="#sipissubclassinstance" id="id173" name="id173">9.33&nbsp;&nbsp;&nbsp;sipIsSubClassInstance()</a></li><li><a class="reference" href="#siplong-asunsignedlong" id="id174" name="id174">9.34&nbsp;&nbsp;&nbsp;sipLong_AsUnsignedLong()</a></li><li><a class="reference" href="#sipmalloc" id="id175" name="id175">9.35&nbsp;&nbsp;&nbsp;sipMalloc()</a></li><li><a class="reference" href="#sipmapinttoclass" id="id176" name="id176">9.36&nbsp;&nbsp;&nbsp;sipMapIntToClass()</a></li><li><a class="reference" href="#sipmapstringtoclass" id="id177" name="id177">9.37&nbsp;&nbsp;&nbsp;sipMapStringToClass()</a></li><li><a class="reference" href="#sipparseresult" id="id178" name="id178">9.38&nbsp;&nbsp;&nbsp;sipParseResult()</a></li><li><a class="reference" href="#sipreleaseinstance" id="id179" name="id179">9.39&nbsp;&nbsp;&nbsp;sipReleaseInstance()</a></li><li><a class="reference" href="#sipreleasemappedtype" id="id180" name="id180">9.40&nbsp;&nbsp;&nbsp;sipReleaseMappedType()</a></li><li><a class="reference" href="#sipstringtypeclassmap" id="id181" name="id181">9.41&nbsp;&nbsp;&nbsp;sipStringTypeClassMap</a></li><li><a class="reference" href="#siptransfer" id="id182" name="id182">9.42&nbsp;&nbsp;&nbsp;sipTransfer()</a></li><li><a class="reference" href="#siptransferback" id="id183" name="id183">9.43&nbsp;&nbsp;&nbsp;sipTransferBack()</a></li><li><a class="reference" href="#siptransferto" id="id184" name="id184">9.44&nbsp;&nbsp;&nbsp;sipTransferTo()</a></li><li><a class="reference" href="#sipwrapper" id="id185" name="id185">9.45&nbsp;&nbsp;&nbsp;sipWrapper</a></li><li><a class="reference" href="#sipwrapper-check" id="id186" name="id186">9.46&nbsp;&nbsp;&nbsp;sipWrapper_Check()</a></li><li><a class="reference" href="#sipwrappertype" id="id187" name="id187">9.47&nbsp;&nbsp;&nbsp;sipWrapperType</a></li><li><a class="reference" href="#generated-type-convertors" id="id188" name="id188">9.48&nbsp;&nbsp;&nbsp;Generated Type Convertors</a></li><li><a class="reference" href="#generated-type-objects" id="id189" name="id189">9.49&nbsp;&nbsp;&nbsp;Generated Type Objects</a></li><li><a class="reference" href="#generated-named-enum-type-objects" id="id190" name="id190">9.50&nbsp;&nbsp;&nbsp;Generated Named Enum Type Objects</a></li><li><a class="reference" href="#generated-derived-classes" id="id191" name="id191">9.51&nbsp;&nbsp;&nbsp;Generated Derived Classes</a></li><li><a class="reference" href="#generated-exception-objects" id="id192" name="id192">9.52&nbsp;&nbsp;&nbsp;Generated Exception Objects</a></li></ul></li><li><a class="reference" href="#using-the-sip-module-in-applications" id="id193" name="id193">10&nbsp;&nbsp;&nbsp;Using the SIP Module in Applications</a></li><li><a class="reference" href="#the-sip-build-system" id="id194" name="id194">11&nbsp;&nbsp;&nbsp;The SIP Build System</a><ul class="auto-toc"><li><a class="reference" href="#sipconfig-functions" id="id195" name="id195">11.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">sipconfig</span></tt> Functions</a></li><li><a class="reference" href="#sipconfig-classes" id="id196" name="id196">11.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">sipconfig</span></tt> Classes</a></li></ul></li><li><a class="reference" href="#building-your-extension-with-distutils" id="id197" name="id197">12&nbsp;&nbsp;&nbsp;Building Your Extension with distutils</a></li><li><a class="reference" href="#builtin-modules-and-custom-interpreters" id="id198" name="id198">13&nbsp;&nbsp;&nbsp;Builtin Modules and Custom Interpreters</a></li></ul></div><div class="section" id="introduction"><h1><a class="toc-backref" href="#id22" name="introduction">1&nbsp;&nbsp;&nbsp;Introduction</a></h1><p>This is the reference guide for SIP 4.4.3.  SIP is a tool forautomatically generating <a class="reference" href="http://www.python.org">Python</a> bindings for C andC++ libraries.  SIP was originally developed in 1998 for<a class="reference" href="http://www.riverbankcomputing.co.uk/pyqt/">PyQt</a> - the Python bindings forthe Qt GUI toolkit - but is suitable for generating bindings for any C or C++library.</p><p>This version of SIP generates bindings for Python v2.3 or later.  If you wantto generate bindings for earlier versions of Python (going back as far asPython v1.5) then you need to use <a class="reference" href="#sip-v3-x">SIP v3.x</a>.</p><p>There are many other similar tools available.  One of the original such toolsis <a class="reference" href="http://www.swig.org">SWIG</a> and, in fact, SIP is so called because itstarted out as a small SWIG.  Unlike SWIG, SIP is specifically designed forbringing together Python and C/C++ and goes to great lengths to make theintegration as tight as possible.</p><p>The homepage for SIP is <a class="reference" href="http://www.riverbankcomputing.co.uk/sip/">http://www.riverbankcomputing.co.uk/sip/</a>.  Here youwill always find the latest stable version, current development snapshots, andthe latest version of this documentation.</p><div class="section" id="license"><h2><a class="toc-backref" href="#id23" name="license">1.1&nbsp;&nbsp;&nbsp;License</a></h2><p>SIP is licensed under the same terms as Python itself.  SIP places norestrictions on the license you may apply to the bindings you create.</p></div><div class="section" id="features"><h2><a class="toc-backref" href="#id24" name="features">1.2&nbsp;&nbsp;&nbsp;Features</a></h2><p>SIP, and the bindings it produces, have the following features.</p><blockquote><ul class="simple"><li>bindings are fast to load and minimise memory consumption especially whenonly a small sub-set of a large library is being used</li><li>automatic conversion between standard Python and C/C++ data types</li><li>overloading of functions and methods with different argument signatures</li><li>access to a C++ class's protected methods</li><li>the ability to define a Python class that is a sub-class of a C++ class,including abstract C++ classes</li><li>support for ordinary C++ functions, class methods, static class methods,virtual class methods and abstract class methods</li><li>the ability to re-implement C++ virtual and abstract methods in Python</li><li>support for global and class variables</li><li>support for global and class operators</li><li>support for C++ namespaces</li><li>support for C++ templates</li><li>support for C++ exceptions and wrapping them as Python exceptions</li><li>the ability to define mappings between C++ classes and similar Pythondata types that are automatically invoked</li><li>the ability to automatically exploit any available run time typeinformation to ensure that the class of a Python instance object matchesthe class of the corresponding C++ instance</li><li>full support of the Python global interpreter lock, including the abilityto specify that a C++ function of method may block, therefore allowingthe lock to be released and other Python threads to run</li><li>support for the concept of ownership of a C++ instance (i.e. what part ofthe code is responsible for calling the instance's destructor) and howthe ownership may change during the execution of an application</li><li>the ability to generate bindings for a C++ class library that itself isbuilt on another C++ class library which also has had bindings generatedso that the different bindings integrate and share code properly</li><li>a sophisticated versioning system that allows the full lifetime of a C++class library, including any platform specific or optional features, tobe described in a single set of specification files</li><li>the ability to include documentation in the specification files which canbe extracted and subsequently processed by external tools</li><li>the ability to include copyright notices and licensing information in thespecification files that is automatically included in all generatedsource code</li><li>a build system, written in Python, that you can extend to configure,compile and install your own bindings without worrying about platformspecific issues</li><li>support for building your extensions using distutils</li><li>SIP, and the bindings it produces, runs under UNIX, Linux, Windows andMacOS/X</li></ul></blockquote></div><div class="section" id="sip-v3-x"><h2><a class="toc-backref" href="#id25" name="sip-v3-x">1.3&nbsp;&nbsp;&nbsp;SIP v3.x</a></h2><p>SIP v3.x differs from current versions in the following respects.</p><blockquote><ul class="simple"><li>It uses Python's classic classes to wrap C++ classes (and so generatedbindings can be built against any version of Python).</li><li>It does not support the creation of bindings for C libraries.</li><li>It does not generate bindings that will work on MacOS/X.</li><li>It is not formally documented.  However, most of this document doesapply to SIP v3.x - just don't be surprised if you come across somethingthat doesn't.</li></ul></blockquote><p>New releases of SIP v3.x may be made in the future, but no significantdevelopment will be done.</p></div><div class="section" id="sip-components"><h2><a class="toc-backref" href="#id26" name="sip-components">1.4&nbsp;&nbsp;&nbsp;SIP Components</a></h2><p>SIP comprises a number of different components.</p><blockquote><ul class="simple"><li>The SIP code generator (<tt class="docutils literal"><span class="pre">sip</span></tt> or <tt class="docutils literal"><span class="pre">sip.exe</span></tt>).  This processes <tt class="docutils literal"><span class="pre">.sip</span></tt>specification files and generates C or C++ bindings.  It is covered indetail in <a class="reference" href="#using-sip">Using SIP</a>.</li><li>The SIP header file (<tt class="docutils literal"><span class="pre">sip.h</span></tt>).  This contains definitions and datastructures needed by the generated C and C++ code.</li><li>The SIP module (<tt class="docutils literal"><span class="pre">sip.so</span></tt> or <tt class="docutils literal"><span class="pre">sip.pyd</span></tt>).  This is a Python extensionmodule that is imported automatically by SIP generated bindings andprovides them with some common utility functions.  See also <a class="reference" href="#using-the-sip-module-in-applications">Using theSIP Module in Applications</a>.</li><li>The SIP build system (<tt class="docutils literal"><span class="pre">sipconfig.py</span></tt>).  This is a pure Python modulethat is created when SIP is configured and encapsulates all the necessaryinformation about your system including relevant directory names,compiler and linker flags, and version numbers.  It also includes severalPython classes and functions which help you write configuration scriptsfor your own bindings.  It is covered in detail in <a class="reference" href="#the-sip-build-system">The SIP BuildSystem</a>.</li><li>The SIP distutils extension (<tt class="docutils literal"><span class="pre">sipdistutils.py</span></tt>).  This is a distutilsextension that can be used to build your extension modules usingdistutils and is an alternative to writing configuration scripts with theSIP build system.  This can be as simple as adding your .sip files to thelist of files needed to build the extension module.  It is covered indetail in <a class="reference" href="#building-your-extension-with-distutils">Building Your Extension with distutils</a>.</li></ul></blockquote></div><div class="section" id="qt-support"><h2><a class="toc-backref" href="#id27" name="qt-support">1.5&nbsp;&nbsp;&nbsp;Qt Support</a></h2><p>SIP has specific support for the creation of bindings based on Trolltech's Qttoolkit.</p><p>The SIP code generator understands the signal/slot type safe callback mechanismthat Qt uses to connect objects together.  This allows applications to definenew Python signals, and allows any Python callable object to be used as a slot.</p><p>SIP itself does not require Qt to be installed.</p></div></div><div class="section" id="potential-incompatibilities-with-earlier-versions"><h1><a class="toc-backref" href="#id28" name="potential-incompatibilities-with-earlier-versions">2&nbsp;&nbsp;&nbsp;Potential Incompatibilities with Earlier Versions</a></h1><div class="section" id="sip-v4-4"><h2><a class="toc-backref" href="#id29" name="sip-v4-4">2.1&nbsp;&nbsp;&nbsp;SIP v4.4</a></h2><blockquote><ul class="simple"><li>The <tt class="docutils literal"><span class="pre">SIP_BUILD</span></tt> C preprocessor symbol has been removed.</li><li><a class="reference" href="#sipconverttocpp">sipConvertToCpp()</a>, <a class="reference" href="#sipissubclassinstance">sipIsSubClassInstance()</a> and the old <a class="reference" href="#generated-type-convertors">GeneratedType Convertors</a> have been deprecated.  The functions<a class="reference" href="#sipcanconverttoinstance">sipCanConvertToInstance()</a>, <a class="reference" href="#sipconverttoinstance">sipConvertToInstance()</a>,<a class="reference" href="#sipforceconverttoinstance">sipForceConvertToInstance()</a>, <a class="reference" href="#sipconvertfrominstance">sipConvertFromInstance()</a>,<a class="reference" href="#sipconvertfromnewinstance">sipConvertFromNewInstance()</a>, <a class="reference" href="#sipcanconverttomappedtype">sipCanConvertToMappedType()</a>,<a class="reference" href="#sipconverttomappedtype">sipConvertToMappedType()</a>, <a class="reference" href="#sipforceconverttomappedtype">sipForceConvertToMappedType()</a> and<a class="reference" href="#sipconvertfrommappedtype">sipConvertFromMappedType()</a> should be used instead.  Handwritten<a class="reference" href="#convertfromtypecode">%ConvertFromTypeCode</a> and <a class="reference" href="#converttotypecode">%ConvertToTypeCode</a> now has theresponsibility for using these to implement the <tt class="docutils literal"><span class="pre">Transfer</span></tt> and<tt class="docutils literal"><span class="pre">TransferBack</span></tt> annotations.</li></ul></blockquote></div></div><div class="section" id="installing-sip">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -