PythonType.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __CXX_PythonType__h
00039 #define __CXX_PythonType__h
00040
00041 namespace Py
00042 {
00043 class PYCXX_EXPORT PythonType
00044 {
00045 public:
00046
00047
00048
00049 PythonType( size_t base_size, int itemsize, const char *default_name );
00050 virtual ~PythonType();
00051
00052 const char *getName() const;
00053 const char *getDoc() const;
00054
00055 PyTypeObject *type_object() const;
00056 PythonType &name( const char *nam );
00057 PythonType &doc( const char *d );
00058
00059 PythonType &supportClass( void );
00060 #if !defined( PY3 )
00061 PythonType &dealloc( void (*f)( PyObject* ) );
00062 #endif
00063 #if defined( PYCXX_PYTHON_2TO3 ) || !defined( PY3 )
00064 PythonType &supportPrint( void );
00065 #endif
00066 PythonType &supportGetattr( void );
00067 PythonType &supportSetattr( void );
00068 PythonType &supportGetattro( void );
00069 PythonType &supportSetattro( void );
00070 #if defined( PYCXX_PYTHON_2TO3 ) || !defined( PY3 )
00071 PythonType &supportCompare( void );
00072 #endif
00073 PythonType &supportRichCompare( void );
00074 PythonType &supportRepr( void );
00075 PythonType &supportStr( void );
00076 PythonType &supportHash( void );
00077 PythonType &supportCall( void );
00078 PythonType &supportIter( void );
00079
00080 PythonType &supportSequenceType( void );
00081 PythonType &supportMappingType( void );
00082 PythonType &supportNumberType( void );
00083 PythonType &supportBufferType( void );
00084
00085 PythonType &set_tp_dealloc( void (*tp_dealloc)( PyObject * ) );
00086 PythonType &set_tp_init( int (*tp_init)( PyObject *self, PyObject *args, PyObject *kwds ) );
00087 PythonType &set_tp_new( PyObject *(*tp_new)( PyTypeObject *subtype, PyObject *args, PyObject *kwds ) );
00088 PythonType &set_methods( PyMethodDef *methods );
00089
00090
00091 bool readyType();
00092
00093 protected:
00094 void init_sequence();
00095 void init_mapping();
00096 void init_number();
00097 void init_buffer();
00098
00099 PyTypeObject *table;
00100 PySequenceMethods *sequence_table;
00101 PyMappingMethods *mapping_table;
00102 PyNumberMethods *number_table;
00103 PyBufferProcs *buffer_table;
00104
00105 private:
00106
00107
00108
00109 PythonType( const PythonType &tb );
00110 void operator=( const PythonType &t );
00111
00112 };
00113
00114 }
00115
00116
00117 #endif