In this section we describe the API that can be used by handwritten code in specification files.
SIP generates an opaque type structure for each C structure, C++ class, C++ namespace, named enum or mapped type being wrapped. These are :c:type:`sipTypeDef` structures and are used extensively by the SIP API.
The names of these structure are prefixed by sipType_.
For those structures that correspond to C structures, C++ classes, C++ namespaces or named enums the remaining part of the name is the fully qualified name of the structure, class, namespace or enum name. Any :: scope separators are replaced by an underscore. For example, the type object for class Klass is sipType_Klass.
For those structure that correspond to mapped types the remaining part of the name is generated by SIP. The only way for handwritten code to obtain a pointer to a structure for a mapped type is to use :c:func:`sipFindType()`.
The type structures of all imported types are available to handwritten code.
Deprecated since version 4.8: Use the corresponding generated type structure (see Generated Type Structures) and :c:func:`sipTypeAsPyTypeObject()` instead.
SIP generates a :c:type:`sipWrapperType` type object for each C structure or C++ class being wrapped.
These objects are named with the structure or class name prefixed by sipClass_. For example, the type object for class Klass is sipClass_Klass.
Deprecated since version 4.8: Use the corresponding generated type structure (see Generated Type Structures) and :c:func:`sipTypeAsPyTypeObject()` instead.
SIP generates a type object for each named enum being wrapped. These are PyTypeObject structures. (Anonymous enums are wrapped as Python integers.)
These objects are named with the fully qualified enum name (i.e. including any enclosing scope) prefixed by sipEnum_. For example, the type object for enum Enum defined in class Klass is sipEnum_Klass_Enum.
For most C++ classes being wrapped SIP generates a derived class with the same name prefixed by sip. For example, the derived class for class Klass is sipKlass.
If a C++ class doesn’t have any virtual or protected methods in it or any of it’s super-class hierarchy, or does not emit any Qt signals, then a derived class is not generated.
Most of the time handwritten code should ignore the derived classes. The only exception is that handwritten constructor code specified using the %MethodCode directive should call the derived class’s constructor (which has the same C++ signature) rather then the wrapped class’s constructor.
SIP generates a Python object for each exception defined with the %Exception directive.
These objects are named with the fully qualified exception name (i.e. including any enclosing scope) prefixed by sipException_. For example, the type object for enum Except defined in class Klass is sipException_Klass_Except.
The objects of all imported exceptions are available to handwritten code.