SourceForge.net Logo
Classes | Public Member Functions | Static Public Member Functions

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>

List of all members.

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
void setupCPPObject (const QByteArray &classname)
 setup as a CPP (non-QObject), taking the classname
void setTypeSlots (int typeSlots)
 set the type capabilities
int typeSlots () const
 get the type capabilities
PythonQtMemberInfo member (const char *member)
 get the Python method definition for a given slot name (without return type and signature)
PythonQtSlotInfoconstructors ()
 get access to the constructor slot (which may be overloaded if there are multiple constructors)
PythonQtSlotInfodestructor ()
 get access to the destructor slot
void addConstructor (PythonQtSlotInfo *info)
 add a constructor, ownership is passed to classinfo
void setDestructor (PythonQtSlotInfo *info)
 set a destructor, ownership is passed to classinfo
void addDecoratorSlot (PythonQtSlotInfo *info)
 add a decorator slot, ownership is passed to classinfo
const char * className ()
 get the classname (either of the QObject or of the wrapped CPP object)
bool isQObject ()
 returns if the QObject
bool isCPPWrapper ()
 returns if the class is a CPP wrapper
const QMetaObject * metaObject ()
 get the meta object
void setMetaObject (const QMetaObject *meta)
 set the meta object, this will reset the caching
bool inherits (const char *classname)
 returns if this class inherits from the given classname
bool inherits (PythonQtClassInfo *info)
 returns if this class inherits from the given classinfo
void * castTo (void *ptr, const char *classname)
QString help ()
 get help string for the metaobject
QStringList propertyList ()
 get list of all properties (on QObjects only, otherwise the list is empty)
QStringList memberList (bool metaOnly=false)
 get list of all members
int metaTypeId ()
 get the meta type id of this class (only valid for isCPPWrapper() == true)
void setDecoratorProvider (PythonQtQObjectCreatorFunctionCB *cb)
 set an additional decorator provider that offers additional decorator slots for this class
QObject * decorator ()
 get the decorator qobject instance
void addParentClass (const ParentClassInfo &info)
 add the parent class info of a CPP object
bool hasOwnerMethodButNoOwner (void *object)
 check if the special method "py_hasOwner" is implemented and if it returns false, which means that the object may be destroyed
void setPythonQtClassWrapper (PyObject *obj)
 set the associated PythonQtClassWrapper (which handles instance creation of this type)
PyObjectpythonQtClassWrapper ()
 get the associated PythonQtClassWrapper (which handles instance creation of this type)
void setShellSetInstanceWrapperCB (PythonQtShellSetInstanceWrapperCB *cb)
 set the shell set instance wrapper cb
PythonQtShellSetInstanceWrapperCBshellSetInstanceWrapperCB ()
 get the shell set instance wrapper cb
void addPolymorphicHandler (PythonQtPolymorphicHandlerCB *cb)
 add a handler for polymorphic downcasting
void * castDownIfPossible (void *ptr, PythonQtClassInfo **resultClassInfo)
 cast the pointer down in the class hierarchy if a polymorphic handler allows to do that

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

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 85 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::addParentClass ( const ParentClassInfo info  )  [inline]

add the parent class info of a CPP object

Definition at line 175 of file PythonQtClassInfo.h.

{ _parentClasses.append(info); }

void PythonQtClassInfo::addPolymorphicHandler ( PythonQtPolymorphicHandlerCB cb  )  [inline]

add a handler for polymorphic downcasting

Definition at line 197 of file PythonQtClassInfo.h.

{ _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 char* PythonQtClassInfo::className (  ) 

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

PythonQtSlotInfo* PythonQtClassInfo::constructors (  ) 

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

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

bool PythonQtClassInfo::hasOwnerMethodButNoOwner ( void *  object  ) 

check if the special method "py_hasOwner" is implemented and if it returns false, which means that the object may be destroyed

QString PythonQtClassInfo::help (  ) 

get help string for the metaobject

bool PythonQtClassInfo::inherits ( PythonQtClassInfo info  ) 

returns if this class inherits from the given classinfo

bool PythonQtClassInfo::inherits ( const char *  classname  ) 

returns if this class inherits from the given classname

bool PythonQtClassInfo::isCPPWrapper (  )  [inline]

returns if the class is a CPP wrapper

Definition at line 137 of file PythonQtClassInfo.h.

{ return !_isQObject; }

bool PythonQtClassInfo::isQObject (  )  [inline]

returns if the QObject

Definition at line 134 of file PythonQtClassInfo.h.

{ 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 ( bool  metaOnly = false  ) 

get list of all members

const QMetaObject* PythonQtClassInfo::metaObject (  )  [inline]

get the meta object

Definition at line 140 of file PythonQtClassInfo.h.

{ return _meta; }

int PythonQtClassInfo::metaTypeId (  )  [inline]

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

Definition at line 166 of file PythonQtClassInfo.h.

{ return _metaTypeId; }

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 184 of file PythonQtClassInfo.h.

{ return _pythonQtClassWrapper; }

void PythonQtClassInfo::setDecoratorProvider ( PythonQtQObjectCreatorFunctionCB cb  )  [inline]

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

Definition at line 169 of file PythonQtClassInfo.h.

{ _decoratorProviderCB = cb; _decoratorProvider = NULL; }

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 181 of file PythonQtClassInfo.h.

{ _pythonQtClassWrapper = obj; }

void PythonQtClassInfo::setShellSetInstanceWrapperCB ( PythonQtShellSetInstanceWrapperCB cb  )  [inline]

set the shell set instance wrapper cb

Definition at line 187 of file PythonQtClassInfo.h.

                                                                           {
    _shellSetInstanceWrapperCB = cb;
  }

void PythonQtClassInfo::setTypeSlots ( int  typeSlots  )  [inline]

set the type capabilities

Definition at line 108 of file PythonQtClassInfo.h.

{ _typeSlots = typeSlots; }

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 192 of file PythonQtClassInfo.h.

                                                                 {
    return _shellSetInstanceWrapperCB;
  }

int PythonQtClassInfo::typeSlots (  )  const [inline]

get the type capabilities

Definition at line 110 of file PythonQtClassInfo.h.

{ return _typeSlots; }


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