Shiboken Namespace

Root namespace for everything that is not extern "C". More...

Header: #include <autodecref.h>

Namespaces

namespace Buffer
namespace Conversions
namespace Enum
namespace Errors
namespace Messages
namespace Module
namespace Numpy
namespace Object
namespace ObjectType
namespace PyMagicName
namespace PyName
namespace String
namespace Warnings

Classes

Functions

PyTypeObject *SbkType()
void callCppDestructor(void *cptr)
void deleteArgv(int argc, char **argv)
void init()
void initShibokenSupport(PyObject *module)
bool isCompiled()
bool isCompiledMethod(PyObject *method)
bool listToArgcArgv(PyObject *argList, int *argcIn, char ***argvIn, const char *defaultAppName = nullptr)
bool parseConstructorKeywordArguments(PyObject *kwds, const Shiboken::ArgumentNameIndexMapping *mapping, size_t size, Shiboken::AutoDecRef &errInfo, PyObject **pyArgs)
bool parseKeywordArguments(PyObject *kwds, const Shiboken::ArgumentNameIndexMapping *mapping, size_t size, Shiboken::AutoDecRef &errInfo, PyObject **pyArgs)
PyObject *returnFromRichCompare(PyObject *result)
int *sequenceToIntArray(PyObject *obj, bool zeroTerminated = false)
void setErrorAboutWrongArguments(PyObject *args, const char *funcName, PyObject *info, const char *className = nullptr)
const char *typeNameOf(const char *typeIdName)
int warning(PyObject *category, int stacklevel, const char *format, ...)

Detailed Description

Namespaces

namespace Shiboken::Buffer

namespace Shiboken::Conversions

namespace Shiboken::Enum

namespace Shiboken::Errors

namespace Shiboken::Messages

namespace Shiboken::Module

namespace Shiboken::Numpy

namespace Shiboken::Object

namespace Shiboken::ObjectType

namespace Shiboken::PyMagicName

namespace Shiboken::PyName

namespace Shiboken::String

namespace Shiboken::Warnings

Classes

class ArgumentNameIndexMapping

Maps a keyword argument by name to its parameter index. More...

class ArrayPointer

Creates and automatically deallocates C++ arrays. More...

class AutoDecRef

AutoDecRef holds a PyObject pointer and decrements its reference counter when destroyed. More...

class BindingManager

Maintains a set of wrappers. More...

class DestructorEntry

Data required to invoke a C++ destructor. More...

class GilState

RAII wrapper around the global interpreter lock (GIL). More...

class PyObjectHolder

Keeps a reference to a PyObject. More...

class ThreadStateSaver

RAII wrapper around PyEval_SaveThread()/PyEval_RestoreThread(). More...

Function Documentation

template <typename T> PyTypeObject *Shiboken::SbkType()

This function template is used to get the PyTypeObject of a C++ type T. All implementations should be provided by template specializations generated by the generator when T isn't a C++ primitive type.

template <typename T> void Shiboken::callCppDestructor(void *cptr)

Deletes the instance of class T allocated on cptr.

void Shiboken::deleteArgv(int argc, char **argv)

Deletes a list of arguments argv of size argc created by listToArgcArgv().

void Shiboken::init()

Initializes the shiboken library.

void Shiboken::initShibokenSupport(PyObject *module)

PYSIDE-1415: Publishes Shiboken objects in module.

bool Shiboken::isCompiled()

Returns whether we are running in compiled mode (Nuitka).

bool Shiboken::isCompiledMethod(PyObject *method)

Returns whether method is a compiled method (Nuitka).

bool Shiboken::listToArgcArgv(PyObject *argList, int *argcIn, char ***argvIn, const char *defaultAppName = nullptr)

Transforms a Python list argList into two C variables, argcIn and argvIn.

This function tries to find the application (script) name and puts it into argv[0]. If the application name can't be guessed, defaultAppName will be used.

No memory is allocated if an error occurs.

Returns true on success, false otherwise.

Note: argcIn must be a valid address.

Note: The argv array is allocated using the new operator and each item is allocated using new[].

See also deleteArgv().

bool Shiboken::parseConstructorKeywordArguments(PyObject *kwds, const Shiboken::ArgumentNameIndexMapping *mapping, size_t size, Shiboken::AutoDecRef &errInfo, PyObject **pyArgs)

Function binding helper: Parses the keyword arguments of a QObject constructor in dict kwds according to mapping (name->index) and stores them in array pyArgs under their index. Fails if duplicate entries occur. Unmapped entries (QObject properties) are stored in a dict in errInfo for further processing.

ParameterMeaning
kwdsDict of keyword arguments.
mappingArray of name->index mappings.
sizeSize of mapping.
errInfoReceives error information or the dict of unmapped entries.
pyArgsArray of arguments to be populated.
Returntrue on success, false otherwise.

bool Shiboken::parseKeywordArguments(PyObject *kwds, const Shiboken::ArgumentNameIndexMapping *mapping, size_t size, Shiboken::AutoDecRef &errInfo, PyObject **pyArgs)

Function binding helper: Parses the keyword arguments in dict kwds according to mapping (name->index) and stores them in array pyArgs under their index. Fails if an entry is missing or duplicate entries occur.

ParameterMeaning
kwdsDict of keyword arguments.
mappingArray of name->index mappings.
sizeSize of mapping.
errInfoReceives error information.
pyArgsArray of arguments to be populated.
Returntrue on success, false otherwise.

PyObject *Shiboken::returnFromRichCompare(PyObject *result)

A simple special version for the end of rich comparison returning result.

int *Shiboken::sequenceToIntArray(PyObject *obj, bool zeroTerminated = false)

Converts a Python sequence obj into a heap-allocated array of ints, which is terminated by 0 if zeroTerminated is true.

Returns the newly allocated array or nullptr in case of error or empty sequence. Check with PyErr_Occurred() if it was successful.

void Shiboken::setErrorAboutWrongArguments(PyObject *args, const char *funcName, PyObject *info, const char *className = nullptr)

Sets an error about wrong arguments args passed to the function funcName (of the class className). The overload information is obtained from the signature module. The extra info argument can contain additional data about the error.

const char *Shiboken::typeNameOf(const char *typeIdName)

Fixes a type name typeIdName returned by typeid(t).name(), depending on compiler, and returns the fixed name (allocated).

int Shiboken::warning(PyObject *category, int stacklevel, const char *format, ...)

A utility function used to call PyErr_WarnEx with the warning category, the stacklevel and a message formatted from format.