SourceForge.net Logo
PythonQt
Classes | Public Member Functions | Static Public Member Functions | List of all members
PythonQtClassInfo Class Reference

a class that stores all required information about a Qt object (and an optional associated C++ class name) More...

#include <PythonQtClassInfo.h>

Classes

struct  ParentClassInfo
 store information about parent classes More...
 

Public Member Functions

 PythonQtClassInfo ()
 
 ~PythonQtClassInfo ()
 
void setupQObject (const QMetaObject *meta)
 setup as a QObject, taking the meta object as meta information about the QObject More...
 
void setupCPPObject (const QByteArray &classname)
 setup as a CPP (non-QObject), taking the classname More...
 
void setTypeSlots (int typeSlots)
 set the type capabilities More...
 
int typeSlots () const
 get the type capabilities More...
 
PythonQtMemberInfo member (const char *member)
 get the Python method definition for a given slot name (without return type and signature) More...
 
PythonQtSlotInfoconstructors ()
 get access to the constructor slot (which may be overloaded if there are multiple constructors) More...
 
PythonQtSlotInfodestructor ()
 get access to the destructor slot More...
 
void addConstructor (PythonQtSlotInfo *info)
 add a constructor, ownership is passed to classinfo More...
 
void setDestructor (PythonQtSlotInfo *info)
 set a destructor, ownership is passed to classinfo More...
 
void addDecoratorSlot (PythonQtSlotInfo *info)
 add a decorator slot, ownership is passed to classinfo More...
 
void addNestedClass (PythonQtClassInfo *info)
 add a nested class, so that it can be shown as outer class member More...
 
const QByteArray & className () const
 get the classname (either of the QObject or of the wrapped CPP object) More...
 
QByteArray unscopedClassName () const
 get the unscoped classname (without ParentClass::) for nested classes More...
 
bool isQObject ()
 returns if the QObject More...
 
bool isCPPWrapper ()
 returns if the class is a CPP wrapper More...
 
const QMetaObject * metaObject ()
 get the meta object More...
 
void setMetaObject (const QMetaObject *meta)
 set the meta object, this will reset the caching More...
 
bool inherits (const char *classname)
 returns if this class inherits from the given classname More...
 
bool inherits (PythonQtClassInfo *info)
 returns if this class inherits from the given classinfo More...
 
void * castTo (void *ptr, const char *classname)
 
QString help ()
 get help string for the metaobject More...
 
QStringList propertyList ()
 get list of all properties (on QObjects only, otherwise the list is empty) More...
 
QStringList memberList ()
 get list of all members (excluding properties, which can be listed with propertyList()) More...
 
int metaTypeId ()
 get the meta type id of this class (only valid for isCPPWrapper() == true) More...
 
void setDecoratorProvider (PythonQtQObjectCreatorFunctionCB *cb)
 set an additional decorator provider that offers additional decorator slots for this class More...
 
QObject * decorator ()
 get the decorator qobject instance More...
 
void addParentClass (const ParentClassInfo &info)
 add the parent class info of a CPP object More...
 
void setPythonQtClassWrapper (PyObject *obj)
 set the associated PythonQtClassWrapper (which handles instance creation of this type) More...
 
PyObjectpythonQtClassWrapper ()
 get the associated PythonQtClassWrapper (which handles instance creation of this type) More...
 
void setShellSetInstanceWrapperCB (PythonQtShellSetInstanceWrapperCB *cb)
 set the shell set instance wrapper cb More...
 
PythonQtShellSetInstanceWrapperCBshellSetInstanceWrapperCB ()
 get the shell set instance wrapper cb More...
 
void addPolymorphicHandler (PythonQtPolymorphicHandlerCB *cb)
 add a handler for polymorphic downcasting More...
 
void * castDownIfPossible (void *ptr, PythonQtClassInfo **resultClassInfo)
 cast the pointer down in the class hierarchy if a polymorphic handler allows to do that More...
 
void clearNotFoundCachedMembers ()
 clear all members that where cached as "NotFound" More...
 
const QList< PythonQtClassInfo * > & nestedClasses ()
 get nested classes More...
 
PyObjectcopyObject (void *cppObject)
 
PythonQtSlotInfogetCopyConstructor ()
 Get the copy constructor for this class. More...
 
void setReferenceCounting (PythonQtVoidPtrCB *refCB, PythonQtVoidPtrCB *unrefCB)
 Sets reference counting callbacks for this class and all its subclasses. More...
 
PythonQtVoidPtrCBreferenceCountingRefCB ()
 Returns the ref counting CB, if there is any. More...
 
PythonQtVoidPtrCBreferenceCountingUnrefCB ()
 Returns the unref counting CB, if there is any. More...
 
PyObjectgetPythonTypeForProperty (const QString &name)
 
PythonQtClassInfogetClassInfoForProperty (const QString &name)
 Returns the class info for given property, if available. More...
 

Static Public Member Functions

static PyObjectfindEnumWrapper (const QByteArray &name, PythonQtClassInfo *localScope, bool *isLocalEnum=NULL)
 returns if the localScope has an enum of that type name or if the enum contains a :: scope, if that class contails the enum More...
 

Detailed Description

a class that stores all required information about a Qt object (and an optional associated C++ class name)

for fast lookup of slots when calling the object from Python

Definition at line 80 of file PythonQtClassInfo.h.

Constructor & Destructor Documentation

PythonQtClassInfo::PythonQtClassInfo ( )
PythonQtClassInfo::~PythonQtClassInfo ( )

Member Function Documentation

void PythonQtClassInfo::addConstructor ( PythonQtSlotInfo info)

add a constructor, ownership is passed to classinfo

void PythonQtClassInfo::addDecoratorSlot ( PythonQtSlotInfo info)

add a decorator slot, ownership is passed to classinfo

void PythonQtClassInfo::addNestedClass ( PythonQtClassInfo info)

add a nested class, so that it can be shown as outer class member

void PythonQtClassInfo::addParentClass ( const ParentClassInfo info)
inline

add the parent class info of a CPP object

Definition at line 176 of file PythonQtClassInfo.h.

176 { _parentClasses.append(info); }
void PythonQtClassInfo::addPolymorphicHandler ( PythonQtPolymorphicHandlerCB cb)
inline

add a handler for polymorphic downcasting

Definition at line 195 of file PythonQtClassInfo.h.

195 { _polymorphicHandlers.append(cb); }
void* PythonQtClassInfo::castDownIfPossible ( void *  ptr,
PythonQtClassInfo **  resultClassInfo 
)

cast the pointer down in the class hierarchy if a polymorphic handler allows to do that

void* PythonQtClassInfo::castTo ( void *  ptr,
const char *  classname 
)

casts the given ptr to an object of type classname, returns the new pointer which might be different to ptr due to C++ multiple inheritance (if the cast is not possible or if ptr is NULL, NULL is returned)

const QByteArray& PythonQtClassInfo::className ( ) const

get the classname (either of the QObject or of the wrapped CPP object)

Referenced by PythonQtConvertListOfKnownClassToPythonList(), and PythonQtConvertPythonListToListOfKnownClass().

void PythonQtClassInfo::clearNotFoundCachedMembers ( )

clear all members that where cached as "NotFound"

PythonQtSlotInfo* PythonQtClassInfo::constructors ( )

get access to the constructor slot (which may be overloaded if there are multiple constructors)

PyObject* PythonQtClassInfo::copyObject ( void *  cppObject)

Create a copy of the given C++ object (which is known to be of a derived class), wrapped by Python and owned by PythonQt. This will downcast if possible and return a copy of the down casted object. This either requires a copy constructor on the class or it needs to be registered as a meta type.

QObject* PythonQtClassInfo::decorator ( )

get the decorator qobject instance

PythonQtSlotInfo* PythonQtClassInfo::destructor ( )

get access to the destructor slot

static PyObject* PythonQtClassInfo::findEnumWrapper ( const QByteArray &  name,
PythonQtClassInfo localScope,
bool *  isLocalEnum = NULL 
)
static

returns if the localScope has an enum of that type name or if the enum contains a :: scope, if that class contails the enum

PythonQtClassInfo* PythonQtClassInfo::getClassInfoForProperty ( const QString &  name)

Returns the class info for given property, if available.

PythonQtSlotInfo* PythonQtClassInfo::getCopyConstructor ( )

Get the copy constructor for this class.

PyObject* PythonQtClassInfo::getPythonTypeForProperty ( const QString &  name)

Returns the Python type object for a given property. (the returned object does not get an extra reference count)

QString PythonQtClassInfo::help ( )

get help string for the metaobject

bool PythonQtClassInfo::inherits ( const char *  classname)

returns if this class inherits from the given classname

bool PythonQtClassInfo::inherits ( PythonQtClassInfo info)

returns if this class inherits from the given classinfo

bool PythonQtClassInfo::isCPPWrapper ( )
inline

returns if the class is a CPP wrapper

Definition at line 138 of file PythonQtClassInfo.h.

138 { return !_isQObject; }
bool PythonQtClassInfo::isQObject ( )
inline

returns if the QObject

Definition at line 135 of file PythonQtClassInfo.h.

135 { return _isQObject; }
PythonQtMemberInfo PythonQtClassInfo::member ( const char *  member)

get the Python method definition for a given slot name (without return type and signature)

QStringList PythonQtClassInfo::memberList ( )

get list of all members (excluding properties, which can be listed with propertyList())

const QMetaObject* PythonQtClassInfo::metaObject ( )
inline

get the meta object

Definition at line 141 of file PythonQtClassInfo.h.

141 { return _meta; }
int PythonQtClassInfo::metaTypeId ( )
inline

get the meta type id of this class (only valid for isCPPWrapper() == true)

Definition at line 167 of file PythonQtClassInfo.h.

167 { return _metaTypeId; }
const QList<PythonQtClassInfo*>& PythonQtClassInfo::nestedClasses ( )
inline

get nested classes

Definition at line 207 of file PythonQtClassInfo.h.

207 { return _nestedClasses; }
QStringList PythonQtClassInfo::propertyList ( )

get list of all properties (on QObjects only, otherwise the list is empty)

PyObject* PythonQtClassInfo::pythonQtClassWrapper ( )
inline

get the associated PythonQtClassWrapper (which handles instance creation of this type)

Definition at line 182 of file PythonQtClassInfo.h.

182 { return _pythonQtClassWrapper; }
PythonQtVoidPtrCB* PythonQtClassInfo::referenceCountingRefCB ( )

Returns the ref counting CB, if there is any.

PythonQtVoidPtrCB* PythonQtClassInfo::referenceCountingUnrefCB ( )

Returns the unref counting CB, if there is any.

void PythonQtClassInfo::setDecoratorProvider ( PythonQtQObjectCreatorFunctionCB cb)

set an additional decorator provider that offers additional decorator slots for this class

void PythonQtClassInfo::setDestructor ( PythonQtSlotInfo info)

set a destructor, ownership is passed to classinfo

void PythonQtClassInfo::setMetaObject ( const QMetaObject *  meta)

set the meta object, this will reset the caching

void PythonQtClassInfo::setPythonQtClassWrapper ( PyObject obj)
inline

set the associated PythonQtClassWrapper (which handles instance creation of this type)

Definition at line 179 of file PythonQtClassInfo.h.

179 { _pythonQtClassWrapper = obj; }
void PythonQtClassInfo::setReferenceCounting ( PythonQtVoidPtrCB refCB,
PythonQtVoidPtrCB unrefCB 
)

Sets reference counting callbacks for this class and all its subclasses.

void PythonQtClassInfo::setShellSetInstanceWrapperCB ( PythonQtShellSetInstanceWrapperCB cb)
inline

set the shell set instance wrapper cb

Definition at line 185 of file PythonQtClassInfo.h.

185  {
186  _shellSetInstanceWrapperCB = cb;
187  }
void PythonQtClassInfo::setTypeSlots ( int  typeSlots)
inline

set the type capabilities

Definition at line 103 of file PythonQtClassInfo.h.

103 { _typeSlots = typeSlots; }
int typeSlots() const
get the type capabilities
void PythonQtClassInfo::setupCPPObject ( const QByteArray &  classname)

setup as a CPP (non-QObject), taking the classname

void PythonQtClassInfo::setupQObject ( const QMetaObject *  meta)

setup as a QObject, taking the meta object as meta information about the QObject

PythonQtShellSetInstanceWrapperCB* PythonQtClassInfo::shellSetInstanceWrapperCB ( )
inline

get the shell set instance wrapper cb

Definition at line 190 of file PythonQtClassInfo.h.

190  {
191  return _shellSetInstanceWrapperCB;
192  }
int PythonQtClassInfo::typeSlots ( ) const
inline

get the type capabilities

Definition at line 105 of file PythonQtClassInfo.h.

105 { return _typeSlots; }
QByteArray PythonQtClassInfo::unscopedClassName ( ) const

get the unscoped classname (without ParentClass::) for nested classes


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