Chapter 5. SIPLIB Functions

Table of Contents
Public Support Functions
Private Functions

Public Support Functions

To use the SIPLIB functions described here, include sip.h. The source of these functions is in siplib.c.

Information functions

Table of Contents
sipGetCppPtr — Get the C/C++ pointer from a wrapper and cast it to the required type
sipGetComplexCppPtr — Get the C/C++ pointer for a complex object
sipGetThisWrapper — Convert a C/C++ pointer to the object that wraps it
sipIsSubClassInstance — See if a Python object is an instance of a sub-class of a given base class

sipGetCppPtr

Name

sipGetCppPtr -- Get the C/C++ pointer from a wrapper and cast it to the required type

Synopsis

const void * sipGetCppPtr(sipThisType * w, PyObject * toClass);

Description

Return Value

A pointer to the appropriate C++ class or NULL in case of an error.

w

A pointer to SIPs info about the Python object.

toClass

A pointer to the Python object.

Examples

See here.


sipGetComplexCppPtr

Name

sipGetComplexCppPtr -- Get the C/C++ pointer for a complex object

Synopsis

const void * sipGetComplexCppPtr(sipThisType * w);

Description

No access to protected functions or signals for object not created from Python.

Return Value

A pointer to the appropriate C++ class or NULL in case of an error.

w

A pointer to SIPs info about the Python object.

Remarks

$$$ What's the full story about this? When are classes complex?


sipGetThisWrapper

Name

sipGetThisWrapper -- Convert a C/C++ pointer to the object that wraps it

Synopsis

sipThisType * sipGetThisWrapper(const void * cppPtr, PyObject * pyClass);

Description

Return Value

Return the wrapped Python object or NULL if it wasn't found.

cppPtr

The C++ pointer, used as a key to SIPs object map.

pyClass

if the wrapped object is a sub-class of the given pyClass then we assume we are returning the value of something like QObject::parent() where the parent is something like a QLabel.

sipIsSubClassInstance

Name

sipIsSubClassInstance -- See if a Python object is an instance of a sub-class of a given base class

Synopsis

int sipIsSubClassInstance(PyObject * inst, PyObject * baseclass);

Description

Return Value

True if Python object inst is an instance of a sub-class of baseclass, else false.

inst

Pointer to the Python object instance.

baseclass

Pointer to the Python base class.