This class is a thin wrapper around the type information in Python. More...
#include <utils.h>

Public Types | |
| typedef PyObject *(* | createfunc )(PyTypeObject *, PyObject *, PyObject *) |
Public Member Functions | |
| void | addMethod (const char *, PyCFunction, int, const char *) |
| void | addMethod (const char *, PyCFunctionWithKeywords, int, const char *) |
| bool | operator== (const PythonType &i) const |
| bool | operator== (const type_info &i) const |
| PythonType (size_t, const type_info *) | |
| void | setBase (PyTypeObject *b) |
| void | setDoc (const string n) |
| void | setName (const string n) |
| void | supportcall () |
| void | supportcompare () |
| void | supportcreate (createfunc c) |
| void | supportdealloc (void(*f)(PyObject *)) |
| void | supportgetattro () |
| void | supportiter () |
| void | supportsetattro () |
| void | supportstr () |
| PyTypeObject * | type_object () const |
| int | typeReady () |
Static Public Member Functions | |
| static void | evalException () |
Public Attributes | |
| const type_info * | cppClass |
Additional Inherited Members | |
Protected Member Functions inherited from frepple::utils::NonCopyable | |
| NonCopyable () | |
| ~NonCopyable () | |
This class is a thin wrapper around the type information in Python.
This class defines a number of convenience functions to interact with the PyTypeObject struct of the Python C API.
| typedef PyObject*(* frepple::utils::PythonType::createfunc)(PyTypeObject *, PyObject *, PyObject *) |
| frepple::utils::PythonType::PythonType | ( | size_t | base_size, |
| const type_info * | tp | ||
| ) |
Constructor, sets the tp_base_size member.
Definition at line 463 of file pythonutils.cpp.
| void frepple::utils::PythonType::addMethod | ( | const char * | method_name, |
| PyCFunction | f, | ||
| int | flags, | ||
| const char * | doc | ||
| ) |
Add a new method.
Definition at line 546 of file pythonutils.cpp.
| void frepple::utils::PythonType::addMethod | ( | const char * | c, |
| PyCFunctionWithKeywords | f, | ||
| int | i, | ||
| const char * | d | ||
| ) |
Add a new method.
Definition at line 584 of file pythonutils.cpp.
|
static |
A static function that evaluates an exception and sets the Python error string properly.
This function should only be called from within a catch-block, since internally it rethrows the exception!
Definition at line 610 of file pythonutils.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Updates tp_getattro.
The extension class will need to define a member function with this prototype:
PythonObject getattro(const XMLElement& name)
|
inline |
|
inline |
|
inline |
|
inline |
| int frepple::utils::PythonType::typeReady | ( | ) |
This method needs to be called after the type information has all been updated. It adds the type to the frepple module.
Definition at line 590 of file pythonutils.cpp.
| const type_info* frepple::utils::PythonType::cppClass |