SourceForge.net Logo
PythonQt
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
PythonQtPrivate Class Reference

internal PythonQt details More...

#include <PythonQt.h>

Inheritance diagram for PythonQtPrivate:

Public Types

enum  DecoratorTypes {
  StaticDecorator = 1, ConstructorDecorator = 2, DestructorDecorator = 4, InstanceDecorator = 8,
  AllDecorators = 0xffff
}
 

Public Member Functions

 PythonQtPrivate ()
 
 ~PythonQtPrivate ()
 
const QStringList & sharedLibrarySuffixes ()
 get the suffixes that are used for shared libraries More...
 
bool isPythonQtObjectPtrMetaId (int id)
 returns if the id is the id for PythonQtObjectPtr More...
 
void addWrapperPointer (void *obj, PythonQtInstanceWrapper *wrapper)
 add the wrapper pointer (for reuse if the same obj appears while wrapper still exists) More...
 
void removeWrapperPointer (void *obj)
 remove the wrapper ptr again More...
 
void shellClassDeleted (void *shellClass)
 called by destructor of shells to allow invalidation of the Python wrapper More...
 
void * unwrapForeignWrapper (const QByteArray &classname, PyObject *obj)
 try to unwrap the given object to a C++ pointer using the foreign wrapper factories More...
 
bool addParentClass (const char *typeName, const char *parentTypeName, int upcastingOffset)
 add parent class relation More...
 
void addPolymorphicHandler (const char *typeName, PythonQtPolymorphicHandlerCB *cb)
 add a handler for polymorphic downcasting More...
 
PythonQtClassInfolookupClassInfoAndCreateIfNotPresent (const char *typeName)
 lookup existing classinfo and return new if not yet present More...
 
void removeSignalEmitter (QObject *obj)
 called when a signal emitting QObject is destroyed to remove the signal handler from the hash map More...
 
PyObjectwrapQObject (QObject *obj)
 wrap the given QObject into a Python object (or return existing wrapper!) More...
 
PyObjectwrapPtr (void *ptr, const QByteArray &name)
 wrap the given ptr into a Python object (or return existing wrapper!) if there is a known QObject of that name or a known wrapper in the factory More...
 
void registerClass (const QMetaObject *metaobject, const char *package=NULL, PythonQtQObjectCreatorFunctionCB *wrapperCreator=NULL, PythonQtShellSetInstanceWrapperCB *shell=NULL, PyObject *module=NULL, int typeSlots=0)
 registers a QObject derived class to PythonQt (this is implicitly called by addObject as well) More...
 
void registerCPPClass (const char *typeName, const char *parentTypeName=NULL, const char *package=NULL, PythonQtQObjectCreatorFunctionCB *wrapperCreator=NULL, PythonQtShellSetInstanceWrapperCB *shell=NULL, PyObject *module=NULL, int typeSlots=0)
 
void registerQObjectClassNames (const QStringList &names)
 
void addDecorators (QObject *o, int decoTypes)
 add a decorator object More...
 
PythonQtClassWrappercreateNewPythonQtClassWrapper (PythonQtClassInfo *info, PyObject *module, const QByteArray &pythonClassName)
 helper method that creates a PythonQtClassWrapper object (returns a new reference) More...
 
PythonQtInstanceWrappercreateNewPythonQtInstanceWrapper (QObject *obj, PythonQtClassInfo *info, void *wrappedPtr=NULL)
 helper method that creates a PythonQtInstanceWrapper object and registers it in the object map More...
 
PythonQtClassInfogetClassInfo (const QMetaObject *meta)
 get the class info for a meta object (if available) More...
 
PythonQtClassInfogetClassInfo (const QByteArray &className)
 get the class info for a meta object (if available) More...
 
PythonQtObjectPtr createModule (const QString &name, PyObject *pycode)
 creates the new module from the given pycode More...
 
PythonQtClassInfocurrentClassInfoForClassWrapperCreation ()
 get the current class info (for the next PythonQtClassWrapper that is created) and reset it to NULL again More...
 
void handleVirtualOverloadReturnError (const char *signature, const PythonQtMethodInfo *methodInfo, PyObject *result)
 called by virtual overloads when a python return value can not be converted to the required Qt type More...
 
PythonQtObjectPtr pythonQtModule () const
 get access to the PythonQt module More...
 
PythonQt::ProfilingCBprofilingCB () const
 returns the profiling callback, which may be NULL More...
 
QString getSignature (PyObject *object)
 determines the signature of the given callable object (similar as pydoc) More...
 
bool isMethodDescriptor (PyObject *object) const
 returns true if the object is a method descriptor (same as inspect.ismethoddescriptor() in inspect.py) More...
 

Static Public Member Functions

static PyObjectwrapMemoryAsBuffer (const void *data, Py_ssize_t size)
 create a read-only buffer object from the given memory More...
 
static PyObjectwrapMemoryAsBuffer (void *data, Py_ssize_t size)
 create a read-write buffer object from the given memory More...
 
static PyObjectcreateEnumValueInstance (PyObject *enumType, unsigned int enumValue)
 create a new instance of the given enum type with given value (returns a new reference) More...
 
static PyObjectcreateNewPythonQtEnumWrapper (const char *enumName, PyObject *parentObject)
 helper that creates a new int derived class that represents the enum of the given name (returns a new reference) More...
 
static PyObjectdummyTuple ()
 the dummy tuple (which is empty and may be used to detected that a wrapper is called from internal wrapper creation More...
 

Friends

class PythonQt
 

Detailed Description

internal PythonQt details

Definition at line 560 of file PythonQt.h.

Member Enumeration Documentation

Enumerator
StaticDecorator 
ConstructorDecorator 
DestructorDecorator 
InstanceDecorator 
AllDecorators 

Definition at line 568 of file PythonQt.h.

568  {
569  StaticDecorator = 1,
572  InstanceDecorator = 8,
573  AllDecorators = 0xffff
574  };

Constructor & Destructor Documentation

PythonQtPrivate::PythonQtPrivate ( )
PythonQtPrivate::~PythonQtPrivate ( )

Member Function Documentation

void PythonQtPrivate::addDecorators ( QObject *  o,
int  decoTypes 
)

add a decorator object

bool PythonQtPrivate::addParentClass ( const char *  typeName,
const char *  parentTypeName,
int  upcastingOffset 
)

add parent class relation

void PythonQtPrivate::addPolymorphicHandler ( const char *  typeName,
PythonQtPolymorphicHandlerCB cb 
)

add a handler for polymorphic downcasting

void PythonQtPrivate::addWrapperPointer ( void *  obj,
PythonQtInstanceWrapper wrapper 
)

add the wrapper pointer (for reuse if the same obj appears while wrapper still exists)

static PyObject* PythonQtPrivate::createEnumValueInstance ( PyObject enumType,
unsigned int  enumValue 
)
static

create a new instance of the given enum type with given value (returns a new reference)

PythonQtObjectPtr PythonQtPrivate::createModule ( const QString &  name,
PyObject pycode 
)

creates the new module from the given pycode

PythonQtClassWrapper* PythonQtPrivate::createNewPythonQtClassWrapper ( PythonQtClassInfo info,
PyObject module,
const QByteArray &  pythonClassName 
)

helper method that creates a PythonQtClassWrapper object (returns a new reference)

static PyObject* PythonQtPrivate::createNewPythonQtEnumWrapper ( const char *  enumName,
PyObject parentObject 
)
static

helper that creates a new int derived class that represents the enum of the given name (returns a new reference)

PythonQtInstanceWrapper* PythonQtPrivate::createNewPythonQtInstanceWrapper ( QObject *  obj,
PythonQtClassInfo info,
void *  wrappedPtr = NULL 
)

helper method that creates a PythonQtInstanceWrapper object and registers it in the object map

PythonQtClassInfo* PythonQtPrivate::currentClassInfoForClassWrapperCreation ( )

get the current class info (for the next PythonQtClassWrapper that is created) and reset it to NULL again

static PyObject* PythonQtPrivate::dummyTuple ( )
static

the dummy tuple (which is empty and may be used to detected that a wrapper is called from internal wrapper creation

PythonQtClassInfo* PythonQtPrivate::getClassInfo ( const QMetaObject *  meta)
inline

get the class info for a meta object (if available)

Definition at line 652 of file PythonQt.h.

Referenced by PythonQtConvertListOfKnownClassToPythonList(), and PythonQtConvertPythonListToListOfKnownClass().

652 { return _knownClassInfos.value(meta->className()); }
PythonQtClassInfo* PythonQtPrivate::getClassInfo ( const QByteArray &  className)
inline

get the class info for a meta object (if available)

Definition at line 655 of file PythonQt.h.

655 { return _knownClassInfos.value(className); }
QString PythonQtPrivate::getSignature ( PyObject object)

determines the signature of the given callable object (similar as pydoc)

void PythonQtPrivate::handleVirtualOverloadReturnError ( const char *  signature,
const PythonQtMethodInfo methodInfo,
PyObject result 
)

called by virtual overloads when a python return value can not be converted to the required Qt type

bool PythonQtPrivate::isMethodDescriptor ( PyObject object) const

returns true if the object is a method descriptor (same as inspect.ismethoddescriptor() in inspect.py)

bool PythonQtPrivate::isPythonQtObjectPtrMetaId ( int  id)
inline

returns if the id is the id for PythonQtObjectPtr

Definition at line 580 of file PythonQt.h.

580 { return _PythonQtObjectPtr_metaId == id; }
PythonQtClassInfo* PythonQtPrivate::lookupClassInfoAndCreateIfNotPresent ( const char *  typeName)

lookup existing classinfo and return new if not yet present

PythonQt::ProfilingCB* PythonQtPrivate::profilingCB ( ) const
inline

returns the profiling callback, which may be NULL

Definition at line 673 of file PythonQt.h.

673 { return _profilingCB; }
PythonQtObjectPtr PythonQtPrivate::pythonQtModule ( ) const
inline

get access to the PythonQt module

Definition at line 670 of file PythonQt.h.

670 { return _pythonQtModule; }
void PythonQtPrivate::registerClass ( const QMetaObject *  metaobject,
const char *  package = NULL,
PythonQtQObjectCreatorFunctionCB wrapperCreator = NULL,
PythonQtShellSetInstanceWrapperCB shell = NULL,
PyObject module = NULL,
int  typeSlots = 0 
)

registers a QObject derived class to PythonQt (this is implicitly called by addObject as well)

void PythonQtPrivate::registerCPPClass ( const char *  typeName,
const char *  parentTypeName = NULL,
const char *  package = NULL,
PythonQtQObjectCreatorFunctionCB wrapperCreator = NULL,
PythonQtShellSetInstanceWrapperCB shell = NULL,
PyObject module = NULL,
int  typeSlots = 0 
)

add a wrapper object for the given QMetaType typeName, also does an addClassDecorators() to add constructors for variants (ownership of wrapper is passed to PythonQt)

Make sure that you have done a qRegisterMetaType first, if typeName is a user type!

This will add a wrapper object that is used to make calls to the given classname typeName. All slots that take a pointer to typeName as the first argument will be callable from Python on a variant object that contains such a type.

void PythonQtPrivate::registerQObjectClassNames ( const QStringList &  names)

as an alternative to registerClass, you can tell PythonQt the names of QObject derived classes and it will register the classes when it first sees a pointer to such a derived class

void PythonQtPrivate::removeSignalEmitter ( QObject *  obj)

called when a signal emitting QObject is destroyed to remove the signal handler from the hash map

void PythonQtPrivate::removeWrapperPointer ( void *  obj)

remove the wrapper ptr again

const QStringList& PythonQtPrivate::sharedLibrarySuffixes ( )
inline

get the suffixes that are used for shared libraries

Definition at line 577 of file PythonQt.h.

577 { return _sharedLibrarySuffixes; }
void PythonQtPrivate::shellClassDeleted ( void *  shellClass)

called by destructor of shells to allow invalidation of the Python wrapper

void* PythonQtPrivate::unwrapForeignWrapper ( const QByteArray &  classname,
PyObject obj 
)

try to unwrap the given object to a C++ pointer using the foreign wrapper factories

static PyObject* PythonQtPrivate::wrapMemoryAsBuffer ( const void *  data,
Py_ssize_t  size 
)
static

create a read-only buffer object from the given memory

static PyObject* PythonQtPrivate::wrapMemoryAsBuffer ( void *  data,
Py_ssize_t  size 
)
static

create a read-write buffer object from the given memory

PyObject* PythonQtPrivate::wrapPtr ( void *  ptr,
const QByteArray &  name 
)

wrap the given ptr into a Python object (or return existing wrapper!) if there is a known QObject of that name or a known wrapper in the factory

Referenced by PythonQtConvertListOfKnownClassToPythonList().

PyObject* PythonQtPrivate::wrapQObject ( QObject *  obj)

wrap the given QObject into a Python object (or return existing wrapper!)

Friends And Related Function Documentation

friend class PythonQt
friend

Definition at line 741 of file PythonQt.h.


The documentation for this class was generated from the following file: